Пример #1
0
        private void SetupWorldPay()
        {
            if ((!Request.IsAuthenticated) && (!canCheckoutWithoutAuthentication)) { return; }

            if (commerceConfig.WorldPayInstallationId.Length == 0) { return; }

            if (cart.OrderTotal <= 0) { return; }

            pnlWorldPay.Visible = true;
            frmCardInput.Visible = false;
            heading.Text = WebStoreResources.WorldPayCheckoutHeader;

            worldPayAcceptanceMark.InstId = commerceConfig.WorldPayInstallationId;
            btnWorldPay.Text = WebStoreResources.ContinueButton;

            btnWorldPay.InstId = commerceConfig.WorldPayInstallationId;
            btnWorldPay.Md5Secret = commerceConfig.WorldPayMd5Secret;
            btnWorldPay.MerchantCode = commerceConfig.WorldPayMerchantCode;
            btnWorldPay.CurrencyCode = siteSettings.GetCurrency().Code;

            btnWorldPay.Amount = cart.OrderTotal;
            btnWorldPay.UseTestServer = commerceConfig.PaymentGatewayUseTestMode;
            btnWorldPay.OrderDescription = cart.GetStringOfCartOfferNames();

            btnWorldPay.CustomerEmail = cart.OrderInfo.CustomerEmail;
            if ((cart.OrderInfo.CustomerFirstName.Length > 0) && (cart.OrderInfo.CustomerLastName.Length > 0))
            {
                btnWorldPay.CustomerName = string.Format(CultureInfo.InvariantCulture, WebStoreResources.FirstNameLastNameFormat,
                    cart.OrderInfo.CustomerFirstName, cart.OrderInfo.CustomerLastName);
            }

            btnWorldPay.Address1 = cart.OrderInfo.CustomerAddressLine1;
            btnWorldPay.Address2 = cart.OrderInfo.CustomerAddressLine2;
            btnWorldPay.Town = cart.OrderInfo.CustomerCity;
            btnWorldPay.Region = cart.OrderInfo.CustomerState;
            btnWorldPay.Country = cart.OrderInfo.CustomerCountry;
            btnWorldPay.PostalCode = cart.OrderInfo.CustomerPostalCode;
            btnWorldPay.CustomerPhone = cart.OrderInfo.CustomerTelephoneDay;

            PayPalLog worldPayLog = StoreHelper.EnsureWorldPayCheckoutLog(
                cart,
                store,
                SiteRoot,
                WebUtils.ResolveServerUrl(SiteUtils.GetCurrentPageUrl()),
                pageId,
                moduleId);

            // note that we actually pass the PayPalLog guid not the cart id
            // we then deserialize the cart form tha PayPsalLog to ensure it has not been modified
            // since the user left our site and went to WorldPay
            btnWorldPay.CartId = worldPayLog.RowGuid.ToString();
            //btnWorldPay.CustomData = worldPayLog.RowGuid.ToString();
        }