private static PaymentHistoryType ToPaymentHistoryType(CreditCardEventType type) { switch (type) { case CreditCardEventType.Authorize: return(PaymentHistoryType.Authorize); case CreditCardEventType.Capture: return(PaymentHistoryType.Capture); case CreditCardEventType.Void: return(PaymentHistoryType.None); case CreditCardEventType.None: return(PaymentHistoryType.None); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public async Task Write <TEventData>(CreditCardEventType eventType, string maskedNumber, decimal amount, ApiCaller apiCaller, TEventData eventData, string referenceCode, int agentId, Currencies currency) { var logEntry = new CreditCardAuditLogEntry() { Created = _dateTimeProvider.UtcNow(), Type = eventType, MaskedNumber = maskedNumber, Amount = amount, UserId = apiCaller.Id, ApiCallerType = apiCaller.Type, EventData = JsonConvert.SerializeObject(eventData), ReferenceCode = referenceCode, AgentId = agentId, Currency = currency }; _context.CreditCardAuditLogs.Add(logEntry); await _context.SaveChangesAsync(); }