public async Task <ProcessResponse> ProcessPaymentAsync(ProcessRequest processRequest) { var paymentId = Guid.NewGuid().ToString(); var bankRequest = new BankRequest(GetBank(processRequest.CardNo), processRequest.CardNo, processRequest.Amount); var bankResponse = await _bankIntegration.SendtoAcquirerAsync(bankRequest); var dbResponse = await _operations.AddPaymentAsync(processRequest, bankResponse, paymentId); if (!dbResponse.Success) { _logger.LogError("Failed to log payment to databse for Payment Id {PaymentId}", paymentId); } if (bankResponse.Success) { return(new ProcessResponse { Success = true, PaymentId = paymentId }); } _logger.LogWarning("Acquirer returned error for Payment Id {PaymentId}", paymentId); return(new ProcessResponse { Success = false, ErrorMessage = bankResponse.Reason, Message = "Something went wrong with transaction, please contact card issuer.", PaymentId = paymentId }); }