public Task <XmlDocument> CreateACHEFTCustomerCodeAsync(CreateACHEFTCustomerCode obj, CancellationToken cancellationToken = default)
 {
     return(ExecuteRequestAsync(obj, "https://www.iatspayments.com/netgate/CustomerLinkv2.asmx", "https://www.iatspayments.com/NetGate/CreateACHEFTCustomerCode", cancellationToken));
 }
        private async Task <XmlDocument> CreateCustomerProfileAsync(IatsCreditCardPaymentInput input, CancellationToken cancellationToken)
        {
            if (input.IsBankProcess)
            {
                var iatsBankCustomerProfile = new CreateACHEFTCustomerCode();

                iatsBankCustomerProfile.agentCode         = input.IatsAgentCode;
                iatsBankCustomerProfile.password          = input.IatsPassword;
                iatsBankCustomerProfile.customerIPAddress = input.IpAddress;
                iatsBankCustomerProfile.firstName         = input.FirstName;
                iatsBankCustomerProfile.lastName          = input.LastName;
                iatsBankCustomerProfile.address           = input.BillingLine1;
                iatsBankCustomerProfile.city    = input.BillingCity;
                iatsBankCustomerProfile.state   = input.BillingStateorProvince;
                iatsBankCustomerProfile.zipCode = input.BillingPostalCode;
                iatsBankCustomerProfile.phone   = input.Telephone;
                iatsBankCustomerProfile.email   = input.EmailAddress;

                iatsBankCustomerProfile.recurring = input.IsRecurring;
                iatsBankCustomerProfile.beginDate = DateTime.Now;
                iatsBankCustomerProfile.endDate   = DateTime.Now;

                var accNo = input.AccountNumber;
                if (input.AccountNumberFormat == AccountNumberFormat.BankAndTransitNumber)
                {
                    iatsBankCustomerProfile.accountNum = input.BankNumber + input.TransitNumber + accNo;
                }
                else if (input.AccountNumberFormat == AccountNumberFormat.RoutingNumber)
                {
                    iatsBankCustomerProfile.accountNum = input.RoutingNumber + accNo;
                }

                if (input.AccountType == BankAccountType.Checking)
                {
                    iatsBankCustomerProfile.accountType = "CHECKING";
                }
                else if (input.AccountType == BankAccountType.Saving)
                {
                    iatsBankCustomerProfile.accountType = "SAVING";
                }

                return(await this.iATSProcess.CreateACHEFTCustomerCodeAsync(iatsBankCustomerProfile, cancellationToken));
            }
            else
            {
                var iatsCustomerProfile = new CreateCreditCardCustomerCode();

                iatsCustomerProfile.agentCode         = input.IatsAgentCode;
                iatsCustomerProfile.password          = input.IatsPassword;
                iatsCustomerProfile.customerIPAddress = input.IpAddress;
                iatsCustomerProfile.firstName         = input.FirstName;
                iatsCustomerProfile.lastName          = input.LastName;
                iatsCustomerProfile.address           = input.BillingLine1;
                iatsCustomerProfile.city    = input.BillingCity;
                iatsCustomerProfile.state   = input.BillingStateorProvince;
                iatsCustomerProfile.zipCode = input.BillingPostalCode;
                iatsCustomerProfile.phone   = input.Telephone;
                iatsCustomerProfile.email   = input.EmailAddress;

                iatsCustomerProfile.recurring     = input.IsRecurring;
                iatsCustomerProfile.beginDate     = DateTime.Now;
                iatsCustomerProfile.endDate       = DateTime.Now;
                iatsCustomerProfile.creditCardNum = input.CreditCardNo;
                iatsCustomerProfile.comment       = "Created by CRM Azure App on " + DateTime.Now.ToString();
                var mm = input.CcExpMmYy.Substring(0, 2);
                var yy = input.CcExpMmYy.Substring(2, 2);
                iatsCustomerProfile.creditCardExpiry = mm + "/" + yy;

                return(await this.iATSProcess.CreateCreditCardCustomerCodeAsync(iatsCustomerProfile, cancellationToken));
            }
        }