public Task <Payment> AddPaymentAsync(AcquirerBank acquirerBank, Guid merchantId, CardPaymentRequestDto cardPaymentRequest) { var maskedCardNumber = _cardMaskingService.MaskCardNumber(cardPaymentRequest.CardInformation.CardNumber); var card = cardPaymentRequest.CardInformation; var hashedCardNumber = _hashService.GetHash(card.CardNumber); //this would be calling a stored proc which would do all this within a transaction at the database level var address = _addressDataStore.AddAddress(); var cardInformation = _cardInformationDataStore.AddCardInformation(firstName: card.FirstName, lastName: card.LastName, expiryMonth: card.ExpiryMonth, expiryYear: card.ExpiryYear, hashedCardNumber: hashedCardNumber, maskedCardNumber: maskedCardNumber); var payment = _paymentDataStore.AddPayment(merchantId, address.AddressId, cardInformation.CardInformationId, acquirerBank, cardPaymentRequest.Amount, cardPaymentRequest.Currency); return(Task.FromResult(payment)); }
public Payment AddPayment(Guid merchantId, int addressId, int cardInformationId, AcquirerBank acquirerBank, decimal amount, string currencyCode) { var card = new Payment { PaymentId = Guid.NewGuid(), MerchantId = merchantId, BillingAddressId = addressId, CardInformationId = cardInformationId, AcquirerBank = acquirerBank, PaymentStatus = PaymentStatus.Created, CurrencyCode = currencyCode, Amount = amount }; Payments.Add(card); return(card); }