Beispiel #1
0
    private void CreatePostParameters(CheckoutDetails checkout)
    {
        PaymentAppGateway gateway = new PaymentAppGateway(checkout);
        TwoCheckoutRedirectPaymentMethod twoCheckoutPaymentMethod = (TwoCheckoutRedirectPaymentMethod)checkout.PaymentMethod;
        string urlHidden = twoCheckoutPaymentMethod.GetPostedUrl();

        NameValueCollection collection = twoCheckoutPaymentMethod.CreatePostParameters(
            checkout,
            StoreContext.Culture,
            StoreContext.Currency,
            StoreContext.ShoppingCart,
            UrlPath.StorefrontUrl,
            OrderID,
            StoreContext.GetOrderAmount().Total,
            StoreContext.WholesaleStatus,
            WebUtilities.GetVisitorIP());

        uxLiteral.Text = CreateParameterText(collection, twoCheckoutPaymentMethod);

        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;
    }
Beispiel #2
0
    public string CreateParameterText(NameValueCollection collection, TwoCheckoutRedirectPaymentMethod paymentMethod)
    {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < collection.Count; i++)
        {
            string text;
            if (paymentMethod.IsHiddenFieldUsingID)
            {
                text = CreateTagHiddenWithID(collection.GetKey(i), collection.Get(i));
            }
            else
            {
                text = CreateTagHidden(collection.GetKey(i), collection.Get(i));
            }

            text = CreateTagHidden(collection.GetKey(i), collection.Get(i));

            sb.Append(text);
        }
        return(sb.ToString());
    }