Exemple #1
0
        private void GotoPay()
        {
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo.Gateway == "Ecdev.plugins.payment.advancerequest")
            {
                this.Page.Response.Redirect("TransactionPwd.aspx?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal().ToString("F2"));
            }
            if (orderInfo.Gateway == "Ecdev.plugins.payment.ws_wappay.wswappayrequest")
            {
                PaymentModeInfo paymentMode    = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway);
                string          attach         = "";
                string          showUrl        = string.Format("http://{0}/Wapshop/", System.Web.HttpContext.Current.Request.Url.Host);
                PaymentRequest  paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url.aspx"), Globals.FullPath("/pay/wap_alipay_return_url.aspx"), attach);
                paymentRequest.SendRequest();
                return;
            }
            if (orderInfo.Gateway == "Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
            {
                PaymentModeInfo paymentMode2 = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway);
                string          attach2      = "";
                string          text         = string.Format("http://{0}/Wapshop/", System.Web.HttpContext.Current.Request.Url.Host);
                HiCryptographer.Decrypt(paymentMode2.Settings);
                PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode2.Gateway, HiCryptographer.Decrypt(paymentMode2.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text, text, Globals.FullPath("/pay/wap_sheng_return_url.aspx"), attach2);
                paymentRequest2.SendRequest();
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection
            {
                this.Page.Request.Form,
                this.Page.Request.QueryString
            };
            this.Gateway = "Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            this.OrderId = this.Notify.GetOrderId();
            this.Order   = ShoppingProcessor.GetOrderInfo(this.OrderId);
            if (this.Order == null)
            {
                base.Response.Write("<p style=\"font-size:16px;\">找不到对应的订单,你付款的订单可能已经被删除</p>");
                return;
            }
            this.Amount = this.Notify.GetOrderAmount();
            if (this.Amount <= 0m)
            {
                this.Amount = this.Order.GetTotal();
            }
            this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
            PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("Ecdev.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                base.Response.Write("<p style=\"font-size:16px;\">找不到对应的支付方式,该支付方式可能已经被删除</p>");
                return;
            }
            this.Notify.Finished          += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished);
            this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild);
            this.Notify.Payment           += new System.EventHandler(this.Notify_Payment);
            this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings));
        }
Exemple #3
0
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            if (!this.isBackRequest)
            {
                parameters.Add("IsReturn", "true");
            }
            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath("/pay/PaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query;
            }
            this.OrderId = this.Notify.GetOrderId();
            string gatewayOrderId = this.Notify.GetGatewayOrderId();

            if (string.IsNullOrEmpty(this.OrderId))
            {
                Globals.Debuglog(" OrderId:没获取到,GetewayOrderId:" + gatewayOrderId, "_DebuglogPaymentTest.txt");
                this.ResponseStatus(true, "noorderId");
            }
            else
            {
                this.orderlist = ShoppingProcessor.GetOrderMarkingOrderInfo(this.OrderId, false);
                if (this.orderlist.Count == 0)
                {
                    Globals.Debuglog("更新订单失败,也许是订单已后台付款,OrderId:" + this.OrderId, "_DebugAlipayPayNotify.txt");
                    this.ResponseStatus(true, "nodata");
                }
                else
                {
                    int modeId = 0;
                    foreach (OrderInfo info in this.orderlist)
                    {
                        this.Amount        += info.GetTotal();
                        info.GatewayOrderId = gatewayOrderId;
                        modeId = info.PaymentTypeId;
                    }
                    PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                    if (paymentMode == null)
                    {
                        Globals.Debuglog("gatewaynotfound" + this.OrderId, "_DebugAlipayPayNotify.txt");
                        this.ResponseStatus(true, "gatewaynotfound");
                    }
                    else
                    {
                        this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                        this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                        this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                        string configXml = HiCryptographer.Decrypt(paymentMode.Settings);
                        this.Notify.VerifyNotify(0x7530, configXml);
                    }
                }
            }
        }
Exemple #4
0
 public void XmlPay(OrderInfo order)
 {
     if (order.Gateway == "hishop.plugins.payment.alipaywx.alipaywxrequest")
     {
         if (order.OrderStatus != OrderStatus.WaitBuyerPay)
         {
             this.Page.Response.Write("<h2 style=\"color:red;width:100%; text-align:center;\">订单状态错误,不能进行支付!<h2>");
             this.Page.Response.End();
         }
         this.OrderId      = order.OrderId;
         this.isFightGroup = ((order.FightGroupId > 0) ? "true" : "false");
         decimal amount = default(decimal);
         if (order.PreSaleId > 0)
         {
             if (!order.DepositDate.HasValue && order.OrderStatus == OrderStatus.WaitBuyerPay)
             {
                 this.OrderId = order.OrderId;
                 amount       = order.Deposit;
             }
             if (order.DepositDate.HasValue && order.OrderStatus == OrderStatus.WaitBuyerPay)
             {
                 if (order.PayRandCode.ToInt(0) == 0)
                 {
                     int num = order.PayRandCode.ToInt(0);
                     num = ((num >= 100) ? (num + 1) : 100);
                     order.PayRandCode = num.ToString();
                     OrderHelper.UpdateOrderPaymentTypeOfAPI(order);
                 }
                 this.OrderId = order.PayOrderId;
                 amount       = order.FinalPayment;
             }
         }
         else
         {
             this.OrderId = order.PayOrderId;
             amount       = order.GetTotal(true);
         }
         SiteSettings    masterSettings = SettingsManager.GetMasterSettings();
         PaymentModeInfo paymentMode    = SalesHelper.GetPaymentMode("hishop.plugins.payment.alipaywx.alipaywxrequest");
         string          showUrl        = $"http://{HttpContext.Current.Request.Url.Host}/vshop/";
         string          returnUrl      = Globals.FullPath("/pay/wap_alipay_return_url");
         string          notifyUrl      = Globals.FullPath("/pay/wap_alipay_notify_url");
         string          attach         = "";
         PaymentModeInfo paymentMode2   = ShoppingProcessor.GetPaymentMode(order.Gateway);
         PaymentRequest  paymentRequest = PaymentRequest.CreateInstance(paymentMode2.Gateway, HiCryptographer.Decrypt(paymentMode2.Settings), this.OrderId, amount, "订单支付", "订单号-" + order.OrderId, order.EmailAddress, order.OrderDate, showUrl, returnUrl, notifyUrl, attach);
         object          obj            = paymentRequest.SendRequest_Ret();
         if (obj.ToNullString().IndexOf("error:") > -1)
         {
             this.ShowWapMessage("支付错误:" + obj.ToNullString().Replace("error:", ""), "");
         }
         else
         {
             HttpContext.Current.Response.Clear();
             HttpContext.Current.Response.Write(obj.ToNullString());
             HttpContext.Current.Response.End();
         }
     }
 }
Exemple #5
0
        private void Pay(InpourRequestInfo request)
        {
            string         inpourId    = request.InpourId;
            PayGatewayInfo gatewayInfo = this.GetGatewayInfo(request.PaymentId.ToString());

            gatewayInfo.InpourRequest = request;
            if (gatewayInfo.GatewayTypeName == "hishop.plugins.payment.weixinrequest")
            {
                string     empty = string.Empty;
                MemberInfo user  = HiContext.Current.User;
                if (user.UserId != 0)
                {
                    MemberOpenIdInfo memberOpenIdInfo = user.MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin");
                    if (memberOpenIdInfo != null)
                    {
                        empty = memberOpenIdInfo.OpenId;
                    }
                }
                else
                {
                    this.Page.Response.Redirect("/" + base.ClientType.ToString() + "/Login.aspx", true);
                }
                this.Page.Response.Redirect("/pay/WeiXinInpourSubmit?orderId=" + inpourId, true);
            }
            if (gatewayInfo.GatewayTypeName == "hishop.plugins.payment.alipaywx.alipaywxrequest")
            {
                HttpContext.Current.Response.Redirect("~/vshop/WXAliPay.aspx?orderId=" + inpourId + "&status=1");
            }
            if (gatewayInfo.GatewayTypeName == "hishop.plugins.payment.ws_apppay.wswappayrequest")
            {
                HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + inpourId, true);
            }
            SiteSettings masterSettings     = SettingsManager.GetMasterSettings();
            string       text               = $"http://{HttpContext.Current.Request.Url.Host}/{HiContext.Current.GetClientPath}/";
            string       hIGW               = gatewayInfo.GatewayTypeName.Replace(".", "_");
            string       wapInpourNotifyUrl = Globals.FullPath(base.GetRouteUrl("WapInpourNotify", new
            {
                HIGW = hIGW
            }));
            string wapInpourReturnUrl = Globals.FullPath(base.GetRouteUrl("WapInpourReturn", new
            {
                HIGW = hIGW
            }));
            PaymentModeInfo paymentModeInfo = gatewayInfo.Paymode = ShoppingProcessor.GetPaymentMode(gatewayInfo.GatewayTypeName);

            gatewayInfo.OrderId = inpourId;
            if (paymentModeInfo == null)
            {
                this.ShowWapMessage("错误的支付方式", this.Page.Request.Url.ToString());
            }
            else
            {
                gatewayInfo.WapInpourNotifyUrl = wapInpourNotifyUrl;
                gatewayInfo.WapInpourReturnUrl = wapInpourReturnUrl;
                this.SendRequest(gatewayInfo);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NameValueCollection nameValueCollection = new NameValueCollection
            {
                this.Page.Request.Form
            };

            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection);
            this.OrderId = this.Notify.GetOrderId();
            this.Order   = ShoppingProcessor.GetOrderInfo(this.OrderId);
            if (this.Order == null)
            {
                Globals.WriteLog(nameValueCollection, "订单信息不存在", "", "", "alipay");
                base.Response.Write("success");
            }
            else
            {
                this.Amount = this.Notify.GetOrderAmount();
                if (this.Amount <= decimal.Zero)
                {
                    this.Amount = this.Order.GetTotal(false);
                }
                this.hasNotify = !string.IsNullOrEmpty(this.Order.GatewayOrderId);
                if (this.Order.PreSaleId > 0 && this.Order.DepositGatewayOrderId.ToNullString() == this.Notify.GetGatewayOrderId())
                {
                    base.Response.Write("success");
                }
                else
                {
                    if (this.Order.PreSaleId > 0 && !this.Order.DepositDate.HasValue)
                    {
                        this.Order.DepositGatewayOrderId = this.Notify.GetGatewayOrderId();
                    }
                    else
                    {
                        this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                    }
                    PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
                    if (paymentMode == null)
                    {
                        paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.alipaywx.alipaywxrequest");
                        if (paymentMode == null)
                        {
                            Globals.WriteLog(nameValueCollection, "支付方式获取失败hishop.plugins.payment.ws_wappay.wswappayrequest", "", "", "alipay");
                            base.Response.Write("success");
                            return;
                        }
                    }
                    this.Notify.Finished          += this.Notify_Finished;
                    this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild;
                    this.Notify.Payment           += this.Notify_Payment;
                    this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Response.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>");
            NameValueCollection nameValueCollection = new NameValueCollection
            {
                this.Page.Request.QueryString
            };

            nameValueCollection.Add("IsReturn", "true");
            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection);
            this.OrderId = this.Notify.GetOrderId();
            this.Order   = ShoppingProcessor.GetOrderInfo(this.OrderId);
            if (this.Order == null)
            {
                base.Response.Write("<p style=\"font-size:16px;\">找不到对应的订单,你付款的订单可能已经被删除</p>");
            }
            else
            {
                this.Amount = this.Notify.GetOrderAmount();
                if (this.Amount <= decimal.Zero)
                {
                    this.Amount = this.Order.GetTotal(false);
                }
                if (this.Order.PreSaleId > 0 && this.Order.DepositGatewayOrderId.ToNullString() == this.Notify.GetGatewayOrderId())
                {
                    base.Response.Write("<p style=\"font-size:16px;\">预售订单,订金已支付成功</p>");
                }
                else
                {
                    if (this.Order.PreSaleId > 0 && !this.Order.DepositDate.HasValue)
                    {
                        this.Order.DepositGatewayOrderId = this.Notify.GetGatewayOrderId();
                    }
                    else
                    {
                        this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                    }
                    PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
                    if (paymentMode == null)
                    {
                        paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.alipaywx.alipaywxrequest");
                        if (paymentMode == null)
                        {
                            base.Response.Write("<p style=\"font-size:16px;\">找不到对应的支付方式,该支付方式可能已经被删除</p>");
                            return;
                        }
                    }
                    this.Notify.Finished          += this.Notify_Finished;
                    this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild;
                    this.Notify.Payment           += this.Notify_Payment;
                    this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
Exemple #8
0
        void FillOrderPaymentMode(OrderInfo orderInfo)
        {
            orderInfo.PaymentTypeId = int.Parse(inputPaymentModeId.Value);
            PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);

            if (paymentMode != null)
            {
                orderInfo.PaymentType       = Globals.HtmlEncode(paymentMode.Name);
                orderInfo.AdjustedPayCharge = orderInfo.PayCharge = ShoppingProcessor.CalcPayCharge(orderInfo.GetTotal(), paymentMode);
            }
        }
Exemple #9
0
        protected override void AttachChildControls()
        {
            this.specialHideShow = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("specialHideShow");
            //传递爽爽挝啡的特殊名到前端,前端用jquery进行相应的功能隐藏
            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.AutoShipping)
            {
                specialHideShow.Value = "sswk";//爽爽挝啡
            }
            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.IsProLa)
            {
                specialHideShow.Value = "prola";//prola
            }
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("");
            }
            if (!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway == "hishop.plugins.payment.offlinerequest"))
            {
                this.litMessage = (Literal)this.FindControl("litMessage");
                this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest"))
            {
                this.btnToPay.Visible = true;
                this.btnToPay.HRef    = "~/pay/wx_Submit.aspx?orderId=" + orderInfo.OrderId;
                specialHideShow.Value = "prolaQuickpay";//自动快速支付
            }
            if ((!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway != "hishop.plugins.payment.podrequest")) && ((orderInfo.Gateway != "hishop.plugins.payment.offlinerequest") && (orderInfo.Gateway != "hishop.plugins.payment.weixinrequest")))
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);
                string          attach      = "";
                string          showUrl     = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host);
                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest();
            }
            else
            {
                this.litOrderId     = (Literal)this.FindControl("litOrderId");
                this.litOrderTotal  = (Literal)this.FindControl("litOrderTotal");
                this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType");
                this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal().ToString("F2"));
                this.litHelperText = (Literal)this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                PageTitle.AddSiteNameTitle("支付");
            }
        }
Exemple #10
0
        private PayGatewayInfo GetGatewayInfo(string paymentType)
        {
            PayGatewayInfo payGatewayInfo = new PayGatewayInfo();

            payGatewayInfo.GatewayTypeId = Convert.ToInt16(paymentType);
            if (paymentType == "-2")
            {
                payGatewayInfo.PaymentName     = "微信支付";
                payGatewayInfo.GatewayTypeName = "hishop.plugins.payment.weixinrequest";
            }
            else if (paymentType == "-22")
            {
                payGatewayInfo.PaymentName     = "微信H5支付";
                payGatewayInfo.GatewayTypeName = "hishop.plugins.payment.weixinrequest";
            }
            else if (paymentType == "-10")
            {
                payGatewayInfo.PaymentName     = "支付宝app支付";
                payGatewayInfo.GatewayTypeName = "hishop.plugins.payment.ws_apppay.wswappayrequest";
            }
            else if (paymentType == "-4")
            {
                payGatewayInfo.PaymentName     = "支付宝H5网页支付";
                payGatewayInfo.GatewayTypeName = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            }
            else if (paymentType == "-5")
            {
                payGatewayInfo.PaymentName     = "盛付通手机网页支付";
                payGatewayInfo.GatewayTypeName = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest";
            }
            else if (paymentType == "-7")
            {
                payGatewayInfo.PaymentName     = "银联全渠道支付";
                payGatewayInfo.GatewayTypeName = "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest";
            }
            else if (paymentType == "-20")
            {
                payGatewayInfo.PaymentName     = "支付宝微信端支付";
                payGatewayInfo.GatewayTypeName = "hishop.plugins.payment.alipaywx.alipaywxrequest";
            }
            else
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(paymentType);
                if (paymentMode != null)
                {
                    payGatewayInfo.GatewayTypeId   = paymentMode.ModeId;
                    payGatewayInfo.PaymentName     = paymentMode.Name;
                    payGatewayInfo.GatewayTypeName = paymentMode.Gateway;
                }
            }
            return(payGatewayInfo);
        }
Exemple #11
0
        private void ProcessorPaymentMode(System.Web.HttpContext context)
        {
            decimal money = 0m;

            if (!string.IsNullOrEmpty(context.Request.Params["ModeId"]))
            {
                int             modeId      = int.Parse(context.Request["ModeId"], System.Globalization.NumberStyles.None);
                decimal         cartMoney   = decimal.Parse(context.Request["TotalPrice"]);
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                money = paymentMode.CalcPayCharge(cartMoney);
            }
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.Append("{");
            stringBuilder.Append("\"Status\":\"OK\",");
            stringBuilder.AppendFormat("\"Charge\":\"{0}\"", Globals.FormatMoney(money));
            stringBuilder.Append("}");
            context.Response.ContentType = "text/plain";
            context.Response.Write(stringBuilder.ToString());
        }
Exemple #12
0
        /// <summary>
        /// 支付方式
        /// </summary>
        /// <param name="context"></param>
        void ProcessorPaymentMode(HttpContext context)
        {
            decimal num = 0M;

            if (!string.IsNullOrEmpty(context.Request.Params["ModeId"]))
            {
                int     modeId    = int.Parse(context.Request["ModeId"], NumberStyles.None);
                decimal cartMoney = decimal.Parse(context.Request["CartTotalPrice"]);
                num = ShoppingProcessor.GetPaymentMode(modeId).CalcPayCharge(cartMoney);
            }
            StringBuilder builder = new StringBuilder();

            builder.Append("{");
            builder.Append("\"Status\":\"OK\",");
            builder.AppendFormat("\"Charge\":\"{0}\", \"Charge_v\":\"{1}\"", Globals.FormatMoney(num), num);
            builder.Append("}");
            context.Response.ContentType = "text/plain";
            context.Response.Write(builder.ToString());
        }
Exemple #13
0
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            Globals.Debuglog("订单支付:0-" + JsonConvert.SerializeObject(this.Notify), "_Debuglog.txt");
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath("/pay/PaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query;
            }
            Globals.Debuglog("订单支付:1-" + JsonConvert.SerializeObject(this.Notify), "_Debuglog.txt");
            this.OrderId   = this.Notify.GetOrderId();
            this.orderlist = ShoppingProcessor.GetOrderMarkingOrderInfo(this.OrderId);
            if (this.orderlist.Count != 0)
            {
                int modeId = 0;
                foreach (OrderInfo info in this.orderlist)
                {
                    this.Amount        += info.GetAmount();
                    info.GatewayOrderId = this.Notify.GetGatewayOrderId();
                    modeId = info.PaymentTypeId;
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    string configXml = HiCryptographer.Decrypt(paymentMode.Settings);
                    this.Notify.VerifyNotify(0x7530, configXml);
                }
            }
        }
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath("/pay/PaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query;
            }
            this.OrderId = this.Notify.GetOrderId();
            this.Order   = ShoppingProcessor.GetOrderInfo(this.OrderId);
            if (this.Order == null)
            {
                this.ResponseStatus(true, "ordernotfound");
            }
            else
            {
                this.Amount = this.Notify.GetOrderAmount();
                if (this.Amount <= 0M)
                {
                    this.Amount = this.Order.GetTotal();
                }
                this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(this.Order.PaymentTypeId);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    this.Notify.VerifyNotify(0x7530, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
Exemple #15
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("");
            }
            if (!(string.IsNullOrEmpty(orderInfo.Gateway) || !(orderInfo.Gateway == "hishop.plugins.payment.offlinerequest")))
            {
                this.litMessage = (Literal)this.FindControl("litMessage");
                this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
            }
            if (!(string.IsNullOrEmpty(orderInfo.Gateway) || !(orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")))
            {
                HttpContext.Current.Response.Redirect("~/pay/wx_Submit.aspx?orderId=" + orderInfo.OrderId);
            }
            if (((!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway != "hishop.plugins.payment.podrequest")) && (orderInfo.Gateway != "hishop.plugins.payment.offlinerequest")) && (orderInfo.Gateway != "hishop.plugins.payment.weixinrequest"))
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);
                string          attach      = "";
                string          showUrl     = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host);
                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest();
            }
            else
            {
                this.litOrderId     = (Literal)this.FindControl("litOrderId");
                this.litOrderTotal  = (Literal)this.FindControl("litOrderTotal");
                this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType");
                this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal().ToString("F2"));
                this.litHelperText = (Literal)this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                PageTitle.AddSiteNameTitle("下单成功");
            }
        }
Exemple #16
0
        /// <summary>
        /// 提交到订货列表按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBuy_Click(object sender, System.EventArgs e)
        {
            this.btnBuy.Enabled = false;                                    //禁用当前按钮
            ManagerInfo currentManager = ManagerHelper.GetCurrentManager(); //当前登录用户信息

            if (currentManager != null /*&& currentManager.ClientUserId > 0*/)
            {
                string strSkuIds     = string.Empty; //存储所有订购商品的SkuId,用于操作后清除待选列表Erp_AgentProduct表数据
                int    shipaddressId = 0;            //送货地址Id
                int    givemodeId    = 0;            //配送方式Id
                int    paymodeId     = 0;            //支付方式Id

                ShoppingCartInfo shoppingCart = null;

                OrderInfo  orderInfo     = new OrderInfo();
                MemberInfo currentMember = MemberHelper.GetMember(currentManager.ClientUserId);
                foreach (System.Web.UI.WebControls.GridViewRow row in this.grdProducts.Rows)
                {
                    //decimal total = 0;
                    decimal price     = 0;                                                                                                 //单价
                    int     resultNum = 0;                                                                                                 //数量

                    System.Web.UI.WebControls.HiddenField txtboxvalue = (System.Web.UI.WebControls.HiddenField)row.FindControl("hiValue"); //得到SkuId
                    //System.Web.UI.WebControls.HiddenField txtboxproduct = (System.Web.UI.WebControls.HiddenField)row.FindControl("hiProductId");//得到ProductId
                    System.Web.UI.WebControls.Literal litSalePrice = (System.Web.UI.WebControls.Literal)row.FindControl("litSalePrice");

                    if (int.TryParse(txtboxvalue.Value.Trim(), out resultNum) && decimal.TryParse(litSalePrice.Text, out price))
                    {
                        string skuId = this.grdProducts.DataKeys[row.RowIndex].Value.ToString();
                        strSkuIds += "'" + skuId + "',";//累加SkuId值并用'',''分割
                        if (!string.IsNullOrEmpty(skuId))
                        {
                            //首先将商品插入购物车
                            //后台订单的购物车处理
                            int pcUserid = 0;
                            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.RegionalFunction && ManagerHelper.GetCurrentManager() != null)
                            {
                                int categoryId = CategoryBrowser.GetCategoryIdBySkuId(skuId);
                                pcUserid = currentManager.UserId;
                                ShoppingCartProcessor.AddLineItemPC(skuId, resultNum, categoryId, pcUserid);
                            }


                            //total += price * resultNum;//计算合计
                            //生成订单项

                            //shoppingCart = ShoppingCartProcessor.GetGroupBuyShoppingCart(currentMember, price, skuId, resultNum);
                            shoppingCart = ShoppingCartProcessor.GetShoppingCart(currentManager.UserId);
                            if (shoppingCart != null && shoppingCart.LineItems != null && shoppingCart.LineItems.Count > 0)
                            {
                                foreach (ShoppingCartItemInfo info2 in shoppingCart.LineItems)
                                {
                                    LineItemInfo info3 = new LineItemInfo
                                    {
                                        SkuId             = info2.SkuId,
                                        ProductId         = info2.ProductId,
                                        SKU               = info2.SKU,
                                        Quantity          = info2.Quantity,
                                        ShipmentQuantity  = info2.ShippQuantity,
                                        ItemCostPrice     = new SkuDao().GetSkuItem(info2.SkuId).CostPrice,
                                        ItemListPrice     = info2.MemberPrice,
                                        ItemAdjustedPrice = info2.AdjustedPrice,
                                        ItemDescription   = info2.Name,
                                        ThumbnailsUrl     = info2.ThumbnailUrl40,
                                        ItemWeight        = info2.Weight,
                                        SKUContent        = info2.SkuContent,
                                        PromotionId       = info2.PromotionId,
                                        PromotionName     = info2.PromotionName,
                                        MainCategoryPath  = info2.MainCategoryPath
                                    };
                                    orderInfo.LineItems.Add(info3.SkuId, info3);
                                }
                            }
                            else
                            {
                                this.ShowMsg("订单生成失败。", true);
                                this.btnBuy.Enabled = true;//启用当前按钮
                                return;
                            }
                        }
                    }
                }
                //一个商品数量都没输入,则退出
                if (string.IsNullOrEmpty(strSkuIds))
                {
                    this.ShowMsg("请输入商品数量。", true);
                    this.btnBuy.Enabled = true;//启用当前按钮
                    return;
                }

                //送货地址
                if (int.TryParse(this.userAddress.SelectedValue, out shipaddressId))
                {
                    ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(shipaddressId, Convert.ToInt32("99999" + currentManager.UserId.ToString()));//(shipaddressId, currentMember.UserId);
                    if (shippingAddress != null)
                    {
                        //this.userAddress.SelectedItem.Text
                        orderInfo.ShippingRegion = RegionHelper.GetFullRegion(shippingAddress.RegionId, ",");
                        orderInfo.RegionId       = shippingAddress.RegionId;
                        orderInfo.Address        = shippingAddress.Address;
                        orderInfo.ZipCode        = shippingAddress.Zipcode;
                        orderInfo.ShipTo         = shippingAddress.ShipTo;
                        orderInfo.TelPhone       = shippingAddress.TelPhone;
                        orderInfo.CellPhone      = shippingAddress.CellPhone;
                        MemberProcessor.SetDefaultShippingAddress(shipaddressId, Convert.ToInt32("99999" + currentManager.UserId.ToString()));
                    }
                }
                //配送方式
                if (int.TryParse(this.userGiveMode.SelectedValue, out givemodeId))
                {
                    ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(givemodeId, true);
                    if (shippingMode != null)
                    {
                        orderInfo.ShippingModeId = shippingMode.ModeId;
                        orderInfo.ModeName       = shippingMode.Name;
                        if (shoppingCart.LineItems.Count != shoppingCart.LineItems.Count((ShoppingCartItemInfo a) => a.IsfreeShipping))
                        {
                            orderInfo.AdjustedFreight = (orderInfo.Freight = ShoppingProcessor.CalcFreight(orderInfo.RegionId, shoppingCart.Weight, shippingMode));
                        }
                        else
                        {
                            orderInfo.AdjustedFreight = (orderInfo.Freight = 0m);
                        }
                    }
                }
                //支付方式
                if (int.TryParse(this.userPayMode.SelectedValue, out paymodeId))
                {
                    orderInfo.PaymentTypeId = paymodeId;
                    switch (paymodeId)
                    {
                    //case -1:
                    //case 0:
                    //    {
                    //        orderInfo.PaymentType = "货到付款";
                    //        orderInfo.Gateway = "hishop.plugins.payment.podrequest";
                    //        break;
                    //    }
                    //case 88:
                    //    {
                    //        orderInfo.PaymentType = "微信支付";
                    //        orderInfo.Gateway = "hishop.plugins.payment.weixinrequest";
                    //        break;
                    //    }
                    case 99:
                    {
                        orderInfo.PaymentType = "线下付款";
                        orderInfo.Gateway     = "hishop.plugins.payment.offlinerequest";
                        break;
                    }

                    default:
                    {
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(paymodeId);
                        if (paymentMode != null)
                        {
                            orderInfo.PaymentTypeId = paymentMode.ModeId;
                            orderInfo.PaymentType   = paymentMode.Name;
                            orderInfo.Gateway       = paymentMode.Gateway;
                        }
                        break;
                    }
                    }
                }
                orderInfo.OrderId   = this.GenerateOrderId(currentManager.UserId); //生成ID
                orderInfo.OrderDate = System.DateTime.Now;                         //当前时间
                //基本信息
                orderInfo.OrderStatus    = OrderStatus.WaitBuyerPay;
                orderInfo.RefundStatus   = RefundStatus.None;
                orderInfo.ShipToDate     = "时间不限";
                orderInfo.ReferralUserId = 0;//订单的所属分销ID,没有就设置为0

                //代理商用户相关信息
                orderInfo.UserId       = Convert.ToInt32("99999" + currentManager.UserId.ToString()); //currentMember.UserId;
                orderInfo.Username     = currentManager.UserName;                                     //currentMember.UserName;
                orderInfo.EmailAddress = currentManager.Email;                                        //currentMember.Email;

                //orderInfo.RealName = currentMember.RealName;
                orderInfo.RealName = currentManager.AgentName;//存储用户后台昵称

                //orderInfo.QQ = currentMember.QQ;
                orderInfo.Remark      = this.txtOrderRemark.Text; //得到前端TextBox值
                orderInfo.OrderSource = 1;                        //来源代理商采购
                this.SetOrderItemStatus(orderInfo);



                if (ShoppingProcessor.CreatOrder(orderInfo))
                {
                    ShoppingCartProcessor.ClearShoppingCartPC();
                    //订单生成成功后清空
                    strSkuIds = strSkuIds.TrimEnd(',');
                    //清除已经订购的商品在订购列表中
                    ProductBrowser.DeleteAgentProduct(strSkuIds, currentManager.UserId);

                    this.ShowMsg("订单生成成功,请尽快完成支付。", true);
                }
                else
                {
                    this.ShowMsg("订单生成失败。", true);
                }

                //HiCache.Remove("DataCache-Categories");//刷前台缓存
                this.BindProducts();
            }
            else
            {
                this.ShowMsg("当前登录用户不是前端用户升级而来,无法进行生成订单操作。", true);
            }
            this.btnBuy.Enabled = true;//启用当前按钮
        }
Exemple #17
0
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            OrderInfo    orderInfo      = ShoppingProcessor.GetOrderInfo(this.orderId);
            string       str            = "";

            if (orderInfo == null)
            {
                this.litErrorMsg.Text = "数据错误!";
            }
            else
            {
                if (orderInfo.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                if (orderInfo.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                string  text   = orderInfo.OrderId;
                decimal amount = orderInfo.GetTotal(true);
                text = orderInfo.PayOrderId;
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.Deposit;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.FinalPayment;
                    }
                }
                this.litErrorMsg.Text = "";
                if (orderInfo.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal(false).F2ToString("f2"));
                }
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_apppay.wswappayrequest")
                {
                    HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + orderInfo.OrderId);
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway);
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if (!masterSettings.EnableAppWapAliPay)
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else
                    {
                        string         attach         = "";
                        string         showUrl        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/MemberOrderDetails?orderId={orderInfo.OrderId}";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                {
                    if (!masterSettings.EnableAppShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string         attach2         = "";
                        string         text2           = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text2, text2 + "MemberOrderDetails?orderId=" + orderInfo.OrderId, Globals.FullPath("/pay/wap_sheng_return_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableAPPBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach3         = "";
                        string         showUrl2        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl2, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else
                {
                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest" || orderInfo.Gateway == "hishop.plugins.payment.appwxrequest")
                    {
                        if (!masterSettings.OpenAppWxPay || string.IsNullOrEmpty(masterSettings.AppWxAppId) || string.IsNullOrEmpty(masterSettings.AppWxAppSecret) || string.IsNullOrEmpty(masterSettings.AppWxMchId) || string.IsNullOrEmpty(masterSettings.AppWxPartnerKey))
                        {
                            this.litErrorMsg.Text = "APP未开通微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit?orderId=" + orderInfo.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "APP不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
Exemple #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    orderId   = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = Hidistro.SaleSystem.Vshop.TradeHelper.GetOrderInfo(orderId);

            if (orderInfo == null)
            {
                base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>");
            }
            else if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.Page.Response.Write("订单当前状态不能支付");
            }
            else
            {
                if (orderInfo.CountDownBuyId > 0)
                {
                    CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId);
                    if ((countDownInfoByCountDownId == null) || (countDownInfoByCountDownId.EndDate < DateTime.Now))
                    {
                        this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在");
                        return;
                    }
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);
                //PaymentModeInfo paymentMode = Hidistro.SaleSystem.Vshop.TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                if (paymentMode == null)
                {
                    base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>");
                }
                else
                {
                    /*
                     * foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                     * {
                     *  int productId = info4.ProductId;
                     *  SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                     *  ProductBrowseInfo info5 = ProductBrowser.GetProductBrowseInfo(productId, 6, 6, 0,false);
                     *  //ProductBrowseInfo info5 = ProductBrowser.GetProducts
                     *  if ((info5.Product == null) || (info5.Product.SaleStatus == ProductSaleStatus.Delete))
                     *  {
                     *      base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除"));
                     *      return;
                     *  }
                     *  if (info5.Product.SaleStatus == ProductSaleStatus.OnStock)
                     *  {
                     *      base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库"));
                     *      return;
                     *  }
                     *  int stock = info5.Product.Stock;
                     *  if (info4.ShipmentQuantity > stock)
                     *  {
                     *      base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足"));
                     *      return;
                     *  }
                     * }
                     */
                    string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders");
                    if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
                    {
                        showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId));
                    }
                    if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
                    {
                        showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { orderInfo.OrderId }));
                    }
                    if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
                    {
                        showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { orderInfo.OrderId }));
                    }
                    string attach = "";
                    //HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                    //if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
                    //{
                    //    attach = cookie.Value;
                    //}
                    PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest();
                }
            }
        }
Exemple #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.parameters = new NameValueCollection
     {
         this.Page.Request.Form,
         this.Page.Request.QueryString
     };
     try
     {
         this.Gateway = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest";
         this.Notify  = PaymentNotify.CreateInstance(this.Gateway, this.parameters);
         this.OrderId = this.Notify.GetOrderId();
         this.Order   = ShoppingProcessor.GetOrderInfo(this.OrderId);
         if (this.Order == null)
         {
             Globals.AppendLog(this.parameters, "订单信息为空", this.OrderId, "", "ShengPay_Return1");
             base.Response.Write("OK");
         }
         else
         {
             this.Amount = this.Notify.GetOrderAmount();
             if (this.Amount <= decimal.Zero)
             {
                 this.Amount = this.Order.GetTotal(true);
             }
             this.hasNotify = !string.IsNullOrEmpty(this.Order.GatewayOrderId);
             if (this.Order.PreSaleId > 0 && this.Order.DepositGatewayOrderId.ToNullString() == this.Notify.GetGatewayOrderId())
             {
                 Globals.AppendLog(this.parameters, "预售订单已更新过状态", this.OrderId, "", "ShengPay_Return1");
                 base.Response.Write("OK");
             }
             else
             {
                 if (this.Order.PreSaleId > 0 && !this.Order.DepositDate.HasValue)
                 {
                     this.Order.DepositGatewayOrderId = this.Notify.GetGatewayOrderId();
                 }
                 else
                 {
                     this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                 }
                 PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");
                 if (paymentMode == null)
                 {
                     Globals.AppendLog(this.parameters, "未找到支付方式", this.OrderId, "", "ShengPay_Return1");
                     base.Response.Write("OK");
                 }
                 else
                 {
                     this.Notify.Finished          += this.Notify_Finished;
                     this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild;
                     this.Notify.Payment           += this.Notify_Payment;
                     this.Notify.VerifyNotify(30000, HiCryptographer.TryDecypt(paymentMode.Settings));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Globals.WriteExceptionLog_Page(ex, this.parameters, "ShengPayNotify");
     }
 }
Exemple #20
0
        private void ProcessSubmmitAmount(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            MemberInfo    currentMember = MemberProcessor.GetCurrentMember();
            StringBuilder builder       = new StringBuilder();

            builder.Append("{");
            if (currentMember == null)
            {
                builder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"请先登录!\"");
                builder.Append("}");
                context.Response.ContentType = "application/json";
                context.Response.Write(builder.ToString());
            }
            else
            {
                int     modeId     = int.Parse(context.Request["paymentType"]);
                decimal num2       = decimal.Parse(context.Request["Amount"]);
                string  generateId = Globals.GetGenerateId();
                if (num2 > 1000000M)
                {
                    builder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"最大充值金额不大于100万!\"");
                    builder.Append("}");
                    context.Response.ContentType = "application/json";
                    context.Response.Write(builder.ToString());
                }
                else
                {
                    MemberAmountDetailedInfo amountInfo = new MemberAmountDetailedInfo {
                        UserId          = currentMember.UserId,
                        UserName        = currentMember.UserName,
                        PayId           = generateId,
                        TradeAmount     = num2,
                        TradeType       = TradeType.Recharge,
                        TradeTime       = DateTime.Now,
                        State           = 0,
                        AvailableAmount = currentMember.AvailableAmount + num2,
                        Remark          = "余额充值"
                    };
                    if (modeId == 0x58)
                    {
                        amountInfo.TradeWays = TradeWays.WeChatWallet;
                    }
                    else
                    {
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                        if (paymentMode != null)
                        {
                            if (paymentMode.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                            {
                                amountInfo.TradeWays = TradeWays.Alipay;
                            }
                            else if (paymentMode.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                            {
                                amountInfo.TradeWays = TradeWays.ShengFutong;
                            }
                        }
                    }
                    if (MemberAmountProcessor.CreatAmount(amountInfo))
                    {
                        builder.Append("\"Status\":\"OK\",\"PayIdStatus\":\"" + amountInfo.PayId + "\",");
                        builder.AppendFormat("\"PayId\":\"{0}\"", amountInfo.PayId);
                    }
                    else
                    {
                        builder.Append("\"Status\":\"Error\"");
                        builder.AppendFormat(",\"ErrorMsg\":\"提交充值失败!\"", new object[0]);
                    }
                    builder.Append("}");
                    context.Response.ContentType = "application/json";
                    context.Response.Write(builder.ToString());
                }
            }
        }
Exemple #21
0
        protected override void AttachChildControls()
        {
            this.orderId = base.GetParameter("orderId", false);
            if (base.GetParameter("isCallback", false).ToBool())
            {
                HiContext.Current.Context.Response.Clear();
                HiContext.Current.Context.Response.ContentType = "application/json";
                string parameter = base.GetParameter("action", false);
                if (parameter.Equals("ToPay"))
                {
                    string    empty     = string.Empty;
                    OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);
                    if (orderInfo != null || orderInfo.UserId != HiContext.Current.UserId)
                    {
                        if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"当前订单不是等待付款状态\"}");
                            return;
                        }
                        if (orderInfo.CountDownBuyId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                            {
                                CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                                if (countDownInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.FightGroupId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                            {
                                FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty);
                                if (fightGroupActivityInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.PreSaleId > 0)
                        {
                            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                            if (productPreSaleInfo == null)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"预售活动不存在不能支付\"}");
                                return;
                            }
                            if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"您支付晚了,预售活动已经结束\"}");
                                return;
                            }
                            if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                            {
                                if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付尚未开始\"}");
                                    return;
                                }
                                DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                                DateTime date     = dateTime.Date;
                                dateTime = DateTime.Now;
                                if (date < dateTime.Date)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付已结束\"}");
                                    return;
                                }
                            }
                        }
                        int             modeId      = base.GetParameter("paymentModeId", false).ToInt(0);
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                        if (paymentMode == null)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"请选择支付方式\"}");
                            return;
                        }
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        orderInfo.PaymentType   = paymentMode.Name;
                        if (TradeHelper.UpdateOrderPaymentType(orderInfo))
                        {
                            string empty2 = string.Empty;
                            empty2 = ((!(orderInfo.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")) ? ("{\"Status\":1,\"Msg\":\"" + $"/user/pay.aspx?OrderId={this.orderId}" + "\"}") : ((!(orderInfo.Gateway.ToLower() == "hishop.plugins.payment.bankrequest")) ? ("{\"Status\":1,\"Msg\":\"" + base.GetRouteUrl("sendPayment", new
                            {
                                this.orderId
                            }) + "\"}") : ("{\"Status\":1,\"Msg\":\"" + Globals.FullPath(base.GetRouteUrl("bank_pay", new
                            {
                                orderInfo.OrderId
                            })) + "\"}")));
                            HttpContext.Current.Response.Write(empty2);
                            HttpContext.Current.Response.End();
                            return;
                        }
                        goto IL_058f;
                    }
                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"错误的订单信息\"}");
                    HttpContext.Current.Response.End();
                    return;
                }
            }
            goto IL_058f;
IL_058f:
            if (string.IsNullOrEmpty(this.orderId))
            {
                base.GotoResourceNotFound();
            }
            this.litOrderId           = (Literal)this.FindControl("litOrderId");
            this.litOrderPrice        = (FormatedMoneyLabel)this.FindControl("litOrderPrice");
            this.promptMsg            = (HtmlGenericControl)this.FindControl("promptMsg");
            this.onlinePayPanel       = (HtmlGenericControl)this.FindControl("onlinePayPanel");
            this.btnOrderPay          = ButtonManager.Create(this.FindControl("btnOrderPay"));
            this.paymentModeList      = (Common_PaymentModeList)this.FindControl("grd_Common_PaymentModeList");
            this.paymentModeId        = (HtmlInputHidden)this.FindControl("paymentModeId");
            this.AdvanceId            = (HtmlInputHidden)this.FindControl("AdvanceId");
            this.hidOrderid           = (HtmlInputHidden)this.FindControl("hidOrderid");
            this.msgTitle             = (HtmlGenericControl)this.FindControl("msgTitle");
            this.hidIspop             = (HiddenField)this.FindControl("hidIspop");
            this.userLink             = (HtmlAnchor)this.FindControl("userLink");
            this.orderLink            = (HtmlAnchor)this.FindControl("orderLink");
            this.divfinish            = (HtmlGenericControl)this.FindControl("divfinish");
            this.userLink.HRef        = "/User/UserDefault";
            this.divOrderPayInfo      = (HtmlGenericControl)this.FindControl("divOrderPayInfo");
            this.imgPayResult         = (HtmlImage)this.FindControl("imgPayResult");
            this.hidIsPreSale         = (HiddenField)this.FindControl("hidIsPreSale");
            this.litDeposit           = (FormatedMoneyLabel)this.FindControl("litDeposit");
            this.litDeposittxt        = (Literal)this.FindControl("litDeposittxt");
            this.demodiv              = (HtmlGenericControl)this.FindControl("demodiv");
            this.demodiv.Visible      = SettingsManager.GetMasterSettings().IsDemoSite;
            this.hidHasTradePassword  = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            this.litOfflinePayContent = (Literal)this.FindControl("litOfflinePayContent");
            this.offlinePayPanel      = (HtmlGenericControl)this.FindControl("offlinePayPanel");
            if (!this.Page.IsPostBack)
            {
                this.LoadOrderInfo();
            }
        }
Exemple #22
0
        public void LoadOrderInfo()
        {
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));

            if (paymentMode != null)
            {
                this.litOfflinePayContent.SetWhenIsNotNull(paymentMode.Description);
            }
            this.hidOrderid.Value = this.orderId;
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null || (orderInfo.UserId != 0 && orderInfo.UserId != HiContext.Current.UserId))
            {
                base.GotoResourceNotFound();
                return;
            }
            MemberInfo user = Users.GetUser(HiContext.Current.UserId);

            this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1");
            if (orderInfo.ParentOrderId == "-1")
            {
                this.orderLink.HRef = base.GetRouteUrl("user_OrderList", new
                {
                    ParentOrderId = this.orderId
                });
                this.litOrderId.Text = OrderHelper.GetOrderIdsByParent(orderInfo.OrderId).Replace(",", "&nbsp;&nbsp;&nbsp;&nbsp;");
            }
            else
            {
                this.orderLink.HRef = base.GetRouteUrl("user_OrderDetails", new
                {
                    OrderId = this.orderId
                });
                this.litOrderId.Text = orderInfo.OrderId;
            }
            IList <string> paymentTypes = new List <string>();

            paymentTypes.Add("hishop.plugins.payment.podrequest");
            paymentTypes.Add("hishop.plugins.payment.bankrequest");
            paymentTypes.Add("hishop.plugins.payment.advancerequest");
            if (orderInfo.PreSaleId > 0)
            {
                this.litOrderPrice.Money = orderInfo.Deposit + orderInfo.FinalPayment;
            }
            else
            {
                this.litOrderPrice.Money = orderInfo.GetTotal(false);
            }
            if (orderInfo.PreSaleId > 0)
            {
                this.hidIsPreSale.Value = "1";
                if (!orderInfo.DepositDate.HasValue)
                {
                    this.litDeposittxt.Text = "定金:";
                    this.litDeposit.Money   = orderInfo.Deposit;
                }
                else
                {
                    this.litDeposittxt.Text = "尾款:";
                    this.litDeposit.Money   = orderInfo.FinalPayment;
                }
            }
            this.onlinePayPanel.Visible  = false;
            this.offlinePayPanel.Visible = false;
            int num;

            if ((orderInfo.PaymentTypeId != -3 || orderInfo.PaymentTypeId != -2) && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentType != "到店支付" && orderInfo.Gateway != "hishop.plugins.payment.podrequest")
            {
                num = ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) ? 1 : 0);
                goto IL_02ea;
            }
            num = 0;
            goto IL_02ea;
IL_02ea:
            if (num != 0)
            {
                this.onlinePayPanel.Visible = true;
            }
            else if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest")
            {
                this.offlinePayPanel.Visible = true;
            }
            string text = "";

            text = ((orderInfo.CountDownBuyId <= 0) ? (HiContext.Current.SiteSettings.CloseOrderDays + "天") : (HiContext.Current.SiteSettings.CountDownTime + "分钟"));
            PaymentModeInfo paymentMode2 = TradeHelper.GetPaymentMode("hishop.plugins.payment.podrequest");
            bool            flag         = false;

            if ((orderInfo.Gateway == "hishop.plugins.payment.podrequest" || (paymentMode2 != null && paymentMode2.ModeId == orderInfo.PaymentTypeId)) && orderInfo.PreSaleId <= 0)
            {
                flag = true;
            }
            switch (orderInfo.OrderStatus)
            {
            case OrderStatus.WaitBuyerPay:
                if (base.GetParameter("t", false).ToNullString() == "1")
                {
                    this.promptMsg.InnerHtml     = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!";
                    this.msgTitle.InnerHtml      = "付款不成功,请重新支付!";
                    this.divfinish.Visible       = true;
                    this.onlinePayPanel.Visible  = false;
                    this.divOrderPayInfo.Visible = false;
                    this.imgPayResult.Src        = "/templates/pccommon/images/cart/ordererror.png";
                }
                if (orderInfo.PreSaleId > 0)
                {
                    if (orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        this.msgTitle.InnerHtml  = "恭喜您,您的定金已支付成功!";
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "请支付定金。";
                        this.msgTitle.InnerHtml  = "订单提交成功,请您尽快支付定金!";
                    }
                    this.divfinish.Visible = true;
                }
                if (flag)
                {
                    this.msgTitle.InnerHtml = "货到付款订单提交成功,平台将及时给您发货";
                }
                break;

            case OrderStatus.BuyerAlreadyPaid:
                if (orderInfo.PaymentType == "上门自提")
                {
                    this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您备货。";
                    this.msgTitle.InnerHtml  = "恭喜您,您的订单已支付成功!";
                }
                else
                {
                    this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。";
                    this.msgTitle.InnerHtml  = "恭喜您,您的订单已支付成功!";
                }
                this.divfinish.Visible = true;
                break;

            case OrderStatus.Closed:
                this.promptMsg.InnerHtml = "您的订单已关闭,关闭原因:" + orderInfo.CloseReason + "。";
                this.msgTitle.InnerHtml  = "您的订单已关闭!";
                this.divfinish.Visible   = true;
                break;

            case OrderStatus.Finished:
                this.promptMsg.InnerHtml = "您的订单已完成.";
                this.msgTitle.InnerHtml  = "恭喜您,您的订单已完成!";
                this.divfinish.Visible   = true;
                break;

            case OrderStatus.SellerAlreadySent:
                this.promptMsg.InnerHtml = "您的订单已发货,请注意收货。";
                this.msgTitle.InnerHtml  = "恭喜您,您的订单已发货!";
                this.divfinish.Visible   = true;
                break;

            default:
                this.promptMsg.InnerHtml = "您的订单已提交成功。";
                this.divfinish.Visible   = true;
                break;
            }
            if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
            {
                this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。";
            }
            else if (orderInfo.PaymentTypeId != -3 && !flag && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
            {
                DateTime dateTime;
                if (base.GetParameter("t", false).ToNullString() == "1")
                {
                    if (orderInfo.PreSaleId > 0 && orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            HtmlGenericControl htmlGenericControl = this.promptMsg;
                            string[]           obj = new string[5]
                            {
                                "定金支付成功,请您在",
                                null,
                                null,
                                null,
                                null
                            };
                            dateTime = productPreSaleInfo.PaymentStartDate;
                            obj[1]   = dateTime.ToString("yyyy-MM-dd");
                            obj[2]   = "至";
                            dateTime = productPreSaleInfo.PreSaleEndDate;
                            obj[3]   = dateTime.ToString("yyyy-MM-dd");
                            obj[4]   = "之间支付尾款,过期定金将不予以退还,请您谅解!";
                            htmlGenericControl.InnerHtml = string.Concat(obj);
                            this.onlinePayPanel.Visible  = false;
                        }
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!";
                    }
                }
                else if (orderInfo.PreSaleId > 0)
                {
                    if (orderInfo.DepositDate.HasValue)
                    {
                        this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。";
                        ProductPreSaleInfo productPreSaleInfo2 = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo2.PaymentStartDate > DateTime.Now)
                        {
                            HtmlGenericControl htmlGenericControl2 = this.promptMsg;
                            string[]           obj2 = new string[5]
                            {
                                "定金支付成功,请您在",
                                null,
                                null,
                                null,
                                null
                            };
                            dateTime = productPreSaleInfo2.PaymentStartDate;
                            obj2[1]  = dateTime.ToString("yyyy-MM-dd");
                            obj2[2]  = "至";
                            dateTime = productPreSaleInfo2.PaymentStartDate;
                            obj2[3]  = dateTime.ToString("yyyy-MM-dd");
                            obj2[4]  = "之间支付尾款,过期定金将不予以退还,请您谅解!";
                            htmlGenericControl2.InnerHtml = string.Concat(obj2);
                            this.onlinePayPanel.Visible   = false;
                        }
                    }
                    else
                    {
                        this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成定金支付,否则订单自动取消。";
                    }
                }
                else
                {
                    this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成支付,否则订单自动取消。";
                }
            }
            else if (flag)
            {
                this.promptMsg.InnerHtml = "您的订单选择了货到付款,平台将及时给您发货。";
            }
            else if (orderInfo.PaymentTypeId == -3)
            {
                this.promptMsg.InnerHtml = "您的订单选择了上门自提,门店正在备货中。";
            }
            if (this.onlinePayPanel.Visible)
            {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("ModeId"));
                dataTable.Columns.Add(new DataColumn("Name"));
                dataTable.Columns.Add(new DataColumn("GateWay"));
                dataTable.Columns.Add(new DataColumn("Description"));
                dataTable.Columns.Add(new DataColumn("OutHtml"));
                IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(PayApplicationType.payOnPC);
                paymentModes = (from item in paymentModes
                                where !paymentTypes.Contains(item.Gateway)
                                select item).ToList();
                if (HiContext.Current.UserId != 0 && HiContext.Current.User.IsOpenBalance)
                {
                    PaymentModeInfo paymentMode3 = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.advancerequest");
                    if (paymentMode3 != null)
                    {
                        this.AdvanceId.Value = paymentMode3.ModeId.ToString();
                        paymentModes.Add(paymentMode3);
                    }
                }
                if (paymentModes.Count == 0)
                {
                    this.ShowMessage("商城暂未配置支付方式,请稍后支付。", false, "", 1);
                    this.onlinePayPanel.Visible = false;
                }
                else
                {
                    decimal num2 = default(decimal);
                    if (HiContext.Current.User != null && HiContext.Current.User.UserId > 0)
                    {
                        num2 = HiContext.Current.User.Balance - HiContext.Current.User.RequestBalance;
                    }
                    string format  = "<a class=\"pic\"><b><img src=\"/pay/images/{0}.png\" alt=\"{1}\"></b> <span>{1}</span></a>";
                    string text2   = "<a class=\"name\"><em>{0}</em> <b>可用余额 ¥{1}</b> <span><a href=\"/user/RechargeRequest.aspx\" target=\"_blank\" style=\"line-height:4.5\">去充值</a></span></a>";
                    string format2 = "<a class=\"name\"><em>{0}</em></a>";
                    int    num3    = 0;
                    foreach (PaymentModeInfo item in paymentModes)
                    {
                        if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest") && (orderInfo.FightGroupActivityId <= 0 || TradeHelper.GatewayIsCanBackReturn(item.Gateway) || !(item.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")))
                        {
                            DataRow dataRow = dataTable.NewRow();
                            dataRow["ModeId"]      = item.ModeId;
                            dataRow["Name"]        = item.Name;
                            dataRow["Gateway"]     = item.Gateway;
                            dataRow["Description"] = item.Description;
                            if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest"))
                            {
                                if (File.Exists(this.Page.Server.MapPath("/pay/images/" + item.Gateway + ".png")))
                                {
                                    dataRow["OutHtml"] = string.Format(format, item.Gateway, item.Name);
                                }
                                else
                                {
                                    dataRow["OutHtml"] = string.Format(format2, item.Name);
                                }
                                dataTable.Rows.Add(dataRow);
                                num3++;
                            }
                        }
                    }
                    this.paymentModeList.DataSource = dataTable;
                    this.paymentModeList.DataBind();
                }
            }
        }
Exemple #23
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            #region 获取商品规格信息,构造购物车信息
            //实例化购物车
            ShoppingCartInfo shoppingCartInfo = new ShoppingCartInfo();

            //实例化SKU信息
            SkuItemInfo skuItemInfo = new SkuItemInfo();

            List <SkuInfo> skuInfoList           = new List <SkuInfo>();
            List <ShoppingCartItemInfo> itemInfo = new List <ShoppingCartItemInfo>();

            //区县Id
            int regionId = 0;
            int.TryParse(txtRegionId.Text, out regionId);
            if (regionId == 0 && dropRegions.GetSelectedRegionId() != null && this.dropRegions.GetSelectedRegionId().Value > 0)
            {
                regionId = this.dropRegions.GetSelectedRegionId().Value;
            }

            string skuList = !string.IsNullOrWhiteSpace(hiddenSkus.Value) ? hiddenSkus.Value : "";

            if (!string.IsNullOrEmpty(skuList))
            {
                skuItemInfo.skuInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <SkuInfo[]>(skuList);
            }

            if (skuItemInfo != null && skuItemInfo.skuInfo != null && skuItemInfo.skuInfo.Count() > 0)
            {
                skuInfoList = skuItemInfo.skuInfo.OrderByDescending(a => a.SkuId).ToList();
            }
            string skuIdStr = "";

            if (skuInfoList.Count > 0)
            {
                skuInfoList.ForEach(a => { skuIdStr += "'" + a.SkuId + "'" + ","; });
            }

            if (!string.IsNullOrEmpty(skuIdStr) && skuIdStr.Length > 0)
            {
                skuIdStr = skuIdStr.Substring(0, skuIdStr.Length - 1);
                skuIdStr = "(" + skuIdStr + ")";

                itemInfo = ShoppingProcessor.GetSkuList(skuIdStr).ToList();
            }

            if (itemInfo.Count > 0)
            {
                //循环处理
                itemInfo.ForEach(a =>
                {
                    skuInfoList.ForEach(b =>
                    {
                        if (b.SkuId == a.SkuId)
                        {
                            a.Quantity      = b.BuyQty;
                            a.ShippQuantity = b.BuyQty;
                        }
                    });
                });
            }
            #endregion

            //收货地址ID
            int shippingId = 0;
            int.TryParse(txtShippingId.Text, out shippingId);
            //身份证号码
            string identityCard = txtIdentityCard.Text.Trim();
            //用户ID
            int userId = 0;
            int.TryParse(txtUserId.Text, out userId);
            //手机号码
            string cellPhone = txtCellPhone.Text.Trim();
            //收货人姓名
            string shipTo = txtShipTo.Text.Trim();
            //地址
            string address     = txtDetailsAddress.Text.Trim();
            string addressproc = "";
            if (!string.IsNullOrEmpty(dropRegions.SelectedRegions))
            {
                addressproc = (dropRegions.SelectedRegions).Replace(",", "") + address;
            }
            //邮政编码
            string zipcode = txtZipcode.Text.Trim();
            //电话号码
            string telPhone = txtTelPhone.Text.Trim();
            //用户名
            string username = txtUserName.Text.Trim();

            #region 新增或修改收货地址信息
            ShippingAddressInfo shippingAddress = new ShippingAddressInfo()
            {
                ShipTo       = shipTo,
                Address      = addressproc,
                Zipcode      = zipcode,
                TelPhone     = telPhone,
                CellPhone    = cellPhone,
                IdentityCard = identityCard,
                IsDefault    = true,
                RegionId     = regionId,
                UserId       = userId,
                ShippingId   = shippingId
            };

            //如果没有选择收获地址,那么新增一个用户,手机号作为用户名,密码为手机号
            int newUserId = 0;
            if (userId == 0)
            {
                Member member = new Member(UserRole.Member);
                member.GradeId             = MemberProcessor.GetDefaultMemberGrade();
                member.SessionId           = Globals.GetGenerateId();
                member.Username            = cellPhone;
                member.Email               = "";// cellPhone + "@mail.haimylife.com";
                member.Password            = cellPhone;
                member.PasswordFormat      = MembershipPasswordFormat.Hashed;
                member.TradePasswordFormat = MembershipPasswordFormat.Hashed;
                member.TradePassword       = cellPhone;
                member.IsApproved          = true;
                member.RealName            = string.Empty;
                member.Address             = string.Empty;
                CreateUserStatus createUserStatus = MemberProcessor.CreateMember(member);
                if (createUserStatus == CreateUserStatus.DuplicateUsername || createUserStatus == CreateUserStatus.DisallowedUsername)
                {
                    ErrorLog.Write("用户名重复,用户名为:" + member.Username);
                }
                if (createUserStatus == CreateUserStatus.DuplicateEmailAddress)
                {
                    ErrorLog.Write("邮件名重复,邮箱为:" + member.Email);
                }
                if (createUserStatus == CreateUserStatus.Created)
                {
                    newUserId = member.UserId;
                    userId    = member.UserId;
                }
            }

            int newShippingId = 0;

            //新增或修改收货地址信息
            int addressResult = MemberProcessor.AddOrUpdateShippingAddress(shippingAddress, newUserId, out newShippingId);
            if (addressResult > 0)
            {
                ErrorLog.Write("新增或修改收货地址信息成功,收获地址Id[newShippingId]" + newShippingId);
            }

            #endregion


            itemInfo.ForEach(a =>
            {
                //门店Id为当前登录用户的Id
                a.StoreId = HiContext.Current.User.UserId;
                a.UserId  = userId;
                shoppingCartInfo.LineItems.Add(a);
            });

            //获取订单信息
            OrderInfo orderInfo = ShoppingProcessor.ConvertShoppingCartToOrder(shoppingCartInfo, false, false, false, userId);
            if (orderInfo != null)
            {
                orderInfo.OrderId   = this.GenerateOrderId();
                orderInfo.OrderDate = System.DateTime.Now;
                orderInfo.UserId    = userId;

                if (!string.IsNullOrEmpty(username))
                {
                    orderInfo.Username = username;
                }
                else
                {
                    orderInfo.Username = cellPhone;
                }
                orderInfo.EmailAddress = "";
                orderInfo.RealName     = "";
                orderInfo.QQ           = "";
                orderInfo.Remark       = txtBak.Text.Trim();
                //站点默认为深圳
                orderInfo.SiteId       = 0;
                orderInfo.IdentityCard = identityCard;
                orderInfo.OrderStatus  = OrderStatus.WaitBuyerPay;
                orderInfo.RefundStatus = RefundStatus.None;
                orderInfo.ShipToDate   = DateTime.Now.ToString();
                //门店Id
                int userStoreId = ManagerHelper.GetStoreIdByUserId(HiContext.Current.User.UserId);
                orderInfo.StoreId = userStoreId;

                if (!string.IsNullOrEmpty(txtDeductible.Text.Trim()))
                {
                    orderInfo.Deductible = Decimal.Parse(txtDeductible.Text.Trim());
                }


                if (shippingAddress != null)
                {
                    #region 验证每人每日最多消费1000元,1000元以上为单件商品
                    int mayCount = 0;
                    foreach (ShoppingCartItemInfo item in shoppingCartInfo.LineItems)
                    {
                        mayCount += item.Quantity;
                        //#region 验证库存
                        int stock = ShoppingProcessor.GetProductStock(item.SkuId);
                        if (stock <= 0 || stock < item.Quantity)
                        {
                            this.ShowMsg("商品库存不足!商品名称为:" + item.Name, false);
                            return;
                        }
                    }
                    #endregion

                    #region 验证是否符合清关条件
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < shoppingCartInfo.LineItems.Count; i++)
                    {
                        if (i == (shoppingCartInfo.LineItems.Count - 1))
                        {
                            sb.Append(shoppingCartInfo.LineItems[i].ProductId);
                        }
                        else
                        {
                            sb.AppendFormat("{0},", shoppingCartInfo.LineItems[i].ProductId);
                        }
                    }
                    bool b = ShoppingProcessor.CheckIsCustomsClearance(sb.ToString());
                    if (b)
                    {
                        orderInfo.IsCustomsClearance = 1;
                        if (string.IsNullOrEmpty(identityCard))
                        {
                            Member memberNew = Users.GetUser(HiContext.Current.User.UserId, false) as Member;
                            identityCard = memberNew.IdentityCard;
                        }
                        if (string.IsNullOrEmpty(identityCard))
                        {
                            this.ShowMsg("有需要清关的商品,身份证号码不能为空,请到个人资料里面填写身份信息!", false);
                            return;
                        }
                    }
                    else
                    {
                        orderInfo.IsCustomsClearance = 0;
                    }
                    #endregion

                    orderInfo.ShippingRegion = RegionHelper.GetFullRegion(regionId, ",");
                    orderInfo.RegionId       = regionId;
                    orderInfo.Address        = address;
                    orderInfo.ZipCode        = zipcode;
                    orderInfo.ShipTo         = shipTo;
                    orderInfo.TelPhone       = telPhone;
                    orderInfo.CellPhone      = cellPhone;

                    orderInfo.ShippingId = shippingId <= 0 ? newShippingId : shippingId;
                }

                //配送方式
                orderInfo.ShippingModeId = ddlshippingMode.SelectedValue > 0 ? (int)ddlshippingMode.SelectedValue : 0;
                orderInfo.ModeName       = !string.IsNullOrEmpty(ddlshippingMode.SelectedItem.Text) ? ddlshippingMode.SelectedItem.Text : "";
                decimal tax     = 0m;
                decimal freight = 0m;

                Dictionary <int, decimal> dictShippingMode = new Dictionary <int, decimal>();
                if (shoppingCartInfo.LineItems.Count != shoppingCartInfo.LineItems.Count((ShoppingCartItemInfo a) => a.IsfreeShipping) && !shoppingCartInfo.IsFreightFree)
                {
                    foreach (ShoppingCartItemInfo item in shoppingCartInfo.LineItems)
                    {
                        tax += item.AdjustedPrice * item.TaxRate * item.Quantity;
                        if ((!item.IsfreeShipping))
                        {
                            if (item.TemplateId > 0)
                            {
                                if (dictShippingMode.ContainsKey(item.TemplateId))
                                {
                                    dictShippingMode[item.TemplateId] += item.Weight * item.Quantity;
                                }
                                else
                                {
                                    dictShippingMode.Add(item.TemplateId, item.Weight * item.Quantity);
                                }
                            }
                        }
                    }
                    foreach (var item in dictShippingMode)
                    {
                        ShippingModeInfo shippingMode = ShoppingProcessor.GetShippingMode(item.Key);
                        freight += ShoppingProcessor.CalcFreight(shippingAddress.RegionId, item.Value, shippingMode);
                    }
                    //运费需要减去优惠
                    orderInfo.Freight     = freight;
                    orderInfo.Tax         = tax <= 50 ? 0 : tax;
                    orderInfo.OriginalTax = tax;
                }
                else
                {
                    orderInfo.Freight = 0m;
                }
                orderInfo.AdjustedFreight = orderInfo.Freight;

                int num = ddlpayment.SelectedValue > 0 ? (int)ddlpayment.SelectedValue:0;
                orderInfo.PaymentTypeId = num;
                if (num == 16)
                {
                    orderInfo.PaymentType = "线下支付";
                    orderInfo.Gateway     = "Ecdev.plugins.payment.bankrequest";
                }
                else
                {
                    PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(num);
                    if (paymentMode != null)
                    {
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.PaymentType   = paymentMode.Name;
                        orderInfo.Gateway       = paymentMode.Gateway;
                    }
                }

                orderInfo.OrderSource = OrderSource.storeAdd;

                try
                {
                    orderInfo.OrderType = (int)OrderType.Normal;

                    if (ShoppingProcessor.CreateOrder(orderInfo, true, true))
                    {
                        Reset();
                        //this.ShowMsg("添加门店订单成功", true);
                        string url = Globals.GetAdminAbsolutePath("/sales/StoreManageOrder.aspx");
                        //清除前端的cookie
                        ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>ClearsCookie();alert('添加门店订单成功');window.location.href='" + url + "';</script>");
                        //base.Response.Redirect(Globals.GetAdminAbsolutePath("'/sales/StoreManageOrder.aspx'"), true);
                    }
                    else
                    {
                        this.ShowMsg("添加门店订单失败!", false);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.Write("后台成功添加门店订单错误:", Newtonsoft.Json.JsonConvert.SerializeObject(orderInfo), ex);
                }
            }
        }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.isOfflineOrder = (base.Request.QueryString["isOffline"].ToNullString().ToLower() == "true");
            bool   flag  = false;
            bool   flag2 = false;
            string text  = HttpContext.Current.Request.UserAgent;

            if (string.IsNullOrEmpty(text))
            {
                text = "";
            }
            bool flag3 = false;

            if (text.ToLower().IndexOf("micromessenger") > -1)
            {
                flag3 = true;
            }
            SiteSettings siteSettings = HiContext.Current.SiteSettings;

            if (!string.IsNullOrEmpty(siteSettings.WeixinAppId) && !string.IsNullOrEmpty(siteSettings.WeixinAppSecret) && !string.IsNullOrEmpty(siteSettings.WeixinPartnerID) && !string.IsNullOrEmpty(siteSettings.WeixinPartnerKey))
            {
                this.hasWxPayRight.Value = "1";
                flag = true;
            }
            else
            {
                this.hasWxPayRight.Value = "0";
            }
            PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");

            if (paymentMode != null)
            {
                this.hasAliPayRight.Value = "1";
                flag2 = true;
            }
            else
            {
                this.hasAliPayRight.Value = "0";
            }
            this.sessionId = this.Page.Request["SessionId"].ToNullString();
            if (!string.IsNullOrEmpty(this.sessionId))
            {
                this.inputPanel.Visible = true;
            }
            else
            {
                this.inputPanel.Visible = false;
            }
            if (!this.isOfflineOrder)
            {
                OrderInfo orderInfo = OrderHelper.GetOrderInfo(base.Request.QueryString["OrderId"].ToNullString());
                if (orderInfo == null)
                {
                    this.hidErrMsg.Value = "错误的订单ID";
                }
                else if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                {
                    this.hidErrMsg.Value = "错误的订单状态";
                }
                else
                {
                    EnumPaymentType enumPaymentType = flag3 ? EnumPaymentType.WXPay : EnumPaymentType.WapAliPay;
                    this.offlineOrder = StoresHelper.GetStoreCollectionInfo(this.OrderId);
                    if (this.offlineOrder == null)
                    {
                        StoreCollectionInfo storeCollectionInfo = new StoreCollectionInfo();
                        storeCollectionInfo.CreateTime      = orderInfo.OrderDate;
                        storeCollectionInfo.FinishTime      = DateTime.Now;
                        storeCollectionInfo.PayTime         = DateTime.Now;
                        storeCollectionInfo.PaymentTypeId   = (int)enumPaymentType;
                        storeCollectionInfo.PaymentTypeName = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 0);
                        storeCollectionInfo.GateWay         = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 1);
                        storeCollectionInfo.OrderId         = orderInfo.OrderId;
                        storeCollectionInfo.OrderType       = 1;
                        storeCollectionInfo.PayAmount       = orderInfo.GetTotal(false);
                        storeCollectionInfo.RefundAmount    = decimal.Zero;
                        storeCollectionInfo.Remark          = "上门自提订单确认提货:" + orderInfo.OrderId;
                        storeCollectionInfo.SerialNumber    = Globals.GetGenerateId();
                        storeCollectionInfo.Status          = 0;
                        storeCollectionInfo.StoreId         = orderInfo.StoreId;
                        storeCollectionInfo.UserId          = orderInfo.UserId;
                        StoresHelper.AddStoreCollectionInfo(storeCollectionInfo);
                    }
                    else
                    {
                        this.offlineOrder.PaymentTypeId   = (int)enumPaymentType;
                        this.offlineOrder.PaymentTypeName = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 0);
                        this.offlineOrder.GateWay         = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 1);
                        StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder);
                    }
                }
            }
            if (flag3)
            {
                if (flag && !this.inputPanel.Visible)
                {
                    base.Response.Redirect("/Vshop/StoreOrderPay?OrderId=" + base.Request.QueryString["OrderId"].ToNullString() + "&IsOffline=" + base.Request.QueryString["isOffline"].ToNullString());
                }
            }
            else if (flag2 && !this.inputPanel.Visible)
            {
                base.Response.Redirect("/WapShop/StoreOrderPay?OrderId=" + base.Request.QueryString["OrderId"].ToNullString() + "&IsOffline=" + base.Request.QueryString["isOffline"].ToNullString());
            }
        }
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       text           = "";
            string       text2          = HttpContext.Current.Request.UserAgent;

            if (string.IsNullOrEmpty(text2))
            {
                text2 = "";
            }
            text2 = text2.ToLower();
            string str = "";

            if (this.order == null)
            {
                this.litErrorMsg.Text = "订单数据错误";
            }
            else
            {
                DateTime dateTime;
                if (this.order.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!this.order.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        dateTime = productPreSaleInfo.PaymentEndDate;
                        DateTime t = dateTime.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                string getClientPath = HiContext.Current.GetClientPath;
                this.litErrorMsg.Text = "";
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(this.order.Gateway);
                if (string.IsNullOrEmpty(text))
                {
                    text = this.order.Gateway;
                }
                if (this.order.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in this.order.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, this.order.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, out empty, this.order.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (this.order.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in this.order.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, this.order.FightGroupActivityId, this.order.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(text))
                {
                    text = text.ToLower();
                }
                string  text3 = this.order.OrderId;
                decimal num   = this.order.GetTotal(true);
                text3 = this.order.PayOrderId;
                if (this.order.PreSaleId > 0)
                {
                    if (!this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        num = this.order.Deposit - this.order.BalanceAmount;
                    }
                    if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        num = this.order.FinalPayment;
                    }
                }
                if (this.order.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + num.F2ToString("f2"));
                }
                if (text == "hishop.plugins.payment.shengpaymobile.shengpaymobilerequest")
                {
                    if (!masterSettings.EnableWapShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string     text4  = "\"outMemberId\":\"{0}\",\"outMemberRegisterTime\":\"{1}\",\"outMemberRegisterIP\":\"{2}\",\"outMemberVerifyStatus\":{3},\"outMemberName\":\"{4}\",\"outMemberMobile\":\"{5}\",\"attach\":\"{6}\"";
                        MemberInfo user   = HiContext.Current.User;
                        string     format = text4;
                        object[]   obj    = new object[7]
                        {
                            user.UserId,
                            null,
                            null,
                            null,
                            null,
                            null,
                            null
                        };
                        dateTime = user.CreateDate;
                        obj[1]   = dateTime.ToString("yyyyMMddHHmmss");
                        obj[2]   = "";
                        obj[3]   = 0;
                        obj[4]   = (string.IsNullOrEmpty(user.NickName) ? user.UserName : user.NickName);
                        obj[5]   = (string.IsNullOrEmpty(user.CellPhone) ? "13566778899" : user.CellPhone);
                        obj[6]   = "";
                        string         attach         = "{" + string.Format(format, obj) + "}";
                        string         text5          = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/default";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, text5, text5, Globals.FullPath("/pay/wap_sheng_return_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (text == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if ((!masterSettings.EnableWeixinWapAliPay && base.ClientType == ClientType.VShop) || (!masterSettings.EnableWapAliPay && (base.ClientType == ClientType.WAP || base.ClientType == ClientType.AliOH)))
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else if (text2.IndexOf("micromessenger") > -1)
                    {
                        this.loadPanel.Visible  = false;
                        this.sharePanel.Visible = true;
                    }
                    else
                    {
                        this.loadPanel.Visible  = true;
                        this.sharePanel.Visible = false;
                        string         attach2         = "";
                        string         showUrl         = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (this.order.Gateway == "hishop.plugins.payment.alipaycrossbordermobilepayment.alipaycrossbordermobilepaymentrequest")
                {
                    if (!masterSettings.EnableWapAliPayCrossBorder || base.ClientType != ClientType.WAP)
                    {
                        this.litErrorMsg.Text = "未开启支付宝跨境网页支付";
                    }
                    else
                    {
                        string attach3  = "";
                        string showUrl2 = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        text3 = this.order.OrderId;
                        text3 = this.order.PayOrderId;
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "OrderPay", "Order_No-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl2, Globals.FullPath("/pay/wap_alipay_cross_border_return_url"), Globals.FullPath("/pay/wap_alipay_cross_border_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else if (base.ClientType == ClientType.VShop)
                {
                    if (text == "hishop.plugins.payment.weixinrequest")
                    {
                        if (!masterSettings.EnableWeiXinRequest && this.order.OrderType == OrderType.ServiceOrder && !masterSettings.OpenWxAppletWxPay)
                        {
                            this.litErrorMsg.Text = "未开启支微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.order.OrderId);
                    }
                    if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                    {
                        if (!masterSettings.EnableBankUnionPay)
                        {
                            this.litErrorMsg.Text = "未开启银联全渠道支付";
                        }
                        else
                        {
                            string         attach4         = "";
                            string         showUrl3        = $"http://{HttpContext.Current.Request.Url.Host}/vshop/";
                            PaymentRequest paymentRequest4 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl3, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach4);
                            paymentRequest4.SendRequest();
                        }
                    }
                    else
                    {
                        if (text == "hishop.plugins.payment.alipaywx.alipaywxrequest")
                        {
                            if (!masterSettings.EnableWeixinWapAliPay)
                            {
                                this.litErrorMsg.Text = "未开启微信端支付宝支付";
                                return;
                            }
                            HttpContext.Current.Response.Redirect("~/vshop/WXAliPay?orderId=" + this.order.OrderId);
                        }
                        if (paymentMode == null)
                        {
                            this.litErrorMsg.Text = "错误的支付方式";
                        }
                        else
                        {
                            this.litErrorMsg.Text = "微信商城不支持使用" + paymentMode.Name + "进行支付";
                        }
                    }
                }
                else if (base.ClientType == ClientType.AliOH)
                {
                    if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                    {
                        this.litErrorMsg.Text = "生活号不支持银联全渠道支付";
                    }
                    else
                    {
                        if (text == "hishop.plugins.payment.weixinrequest")
                        {
                            if (!masterSettings.EnableWapWeiXinPay)
                            {
                                this.litErrorMsg.Text = "未开启支微信支付";
                                return;
                            }
                            HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId);
                        }
                        if (paymentMode == null)
                        {
                            this.litErrorMsg.Text = "错误的支付方式";
                        }
                        else
                        {
                            this.litErrorMsg.Text = "生活号不支持使用" + paymentMode.Name + "进行支付";
                        }
                    }
                }
                else if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach5         = "";
                        string         showUrl4        = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        PaymentRequest paymentRequest5 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl4, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach5);
                        paymentRequest5.SendRequest();
                    }
                }
                else
                {
                    if (text == "hishop.plugins.payment.weixinrequest")
                    {
                        if (!masterSettings.EnableWapWeiXinPay)
                        {
                            this.litErrorMsg.Text = "未开启支微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "触屏版不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
Exemple #26
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId)
            {
                base.GotoResourceNotFound("");
            }
            this.litOrderId          = (Literal)this.FindControl("litOrderId");
            this.litOrderTotal       = (Literal)this.FindControl("litOrderTotal");
            this.litPaymentType      = (HtmlInputHidden)this.FindControl("litPaymentType");
            this.litPaymentName      = (Literal)this.FindControl("litPaymentName");
            this.litPaymentName.Text = orderInfo.PaymentType;
            this.litErrorMsg         = (Literal)this.FindControl("litErrorMsg");
            this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
            this.litOrderId.SetWhenIsNotNull(this.orderId);
            this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal(false).F2ToString("f2"));
            this.divhelper = (HtmlGenericControl)this.FindControl("helper");
            this.btnToPay  = (HtmlAnchor)this.FindControl("btnToPay");
            Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;

            foreach (LineItemInfo value in lineItems.Values)
            {
                int          productId         = value.ProductId;
                SiteSettings masterSettings    = SettingsManager.GetMasterSettings();
                ProductInfo  productSimpleInfo = ProductBrowser.GetProductSimpleInfo(productId);
                if (productSimpleInfo == null || productSimpleInfo.SaleStatus == ProductSaleStatus.Delete)
                {
                    this.litErrorMsg.Text = "订单内商品已经被管理员删除";
                    this.btnToPay.Visible = false;
                }
                else if (productSimpleInfo.SaleStatus == ProductSaleStatus.OnStock)
                {
                    this.litErrorMsg.Text = "订单内商品已入库";
                    this.btnToPay.Visible = false;
                }
                else
                {
                    int num = 0;
                    if (productSimpleInfo.Skus.ContainsKey(value.SkuId))
                    {
                        SKUItem sKUItem = productSimpleInfo.Skus[value.SkuId];
                        num = sKUItem.MaxStock;
                        continue;
                    }
                    this.litErrorMsg.Text = "订单中有商品规格不存在,不能进行支付";
                    this.btnToPay.Visible = false;
                }
                return;
            }
            string str = "";

            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    this.litErrorMsg.Text = "预售活动不存在不能支付";
                    return;
                }
                if (!orderInfo.DepositDate.HasValue)
                {
                    if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                    {
                        this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                        return;
                    }
                    if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                    {
                        this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                        return;
                    }
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付尚未开始";
                        return;
                    }
                    DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                    if (t <= DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                        return;
                    }
                }
            }
            else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
            {
                this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                return;
            }
            if (orderInfo.Gateway != "hishop.plugins.payment.bankrequest")
            {
                this.divhelper.Visible = false;
            }
            else
            {
                this.divhelper.Visible = true;
                this.litHelperText     = (Literal)this.FindControl("litHelperText");
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));
                if (paymentMode != null)
                {
                    this.litHelperText.SetWhenIsNotNull(paymentMode.Description);
                }
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.btnToPay.Visible = false;
            }
            if (this.btnToPay != null)
            {
                this.btnToPay.HRef = "FinishOrder?orderId=" + this.orderId + "&action=topay";
            }
            else
            {
                this.GotoPay();
            }
            if (this.btnToPay != null && (orderInfo.Gateway == "hishop.plugins.payment.podrequest" || orderInfo.Gateway == "hishop.plugins.payment.bankrequest"))
            {
                this.btnToPay.Visible = false;
            }
            PageTitle.AddSiteNameTitle("下单成功");
            if (!this.Page.IsPostBack)
            {
                string text = HttpContext.Current.Request.QueryString["action"];
                if (!string.IsNullOrEmpty(text) && text == "topay")
                {
                    this.GotoPay();
                }
            }
        }
Exemple #27
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId, false);
            decimal d   = 0m;
            decimal num = 0m;

            if (orderMarkingOrderInfo.Count == 0)
            {
                this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0");
            }
            bool flag = true;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                d   += current.GetTotal();
                num += current.GetBalancePayMoneyTotal();
                foreach (LineItemInfo current2 in current.LineItems.Values)
                {
                    if (current2.Type == 0)
                    {
                        flag = false;
                    }
                    foreach (LineItemInfo current3 in current.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(current3.SkuId, current3.Quantity))
                        {
                            current.OrderStatus = OrderStatus.Closed;
                            current.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(current);
                            System.Web.HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            System.Web.HttpContext.Current.Response.End();
                            return;
                        }
                    }
                }
            }
            string text      = this.Page.Request.Url.ToString().ToLower();
            int    num2      = Globals.RequestQueryNum("IsAlipay");
            string userAgent = this.Page.Request.UserAgent;

            if (num2 != 1 && userAgent.ToLower().Contains("micromessenger") && !string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
            {
                this.Page.Response.Redirect("/Pay/IframeAlipay.aspx?OrderId=" + this.orderId);
            }
            else
            {
                if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest")
                {
                    this.litMessage = (System.Web.UI.WebControls.Literal) this.FindControl("litMessage");
                    this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
                }
                this.litOPertorList      = (System.Web.UI.WebControls.Literal) this.FindControl("litOPertorList");
                this.litOPertorList.Text = "<div class=\"btns mt20\"><a id=\"linkToDetail\" class=\"btn btn-default mr10\" role=\"button\">查看订单</a><a href=\"/Default.aspx\" class=\"btn btn-default\" role=\"button\">继续逛逛</a></div>";
                if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest")
                {
                    string text2 = "立即支付";
                    if (num > 0m && d - num > 0m)
                    {
                        text2 = "还需支付 " + (d - num).ToString("F2");
                    }
                    this.litOPertorList.Text = string.Concat(new string[]
                    {
                        "<div class=\"mt20\"><a href=\"/pay/wx_Submit.aspx?orderId=",
                        this.orderId,
                        "\" class=\"btn btn-danger\" role=\"button\" id=\"btnToPay\">",
                        text2,
                        "</a></div>"
                    });
                }
                if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.balancepayrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.pointtocach" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.coupontocach")
                {
                    PaymentModeInfo paymentMode    = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId);
                    string          attach         = "";
                    string          showUrl        = string.Format("http://{0}/vshop/", System.Web.HttpContext.Current.Request.Url.Host);
                    PaymentRequest  paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, d - num, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach);
                    paymentRequest.SendRequest();
                }
                else
                {
                    this.litOrderId            = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId");
                    this.litOrderTotal         = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
                    this.literalOrderTotal     = (System.Web.UI.WebControls.Literal) this.FindControl("literalOrderTotal");
                    this.literalBalancePayInfo = (System.Web.UI.WebControls.Literal) this.FindControl("literalBalancePayInfo");
                    this.litPaymentType        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litPaymentType");
                    int num3 = 0;
                    this.litPaymentType.SetWhenIsNotNull("0");
                    if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out num3))
                    {
                        this.litPaymentType.SetWhenIsNotNull(num3.ToString());
                    }
                    this.litOrderId.SetWhenIsNotNull(this.orderId);
                    if (flag)
                    {
                        this.litOrderTotal.SetWhenIsNotNull("您需要支付:¥" + d.ToString("F2"));
                    }
                    this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span role='orderTotal' style='color:red'>¥" + d.ToString("F2") + "</span>");
                    if (num > 0m)
                    {
                        this.literalBalancePayInfo.Text = "<div class='font-xl'>余额已支付:<span style='color:red'>¥" + num.ToString("F2") + "</span></div>";
                    }
                    this.litHelperText = (System.Web.UI.WebControls.Literal) this.FindControl("litHelperText");
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                    PageTitle.AddSiteNameTitle("下单成功");
                }
            }
        }
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            InsuranceOrderInfo info = dao.GetModel(Convert.ToInt32(this.orderId));
            decimal            num  = 0M;
            decimal            num2 = 0M;

            num = info.InsuranceOrderAmount.Value;

            if (info == null)
            {
                this.Page.Response.Redirect("/Vshop/MemberInsuranceOrders.aspx");
            }
            bool flag = true;

            if (info.InsuranceOrderStatu != 2)
            {
                HttpContext.Current.Response.Write("<script>alert('未报价订单无法支付!');location.href='/Vshop/MemberInsuranceOrders.aspx'</script>");
                HttpContext.Current.Response.End();
            }

            string gateway = "hishop.plugins.payment.weixinrequest";

            int PaymentTypeId = 88;


            this.Page.Request.Url.ToString().ToLower();
            int    num3      = Globals.RequestQueryNum("IsAlipay");
            string userAgent = this.Page.Request.UserAgent;

            if (((num3 == 1) || !userAgent.ToLower().Contains("micromessenger")) || (string.IsNullOrEmpty(gateway) || !(gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")))
            {
                if (!string.IsNullOrEmpty(gateway) && (gateway == "hishop.plugins.payment.offlinerequest"))
                {
                    this.litMessage = (Literal)this.FindControl("litMessage");
                    this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
                }
                this.litOPertorList      = (Literal)this.FindControl("litOPertorList");
                this.litOPertorList.Text = "<div class=\"btns mt20\"><a id=\"linkToDetail\" class=\"btn btn-default mr10\" role=\"button\">查看订单</a><a href=\"/Default.aspx\" class=\"btn btn-default\" role=\"button\">继续逛逛</a></div>";
                if (!string.IsNullOrEmpty(gateway) && (gateway == "hishop.plugins.payment.weixinrequest"))
                {
                    string str2 = "立即支付";
                    if ((num2 > 0M) && ((num - num2) > 0M))
                    {
                        str2 = "还需支付 " + ((num - num2)).ToString("F2");
                    }
                    this.litOPertorList.Text = "<div class=\"mt20\"><a href=\"/pay/wx_Submit.aspx?orderId=" + this.orderId + "\" class=\"btn btn-danger\" role=\"button\" id=\"btnToPay\">" + str2 + "</a></div>";
                }
                if (((!string.IsNullOrEmpty(gateway) && (gateway != "hishop.plugins.payment.podrequest")) && ((gateway != "hishop.plugins.payment.offlinerequest") && (gateway != "hishop.plugins.payment.weixinrequest"))) && (((gateway != "hishop.plugins.payment.balancepayrequest") && (gateway != "hishop.plugins.payment.pointtocach")) && (gateway != "hishop.plugins.payment.coupontocach")))
                {
                    PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(PaymentTypeId);
                    string          attach      = "";
                    string          showUrl     = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host);
                    PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, num - num2, "订单支付", "订单号-" + this.orderId, "*****@*****.**", info.InsuranceOrderCreatDate.Value, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest();
                }
                else
                {
                    this.litOrderId            = (Literal)this.FindControl("litOrderId");
                    this.litOrderTotal         = (Literal)this.FindControl("litOrderTotal");
                    this.literalOrderTotal     = (Literal)this.FindControl("literalOrderTotal");
                    this.literalBalancePayInfo = (Literal)this.FindControl("literalBalancePayInfo");
                    this.litPaymentType        = (HtmlInputHidden)this.FindControl("litPaymentType");
                    int result = 0;
                    this.litPaymentType.SetWhenIsNotNull("0");
                    if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out result))
                    {
                        this.litPaymentType.SetWhenIsNotNull(result.ToString());
                    }
                    this.litOrderId.SetWhenIsNotNull(this.orderId);
                    if (flag)
                    {
                        this.litOrderTotal.SetWhenIsNotNull("您需要支付:\x00a5" + num.ToString("F2"));
                    }
                    this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>\x00a5" + num.ToString("F2") + "</span>");
                    if (num2 > 0M)
                    {
                        this.literalBalancePayInfo.Text = "<div class='font-xl'>余额已支付:<span style='color:red'>\x00a5" + num2.ToString("F2") + "</span></div>";
                    }
                    this.litHelperText = (Literal)this.FindControl("litHelperText");
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                    PageTitle.AddSiteNameTitle("下单成功");
                }
            }
            else
            {
                this.Page.Response.Redirect("/Pay/IframeAlipay.aspx?OrderId=" + this.orderId);
            }
        }
Exemple #29
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId);
            decimal num = 0m;

            if (orderMarkingOrderInfo.Count == 0)
            {
                this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0");
            }
            bool flag = true;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                num += current.GetTotal();
                foreach (LineItemInfo current2 in current.LineItems.Values)
                {
                    if (current2.Type == 0)
                    {
                        flag = false;
                    }
                    foreach (LineItemInfo current3 in current.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(current3.SkuId, current3.Quantity))
                        {
                            current.OrderStatus = OrderStatus.Closed;
                            current.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(current);
                            System.Web.HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            System.Web.HttpContext.Current.Response.End();
                            return;
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest")
            {
                this.litMessage = (System.Web.UI.WebControls.Literal) this.FindControl("litMessage");
                this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
            }
            this.btnToPay = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("btnToPay");
            if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest")
            {
                this.btnToPay.Visible = true;
                this.btnToPay.HRef    = "~/pay/wx_Submit.aspx?orderId=" + this.orderId;
            }
            if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest" && orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest")
            {
                PaymentModeInfo paymentMode    = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId);
                string          attach         = "";
                string          showUrl        = string.Format("http://{0}/vshop/", System.Web.HttpContext.Current.Request.Url.Host);
                PaymentRequest  paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, num, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach);
                paymentRequest.SendRequest();
            }
            else
            {
                this.litOrderId        = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId");
                this.litOrderTotal     = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
                this.literalOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("literalOrderTotal");
                this.litPaymentType    = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litPaymentType");
                int num2 = 0;
                this.litPaymentType.SetWhenIsNotNull("0");
                if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out num2))
                {
                    this.litPaymentType.SetWhenIsNotNull(num2.ToString());
                }
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                if (flag)
                {
                    this.litOrderTotal.SetWhenIsNotNull("您需要支付:¥" + num.ToString("F2"));
                }
                this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>¥" + num.ToString("F2") + "</span>");
                this.litHelperText = (System.Web.UI.WebControls.Literal) this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                PageTitle.AddSiteNameTitle("下单成功");
            }
        }
Exemple #30
0
        //订单完成
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId);
            decimal          amount = 0M;

            if (orderMarkingOrderInfo.Count == 0)
            {
                this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0");
            }
            bool flag = true;

            foreach (OrderInfo info in orderMarkingOrderInfo)
            {
                amount += info.GetTotal();
                foreach (LineItemInfo info2 in info.LineItems.Values)
                {
                    if (info2.Type == 0)
                    {
                        flag = false;
                    }
                    foreach (LineItemInfo info3 in info.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(info3.SkuId, info3.Quantity))
                        {
                            info.OrderStatus = OrderStatus.Closed;
                            info.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(info);
                            HttpContext.Current.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            HttpContext.Current.Response.End();
                            return;
                        }
                    }
                }
            }
            if (!(string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) || !(orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest")))
            {
                this.litMessage = (Literal)this.FindControl("litMessage");
                this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (!(string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) || !(orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest")))
            {
                this.btnToPay.Visible = true;
                this.btnToPay.HRef    = "~/pay/wx_Submit.aspx?orderId=" + this.orderId;
            }
            if (((!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest")) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest")) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest"))
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId);
                string          attach      = "";
                string          showUrl     = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host);

                #region 积分处理
                int            UserId = Globals.GetCurrentMemberUserId();
                string         sql    = "select PointsForMoney from [dbo].[PointsForMoney] where [UserId]=@UserId";
                SqlParameter[] param  = new SqlParameter[] {
                    new SqlParameter("@UserId", UserId)
                };
                int PointsFor = help.ExecuteScalar(sql, CommandType.Text, param);
                if (PointsFor != 0)
                {
                    amount -= PointsFor;
                }
                #endregion

                // System.IO.File.WriteAllText("e:\\测试.txt", "时间:" + DateTime.Now.ToString() + "   PointsFor:" + PointsFor + "   amount:" + amount);

                //调用支付宝支付方法
                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, amount, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest();
            }
            else
            {
                this.litOrderId        = (Literal)this.FindControl("litOrderId");
                this.litOrderTotal     = (Literal)this.FindControl("litOrderTotal");
                this.literalOrderTotal = (Literal)this.FindControl("literalOrderTotal");
                this.litPaymentType    = (HtmlInputHidden)this.FindControl("litPaymentType");
                int result = 0;
                this.litPaymentType.SetWhenIsNotNull("0");
                if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out result))
                {
                    this.litPaymentType.SetWhenIsNotNull(result.ToString());
                }
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                if (flag)
                {
                    this.litOrderTotal.SetWhenIsNotNull("您需要支付:\x00a5" + amount.ToString("F2"));
                }
                this.literalOrderTotal.SetWhenIsNotNull("订单金额:<span style='color:red'>\x00a5" + amount.ToString("F2") + "</span>");
                this.litHelperText = (Literal)this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                PageTitle.AddSiteNameTitle("下单成功");
            }
        }