protected override void CreateChildControls()
    {
        string orderHash = QueryHelper.GetString("o", string.Empty);

        mOrderId = ValidationHelper.GetInteger(WindowHelper.GetItem(orderHash), 0);

        base.CreateChildControls();

        if (PaymentGatewayProvider != null)
        {
            try
            {
                PaymentGatewayProvider.OrderId = mOrderId;

                // Init paymentDataContainer
                mPaymentDataForm = Service.Resolve <IPaymentGatewayFormFactory>().GetPaymentGatewayForm(PaymentGatewayProvider, this);

                if (mPaymentDataForm != null)
                {
                    pnlPaymentDataContainer.Controls.Clear();
                    pnlPaymentDataContainer.Controls.Add(mPaymentDataForm);
                }
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("PaymentForm", "EXCEPTION", ex);
            }
        }
    }
Example #2
0
    private void LoadData()
    {
        // Payment summary
        lblTotalPriceValue.Text = CurrencyInfoProvider.GetFormattedPrice(ShoppingCart.GrandTotal, ShoppingCart.Currency);
        lblOrderIdValue.Text    = Convert.ToString(ShoppingCart.OrderId);
        if (ShoppingCart.PaymentOption != null)
        {
            lblPaymentValue.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(ShoppingCart.PaymentOption.PaymentOptionDisplayName));
        }

        // Add payment gateway custom data
        var provider = ShoppingCartControl.PaymentGatewayProvider;

        mPaymentDataForm = Service.Resolve <IPaymentGatewayFormFactory>().GetPaymentGatewayForm(provider, this);

        if (mPaymentDataForm != null)
        {
            PaymentDataContainer.Controls.Clear();
            PaymentDataContainer.Controls.Add(mPaymentDataForm);
        }

        var customerUser = ShoppingCartControl.ShoppingCartInfoObj?.Customer?.CustomerUser;

        // Disable next button for unauthorized payment method
        if (!ShoppingCartControl.PaymentGatewayProvider.IsUserAuthorizedToFinishPayment(customerUser, ShoppingCartControl.ShoppingCartInfoObj, !IsLiveSite))
        {
            ShoppingCartControl.ButtonNext.Enabled = false;
        }

        // Show "Order saved" info message
        if (!ShoppingCartControl.IsCurrentStepPostBack)
        {
            lblInfo.Text    = GetString("ShoppingCart.PaymentGateway.OrderSaved");
            lblInfo.Visible = true;
        }
        else
        {
            lblInfo.Text = "";
        }
    }