Ejemplo n.º 1
0
        public AbstractPagerator(OptimalApiClient apiClient, Type pagingClassType)
        {
            this.arrayKey = pagingClassType.GetMethod("getPageableArrayKey").Invoke(null, null) as string;

            this.client    = apiClient;
            this.classType = pagingClassType;
        }
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber"];
            int    currencyBaseUnitsMultiplier = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CurrencyBaseUnitsMultiplier"]);

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);
            Authorization    auth   = client.cardPaymentService().authorize(Authorization.Builder()
                                                                            .merchantRefNum(Request.Form["merchant_ref_num"])
                                                                            .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"]) * currencyBaseUnitsMultiplier))
                                                                            .settleWithAuth(true)
                                                                            .card()
                                                                            .cardNum(Request.Form["card_number"])
                                                                            .cvv(Request.Form["card_cvv"])
                                                                            .cardExpiry()
                                                                            .month(Convert.ToInt32(Request.Form["card_expiry_month"]))
                                                                            .year(Convert.ToInt32(Request.Form["card_expiry_year"]))
                                                                            .Done()
                                                                            .Done()
                                                                            .billingDetails()
                                                                            .street(Request.Form["street"])
                                                                            .city(Request.Form["city"])
                                                                            .state(Request.Form["state"])
                                                                            .country(Request.Form["country"])
                                                                            .zip(Request.Form["zip"])
                                                                            .Done()
                                                                            .Build());

            this.payment_id = auth.id();
        }
Ejemplo n.º 3
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey_3DS"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret_3DS"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber_3DS"];

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

            try
            {
                EnrollmentChecks enrollmentChecks = EnrollmentChecks.Builder()
                                                    .merchantRefNum(Request.Form["merchant_customer_id"])
                                                    .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"])))
                                                    .currency(Request.Form["currency"])
                                                    .customerIp(Request.Form["customerIp"])
                                                    .userAgent(Request.Form["userAgent"])
                                                    .card()
                                                    .cardNum(Request.Form["cardNum"])
                                                    .cardExpiry()
                                                    .month(Convert.ToInt32(Double.Parse(Request.Form["month"])))
                                                    .year(Convert.ToInt32(Double.Parse(Request.Form["year"])))
                                                    .Done()
                                                    .Done()
                                                    .acceptHeader(Request.Form["acceptHeader"])
                                                    .merchantUrl(Request.Form["merchantUrl"])
                                                    .Build();

                EnrollmentChecks response = client.threeDSecureService().submit(enrollmentChecks);
                this.response = response.ToString();
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }
Ejemplo n.º 4
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber"];

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

            try
            {
                Profile profile = client.customerVaultService().create(Profile.Builder()
                                                                       .merchantCustomerId(System.Guid.NewGuid().ToString())
                                                                       .locale("en_US")
                                                                       .firstName("John")
                                                                       .lastName("Smith")
                                                                       .email("*****@*****.**")
                                                                       .phone("713-444-5555")
                                                                       .Build());

                Address address = client.customerVaultService().create(Address.Builder()
                                                                       .nickName("home")
                                                                       .street("100 Queen Street West")
                                                                       .street2("Unit 201")
                                                                       .city("Toronto")
                                                                       .country("CA")
                                                                       .state("ON")
                                                                       .zip("M5H 2N2")
                                                                       .recipientName("Jane Doe")
                                                                       .phone("647-788-3901")
                                                                       .profileId(profile.id())
                                                                       .Build());

                List <Mandates> mandateList = new List <Mandates>();

                Mandates mandate = Mandates.Builder()
                                   .reference("SUBCRIP35")
                                   .Build();
                mandateList.Add(mandate);

                SEPABankAccounts account = client.customerVaultService().create(SEPABankAccounts.Builder()
                                                                                .iban(Request.Form["iban"])
                                                                                .bic(Request.Form["bic"])
                                                                                .mandates(mandateList)
                                                                                .accountHolderName(Request.Form["account_holder_name"])
                                                                                .nickName(Request.Form["nick_name"])
                                                                                .billingAddressId(address.id())
                                                                                .profileId(profile.id())
                                                                                .Build());
                this.response = account.ToString();
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }
Ejemplo n.º 5
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber"];
            int    currencyBaseUnitsMultiplier = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CurrencyBaseUnitsMultiplier"]);
            string currencyCode = System.Configuration.ConfigurationManager.AppSettings["CurrencyCode"];
            string pageUrl      = HttpContext.Current.Request.Url.AbsoluteUri;

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);
            Order            order  = client.hostedPaymentService().processOrder(Order.Builder()
                                                                                 .merchantRefNum(Request.Form["merchant_ref_num"])
                                                                                 .currencyCode(currencyCode)
                                                                                 .totalAmount(Convert.ToInt32(Double.Parse(Request.Form["amount"]) * currencyBaseUnitsMultiplier))
                                                                                 .addExtendedOption()
                                                                                 .key("silentPost")
                                                                                 .value(true)
                                                                                 .Done()
                                                                                 .addRedirect()
                                                                                 .rel("on_success")
                                                                                 .uri(pageUrl)
                                                                                 .addReturnKey("id")
                                                                                 .Done()
                                                                                 .addRedirect()
                                                                                 .rel("on_decline")
                                                                                 .uri(pageUrl)
                                                                                 .addReturnKey("id")
                                                                                 .Done()
                                                                                 .addRedirect()
                                                                                 .rel("on_error")
                                                                                 .uri(pageUrl)
                                                                                 .addReturnKey("id")
                                                                                 .Done()
                                                                                 .profile()
                                                                                 .firstName(Request.Form["first_name"])
                                                                                 .lastName(Request.Form["last_name"])
                                                                                 .Done()
                                                                                 .billingDetails()
                                                                                 .street(Request.Form["street"])
                                                                                 .city(Request.Form["city"])
                                                                                 .state(Request.Form["state"])
                                                                                 .country(Request.Form["country"])
                                                                                 .zip(Request.Form["zip"])
                                                                                 .Done()
                                                                                 .Build());

            Session["order"]           = order;
            this.silent_post_url       = order.getLink("hosted_payment").uri();
            this.silentPostForm.Action = silent_post_url;
            this.order_id = order.id();
        }
        protected void submit(object sender, System.EventArgs e)
        {
            try
            {
                string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
                string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
                string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber"];
                int    currencyBaseUnitsMultiplier = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CurrencyBaseUnitsMultiplier"]);
                string currencyCode = System.Configuration.ConfigurationManager.AppSettings["CurrencyCode"];
                string pageUrl      = HttpContext.Current.Request.Url.AbsoluteUri;

                OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);
                Order            order  = client.hostedPaymentService().processOrder(Order.Builder()
                                                                                     .merchantRefNum(Request.Form["merchant_ref_num"])
                                                                                     .currencyCode(currencyCode)
                                                                                     .totalAmount(Convert.ToInt32(Double.Parse(Request.Form["amount"]) * currencyBaseUnitsMultiplier))
                                                                                     .addRedirect()
                                                                                     .rel("on_success")
                                                                                     .uri(pageUrl)
                                                                                     .addReturnKey("id")
                                                                                     .Done()
                                                                                     .addRedirect()
                                                                                     .rel("on_decline")
                                                                                     .uri(pageUrl)
                                                                                     .addReturnKey("id")
                                                                                     .Done()
                                                                                     .addRedirect()
                                                                                     .rel("on_error")
                                                                                     .uri(pageUrl)
                                                                                     .addReturnKey("id")
                                                                                     .Done()
                                                                                     .profile()
                                                                                     .firstName(Request.Form["first_name"])
                                                                                     .lastName(Request.Form["last_name"])
                                                                                     .Done()
                                                                                     .billingDetails()
                                                                                     .street(Request.Form["street"])
                                                                                     .city(Request.Form["city"])
                                                                                     .state(Request.Form["state"])
                                                                                     .country(Request.Form["country"])
                                                                                     .zip(Request.Form["zip"])
                                                                                     .Done()
                                                                                     .Build());
                Session["order"] = order;
                Response.Redirect(order.getLink("hosted_payment").uri());
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }
Ejemplo n.º 7
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey_3DS"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret_3DS"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber_3DS"];

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

            try
            {
                EnrollmentChecks enrollmentChecks = EnrollmentChecks.Builder()
                                                    .merchantRefNum(Request.Form["merchant_customer_id"])
                                                    .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"])))
                                                    .currency(Request.Form["currency"])
                                                    .customerIp(Request.Form["customerIp"])
                                                    .userAgent(Request.Form["userAgent"])
                                                    .card()
                                                    .cardNum(Request.Form["cardNum"])
                                                    .cardExpiry()
                                                    .month(Convert.ToInt32(Double.Parse(Request.Form["month"])))
                                                    .year(Convert.ToInt32(Double.Parse(Request.Form["year"])))
                                                    .Done()
                                                    .Done()
                                                    .acceptHeader(Request.Form["acceptHeader"])
                                                    .merchantUrl(Request.Form["merchantUrl"])
                                                    .Build();

                EnrollmentChecks response_enrollmentChecks = client.threeDSecureService().submit(enrollmentChecks);

                enrollmentChecks.id("1346db4c-817e-47bb-9752-3a59f3e350f2");

                Authentication authentications = Authentication.Builder()
                                                 .merchantRefNum(enrollmentChecks.merchantRefNum())
                                                 .paResp("eJzNWNey4ziS/ZWKmkdFN72bUN0J0FMiRZGi1UsHnehEIxrRfP1Q91ZX362o2Jjd3ofVi4BEZuIkEnkAcP+vubp/eSZdnzf1t6/I7/DXL0kdNXFep9++2pb4G/31X297K+uShL8k0dglb3st6fsgTb7k8bevXbnAv8O/I39EYdo/u2qAkT8QnEQZEsFp5g+GQREa/wNFv77tz8BM+nejf7w3v6sRCPMbhpAovKl8B/K24fgd3UN/drcZuygL6uFtH0QPVjm94QzKwPAe+t7dV0mn8G8kjdAMvhl+dPfQX3bn8dXqN/RzHr/56KGOsOsSesakXUBqG/bqrJeUT8G3PfTS2MfBkLyhMELCBIJ8QeB/Isg/UWYPvcv37csdqJpx8428gHwW7Ldl6rZVXN5ofBv60dsnc9vUyaaxQfzR3kN/YWuD+g3+9MNI6uV7k+4t720/5NUvMb3L9/0QDGP/5u+h7619FDyfb1oBUh/NsqgSi1hyFkVC7hF2yq6ovcX6rrJPovwNJjZQ2/+7FbinTZcPWfWGfOj8JdhDLyjQewrf9pc8rbfJuuTLtpHq/tvXbBjaf0LQNE2/T9jvTZdC6BYIBDPQphD3efqPrx9WSazUt+Z/ZMYFdVPnUXDP12DYNoaWDFkTf/mB7VduLPPlCYFMgfttc/VbhOD1by8JjCHE5hP6tdNPkf0ns/wMtuuD3/osQF4T/OTobW8mt+S1I5Ivtqls1YCgFE2RLzB8nib98L+Z8M/JPnv4058T3Mfk7Vpciiq/kQKvgqNHIugzrc9Oi8Y6/u1Puw/NPfQD4Xf4H7n6tCYfiiNNwFjc1SnlcrnTUD6FmMrBgXyILBBi1gJPOpgPGNV41ZW9jDhKnn86+BTLEQC9tYmcF5V3qdecWmD+tvZzP+MGNatBazBRzzauISxrExcQJSwTwVz0q8+coZZOa7BOSCc9xGBwHhMc05i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I+SXsEcfi4yFrmFQ94MbNAOxxjdGb+6gUJ/vZuhH2/pv17Z758K3z9qvj5vff7Y+W+MPPYH")
                                                 .enrollmentId("1346db4c-817e-47bb-9752-3a59f3e350f2")
                                                 .Build();

                Authentication response_authentication = client.threeDSecureService().submit(authentications);
                this.response = response_authentication.ToString();
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }
Ejemplo n.º 8
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber"];
            int    currencyBaseUnitsMultiplier = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CurrencyBaseUnitsMultiplier"]);

            OptimalApiClient client  = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);
            Profile          profile = client.customerVaultService().create(Profile.Builder()
                                                                            .merchantCustomerId(Request.Form["merchant_customer_id"])
                                                                            .locale("en_US")
                                                                            .firstName(Request.Form["first_name"])
                                                                            .lastName(Request.Form["last_name"])
                                                                            .email(Request.Form["email"])
                                                                            .Build());
            Address address = client.customerVaultService().create(Address.Builder()
                                                                   .nickName("home")
                                                                   .street(Request.Form["street"])
                                                                   .city(Request.Form["city"])
                                                                   .state(Request.Form["state"])
                                                                   .country(Request.Form["country"])
                                                                   .zip(Request.Form["zip"])
                                                                   .profileId(profile.id())
                                                                   .Build());
            Card card = client.customerVaultService().create(Card.Builder()
                                                             .cardNum(Request.Form["card_number"])
                                                             .cardExpiry()
                                                             .month(Convert.ToInt32(Request.Form["card_expiry_month"]))
                                                             .year(Convert.ToInt32(Request.Form["card_expiry_year"]))
                                                             .Done()
                                                             .billingAddressId(address.id())
                                                             .profileId(profile.id())
                                                             .Build());
            Authorization auth = client.cardPaymentService().authorize(Authorization.Builder()
                                                                       .merchantRefNum(Request.Form["merchant_ref_num"])
                                                                       .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"]) * currencyBaseUnitsMultiplier))
                                                                       .settleWithAuth(true)
                                                                       .card()
                                                                       .paymentToken(card.paymentToken())
                                                                       .Done()
                                                                       .Build());

            this.payment_id = auth.id();
        }
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["AccountNumber_ACH"];

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

            try
            {
                Purchases purchase = Purchases.Builder()
                                     .merchantRefNum(Request.Form["merchant_customer_id"])
                                     .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"])))
                                     .ach()
                                     .accountHolderName(Request.Form["account_holder_name"])
                                     .accountNumber(Request.Form["account_number"])
                                     .accountType(Request.Form["account_type"])
                                     .routingNumber(Request.Form["routing_number"])
                                     .payMethod(Request.Form["pay_method"])
                                     .Done()
                                     .customerIp(Request.Form["customer_ip"])
                                     .profile()
                                     .firstName(Request.Form["first_name"])
                                     .lastName(Request.Form["last_name"])
                                     .email(Request.Form["email"])
                                     .Done()
                                     .billingDetails()
                                     .street(Request.Form["street"])
                                     .city(Request.Form["city"])
                                     .state(Request.Form["state"])
                                     .country(Request.Form["country"])
                                     .zip(Request.Form["zip"])
                                     .phone(Request.Form["phone"])
                                     .Done()
                                     .Build();
                Purchases response = client.directDebitService().submit(purchase);
                this.response = response.ToString();
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }
Ejemplo n.º 10
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["AccountNumber_BACS"];

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

            try
            {
                StandaloneCredits standaloneCredits = StandaloneCredits.Builder()
                                                      .merchantRefNum(Request.Form["merchant_customer_id"])
                                                      .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"])))
                                                      .bacs()
                                                      .accountHolderName(Request.Form["account_holder_name"])
                                                      .accountNumber(Request.Form["account_number"])
                                                      .sortCode(Request.Form["sort_code"])
                                                      .mandateReference(Request.Form["mandate_Reference"])
                                                      .Done()
                                                      .customerIp(Request.Form["customer_ip"])
                                                      .profile()
                                                      .firstName(Request.Form["first_name"])
                                                      .lastName(Request.Form["last_name"])
                                                      .email(Request.Form["email"])
                                                      .Done()
                                                      .billingDetails()
                                                      .street(Request.Form["street"])
                                                      .city(Request.Form["city"])
                                                      .state(Request.Form["state"])
                                                      .country(Request.Form["country"])
                                                      .zip(Request.Form["zip"])
                                                      .phone(Request.Form["phone"])
                                                      .Done()
                                                      .Build();
                StandaloneCredits response = client.directDebitService().submit(standaloneCredits);
                this.payment_id = response.id();
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }
Ejemplo n.º 11
0
        protected void checkOrder()
        {
            string apiKey        = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret     = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];
            string accountNumber = System.Configuration.ConfigurationManager.AppSettings["accountNumber"];
            int    currencyBaseUnitsMultiplier = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CurrencyBaseUnitsMultiplier"]);
            string currencyCode = System.Configuration.ConfigurationManager.AppSettings["CurrencyCode"];
            string pageUrl      = HttpContext.Current.Request.Url.AbsoluteUri;

            if (Session["order"] == null)
            {
                throw new Exception("No pending order found.");
            }
            Order sessionOrder = (Order)Session["order"];

            Session.Remove("order");

            if (sessionOrder.id() != Request.QueryString["id"])
            {
                throw new Exception("Invalid id");
            }

            OptimalApiClient client = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);
            Order            order  = client.hostedPaymentService().getOrder(new Order(Request.QueryString["id"]));

            if (order.transaction().status().Equals("success"))
            {
                if (sessionOrder.totalAmount() != order.totalAmount())
                {
                    throw new Exception("Invalid amount");
                }
                this.payment_id = order.id();
            }
            else
            {
                throw new Exception("Unexpected transaction status: " + order.transaction().status());
            }
        }
Ejemplo n.º 12
0
 public Pagerator(OptimalApiClient apiClient, Type pagingClassType, Dictionary <string, object> data)
     : base(apiClient, pagingClassType)
 {
     this.parseResponse(data);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initialize the ThreeDSecure service with an client object
 /// </summary>
 /// <param name="client">OptimalApiClient</param>
 public ThreeDSecureService(OptimalApiClient client)
 {
     this.client = client;
 }
Ejemplo n.º 14
0
        protected void submit(object sender, System.EventArgs e)
        {
            string apiKey    = System.Configuration.ConfigurationManager.AppSettings["ApiKey"];
            string apiSecret = System.Configuration.ConfigurationManager.AppSettings["ApiSecret"];

            try
            {
                string val = radio.SelectedItem.Value.ToString();
                if (val.Equals("ACH"))
                {
                    string           accountNumber = System.Configuration.ConfigurationManager.AppSettings["AccountNumber_ACH"];
                    OptimalApiClient client        = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

                    OptimalPayments.CustomerVault.Profile profile = client.customerVaultService().create(
                        OptimalPayments.CustomerVault.Profile.Builder()
                        .merchantCustomerId(System.Guid.NewGuid().ToString())
                        .locale("en_US")
                        .firstName("John")
                        .lastName("Smith")
                        .email("*****@*****.**")
                        .phone("713-444-5555")
                        .Build());

                    OptimalPayments.CustomerVault.Address address = client.customerVaultService().create(
                        OptimalPayments.CustomerVault.Address.Builder()
                        .nickName("home")
                        .street("100 Queen Street West")
                        .street2("Unit 201")
                        .city("Toronto")
                        .country("CA")
                        .state("ON")
                        .zip("M5H 2N2")
                        .recipientName("Jane Doe")
                        .phone("647-788-3901")
                        .profileId(profile.id())
                        .Build());

                    OptimalPayments.CustomerVault.ACHBankAccounts account = client.customerVaultService().create(
                        OptimalPayments.CustomerVault.ACHBankAccounts.Builder()
                        .nickName("Johns RBC Business Bank Account")
                        .accountNumber(getRandomNumber())
                        .routingNumber("123456789")
                        .accountHolderName("XYZ Business")
                        .billingAddressId(address.id())
                        .accountType("CHECKING")
                        .merchantRefNum(System.Guid.NewGuid().ToString())
                        .profileId(profile.id())
                        .Build());

                    Purchases purchase = Purchases.Builder()
                                         .merchantRefNum(Request.Form["merchant_customer_id"])
                                         .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"])))
                                         .ach()
                                         .paymentToken(account.paymentToken())
                                         .payMethod("WEB")
                                         .Done()
                                         .Build();
                    Purchases response = client.directDebitService().submit(purchase);
                    this.response = response.ToString();
                }
                else if (val.Equals("BACS"))
                {
                    string           accountNumber = System.Configuration.ConfigurationManager.AppSettings["AccountNumber_BACS"];
                    OptimalApiClient client        = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

                    Purchases purchase = Purchases.Builder()
                                         .merchantRefNum(Request.Form["merchant_customer_id"])
                                         .amount(Convert.ToInt32(Double.Parse(Request.Form["amount"])))
                                         .bacs()
                                         .paymentToken(Request.Form["payment_token"])
                                         .Done()
                                         .Build();
                    Purchases response = client.directDebitService().submit(purchase);
                    this.response = response.ToString();
                }
                else if (val.Equals("EFT"))
                {
                    string           accountNumber = System.Configuration.ConfigurationManager.AppSettings["AccountNumber_EFT"];
                    OptimalApiClient client        = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

                    OptimalPayments.CustomerVault.Profile profile = client.customerVaultService().create(
                        OptimalPayments.CustomerVault.Profile.Builder()
                        .merchantCustomerId(System.Guid.NewGuid().ToString())
                        .locale("en_US")
                        .firstName("John")
                        .lastName("Smith")
                        .email("*****@*****.**")
                        .phone("713-444-5555")
                        .Build());

                    OptimalPayments.CustomerVault.Address address = client.customerVaultService().create(
                        OptimalPayments.CustomerVault.Address.Builder()
                        .nickName("home")
                        .street("100 Queen Street West")
                        .street2("Unit 201")
                        .city("Toronto")
                        .country("CA")
                        .state("ON")
                        .zip("M5H 2N2")
                        .recipientName("Jane Doe")
                        .phone("647-788-3901")
                        .profileId(profile.id())
                        .Build());

                    OptimalPayments.CustomerVault.EFTBankAccounts account = client.customerVaultService().create(
                        OptimalPayments.CustomerVault.EFTBankAccounts.Builder()
                        .accountNumber(getRandomNumber())
                        .transitNumber("11224")
                        .institutionId("123")
                        .accountHolderName("John Smith")
                        .nickName("Johns RBC Business Bank Account")
                        .billingAddressId(address.id())
                        .profileId(profile.id())
                        .Build());

                    Purchases response = client.directDebitService().submit(Purchases.Builder()
                                                                            .merchantRefNum(System.Guid.NewGuid().ToString())
                                                                            .amount(10038)
                                                                            .eft()
                                                                            .paymentToken(account.paymentToken())
                                                                            .Done()
                                                                            .Build()
                                                                            );
                    this.response = response.ToString();
                }
                else if (val.Equals("SEPA"))
                {
                    string           accountNumber = System.Configuration.ConfigurationManager.AppSettings["AccountNumber_SEPA"];
                    OptimalApiClient client        = new OptimalApiClient(apiKey, apiSecret, OptimalPayments.Environment.TEST, accountNumber);

                    Purchases response = client.directDebitService().submit(Purchases.Builder()
                                                                            .merchantRefNum(System.Guid.NewGuid().ToString())
                                                                            .amount(10038)
                                                                            .sepa()
                                                                            .paymentToken(Request.Form["payment_token"])
                                                                            .Done()
                                                                            .Build()
                                                                            );
                    this.response = response.ToString();
                }
            }
            catch (Exception ex)
            {
                Response.Write("<font style=\"color: #FF0000;\">Error Message is : " + ex.Message + "</font>\n");
            }
        }