Exemple #1
0
 public CoinOrderMap()
 {
     this._id              = this.id;
     this._OT              = this.OT;
     this._CT              = this.CT;
     this._coinBankVal     = this.coinBankVal;
     this._perCoin         = this.perCoin;
     this._coinsToBeTraded = this.coinsToBeTraded;
 }
Exemple #2
0
 public CoinOrderMap()
 {
     this._id = this.id;
      this._OT = this.OT;
      this._CT = this.CT;
      this._coinBankVal = this.coinBankVal;
      this._perCoin = this.perCoin;
      this._coinsToBeTraded = this.coinsToBeTraded;
 }
Exemple #3
0
    public CoinOrderMap cheapestCoin(orderType order)
    {
        RepoMapConnect RMC = new RepoMapConnect(databaseTable.CoinOrder);

        RMC.map.OT = order;

        SqlCommand command = new SqlCommand(string.Format("select * from coinOrder WHERE OT = {0} ORDER BY perCoin ASC LIMIT 1;", func.orderTypeEnumToString(RMC.map.OT)));

        RMC.map = RMC.repo.sqlFunc.selectData(command, databaseTable.CoinOrder);

        return(RMC.map);
    }
Exemple #4
0
 public void AddOrderItem(string qualifiedFieldname, orderType type)
 {
     if (m_sOrderstring.Length == 0)
     {
         m_sOrderstring = " order by ";
     }
     else
     {
         m_sOrderstring += " , ";
     }
     m_sOrderstring        += qualifiedFieldname;
     m_sOrderstring        += type == orderType.Ascending ? " asc " : " desc ";
     customOrderStringIsSet = true;
 }
Exemple #5
0
    public string orderTypeEnumToString(orderType value)
    {
        switch (value)
        {
        case orderType.Buy:
            return("Buy");

        case orderType.Sell:
            return("Sell");

        default:
            return(null);
        }
    }
 public void PreOrderRecur(orderType orderType)
 {
     if (orderType == orderType.per)
     {
         PreOrderRecur(root);
         PreOrderStack(root);
     }
     else if (orderType == orderType.mid)
     {
         MidOrderRecur(root);
         MidOrderStack(root);
     }
     else if (orderType == orderType.last)
     {
         LastOrderRecur(root);
         LastOrderStack_1(root);
         LastOrderStack_2(root);
     }
 }
        public static Order Create(orderType type)
        {
            switch (type)
            {
            case orderType.HLT:
                return(new HLTOrder());

            case orderType.RedNCheesy:
                return(new RedCheesyOrder());

            case orderType.SuperGreen:
                return(new SuperGreenOrder());

            case orderType.Vegan:
                return(new VeganOrder());

            default:
                return(new HLTOrder());
            }
        }
Exemple #8
0
        public void SetUp()
        {
            MockContext = new MockFactory();

            //initialize counter
            Counter    = _random.Next(1, (int)(Math.Pow(2, 24)));
            CounterStr = GetRandomString("");

            _now       = DateTime.UtcNow;
            _nowString = _now.ToString(DateFormat);

            _pastDate   = _now.AddMonths(-1);
            _nowDate    = _now;
            _futureDate = _now.AddMonths(1);

            CustomMerchantAuthenticationType = new merchantAuthenticationType
            {
                name            = ApiLoginIdKey,
                ItemElementName = ItemChoiceType.transactionKey,
                Item            = TransactionKey,
            };

            //		merchantAuthenticationType.setSessionToken(GetRandomString("SessionToken"));
            //		merchantAuthenticationType.setPass_word(GetRandomString("Pass_word"));
            //	    merchantAuthenticationType.setMobileDeviceId(GetRandomString("MobileDevice"));

            //	    ImpersonationAuthenticationType impersonationAuthenticationType = new ImpersonationAuthenticationType();
            //	    impersonationAuthenticationType.setPartnerLoginId(CnpApiLoginIdKey);
            //	    impersonationAuthenticationType.setPartnerTransactionKey(CnpTransactionKey);
            //	    merchantAuthenticationType.setImpersonationAuthentication(impersonationAuthenticationType);

            CustomerProfileType = new customerProfileType
            {
                merchantCustomerId = GetRandomString("Customer"),
                description        = GetRandomString("CustomerDescription"),
                email = CounterStr + "*****@*****.**",
            };

            //make sure these elements are initialized by calling get as it uses lazy initialization
            var paymentProfiles = CustomerProfileType.paymentProfiles;
            var addresses       = CustomerProfileType.shipToList;

            CreditCardOne = new creditCardType
            {
                cardNumber     = "4111111111111111",
                expirationDate = "2038-12",
            };
            //		creditCardOne.setCardCode("");

            BankAccountOne = new bankAccountType
            {
                accountType   = bankAccountTypeEnum.savings,
                routingNumber = "125000000",
                accountNumber = GetRandomString("A/C#"),
                nameOnAccount = GetRandomString("A/CName"),
                echeckType    = echeckTypeEnum.WEB,
                bankName      = GetRandomString("Bank"),
                checkNumber   = CounterStr,
            };

            TrackDataOne = new creditCardTrackType
            {
                ItemElementName = ItemChoiceType1.track1,
                Item            = GetRandomString("Track1"),
                //trackDataOne.setTrack2(GetRandomString("Track2"));
            };

            EncryptedTrackDataOne = new encryptedTrackDataType
            {
                FormOfPayment = new KeyBlock(),
            };
            //keyBlock.setValue(value);

            PayPalOne = new payPalType
            {
                successUrl         = GetRandomString("https://success.anet.net"),
                cancelUrl          = GetRandomString("https://cancel.anet.net"),
                paypalLc           = GetRandomString("Lc"),
                paypalHdrImg       = GetRandomString("Hdr"),
                paypalPayflowcolor = GetRandomString("flowClr"),
                payerID            = GetRandomString("PayerId"),
            };

            PaymentOne = new paymentType
            {
                Item = CreditCardOne
            };
            //paymentOne.setBankAccount(bankAccountOne);
            //paymentOne.setTrackData(trackDataOne);
            //paymentOne.setEncryptedTrackData(encryptedTrackDataOne);
            //paymentOne.setPayPal( payPalOne);

            //		driversLicenseOne = new DriversLicenseType();
            //		driversLicenseOne.setNumber(GetRandomString("DLNumber"));
            //		driversLicenseOne.setState(GetRandomString("WA"));
            //		driversLicenseOne.setDateOfBirth(nowString);

            CustomerAddressOne = new customerAddressType
            {
                firstName   = GetRandomString("FName"),
                lastName    = GetRandomString("LName"),
                company     = GetRandomString("Company"),
                address     = GetRandomString("StreetAdd"),
                city        = "Bellevue",
                state       = "WA",
                zip         = "98000",
                country     = "USA",
                phoneNumber = FormatToPhone(Counter),
                faxNumber   = FormatToPhone(Counter + 1),
            };

            CustomerPaymentProfileOne = new customerPaymentProfileType
            {
                customerType = customerTypeEnum.individual,
                payment      = PaymentOne,
            };
            //	    customerPaymentProfileOne.setBillTo(customerAddressOne);
            //	    customerPaymentProfileOne.setDriversLicense(driversLicenseOne);
            //	    customerPaymentProfileOne.setTaxId(GetRandomString("XX"));


            CustomerOne = new customerType
            {
                type           = customerTypeEnum.individual,
                id             = GetRandomString("Id"),
                email          = CounterStr + "*****@*****.**",
                phoneNumber    = FormatToPhone(Counter),
                faxNumber      = FormatToPhone(Counter + 1),
                driversLicense = DriversLicenseOne,
                taxId          = "911011011",
            };

            CustomerTwo = new customerType();

            var interval = new paymentScheduleTypeInterval
            {
                length = 1,
                unit   = ARBSubscriptionUnitEnum.months,
            };

            OrderType = new orderType()
            {
                //TODO ADD VALIDATION ON INVOICE LENGTH
                invoiceNumber = GetRandomString("Inv:"),
                description   = GetRandomString("Description"),
            };

            NameAndAddressTypeOne = new nameAndAddressType
            {
                firstName = GetRandomString("FName"),
                lastName  = GetRandomString("LName"),
                company   = GetRandomString("Company"),
                address   = GetRandomString("Address"),
                city      = GetRandomString("City"),
                state     = GetRandomString("State"),
                zip       = "98004",
                country   = "USA",
            };

            NameAndAddressTypeTwo = new nameAndAddressType
            {
                firstName = GetRandomString("FName"),
                lastName  = GetRandomString("LName"),
                company   = GetRandomString("Company"),
                address   = GetRandomString("Address"),
                city      = GetRandomString("City"),
                state     = GetRandomString("State"),
                zip       = "98004",
                country   = "USA",
            };

            PaymentScheduleTypeOne = new paymentScheduleType
            {
                interval         = interval,
                startDate        = _nowDate,
                totalOccurrences = 5,
                trialOccurrences = 0,
            };

            ArbSubscriptionOne = new ARBSubscriptionType
            {
                amount          = SetValidSubscriptionAmount(Counter),
                billTo          = NameAndAddressTypeOne,
                customer        = CustomerOne,
                name            = GetRandomString("Name"),
                order           = OrderType,
                payment         = PaymentOne,
                paymentSchedule = PaymentScheduleTypeOne,
                shipTo          = NameAndAddressTypeOne,
                trialAmount     = SetValidSubscriptionAmount(0),
            };

            CustomerDataOne = new customerDataType
            {
                driversLicense = CustomerOne.driversLicense,
                email          = CustomerOne.email,
                id             = CustomerOne.id,
                taxId          = CustomerOne.taxId,
                type           = CustomerOne.type,
            };

            RefId = CounterStr;
        }
        public static AuthorizeNetResponse AuthorizePaymentAmount(string ordero, decimal amount, string firstName, string lastName, string billToStreet, string city, string state, string billToZipCode, string country,
                                                                  string cardNo, string cardExporedDate, string securityCode, bool simulation = false)
        {
            AuthorizeNetResponse finalResponse = new AuthorizeNetResponse();

            try
            {
                InitEnvironmentAndAccount(simulation);
                //if (simulation)
                //{
                //    ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
                //}
                //else
                //{
                //    ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;
                //}

                //// define the merchant information (authentication / transaction id)
                //ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
                //{
                //    name = apiLoginId,
                //    ItemElementName = ItemChoiceType.transactionKey,
                //    Item = apiTransactionKey,
                //};

                var creditCard = new creditCardType();
                creditCard = new creditCardType
                {
                    cardNumber     = cardNo,
                    expirationDate = cardExporedDate,
                    cardCode       = securityCode
                };


                var billingAddress = new customerAddressType
                {
                    firstName = string.IsNullOrEmpty(firstName) ? "" : firstName,
                    lastName  = string.IsNullOrEmpty(lastName) ? "" : lastName,
                    address   = billToStreet,
                    city      = city,
                    zip       = billToZipCode,
                    country   = country
                };

                //standard api call to retrieve response
                var paymentType = new paymentType {
                    Item = creditCard
                };

                var requestOrder = new orderType {
                    invoiceNumber = ordero
                };

                var transactionRequest = new transactionRequestType
                {
                    transactionType = transactionTypeEnum.authOnlyTransaction.ToString(),    // charge the card
                    amount          = amount,
                    payment         = paymentType,
                    billTo          = billingAddress,
                    order           = requestOrder
                };

                System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // .net3.5沒有Tls12

                var request = new createTransactionRequest {
                    transactionRequest = transactionRequest
                };

                // instantiate the contoller that will call the service
                var controller = new createTransactionController(request);
                controller.Execute();

                // get the response from the service (errors contained if any)
                var response = controller.GetApiResponse();

                finalResponse = ParseResponse(response);
            }
            catch (Exception ex)
            {
                finalResponse = GenerateExceptionResponse(ex.Message);
            }
            return(finalResponse);
        }
Exemple #10
0
        public static Array PostPay(string AuthorizeLoginID, string AuthorizeTransactionKey, FetchResponse bookingDetails, PaymentViewModel payDetails, decimal AmountToBeCharged = 0)
        {
            string env = System.Configuration.ConfigurationManager.AppSettings["enviroment"].ToString();

            if (env == "production")
            {
                ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.PRODUCTION;
            }
            else
            {
                ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.SANDBOX;
            }

            // define the merchant information (authentication / transaction id)
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
            {
                name            = AuthorizeLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item            = AuthorizeTransactionKey,
            };

            var orderType = new orderType
            {
                invoiceNumber = bookingDetails.lbkg.ToString(),
                description   = "PreCheckIn payment",
            };

            var customerData = new customerDataType
            {
                type  = customerTypeEnum.individual,
                email = bookingDetails.guest.emai
            };

            var creditCard = new creditCardType
            {
                cardNumber     = payDetails.cardNumber.Replace(" ", ""),  // bookingDetails.stay.card.numb.Replace(" ",""),
                expirationDate = payDetails.cardEndDate.Replace(" ", ""), // bookingDetails.stay.card.expy.Replace("/", ""),
                cardCode       = payDetails.cardCode                      // bookingDetails.stay.card.auth
            };

            var billingAddress = new customerAddressType
            {
                firstName   = bookingDetails.guest.namf,
                lastName    = bookingDetails.guest.naml,
                email       = bookingDetails.guest.emai,
                address     = bookingDetails.guest.addr.line1,
                city        = bookingDetails.guest.addr.city,
                state       = bookingDetails.guest.addr.stat,
                country     = bookingDetails.guest.addr.cnty,
                company     = bookingDetails.guest.comp,
                phoneNumber = bookingDetails.guest.phon,
                zip         = bookingDetails.guest.addr.posc
            };

            var retailType = new transRetailInfoType
            {
                marketType = "2",
                deviceType = "8"
            };

            //standard api call to retrieve response
            var paymentType = new paymentType {
                Item = creditCard
            };

            // Add line Items
            var lineItems = new lineItemType[1];

            lineItems[0] = new lineItemType {
                itemId = "1", name = "PreCheckIn of booking " + bookingDetails.lbkg.ToString(), quantity = 1, unitPrice = bookingDetails.stay.fcst, totalAmount = AmountToBeCharged
            };

            var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),// charge the card
                refTransId      = bookingDetails.lbkg.ToString(),
                order           = orderType,
                customer        = customerData,
                lineItems       = lineItems,
                payment         = paymentType,
                amount          = AmountToBeCharged,
                billTo          = billingAddress,
            };

            var request = new createTransactionRequest {
                transactionRequest = transactionRequest
            };

            // instantiate the controller that will call the service
            var controller = new createTransactionController(request);

            controller.Execute();

            // get the response from the service (errors contained if any)
            var response = controller.GetApiResponse();

            Array response_array = new string[6];

            // validate response
            if (response != null)
            {
                if (response.messages.resultCode == messageTypeEnum.Ok)
                {
                    if (response.transactionResponse.messages != null)
                    {
                        response_array.SetValue(response.transactionResponse.responseCode, 0);            //Response Code
                        response_array.SetValue(response.transactionResponse.messages[0].code, 1);        //Message Code
                        response_array.SetValue(response.transactionResponse.messages[0].description, 2); //Description
                        response_array.SetValue(response.transactionResponse.authCode, 3);                //Success, Auth Code
                        response_array.SetValue(response.transactionResponse.transId, 4);                 //Transaction ID
                        response_array.SetValue(bookingDetails.lbkg.ToString(), 5);                       //Reference ID


                        Console.WriteLine("Successfully created transaction with Transaction ID: " + response.transactionResponse.transId);
                        Console.WriteLine("Response Code: " + response.transactionResponse.responseCode);
                        Console.WriteLine("Message Code: " + response.transactionResponse.messages[0].code);
                        Console.WriteLine("Description: " + response.transactionResponse.messages[0].description);
                        Console.WriteLine("Success, Auth Code : " + response.transactionResponse.authCode);
                    }
                    else
                    {
                        //Failed Transaction.
                        if (response.transactionResponse.errors != null)
                        {
                            response_array.SetValue("2", 0);                                              //Response Code
                            response_array.SetValue(response.transactionResponse.errors[0].errorCode, 1); //Message Code
                            response_array.SetValue(response.transactionResponse.errors[0].errorText, 2); //Description
                            response_array.SetValue(response.transactionResponse.authCode, 3);            //Success, Auth Code
                            response_array.SetValue(response.transactionResponse.transId, 4);             //Transaction ID
                            response_array.SetValue(bookingDetails.lbkg.ToString(), 5);                   //Reference ID

                            Console.WriteLine("Error Code: " + response.transactionResponse.errors[0].errorCode);
                            Console.WriteLine("Error message: " + response.transactionResponse.errors[0].errorText);
                        }
                    }
                }
                else
                {
                    //Failed Transaction.
                    if (response.transactionResponse != null && response.transactionResponse.errors != null)
                    {
                        response_array.SetValue("2", 0);                                              //Response Code
                        response_array.SetValue(response.transactionResponse.errors[0].errorCode, 1); //Message Code
                        response_array.SetValue(response.transactionResponse.errors[0].errorText, 2); //Description
                        response_array.SetValue(response.transactionResponse.authCode, 3);            //Success, Auth Code
                        response_array.SetValue(response.transactionResponse.transId, 4);             //Transaction ID
                        response_array.SetValue(bookingDetails.lbkg.ToString(), 5);                   //Reference ID

                        Console.WriteLine("Error Code: " + response.transactionResponse.errors[0].errorCode);
                        Console.WriteLine("Error message: " + response.transactionResponse.errors[0].errorText);
                    }
                    else
                    {
                        response_array.SetValue("3", 0);                                   //Response Code
                        response_array.SetValue(response.messages.message[0].code, 1);     //Message Code
                        response_array.SetValue(response.messages.message[0].text, 2);     //Description
                        response_array.SetValue(response.transactionResponse.authCode, 3); //Success, Auth Code
                        response_array.SetValue(response.transactionResponse.transId, 4);  //Transaction ID
                        response_array.SetValue(bookingDetails.lbkg.ToString(), 5);        //Reference ID

                        Console.WriteLine("Error Code: " + response.messages.message[0].code);
                        Console.WriteLine("Error message: " + response.messages.message[0].text);
                    }
                }
            }
            else
            {
                Console.WriteLine("Null Response.");
                response_array.SetValue("-1", 0);
                response_array.SetValue(bookingDetails.lbkg.ToString(), 5); //Reference ID
            }

            //return response;
            return(response_array);
        }
Exemple #11
0
 public void InsertOrderItem(string qualifiedFieldname, orderType type)
 {
     m_sOrderstring = m_sOrderstring.Replace("order by ", "").TrimStart();
     m_sOrderstring = " order by " + qualifiedFieldname + (type == orderType.Ascending ? " asc " : " desc ") + (Helper.IsNullOrWhiteSpace(m_sOrderstring) ? string.Empty : ", " + m_sOrderstring);
     customOrderStringIsSet = true;
 }
 public void OrderBy(column v,orderType o)
 {
     this.orderby = v;
      this.ordtype = o;
 }
Exemple #13
0
 public void AddOrderItem(string qualifiedFieldname, orderType type)
 {
     if (m_sOrderstring.Length == 0)
         m_sOrderstring = " order by ";
     else m_sOrderstring += " , ";
     m_sOrderstring += qualifiedFieldname;
     m_sOrderstring += type == orderType.Ascending ? " asc " : " desc ";
     customOrderStringIsSet = true;
 }
Exemple #14
0
 public static void orderType(orderType request)
 {
 }
        private bool ProcessPayment()
        {
            RegistrationType regType = (RegistrationType)GetFromViewState(REG_TYPE_VIEW_STATE);

            // Create registration record
            int participantId = CreateRegistration(regType);


            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.PRODUCTION;

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
            {
                // Sandbox Account - Uncomment to run in sandbox mode
                //name = "3QeAr3WX7z",
                //Item = "9f896x36Uy242FQf",
                // -----------------------------------------------------
                // Production Account - Uncomment to run in production mode
                name = "2B4f4zGR",
                Item = "98y32V6UX4kfStLz",
                // -----------------------------------------------------
                ItemElementName = ItemChoiceType.transactionKey
            };

            var creditCard = new creditCardType
            {
                cardNumber     = txtCreditCardNumber.Text,
                expirationDate = (ddlExpirationMonth.SelectedValue + ddlExpirationYear.SelectedValue)
            };

            var paymentType = new paymentType {
                Item = creditCard
            };

            var billToType = new customerAddressType
            {
                firstName = txtFirstName.Text,
                lastName  = txtLastName.Text,
                email     = txtEmail.Text
            };

            var customerType = new customerDataType
            {
                email = txtEmail.Text,
                type  = customerTypeEnum.individual
            };

            var orderType = new orderType
            {
                invoiceNumber = "2019 - " + participantId,
                description   = "Preregistration for Ragnarok 2019"
            };

            settingType[] settings = new settingType[] {
                new settingType
                {
                    settingName  = "emailCustomer",
                    settingValue = "true"
                },
                new settingType
                {
                    settingName  = "headerEmailReceipt",
                    settingValue = "Receipt for your registration to attend Ragnarok 2019"
                },
                new settingType
                {
                    settingName  = "footerEmailReceipt",
                    settingValue = "Thank you for attending Ragnarok 2019, and we look forward to seeing you!"
                }
            };

            var transcationSettingsType = new settingType
            {
                settingName  = "emailCustomer",
                settingValue = "true"
            };

            var transactionRequest = new transactionRequestType
            {
                transactionType     = transactionTypeEnum.authCaptureTransaction.ToString(),
                amount              = Convert.ToDecimal(regType.Cost),
                payment             = paymentType,
                billTo              = billToType,
                order               = orderType,
                customer            = customerType,
                transactionSettings = settings
            };

            var request = new createTransactionRequest {
                transactionRequest = transactionRequest
            };

            try
            {
                var controller = new createTransactionController(request);
                controller.Execute();

                var response = controller.GetApiResponse();

                if (response.messages.resultCode == messageTypeEnum.Ok)
                {
                    if (!regType.IsMinor)
                    {
                        SaveSignature(participantId);
                    }

                    CompleteRegistration(participantId, response.transactionResponse.authCode, response.transactionResponse.transId, regType);

                    UpdateRegistration(participantId, "Paid");
                }
                else
                {
                    cardError.Text = "<br /><br />Error!  " + response.messages.message[0].code + " " + response.messages.message[0].text;

                    if (response.messages.message[0].code == "2")
                    {
                        UpdateRegistration(participantId, "Declined");
                    }
                    else
                    {
                        UpdateRegistration(participantId, "Errored");
                    }

                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                cardError.Text = "<br /><br />Error! There was a problem submitting your payment.  Please try again.  If you are still unsuccessful, please contact Troll.";

                string errMessage = "Message: " + ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += " | Inner Exception: " + ex.InnerException.Message;
                }

                AddError(errMessage);
                return(false);
            }
        }
Exemple #16
0
 public void InsertOrderItem(string qualifiedFieldname, orderType type)
 {
     m_sOrderstring         = m_sOrderstring.Replace("order by ", "").TrimStart();
     m_sOrderstring         = " order by " + qualifiedFieldname + (type == orderType.Ascending ? " asc " : " desc ") + (Helper.IsNullOrWhiteSpace(m_sOrderstring) ? string.Empty : ", " + m_sOrderstring);
     customOrderStringIsSet = true;
 }
Exemple #17
0
        public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, decimal amount, Page p, out string token)
        {
            p.Response.Write("GetAnAcceptPaymentPage Sample\n");

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment         = AuthorizeNet.Environment.SANDBOX;
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
            {
                name            = ApiLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item            = ApiTransactionKey,
            };

            settingType[] settings = new settingType[3];

            settings[0]              = new settingType();
            settings[0].settingName  = settingNameEnum.hostedPaymentButtonOptions.ToString();
            settings[0].settingValue = "{\"text\": \"Pay\"}";

            settings[1]              = new settingType();
            settings[1].settingName  = settingNameEnum.hostedPaymentOrderOptions.ToString();
            settings[1].settingValue = "{\"show\": true}";

            settings[2]              = new settingType();
            settings[2].settingName  = settingNameEnum.hostedPaymentReturnOptions.ToString();
            settings[2].settingValue = "{\"showReceipt\": true, \"url\": \"http://*****:*****@test.com",
                taxId = "123"
            };

            var order = new orderType();

            order.invoiceNumber = "123123";
            order.description   = "234234";

            var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // authorize capture only
                amount          = amount,
                lineItems       = lineItems,
                billTo          = billingAddress,
                customerIP      = "192.1.1.1",
                order           = order
            };

            var request = new getHostedPaymentPageRequest();

            request.transactionRequest    = transactionRequest;
            request.hostedPaymentSettings = settings;

            request.refId = "11111111";


            // instantiate the controller that will call the service
            var controller = new getHostedPaymentPageController(request);

            controller.Execute();

            // get the response from the service (errors contained if any)
            var response = controller.GetApiResponse();

            // validate response
            if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
            {
                p.Response.Write("Message code : " + response.messages.message[0].code);
                p.Response.Write("Message text : " + response.messages.message[0].text);
                //p.Response.Write("Token : " + response.token);
            }
            else if (response != null)
            {
                p.Response.Write("Error: " + response.messages.message[0].code + "  " + response.messages.message[0].text);
                p.Response.Write("Failed to get hosted payment page");
            }

            token = response.token;


            return(response);
        }