示例#1
0
    private void ProcessHostedPayment(CheckoutDetails checkout)
    {
        OrderNotifyService order = CreateOrder(checkout);

        PaymentAppGateway gateway = new PaymentAppGateway(checkout);

        string xmlData = gateway.CreateHostedPaymentXml(
            StoreContext.Culture,
            StoreContext.Currency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            order.OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP());

        Response.Redirect("Gateway/GatewayPosting.aspx?OrderID=" + order.OrderID);
    }
示例#2
0
    protected void uxViewCreditCardLink_Load(Object sender, EventArgs e)
    {
        Order      order = DataAccessContext.OrderRepository.GetOne(CurrentOrderID);
        LinkButton uxViewCreditCardLink = (LinkButton)sender;

        if (String.IsNullOrEmpty(order.PaymentToken))
        {
            uxViewCreditCardLink.Visible = false;
        }
        else
        {
            string redirectUrl = PaymentAppGateway.GetPaymentAppUrl("/ViewCreditCard.aspx?Token=", UrlPath.StorefrontUrl);

            string script = String.Format("window.open( '{0}', 'mywin','toolbar=no,resizable=yes,scrollbars=yes' ); return false;",
                                          redirectUrl + order.PaymentToken);

            uxViewCreditCardLink.Attributes.Add("onclick", script);
            uxViewCreditCardLink.Visible = true;
        }
    }
示例#3
0
    private void CreatePostParameters(CheckoutDetails checkout)
    {
        PaymentAppGateway gateway = new PaymentAppGateway(checkout);

        string urlHidden = PaymentAppGateway.GetPaymentAppUrl("/HostedRecordHtml.aspx", UrlPath.StorefrontUrl);

        string xmlData = gateway.CreateHostedPaymentXml(
            StoreContext.Culture,
            StoreContext.Currency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP());

        HostedXml.Value           = HttpUtility.UrlEncode(xmlData);
        uxUrlHidden.Value         = urlHidden;
        uxRefreshLink.NavigateUrl = urlHidden;
    }
    private void ProcessOfflineCreditCardPayment(CheckoutDetails checkout)
    {
        PaymentAppGateway gateway  = new PaymentAppGateway(checkout);
        string            postData = gateway.CreateOnWebsitePaymentXml(
            StoreContext.Culture,
            StoreContext.GetOrderAmount().Total,
            "",
            WebUtilities.GetVisitorIP(),
            UrlPath.StorefrontUrl,
            true);

        PaymentAppResult paymentResult = gateway.PostCommand(new HttpService(), postData, UrlPath.StorefrontUrl);

        if (paymentResult.Status == PaymentAppResult.PaymentStatus.OK)
        {
            ProcessOfflinePaymentSuccess(checkout);
        }
        else
        {
            ProcessCreditCardPaymentFailure(paymentResult.ErrorMessage);
        }
    }
示例#5
0
    public void SetIFrameData()
    {
        PaymentOption paymentOption = DataAccessContext.PaymentOptionRepository.GetOne(
            StoreContext.Culture, StoreContext.CheckoutDetails.PaymentMethod.Name);

        string        url = PaymentAppGateway.GetPaymentAppUrl("/CreditCardInfo.aspx", UrlPath.StorefrontUrl);
        StringBuilder sb  = new StringBuilder();

        AppendAndEncode(sb, "?Cvv2Required={0}", paymentOption.Cvv2Required);
        AppendAndEncode(sb, "&BillingAddressRequired={0}", paymentOption.BillingAddressRequired);
        AppendAndEncode(sb, "&SupportedCreditCards={0}", paymentOption.SupportedCreditCards);
        AppendAndEncode(sb, "&SupportedCreditCardValues={0}", paymentOption.SupportedCreditCardValues);

        // Set User Information.
        if (Page.User.Identity.IsAuthenticated)
        {
            Customer customer = DataAccessContext.CustomerRepository.GetOne(
                DataAccessContext.CustomerRepository.GetIDFromUserName(Membership.GetUser().UserName));
            AppendAndEncode(sb, "&BillingFirstName={0}"
                            , EncodeSpecialCharacters(customer.BillingAddress.FirstName));
            AppendAndEncode(sb, "&BillingLastName={0}"
                            , EncodeSpecialCharacters(customer.BillingAddress.LastName));
            AppendAndEncode(sb, "&BillingCompany={0}"
                            , EncodeSpecialCharacters(customer.BillingAddress.Company));
            AppendAndEncode(sb, "&BillingAddress1={0}"
                            , EncodeSpecialCharacters(customer.BillingAddress.Address1));
            AppendAndEncode(sb, "&BillingAddress2={0}"
                            , EncodeSpecialCharacters(customer.BillingAddress.Address2));
            AppendAndEncode(sb, "&BillingCity={0}", EncodeSpecialCharacters(customer.BillingAddress.City));
            AppendAndEncode(sb, "&BillingZip={0}", EncodeSpecialCharacters(customer.BillingAddress.Zip));
            AppendAndEncode(sb, "&CurrentCountry={0}"
                            , EncodeSpecialCharacters(customer.BillingAddress.Country));
            AppendAndEncode(sb, "&CurrentState={0}", EncodeSpecialCharacters(customer.BillingAddress.State));
            AppendAndEncode(sb, "&BillingPhone={0}", EncodeSpecialCharacters(customer.BillingAddress.Phone));
            AppendAndEncode(sb, "&BillingFax={0}", EncodeSpecialCharacters(customer.BillingAddress.Fax));
            AppendAndEncode(sb, "&Email={0}", EncodeSpecialCharacters(customer.Email));

            AppendAndEncode(sb, "&ShippingFirstName={0}", EncodeSpecialCharacters(customer.ShippingAddress.FirstName));
            AppendAndEncode(sb, "&ShippingLastName={0}", EncodeSpecialCharacters(customer.ShippingAddress.LastName));
            AppendAndEncode(sb, "&ShippingCompany={0}", EncodeSpecialCharacters(customer.ShippingAddress.Company));
            AppendAndEncode(sb, "&ShippingAddress1={0}", EncodeSpecialCharacters(customer.ShippingAddress.Address1));
            AppendAndEncode(sb, "&ShippingAddress2={0}", EncodeSpecialCharacters(customer.ShippingAddress.Address2));
            AppendAndEncode(sb, "&ShippingCity={0}", EncodeSpecialCharacters(customer.ShippingAddress.City));
            AppendAndEncode(sb, "&ShippingZip={0}", EncodeSpecialCharacters(customer.ShippingAddress.Zip));
            AppendAndEncode(sb, "&ShippingCountry={0}", EncodeSpecialCharacters(customer.ShippingAddress.Country));
            AppendAndEncode(sb, "&ShippingState={0}", EncodeSpecialCharacters(customer.ShippingAddress.State));
            AppendAndEncode(sb, "&ShippingPhone={0}", EncodeSpecialCharacters(customer.ShippingAddress.Phone));
            AppendAndEncode(sb, "&ShippingFax={0}", EncodeSpecialCharacters(customer.ShippingAddress.Fax));
        }
        else
        {
            CheckoutDetails checkout = StoreContext.CheckoutDetails;

            AppendAndEncode(sb, "&BillingFirstName={0}", EncodeSpecialCharacters(checkout.BillingAddress.FirstName));
            AppendAndEncode(sb, "&BillingLastName={0}", EncodeSpecialCharacters(checkout.BillingAddress.LastName));
            AppendAndEncode(sb, "&BillingCompany={0}", EncodeSpecialCharacters(checkout.BillingAddress.Company));
            AppendAndEncode(sb, "&BillingAddress1={0}", EncodeSpecialCharacters(checkout.BillingAddress.Address1));
            AppendAndEncode(sb, "&BillingAddress2={0}", EncodeSpecialCharacters(checkout.BillingAddress.Address2));
            AppendAndEncode(sb, "&BillingCity={0}", EncodeSpecialCharacters(checkout.BillingAddress.City));
            AppendAndEncode(sb, "&BillingZip={0}", EncodeSpecialCharacters(checkout.BillingAddress.Zip));
            AppendAndEncode(sb, "&CurrentCountry={0}", EncodeSpecialCharacters(checkout.BillingAddress.Country));
            AppendAndEncode(sb, "&CurrentState={0}", EncodeSpecialCharacters(checkout.BillingAddress.State));
            AppendAndEncode(sb, "&BillingPhone={0}", EncodeSpecialCharacters(checkout.BillingAddress.Phone));
            AppendAndEncode(sb, "&BillingFax={0}", EncodeSpecialCharacters(checkout.BillingAddress.Fax));
            AppendAndEncode(sb, "&Email={0}", checkout.Email);

            AppendAndEncode(sb, "&ShippingFirstName={0}", EncodeSpecialCharacters(checkout.ShippingAddress.FirstName));
            AppendAndEncode(sb, "&ShippingLastName={0}", EncodeSpecialCharacters(checkout.ShippingAddress.LastName));
            AppendAndEncode(sb, "&ShippingCompany={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Company));
            AppendAndEncode(sb, "&ShippingAddress1={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Address1));
            AppendAndEncode(sb, "&ShippingAddress2={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Address2));
            AppendAndEncode(sb, "&ShippingCity={0}", EncodeSpecialCharacters(checkout.ShippingAddress.City));
            AppendAndEncode(sb, "&ShippingZip={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Zip));
            AppendAndEncode(sb, "&ShippingCountry={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Country));
            AppendAndEncode(sb, "&ShippingState={0}", EncodeSpecialCharacters(checkout.ShippingAddress.State));
            AppendAndEncode(sb, "&ShippingPhone={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Phone));
            AppendAndEncode(sb, "&ShippingFax={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Fax));
        }
        AppendAndEncode(sb, "&IPAddress={0}", WebUtilities.GetVisitorIP());
        AppendAndEncode(sb, "&skiplogin={0}", IsAnonymousCheckout().ToString());

        if (StoreContext.CheckoutDetails.PaymentMethod.Name == "OfflineCreditCard")
        {
            sb.Append("&IsOfflineData=True");
        }
        else
        {
            sb.Append("&IsOfflineData=False");
        }

        AppendAndEncode(sb, "&StoreTheme={0}", Page.StyleSheetTheme);

        //For Languagge
        AppendAndEncode(sb, "&a1={0}", "[$Credit]");
        AppendAndEncode(sb, "&a2={0}", "[$Type]");
        AppendAndEncode(sb, "&a21={0}", "[$Please Select]");
        AppendAndEncode(sb, "&a3={0}", "[$CreditNumber]");
        AppendAndEncode(sb, "&a4={0}", "[$CardholderName]");
        AppendAndEncode(sb, "&a5={0}", "[$CreditVerifi]");
        AppendAndEncode(sb, "&a6={0}", "[$Expiration]");
        AppendAndEncode(sb, "&a7={0}", "[$CardIssue]");
        AppendAndEncode(sb, "&a8={0}", "[$CardStart]");

        AppendAndEncode(sb, "&b1={0}", "[$Billing Address]");
        AppendAndEncode(sb, "&b2={0}", "[$Firstname]");
        AppendAndEncode(sb, "&b3={0}", "[$Lastname]");
        AppendAndEncode(sb, "&b4={0}", "[$Country]");
        AppendAndEncode(sb, "&b5={0}", "[$State]");
        AppendAndEncode(sb, "&b6={0}", "[$Company]");
        AppendAndEncode(sb, "&b7={0}", "[$Address1]");
        AppendAndEncode(sb, "&b8={0}", "[$City]");
        AppendAndEncode(sb, "&b9={0}", "[$Zip]");

        AppendAndEncode(sb, "&RedirectURL={0}", UrlPath.StorefrontUrl + "SaveBillingAddress.aspx");

        //reference = http://support.microsoft.com/default.aspx?scid=kb;EN-US;208427
        if (sb.Length + url.Length < 2083 && sb.Length < 2048)
        {
            uxPaymentFrame.Attributes["src"] = url + sb.ToString();
        }
        else
        {
            throw new Exception(
                      String.Format("Query string exceedd maximum length: URL length {0}, Query length {1}",
                                    sb.Length + url.Length, sb.Length));
        }
    }
    public void SetIFrameData()
    {
        PaymentOption paymentOption = DataAccessContext.PaymentOptionRepository.GetOne(
            StoreContext.Culture, StoreContext.CheckoutDetails.PaymentMethod.Name);

        string        url = PaymentAppGateway.GetPaymentAppUrl("/CreditCardInfo.aspx", UrlPath.StorefrontUrl);
        StringBuilder sb  = new StringBuilder();

        AppendAndEncode(sb, "?Cvv2Required={0}", paymentOption.Cvv2Required);
        AppendAndEncode(sb, "&BillingAddressRequired={0}", paymentOption.BillingAddressRequired);
        AppendAndEncode(sb, "&SupportedCreditCards={0}", paymentOption.SupportedCreditCards);
        AppendAndEncode(sb, "&SupportedCreditCardValues={0}", paymentOption.SupportedCreditCardValues);

        CheckoutDetails checkout = StoreContext.CheckoutDetails;

        AppendAndEncode(sb, "&BillingFirstName={0}", EncodeSpecialCharacters(checkout.BillingAddress.FirstName));
        AppendAndEncode(sb, "&BillingLastName={0}", EncodeSpecialCharacters(checkout.BillingAddress.LastName));
        AppendAndEncode(sb, "&BillingCompany={0}", EncodeSpecialCharacters(checkout.BillingAddress.Company));
        AppendAndEncode(sb, "&BillingAddress1={0}", EncodeSpecialCharacters(checkout.BillingAddress.Address1));
        AppendAndEncode(sb, "&BillingAddress2={0}", EncodeSpecialCharacters(checkout.BillingAddress.Address2));
        AppendAndEncode(sb, "&BillingCity={0}", EncodeSpecialCharacters(checkout.BillingAddress.City));
        AppendAndEncode(sb, "&BillingZip={0}", EncodeSpecialCharacters(checkout.BillingAddress.Zip));
        AppendAndEncode(sb, "&CurrentCountry={0}", EncodeSpecialCharacters(checkout.BillingAddress.Country));
        AppendAndEncode(sb, "&CurrentState={0}", EncodeSpecialCharacters(checkout.BillingAddress.State));
        AppendAndEncode(sb, "&BillingPhone={0}", EncodeSpecialCharacters(checkout.BillingAddress.Phone));
        AppendAndEncode(sb, "&BillingFax={0}", EncodeSpecialCharacters(checkout.BillingAddress.Fax));
        AppendAndEncode(sb, "&Email={0}", checkout.Email);

        AppendAndEncode(sb, "&ShippingFirstName={0}", EncodeSpecialCharacters(checkout.ShippingAddress.FirstName));
        AppendAndEncode(sb, "&ShippingLastName={0}", EncodeSpecialCharacters(checkout.ShippingAddress.LastName));
        AppendAndEncode(sb, "&ShippingCompany={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Company));
        AppendAndEncode(sb, "&ShippingAddress1={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Address1));
        AppendAndEncode(sb, "&ShippingAddress2={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Address2));
        AppendAndEncode(sb, "&ShippingCity={0}", EncodeSpecialCharacters(checkout.ShippingAddress.City));
        AppendAndEncode(sb, "&ShippingZip={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Zip));
        AppendAndEncode(sb, "&ShippingCountry={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Country));
        AppendAndEncode(sb, "&ShippingState={0}", EncodeSpecialCharacters(checkout.ShippingAddress.State));
        AppendAndEncode(sb, "&ShippingPhone={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Phone));
        AppendAndEncode(sb, "&ShippingFax={0}", EncodeSpecialCharacters(checkout.ShippingAddress.Fax));
        AppendAndEncode(sb, "&IPAddress={0}", WebUtilities.GetVisitorIP());

        if (StoreContext.CheckoutDetails.PaymentMethod.Name == "OfflineCreditCard")
        {
            sb.Append("&IsOfflineData=True");
        }
        else
        {
            sb.Append("&IsOfflineData=False");
        }

        AppendAndEncode(sb, "&StoreTheme={0}",
                        DataAccessContext.Configurations.GetValue("StoreTheme", DataAccessContext.StoreRepository.GetOne(Store.RegularStoreID)));
        //For Languagge
        AppendAndEncode(sb, "&a1={0}", ("Credit Card"));
        AppendAndEncode(sb, "&a2={0}", "Type");
        AppendAndEncode(sb, "&a21={0}", ("Please Select"));
        AppendAndEncode(sb, "&a3={0}", ("Credit Card Number"));
        AppendAndEncode(sb, "&a4={0}", ("Card Holders Name"));
        AppendAndEncode(sb, "&a5={0}", ("Card Verification Number"));
        AppendAndEncode(sb, "&a6={0}", ("Expiration Date"));
        AppendAndEncode(sb, "&a7={0}", ("Card Issue"));
        AppendAndEncode(sb, "&a8={0}", ("Card Start"));

        AppendAndEncode(sb, "&b1={0}", ("Billing Address"));
        AppendAndEncode(sb, "&b2={0}", ("First Name"));
        AppendAndEncode(sb, "&b3={0}", ("Last Name"));
        AppendAndEncode(sb, "&b4={0}", "Country");
        AppendAndEncode(sb, "&b5={0}", "State");
        AppendAndEncode(sb, "&b6={0}", "Company");
        AppendAndEncode(sb, "&b7={0}", "Address");
        AppendAndEncode(sb, "&b8={0}", "City");
        AppendAndEncode(sb, "&b9={0}", "Zip");

        AppendAndEncode(sb, "&RedirectURL={0}", UrlPath.StorefrontUrl + "SaveBillingAddress.aspx");
        //reference = http://support.microsoft.com/default.aspx?scid=kb;EN-US;208427
        if (sb.Length + url.Length < 2083 && sb.Length < 2048)
        {
            uxPaymentFrame.Attributes["src"] = url + sb.ToString();
        }
        else
        {
            throw new Exception(
                      String.Format("Query string exceedd maximum length: URL length {0}, Query length {1}",
                                    sb.Length + url.Length, sb.Length));
        }
    }