private static ProcessCreditCardWithCustomerCode SetIatsCreditCard(IatsRecurringPaymentInput input)
        {
            var obj = new ProcessCreditCardWithCustomerCode();

            obj.agentCode         = input.AgentCode;
            obj.password          = input.Password;
            obj.customerIPAddress = !String.IsNullOrEmpty(input.IpAddress) ? input.IpAddress : "127.0.0.1";

            obj.customerCode = input.IatsCustomerCode;
            obj.invoiceNum   = input.InvoiceIdentifier;
            obj.total        = String.Format("{0:0.00}", input.Amount);
            obj.comment      = "Debited by Azure on " + DateTime.Now.ToString();

            return(obj);
        }
 public Task <XmlDocument> ProcessCreditCardWithCustomerCodeAsync(ProcessCreditCardWithCustomerCode obj, CancellationToken cancellationToken = default)
 {
     return(ExecuteRequestAsync(obj, "https://www.iatspayments.com/netgate/ProcessLinkv2.asmx", "https://www.iatspayments.com/NetGate/ProcessCreditCardWithCustomerCode", cancellationToken));
 }
        public async Task <PaymentOutput> MakePaymentAsync(IatsCreditCardPaymentInput input, CancellationToken cancellationToken = default)
        {
            var customerXmlDoc = await CreateCustomerProfileAsync(input, cancellationToken);

            var response = new PaymentOutput();

            if (customerXmlDoc != null)
            {
                response.CardType = CreditCardTypeDetection.IatsFromNumber(input.CreditCardNo)?.ToString();

                var customerCode = customerXmlDoc.GetElementsByTagName("CUSTOMERCODE")[0].InnerText;

                if (!String.IsNullOrEmpty(customerCode))
                {
                    XmlDocument transactionXmlDoc;

                    var str = "MIS" + StringUtils.RandomString(6).ToUpper();

                    if (input.IsBankProcess)
                    {
                        var obj = new ProcessACHEFTWithCustomerCode();

                        obj.agentCode         = input.IatsAgentCode;
                        obj.password          = input.IatsPassword;
                        obj.customerIPAddress = input.IpAddress;

                        obj.customerCode = customerXmlDoc.GetElementsByTagName("CUSTOMERCODE")[0].InnerText;
                        obj.total        = String.Format("{0:0.00}", input.Amount);
                        obj.invoiceNum   = str;

                        response.InvoiceNumber = str;
                        transactionXmlDoc      = await this.iATSProcess.ProcessACHEFTWithCustomerCodeAsync(obj, cancellationToken);
                    }
                    else
                    {
                        var obj = new ProcessCreditCardWithCustomerCode();

                        obj.agentCode         = input.IatsAgentCode;
                        obj.password          = input.IatsPassword;
                        obj.customerIPAddress = input.IpAddress;

                        obj.customerCode = customerXmlDoc.GetElementsByTagName("CUSTOMERCODE")[0].InnerText;
                        obj.total        = String.Format("{0:0.00}", input.Amount);
                        obj.invoiceNum   = str;

                        response.InvoiceNumber = str;
                        transactionXmlDoc      = await this.iATSProcess.ProcessCreditCardWithCustomerCodeAsync(obj, cancellationToken);
                    }

                    if (transactionXmlDoc != null)
                    {
                        SetProcessTransactionResposne(response, transactionXmlDoc);
                        response.AuthToken = customerCode;
                    }
                }
                else
                {
                    response.IsSuccessful      = false;
                    response.TransactionResult = customerXmlDoc.GetElementsByTagName("AUTHORIZATIONRESULT")[0].InnerText;
                }
            }

            return(response);
        }