/// <summary> /// Converts to authorize request model. /// </summary> /// <param name="invoicePayRequestModel">The invoice pay request model.</param> /// <returns></returns> public PayfortInvoiceRequestModel ConvertToInvoiceRequestModel(InvoicePayRequestModel invoicePayRequestModel) { try { return(new PayfortInvoiceRequestModel() { RequestPhrase = PayfortConfigurationModel.RequestPhrase, AccessCode = PayfortConfigurationModel.AccessCode, Amount = invoicePayRequestModel.Amount.ToString(), Currency = invoicePayRequestModel.Currency, CustomerEmail = invoicePayRequestModel.CustomerEmail, CustomerName = invoicePayRequestModel.CustomerName, CustomerPhoneNumber = invoicePayRequestModel.CustomerContact, MerchantIdentifier = PayfortConfigurationModel.MerchantIdentifier, BookingReference = invoicePayRequestModel.BookingReferenceNumber, OrderDescription = invoicePayRequestModel.OrderDescription, CreditCardType = invoicePayRequestModel.CardType, RequestExpiryDate = invoicePayRequestModel.ExpiryDate, ReturnUrl = PayfortConfigurationModel.ReturnUrl, DeviceFingerPrint = invoicePayRequestModel.DeviceFingerPrint, Url = PayfortConfigurationModel.URL }); } catch (Exception ex) { throw ex; } }
/// <summary> /// Invoices the pay. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public async Task <InvoicePayResponseModel> InvoicePay(InvoicePayRequestModel request) { try { return(new InvoicePayResponseModel()); } catch (Exception ex) { throw ex; } }
/// <summary> /// Routes the invoice. /// </summary> /// <param name="invoicePayRequestModel">The invoice pay request model.</param> /// <returns></returns> public async Task <InvoicePayResponseModel> RouteInvoice(InvoicePayRequestModel invoicePayRequestModel) { try { return(await _paymentProcessor(invoicePayRequestModel.Engine).InvoicePay(invoicePayRequestModel)); } catch (Exception ex) { _logger.LogError($"Error - {ex.Message} occurred while routing invoice pay for Engine-{((PaymentEngine)invoicePayRequestModel.Engine).ToString()}"); throw ex; } }
/// <summary> /// Invoices the pay. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public async Task <InvoicePayResponseModel> InvoicePay(InvoicePayRequestModel request) { try { var payfortRequest = _payfortRequestParser.ConvertToInvoiceRequestModel(request); var stopwatch = new Stopwatch(); stopwatch.Start(); var gatewayResponse = _payfortService.GenerateInvoice(payfortRequest); //Add profiler return(_payfortResponseParser.MapInvoicePayResponse(gatewayResponse)); } catch (Exception ex) { _logger.LogError($"Exception occured in authorize process in payfort "); throw ex; } }