public async Task <ActionResult <PaymentResponseDto> > Process(PaymentRequestDto paymentRequestDto) { try { var paymentRequest = new PaymentRequest( paymentRequestDto.MerchantId, paymentRequestDto.CardHolderName, paymentRequestDto.CardNumber, paymentRequestDto.ExpiryDate, new Money(paymentRequestDto.Amount, paymentRequestDto.Currency), paymentRequestDto.CVV); var payment = await paymentRequestProcessor.Process(paymentRequest); var result = new PaymentResponseDto { AcquiringBankPaymentId = payment.AcquiringBankPaymentId, Status = payment.Status.ToString(), Timestamp = payment.Timestamp }; return(this.Ok(result)); } catch (Exception ex) { this.logger.LogError(ex, "Error processing payment."); } return(this.Problem("Error processing payment.")); }
public void Process(IPaymentRequestProcessor processor) { processor.Process(this); }