コード例 #1
0
        private void RedirectToSucceedingPage()
        {
            if (_checkOutMode)
            {
                string redirectUrl;

                if (isAnonPayPal)
                {
                    _cart.BuildSalesOrderDetails(false, false);
                    Customer.Current.ThisCustomerSession["paypalfrom"] = "shoppingcart";
                    redirectUrl = PayPalExpress.CheckoutURL(_cart);
                }
                else if (isAnonGoogleCheckout)
                {
                    _cart.BuildSalesOrderDetails(false, false);
                    redirectUrl = GoogleCheckout.CreateGoogleCheckout(_cart);
                }
                else if (AppLogic.AppConfigBool("Checkout.UseOnePageCheckout"))
                {
                    redirectUrl = "checkout1.aspx";
                }
                else
                {
                    redirectUrl = "checkoutshipping.aspx";
                }

                Response.Redirect(redirectUrl);
            }
            else
            {
                Response.Redirect("account.aspx");
            }
        }
コード例 #2
0
        /// <summary>
        /// Processes an order cancelled event
        /// </summary>
        /// <param name="order">Order that has been cancelled</param>
        public static void OrderCancelled(Order order)
        {
            order.Notes.Add(new OrderNote(order.OrderId, order.UserId, LocaleHelper.LocalNow, Properties.Resources.OrderCancelled, NoteType.SystemPrivate));
            order.Notes.Save();
            UpdateOrderStatus(StoreEvent.OrderCancelled, order);
            //if this is a google checkout order update google checkout
            if (!string.IsNullOrEmpty(order.GoogleOrderNumber))
            {
                GoogleCheckout instance = GoogleCheckout.GetInstance();
                string         comment  = order.GetLastPublicNote();
                if (string.IsNullOrEmpty(comment))
                {
                    comment = "N/A";
                }
                instance.CancelOrder(order.GoogleOrderNumber, comment);
            }

            // DELETE ALL ASSOCIATED SUBSCRIPTIONS
            SubscriptionDataSource.DeleteForOrder(order.OrderId);

            Hashtable parameters = new Hashtable();

            parameters["order"]    = order;
            parameters["customer"] = order.User;
            parameters["payments"] = order.Payments;
            ProcessEmails(StoreEvent.OrderCancelled, parameters);
        }
コード例 #3
0
        /// <summary>
        /// Register that a shipment has been shipped.
        /// </summary>
        /// <param name="shipDate">Date the shipment has been shipped.</param>
        /// <param name="updateGoogleCheckout">If the order associated with this shipment is a GoogleCheckout
        /// order, this flag  indicates whether to send an update notification to GoogleCheckout or not.</param>
        public void Ship(DateTime shipDate, bool updateGoogleCheckout)
        {
            this.ShipDate = shipDate;
            this.Save();
            //FORCE ASSOCIATED ORDER TO RELOAD FROM DATABASE
            this._Order = OrderDataSource.Load(this.OrderId, false);
            //TRIGGER THE SHIPMENT SHIPPED EVENT
            Stores.StoreEventEngine.ShipmentShipped(this);
            //RECALCULATE SHIPMENT STATUS
            this.Order.RecalculateShipmentStatus();

            //if the order was a google checkout order, update gooogle checkout
            if (updateGoogleCheckout)
            {
                if (!string.IsNullOrEmpty(this.Order.GoogleOrderNumber))
                {
                    GoogleCheckout instance = GoogleCheckout.GetInstance();
                    TrackingNumber number   = GetLastTrackingNumber();
                    string         carrier  = GetGCCarrier(number);
                    string         trNumber = (number == null || string.IsNullOrEmpty(number.TrackingNumberData))
                                      ? null : number.TrackingNumberData;
                    instance.AddTrackingData(this.Order.GoogleOrderNumber, carrier, trNumber);

                    //If order has not yet shipped completely, notify that it is under processing
                    if (this.Order.ShipmentStatus == OrderShipmentStatus.Unshipped ||
                        this.Order.ShipmentStatus == OrderShipmentStatus.Unspecified)
                    {
                        instance.ProcessOrder(this.Order.GoogleOrderNumber);
                    }
                }
            }
        }
コード例 #4
0
        private static void ProcessNewOrderNotification(object paramWrapper)
        {
            var    param       = paramWrapper as ParamWrapper;
            string ordernumber = GoogleCheckout.ProcessNewOrderNotification(param.XmlData, (paramWrapper as ParamWrapper).CurrentContext, param.XmlCustomerInfo);

            GoogleCheckout.AddMerchantOrderNumber(ordernumber);
            GcThreadProcessor.Finalize(param.ID);
        }
コード例 #5
0
        protected void btnGoogleCheckout_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ProcessCart(false);
            cart.BuildSalesOrderDetails();

            if (!ThisCustomer.IsRegistered &&
                !(AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") && AppLogic.AppConfigBool("GoogleCheckout.AllowAnonCheckout")))
            {
                Response.Redirect("checkoutanon.aspx?checkout=true&checkouttype=gc");
            }
            else
            {
                Response.Redirect(GoogleCheckout.CreateGoogleCheckout(cart));
            }
        }
コード例 #6
0
        private void StartThreading(string xmlData)
        {
            var gNewOrderNotification = GoogleCheckout.DecodeRequest(xmlData, typeof(NewOrderNotification)) as NewOrderNotification;
            var CustomerInfo          = gNewOrderNotification.shoppingcart.merchantprivatedata.Any[0];
            var customerGuid          = new Guid(CustomerInfo.Attributes["ContactGuid"].Value);

            var paramWrapper = new ParamWrapper()
            {
                CurrentContext  = HttpContext.Current,
                ID              = customerGuid,
                XmlData         = xmlData,
                XmlCustomerInfo = CustomerInfo
            };

            GcThreadProcessor.ThreadStart(ProcessNewOrderNotification, paramWrapper);
        }
コード例 #7
0
ファイル: AcHelper.cs プロジェクト: phongdevelopers/my-phong
        public static Payment GetGCPayment(Order order, GoogleCheckout instance, bool createNew)
        {
            int GCPayMethodId = AcHelper.GetGCPaymentMethodId(instance);

            foreach (Payment pmnt in order.Payments)
            {
                if (pmnt.PaymentMethodId == GCPayMethodId)
                {
                    return(pmnt);
                }
            }
            //IF THERE IS ONE PAYMENT
            //AND IT IS A GIFT CERTIFICATE
            //AND IT COVERS THE BALANCE OF THE ORDER
            //THEN THIS IS THE GOOGLE PAYMENT
            if (order.Payments.Count == 1)
            {
                int     gcPayMethodId = PaymentEngine.GetGiftCertificatePaymentMethod().PaymentMethodId;
                Payment payment       = order.Payments[0];
                if (payment.PaymentMethodId == gcPayMethodId)
                {
                    if (payment.Amount == order.TotalCharges)
                    {
                        return(payment);
                    }
                }
            }

            if (createNew)
            {
                Payment payment = new Payment();
                payment.PaymentMethodId   = GCPayMethodId;
                payment.Amount            = order.GetBalance(false);
                payment.OrderId           = order.OrderId;
                payment.PaymentMethodName = "GoogleCheckout";
                payment.PaymentStatus     = PaymentStatus.Unprocessed;
                order.Payments.Add(payment);
                //payment.Save();
                order.Save();
                return(payment);
            }
            else
            {
                return(null);
            }
        }
コード例 #8
0
        public static Transaction ChargeOrder(GoogleCheckout instance, CaptureTransactionRequest captureRequest)
        {
            string env         = instance.UseTestMode ? "Sandbox" : "Production";
            string merchantId  = instance.MerchantID;
            string merchantKey = instance.MerchantKey;
            string orderNum    = captureRequest.Payment.Order.GoogleOrderNumber;
            string currency    = captureRequest.Payment.CurrencyCode;

            if (currency == null || currency.Length == 0)
            {
                currency = "USD";
            }
            LSDecimal amount           = captureRequest.Amount;
            LSDecimal remainingCapture = captureRequest.Payment.Transactions.GetTotalAuthorized()
                                         - captureRequest.Payment.Transactions.GetTotalCaptured();

            ChargeOrderRequest request = new ChargeOrderRequest(merchantId, merchantKey, env, orderNum, currency, amount);

            Util.GCheckoutResponse response = request.Send();

            Transaction transaction = new Transaction();

            transaction.Amount = captureRequest.Amount;
            transaction.ProviderTransactionId = orderNum;
            transaction.PaymentGatewayId      = instance.PaymentGatewayId;
            if (remainingCapture > amount)
            {
                transaction.TransactionType = TransactionType.PartialCapture;
            }
            else
            {
                transaction.TransactionType = TransactionType.Capture;
            }

            if (response.IsGood)
            {
                transaction.TransactionStatus = TransactionStatus.Pending;
            }
            else
            {
                transaction.TransactionStatus = TransactionStatus.Failed;
                transaction.ResponseMessage   = response.ErrorMessage;
            }

            return(transaction);
        }
コード例 #9
0
 protected void btnGoogleCheckout_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     ProcessCart(false, false, false);
     if (!ThisCustomer.IsRegistered && !AppLogic.AppConfigBool("PasswordIsOptionalDuringCheckout") && !AppLogic.AppConfigBool("GoogleCheckout.AllowAnonCheckout"))
     {
         if (AppLogic.ProductIsMLExpress())
         {
             Response.Redirect("signin.aspx?ReturnUrl='shoppingcart.aspx'");
         }
         else
         {
             Response.Redirect("checkoutanon.aspx?checkout=true&checkouttype=gc");
         }
     }
     else
     {
         Response.Redirect(GoogleCheckout.CreateGoogleCheckout(cart));
     }
 }
コード例 #10
0
ファイル: AcHelper.cs プロジェクト: phongdevelopers/my-phong
        public static int GetGCPaymentMethodId(GoogleCheckout gatewayInstance)
        {
            PaymentMethodCollection gcPayMethods =
                PaymentMethodDataSource.LoadForPaymentGateway(gatewayInstance.PaymentGatewayId);

            if (gcPayMethods == null || gcPayMethods.Count == 0)
            {
                PaymentMethod gcPayMethod = new PaymentMethod();
                gcPayMethod.Name              = "GoogleCheckout";
                gcPayMethod.PaymentGatewayId  = gatewayInstance.PaymentGatewayId;
                gcPayMethod.PaymentInstrument = PaymentInstrument.GoogleCheckout;
                gcPayMethod.Save();
                return(gcPayMethod.PaymentMethodId);
            }
            else
            {
                return(gcPayMethods[0].PaymentMethodId);
            }
        }
コード例 #11
0
        public static void UnarchiveOrder(GoogleCheckout instance, string googleOrderNumber)
        {
            string env         = instance.UseTestMode ? "Sandbox" : "Production";
            string merchantId  = instance.MerchantID;
            string merchantKey = instance.MerchantKey;

            UnarchiveOrderRequest request = new UnarchiveOrderRequest(merchantId, merchantKey, env, googleOrderNumber);

            Util.GCheckoutResponse response = request.Send();

            if (response.IsGood)
            {
                Utility.Logger.Debug("Unarchive Order Request initiated successfuly. GoogleOrderNumber=" + googleOrderNumber);
            }
            else
            {
                Utility.Logger.Debug("Unarchive Order Request could not be initiated. ErrorMessage=" + response.ErrorMessage);
            }
        }
コード例 #12
0
        public static void AddTrackingData(GoogleCheckout instance, string googleOrderNumber, string carrier, string trackingNo)
        {
            string env         = instance.UseTestMode ? "Sandbox" : "Production";
            string merchantId  = instance.MerchantID;
            string merchantKey = instance.MerchantKey;

            AddTrackingDataRequest request = new AddTrackingDataRequest(merchantId, merchantKey, env, googleOrderNumber, carrier, trackingNo);

            Util.GCheckoutResponse response = request.Send();

            if (response.IsGood)
            {
                Utility.Logger.Debug("Add Tracking Data Request initiated successfuly. GoogleOrderNumber=" + googleOrderNumber);
            }
            else
            {
                Utility.Logger.Warn("Add Tracking Data Request could not be initiated. ErrorMessage=" + response.ErrorMessage);
            }
        }
コード例 #13
0
        public static void AddMerchantOrderNumber(GoogleCheckout instance, string googleOrderNumber, string acOrderNumber)
        {
            string env         = instance.UseTestMode ? "Sandbox" : "Production";
            string merchantId  = instance.MerchantID;
            string merchantKey = instance.MerchantKey;

            AddMerchantOrderNumberRequest onReq =
                new AddMerchantOrderNumberRequest(merchantId, merchantKey, env, googleOrderNumber, acOrderNumber);

            Util.GCheckoutResponse resp = onReq.Send();

            if (resp.IsGood)
            {
                Utility.Logger.Debug("Add Merchant Order Number Request initiated successfuly. GoogleOrderNumber=" + googleOrderNumber
                                     + " AC OrderNumber=" + acOrderNumber);
            }
            else
            {
                Utility.Logger.Debug("Add Merchant Order Number Request could not be initiated. ErrorMessage=" + resp.ErrorMessage);
            }
        }
コード例 #14
0
        /// <summary>
        /// Processes an order shipped event
        /// </summary>
        /// <param name="order">Order that has been shipped</param>
        public static void OrderShipped(Order order)
        {
            order.Notes.Add(new OrderNote(order.OrderId, order.UserId, LocaleHelper.LocalNow, Properties.Resources.OrderShipped, NoteType.SystemPrivate));
            order.Notes.Save();
            order.ShipmentStatus = OrderShipmentStatus.Shipped;
            order.Save();
            UpdateOrderStatus(StoreEvent.OrderShipped, order);
            //if the order was a google checkout order, update gooogle checkout
            if (!string.IsNullOrEmpty(order.GoogleOrderNumber))
            {
                GoogleCheckout instance = GoogleCheckout.GetInstance();
                TrackingNumber number   = order.GetLastTrackingNumber();
                instance.DeliverOrder(order.GoogleOrderNumber, number);
            }
            Hashtable parameters = new Hashtable();

            parameters["order"]    = order;
            parameters["customer"] = order.User;
            parameters["payments"] = order.Payments;
            ProcessEmails(StoreEvent.OrderShipped, parameters);
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (CommonLogic.QueryStringCanBeDangerousContent("loadcheck") == "1")
            {
                Response.Write("<loadcheck>" + System.DateTime.Now.ToString() + "</loadcheck>");
            }
            else
            {
                Response.CacheControl = "private";
                Response.Expires      = 0;
                Response.AddHeader("pragma", "no-cache");

                // this callback requires basic authentication
                if (!GoogleCheckout.VerifyMessageAuthentication(Request.Headers["Authorization"]) &&
                    !AppLogic.AppConfigBool("GoogleCheckout.UseSandbox"))
                {
                    Response.StatusCode        = 401;
                    Response.StatusDescription = "Access Denied";
                }
                else if (Request.ContentLength > 0)
                {
                    // place notification into string
                    string xmlData = Encoding.UTF8.GetString(Request.BinaryRead(Request.ContentLength));

                    //  Select the appropriate function to handle the notification
                    //  by evaluating the root tag of the document
                    XmlDocument googleResponse = new XmlDocument();
                    googleResponse.LoadXml(xmlData);

                    switch (googleResponse.DocumentElement.Name)
                    {
                    case "merchant-calculation-callback":
                        Response.Write(GoogleCheckout.CreateMerchantCalculationResults(xmlData));
                        break;

                    case "new-order-notification":
                        sendNotificationAcknowledgment();
                        StartThreading(xmlData);
                        break;

                    case "order-state-change-notification":
                        sendNotificationAcknowledgment();
                        GoogleCheckout.ProcessOrderStateChangeNotification(xmlData);
                        break;

                    case "risk-information-notification":
                        sendNotificationAcknowledgment();
                        GoogleCheckout.ProcessRiskInformationNotification(xmlData);
                        break;

                    case "charge-amount-notification":
                        sendNotificationAcknowledgment();
                        GoogleCheckout.ProcessChargeAmountNotification(xmlData);
                        break;

                    case "chargeback-amount-notification":
                        sendNotificationAcknowledgment();
                        GoogleCheckout.ProcessChargebackAmountNotification(xmlData);
                        break;

                    case "authorization-amount-notification":
                        sendNotificationAcknowledgment();
                        GoogleCheckout.ProcessAuthorizationAmountNotification(xmlData);
                        break;

                    case "request-received":
                        GoogleCheckout.ProcessRequestReceived(xmlData);
                        break;

                    case "error":
                        GoogleCheckout.ProcessErrorNotification(xmlData);
                        break;

                    case "diagnosis":
                        GoogleCheckout.ProcessDiagnosisNotification(xmlData);
                        break;

                    default:
                        GoogleCheckout.ProcessUnknownNotification(xmlData);
                        break;
                    }
                }
            }
        }
コード例 #16
0
        public void InitializePageContent()
        {
            int AgeCartDays = AppLogic.AppConfigUSInt("AgeCartDays");

            if (AgeCartDays == 0)
            {
                AgeCartDays = 7;
            }

            ShoppingCart.Age(ThisCustomer.CustomerID, AgeCartDays, CartTypeEnum.ShoppingCart);

            cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false);
            shoppingcartaspx8.Text  = AppLogic.GetString("shoppingcart.aspx.8", SkinID, ThisCustomer.LocaleSetting);
            shoppingcartaspx10.Text = AppLogic.GetString("shoppingcart.aspx.10", SkinID, ThisCustomer.LocaleSetting);
            shoppingcartaspx9.Text  = AppLogic.GetString("shoppingcart.aspx.9", SkinID, ThisCustomer.LocaleSetting);

            shoppingcartcs31.Text          = AppLogic.GetString("shoppingcart.cs.117", SkinID, ThisCustomer.LocaleSetting);
            btnUpdateCart1.Text            = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting);
            btnUpdateCart2.Text            = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting);
            btnUpdateCart3.Text            = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting);
            btnUpdateCart4.Text            = AppLogic.GetString("shoppingcart.cs.110", SkinID, ThisCustomer.LocaleSetting);
            lblOrderNotes.Text             = AppLogic.GetString("shoppingcart.cs.66", SkinID, ThisCustomer.LocaleSetting);
            btnContinueShoppingTop.Text    = AppLogic.GetString("shoppingcart.cs.62", SkinID, ThisCustomer.LocaleSetting);
            btnContinueShoppingBottom.Text = AppLogic.GetString("shoppingcart.cs.62", SkinID, ThisCustomer.LocaleSetting);
            btnCheckOutNowTop.Text         = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting);
            btnCheckOutNowBottom.Text      = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting);

            bool reqOver13 = AppLogic.AppConfigBool("RequireOver13Checked");

            btnCheckOutNowTop.Enabled = !cart.IsEmpty() && !cart.RecurringScheduleConflict && (!reqOver13 || (reqOver13 && ThisCustomer.IsOver13)) || !ThisCustomer.IsRegistered;
            if (btnCheckOutNowTop.Enabled && AppLogic.MicropayIsEnabled() &&
                !AppLogic.AppConfigBool("MicroPay.HideOnCartPage") && cart.CartItems.Count == 1 &&
                cart.HasMicropayProduct() && ((CartItem)cart.CartItems[0]).Quantity == 0)
            {
                // We have only one item and it is the Micropay Product and the Quantity is zero
                // Don't allow checkout
                btnCheckOutNowTop.Enabled = false;
            }
            btnCheckOutNowBottom.Enabled = btnCheckOutNowTop.Enabled;
            ErrorMsgLabel.Text           = CommonLogic.IIF(!cart.IsEmpty() && (reqOver13 && !ThisCustomer.IsOver13 && ThisCustomer.IsRegistered), AppLogic.GetString("Over13OnCheckout", SkinID, ThisCustomer.LocaleSetting), String.Empty);

            PayPalExpressSpan.Visible  = false;
            PayPalExpressSpan2.Visible = false;

            Decimal MinOrderAmount = AppLogic.AppConfigUSDecimal("CartMinOrderAmount");

            if (!cart.IsEmpty() && !cart.ContainsRecurringAutoShip)
            {
                // Enable PayPalExpress if using PayPalPro or PayPal Express is an active payment method.
                bool IncludePayPalExpress = false;

                if (AppLogic.AppConfigBool("PayPal.Express.ShowOnCartPage") && cart.MeetsMinimumOrderAmount(MinOrderAmount))
                {
                    if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWPAYPALPRO)
                    {
                        IncludePayPalExpress = true;
                    }
                    else
                    {
                        foreach (String PM in AppLogic.AppConfig("PaymentMethods").ToUpperInvariant().Split(','))
                        {
                            String PMCleaned = AppLogic.CleanPaymentMethod(PM);
                            if (PMCleaned == AppLogic.ro_PMPayPalExpress)
                            {
                                IncludePayPalExpress = true;
                                break;
                            }
                        }
                    }
                }

                if (IncludePayPalExpress)
                {
                    if (AppLogic.AppConfigBool("PayPal.Promo.Enabled") && cart.Total(true) >= AppLogic.AppConfigNativeDecimal("PayPal.Promo.CartMinimum") && cart.Total(true) <= AppLogic.AppConfigNativeDecimal("PayPal.Promo.CartMaximum"))
                    {
                        btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("PayPal.Promo.ButtonImageURL");
                    }
                    else if (AppLogic.AppConfigExists("Mobile.PayPal.Express.ButtonImageURL"))
                    {
                        btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("Mobile.PayPal.Express.ButtonImageURL");
                    }
                    else
                    {
                        btnPayPalExpressCheckout.ImageUrl = AppLogic.AppConfig("PayPal.Express.ButtonImageURL");
                    }

                    btnPayPalExpressCheckout2.ImageUrl = btnPayPalExpressCheckout.ImageUrl;
                    PayPalExpressSpan.Visible          = true;
                    PayPalExpressSpan2.Visible         = true;
                }
            }

            string googleimageurl;

            if (AppLogic.AppConfigExists("Mobile.GoogleCheckout.LiveCheckoutButton"))
            {
                googleimageurl = String.Format(AppLogic.AppConfig("Mobile.GoogleCheckout.LiveCheckoutButton"), AppLogic.AppConfig("GoogleCheckout.MerchantId"));
            }
            else
            {
                googleimageurl = String.Format(AppLogic.AppConfig("GoogleCheckout.LiveCheckoutButton"), AppLogic.AppConfig("GoogleCheckout.MerchantId"));
            }

            if (AppLogic.AppConfigBool("GoogleCheckout.UseSandbox"))
            {
                googleimageurl = String.Format(AppLogic.AppConfig("GoogleCheckout.SandBoxCheckoutButton"), AppLogic.AppConfig("GoogleCheckout.SandboxMerchantId"));
            }

            googleimageurl = CommonLogic.IsSecureConnection() ? googleimageurl.ToLower().Replace("http://", "https://") : googleimageurl;

            if (AppLogic.ProductIsMLExpress() == true)
            {
                googleimageurl = string.Empty;
            }

            btnGoogleCheckout.ImageUrl  = googleimageurl;
            btnGoogleCheckout2.ImageUrl = googleimageurl;

            bool ForceGoogleOff = false;

            if (cart.IsEmpty() || cart.ContainsRecurringAutoShip || !cart.MeetsMinimumOrderAmount(MinOrderAmount) || ThisCustomer.ThisCustomerSession["IGD"].Length != 0 || (AppLogic.AppConfig("GoogleCheckout.MerchantId").Length == 0 && AppLogic.AppConfig("GoogleCheckout.SandboxMerchantId").Length == 0))
            {
                GoogleCheckoutSpan.Visible  = false;
                GoogleCheckoutSpan2.Visible = false;
                ForceGoogleOff = true; // these conditions force google off period (don't care about other settings)
            }

            if (!AppLogic.AppConfigBool("GoogleCheckout.ShowOnCartPage"))
            {
                // turn off the google checkout, but not in a forced condition, as the mall may turn it back on
                GoogleCheckoutSpan.Visible  = false;
                GoogleCheckoutSpan2.Visible = false;
            }

            // allow the GooglerMall to turn google checkout back on, if not forced off prior and not already visible anyway:
            if (!ForceGoogleOff && !GoogleCheckoutSpan.Visible && (AppLogic.AppConfigBool("GoogleCheckout.GoogleMallEnabled") && Profile.GoogleMall != String.Empty))
            {
                GoogleCheckoutSpan.Visible  = true;
                GoogleCheckoutSpan2.Visible = true;
            }

            AlternativeCheckouts.Visible  = GoogleCheckoutSpan.Visible || PayPalExpressSpan.Visible;
            AlternativeCheckouts2.Visible = GoogleCheckoutSpan2.Visible || PayPalExpressSpan2.Visible;

            if (!AppLogic.AppConfigBool("Mobile.ShowAlternateCheckouts"))
            {
                AlternativeCheckouts.Visible      =
                    AlternativeCheckouts2.Visible = false;
            }

            if (!ForceGoogleOff)
            {
                // hide GC button for carts that don't qualify
                imgGoogleCheckoutDisabled.Visible = !GoogleCheckout.PermitGoogleCheckout(cart);
                btnGoogleCheckout.Visible         = !imgGoogleCheckoutDisabled.Visible;

                imgGoogleCheckout2Disabled.Visible = imgGoogleCheckoutDisabled.Visible;
                btnGoogleCheckout2.Visible         = btnGoogleCheckout.Visible;
            }

            Shipping.ShippingCalculationEnum ShipCalcID = Shipping.GetActiveShippingCalculationID();

            StringBuilder html = new StringBuilder("");

            html.Append("<script type=\"text/javascript\">\n");
            html.Append("function Cart_Validator(theForm)\n");
            html.Append("{\n");
            String cartJS = CommonLogic.ReadFile("jscripts/shoppingcart.js", true);

            foreach (CartItem c in cart.CartItems)
            {
                html.Append(cartJS.Replace("%SKU%", c.ShoppingCartRecordID.ToString()));
            }
            html.Append("return(true);\n");
            html.Append("}\n");
            html.Append("</script>\n");

            ValidationScript.Text = html.ToString();

            JSPopupRoutines.Text = AppLogic.GetJSPopupRoutines();

            ShippingInformation.Visible = (!AppLogic.AppConfigBool("SkipShippingOnCheckout") && !cart.IsAllFreeShippingComponents() && !cart.IsAllSystemComponents());
            AddresBookLlink.Visible     = ThisCustomer.IsRegistered;

            btnCheckOutNowTop.Visible = (!cart.IsEmpty());

            if (!cart.IsEmpty() && cart.HasCoupon() && !cart.CouponIsValid)
            {
                pnlCouponError.Visible = true;
                CouponError.Text       = cart.CouponStatusMessage + " (" + Server.HtmlEncode(CommonLogic.IIF(cart.Coupon.CouponCode.Length != 0, cart.Coupon.CouponCode, ThisCustomer.CouponCode)) + ")";
                cart.ClearCoupon();
            }

            if (!String.IsNullOrEmpty(errorMessage.Message) || ErrorMsgLabel.Text.Length > 0)
            {
                pnlErrorMsg.Visible = true;
                ErrorMsgLabel.Text += errorMessage.Message;
            }

            if (cart.InventoryTrimmed || this.InventoryTrimmed)
            {
                pnlInventoryTrimmedError.Visible = true;
                if (cart.TrimmedReason == InventoryTrimmedReason.RestrictedQuantities || TrimmedEarlyReason == InventoryTrimmedReason.RestrictedQuantities)
                {
                    InventoryTrimmedError.Text = AppLogic.GetString("shoppingcart.aspx.33", SkinID, ThisCustomer.LocaleSetting);
                }
                else
                {
                    InventoryTrimmedError.Text = AppLogic.GetString("shoppingcart.aspx.3", SkinID, ThisCustomer.LocaleSetting);
                }

                cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false);
                ctrlShoppingCart.DataSource = cart.CartItems;
                ctrlCartSummary.DataSource  = cart;
            }

            if (cart.RecurringScheduleConflict)
            {
                pnlRecurringScheduleConflictError.Visible = true;
                RecurringScheduleConflictError.Text       = AppLogic.GetString("shoppingcart.aspx.19", SkinID, ThisCustomer.LocaleSetting);
            }

            if (CommonLogic.QueryStringBool("minimumQuantitiesUpdated"))
            {
                pnlMinimumQuantitiesUpdatedError.Visible = true;
                MinimumQuantitiesUpdatedError.Text       = AppLogic.GetString("shoppingcart.aspx.7", SkinID, ThisCustomer.LocaleSetting);
            }

            if (!cart.MeetsMinimumOrderAmount(MinOrderAmount))
            {
                pnlMeetsMinimumOrderAmountError.Visible = true;
                MeetsMinimumOrderAmountError.Text       = String.Format(AppLogic.GetString("shoppingcart.aspx.4", SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(MinOrderAmount));
            }

            int MinQuantity = AppLogic.AppConfigUSInt("MinCartItemsBeforeCheckout");

            if (!cart.MeetsMinimumOrderQuantity(MinQuantity))
            {
                pnlMeetsMinimumOrderQuantityError.Visible = true;
                MeetsMinimumOrderQuantityError.Text       = String.Format(AppLogic.GetString("shoppingcart.cs.20", SkinID, ThisCustomer.LocaleSetting), MinQuantity.ToString(), MinQuantity.ToString());
            }

            if (AppLogic.MicropayIsEnabled() && AppLogic.AppConfigBool("Micropay.ShowTotalOnTopOfCartPage"))
            {
                pnlMicropay_EnabledError.Visible = true;
                Micropay_EnabledError.Text       = "<div align=\"left\">" + String.Format(AppLogic.GetString("account.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("account.aspx.11", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance)) + "</div>";
            }

            ctrlShoppingCart.HeaderTabImageURL = AppLogic.SkinImage("ShoppingCart.gif");

            if (!cart.IsEmpty())
            {
                pnlOrderOptions.Visible = cart.AllOrderOptions.Count > 0;

                if (cart.CouponsAllowed)
                {
                    if (CouponCode.Text.Length == 0)
                    {
                        CouponCode.Text = cart.Coupon.CouponCode;
                    }

                    btnRemoveCoupon.Visible = CouponCode.Text.Length != 0;
                    pnlCoupon.Visible       = true;
                }
                else
                {
                    pnlCoupon.Visible = false;
                }

                if (!AppLogic.AppConfigBool("DisallowOrderNotes"))
                {
                    OrderNotes.Text       = cart.OrderNotes;
                    pnlOrderNotes.Visible = true;
                }
                else
                {
                    pnlOrderNotes.Visible = false;
                }

                btnCheckOutNowBottom.Visible = true;
            }
            else
            {
                pnlOrderOptions.Visible      = false;
                pnlCoupon.Visible            = false;
                pnlOrderNotes.Visible        = false;
                btnCheckOutNowBottom.Visible = false;
            }

            if (AppLogic.AppConfigBool("SkipShippingOnCheckout") || cart.IsAllFreeShippingComponents() || cart.IsAllSystemComponents())
            {
                ctrlCartSummary.ShowShipping = false;
            }

            if (!cart.HasTaxableComponents() || AppLogic.CustomerLevelHasNoTax(ThisCustomer.CustomerLevelID))
            {
                ctrlCartSummary.ShowTax = false;
            }

            if (cart.ShippingThresHoldIsDefinedButFreeShippingMethodIDIsNot)
            {
                pnlErrorMsg.Visible = true;
                ErrorMsgLabel.Text += Server.HtmlEncode(AppLogic.GetString("shoppingcart.aspx.21", SkinID, ThisCustomer.LocaleSetting));
            }
        }
コード例 #17
0
 public void sendNotificationAcknowledgment()
 {
     Response.Write(GoogleCheckout.SendNotificationAcknowledgment());
     Response.Flush();
 }
コード例 #18
0
 public static void SendBuyerMessage(GoogleCheckout instance, string googleOrderNumber, string message)
 {
     SendBuyerMessage(instance, googleOrderNumber, message, false);
 }
コード例 #19
0
 public static void DeliverOrder(GoogleCheckout instance, string googleOrderNumber, string carrier, string trackingNo)
 {
     DeliverOrder(instance, googleOrderNumber, carrier, trackingNo, true);
 }
コード例 #20
0
 public static void DeliverOrder(GoogleCheckout instance, string googleOrderNumber, bool sendEmail)
 {
     DeliverOrder(instance, googleOrderNumber, null, null, sendEmail);
 }
コード例 #21
0
 public static void DeliverOrder(GoogleCheckout instance, string googleOrderNumber)
 {
     DeliverOrder(instance, googleOrderNumber, null, null, true);
 }