예제 #1
0
    public override void Initialize()
    {
        string returnUrl     = string.Format("{0}fp-paypalembeddedcheckoutok.aspx", AppLogic.GetStoreHTTPLocation(true));
        string errorUrl      = string.Format("{0}fp-paypalembeddedcheckoutok.aspx", AppLogic.GetStoreHTTPLocation(true));
        string cancelUrl     = string.Format("{0}fp-shoppingcart.aspx", AppLogic.GetStoreHTTPLocation(true));
        string notifyUrl     = string.Format("{0}paypalnotification.aspx", AppLogic.GetStoreHTTPLocation(true));
        string silentPostURL = string.Format("{0}paypalembeddedcheckoutok.aspx", AppLogic.GetStoreHTTPLocation(true));
        PayPalEmbeddedCheckoutSecureTokenResponse response = PayFlowProController.GetFramedHostedCheckout(returnUrl, errorUrl, cancelUrl, notifyUrl, silentPostURL);

        if (response.Result != 0)
        {
            throw new Exception(AppLogic.GetString("paypalpaymentsadvanced.configerror", ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer.LocaleSetting));
        }

        Session["PayPalEmbeddedCheckoutSecureToken"]   = response.SecureToken;
        Session["PayPalEmbeddedCheckoutSecureTokenId"] = response.SecureTokenID;

        if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0)
        {
            ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg"));
            ShowError(e.Message);
        }

        string frameSrc = response.GetFrameSrc(0, 400);

        litPayPalEmbeddedCheckoutFrame.Text = frameSrc;
    }
    public void Initialize()
    {
        //btnContCheckout.Visible = false;
        string returnUrl = string.Format("{0}fp-paypalembeddedcheckoutok.aspx", AppLogic.GetStoreHTTPLocation(true));
        string errorUrl = string.Format("{0}fp-paypalembeddedcheckoutok.aspx", AppLogic.GetStoreHTTPLocation(true));
        string cancelUrl = string.Format("{0}fp-shoppingcart.aspx", AppLogic.GetStoreHTTPLocation(true));
        string notifyUrl = string.Format("{0}paypalnotification.aspx", AppLogic.GetStoreHTTPLocation(true));
        string silentPostURL = string.Format("{0}paypalembeddedcheckoutok.aspx", AppLogic.GetStoreHTTPLocation(true));
        PayPalEmbeddedCheckoutSecureTokenResponse response = PayFlowProController.GetFramedHostedCheckout(returnUrl, errorUrl, cancelUrl, notifyUrl, silentPostURL);

        if (response.Result != 0)
            throw new Exception("PayPal Embedded Checkout is not configured properly.");

        Session["PayPalEmbeddedCheckoutSecureToken"] = response.SecureToken;
        Session["PayPalEmbeddedCheckoutSecureTokenId"] = response.SecureTokenID;

        if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0)
        {
            ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg"));
            ShowError(e.Message);
        }

        string frameSrc = response.GetFrameSrc(0, 400);
        litPayPalEmbeddedCheckoutFrame.Text = frameSrc;
    }