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); }
public async Task <EitherAsync <PaymentResponse, ValidationResult> > ProcessPaymentRequestAsync(PaymentRequest command) { ValidationResult validationResult = _paymentRequestValidator.Validate(command); return(!validationResult.IsValid ? RightAsync <PaymentResponse, ValidationResult>(validationResult) : LeftAsync <PaymentResponse, ValidationResult>(await MakePayment(command))); }