public static Payment CreateFromPaymentRequest(PaymentRequest paymentRequest, PaymentId paymentId, AcquirerBankResponse bankResponse) { return(new Payment() { MerchantId = paymentRequest.MerchantId, Card = paymentRequest.Card, Amount = paymentRequest.AmountToCharge, MerchantReference = paymentRequest.MerchantReference, PaymentId = paymentId, Status = bankResponse.Status, BankReference = bankResponse.BankReference, }); }
private async Task CreatePayment(PaymentRequest command, PaymentId paymentId, AcquirerBankResponse bankResponse) { Payment payment = Payment.CreateFromPaymentRequest(command, paymentId, bankResponse); //TODO unit of work pattern if we need to make other change in our future DB await _paymentRepository.SaveAsync(payment); }