Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (!string.IsNullOrEmpty(str))
            {
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str);
                if (orderMarkingOrderInfo.Count != 0)
                {
                    decimal num = 0M;
                    foreach (OrderInfo info in orderMarkingOrderInfo)
                    {
                        num += info.GetTotal();
                    }
                    PackageInfo package = new PackageInfo {
                        Body       = str,
                        NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                        OutTradeNo = str,
                        TotalFee   = (int)(num * 100M)
                    };
                    if (package.TotalFee < 1M)
                    {
                        package.TotalFee = 1M;
                    }
                    string     openId        = "";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null)
                    {
                        openId = currentMember.OpenId;
                    }
                    package.OpenId = openId;
                    wid            = currentMember.wid;
                    //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    Chenduo.Model.sf_website website = new Chenduo.BLL.sf_website().GetModelByWid(wid);
                    //PayRequestInfo req = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey).BuildPayRequest(package);
                    PayRequestInfo req = new PayClient(wid, website.appid, website.appsecret, website.weixin_pay_account, website.account_pay_key, "").BuildPayRequest(package);
                    this.pay_json = this.ConvertPayJson(req);
                    DataTable shareActivity = ShareActHelper.GetShareActivity();
                    int       num2          = 0;
                    decimal   num3          = 0M;
                    if (shareActivity.Rows.Count > 0)
                    {
                        for (int i = 0; i < shareActivity.Rows.Count; i++)
                        {
                            if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                                break;
                            }
                            if ((num != 0M) && (num <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                                break;
                            }
                            if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                            }
                        }
                        if (num >= num3)
                        {
                            this.shareid = num2;
                        }
                    }
                }
            }
        }
Example #2
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;
                    }
                }
            }
            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, wid).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);
                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.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.litHelperText = (Literal)this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                PageTitle.AddSiteNameTitle("下单成功");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str  = base.Request.QueryString.Get("orderId");
            string str2 = base.Request.QueryString.Get("Ptype");

            if (string.IsNullOrEmpty(str))
            {
                this.infos.InnerText = "订单号为空,请返回";
            }
            else
            {
                if (!string.IsNullOrEmpty(str2) && (str2 == "OneTao"))
                {
                    this.DoOneTaoPay(str);
                    base.Response.End();
                }
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str, true);
                if (orderMarkingOrderInfo.Count == 0)
                {
                    this.infos.InnerText = "订单信息未找到!";
                }
                else
                {
                    decimal num = 0M;
                    foreach (OrderInfo info in orderMarkingOrderInfo)
                    {
                        if (info.BargainDetialId > 0)
                        {
                            string str3 = BargainHelper.IsCanBuyByBarginDetailId(info.BargainDetialId);
                            if (str3 != "1")
                            {
                                info.OrderStatus = OrderStatus.Closed;
                                info.CloseReason = str3;
                                OrderHelper.UpdateOrder(info);
                                base.Response.Write("<script>alert('" + str3 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                                base.Response.End();
                                return;
                            }
                        }
                        else
                        {
                            foreach (LineItemInfo info2 in info.LineItems.Values)
                            {
                                if (!ProductHelper.GetProductHasSku(info2.SkuId, info2.Quantity))
                                {
                                    info.OrderStatus = OrderStatus.Closed;
                                    info.CloseReason = "库存不足";
                                    OrderHelper.UpdateOrder(info);
                                    base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                                    base.Response.End();
                                    return;
                                }
                            }
                        }
                        num += info.GetCashPayMoney();
                    }
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    string       partner        = masterSettings.Alipay_Pid;
                    string       str5           = masterSettings.Alipay_Key;
                    string       str6           = "utf-8";
                    Hidistro.ControlPanel.OutPay.App.Core.setConfig(partner, "MD5", str5, str6);
                    string  str7  = "1";
                    string  str8  = Globals.FullPath("/Pay/wap_alipay_return_url.aspx");
                    string  str9  = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
                    string  str10 = str;
                    string  str11 = "订单支付";
                    decimal num2  = num;
                    string  str12 = Globals.FullPath("/Vshop/MemberOrderDetails.aspx?orderId=") + orderMarkingOrderInfo[0].OrderId;
                    string  str13 = "订单号-" + orderMarkingOrderInfo[0].OrderId + " ...";
                    string  str14 = "1m";
                    string  str15 = "";
                    SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                    sParaTemp.Add("partner", partner);
                    sParaTemp.Add("seller_id", partner);
                    sParaTemp.Add("_input_charset", str6);
                    sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
                    sParaTemp.Add("payment_type", str7);
                    sParaTemp.Add("notify_url", str9);
                    sParaTemp.Add("return_url", str8);
                    sParaTemp.Add("out_trade_no", str10);
                    sParaTemp.Add("subject", str11);
                    sParaTemp.Add("total_fee", num2.ToString("F"));
                    sParaTemp.Add("show_url", str12);
                    sParaTemp.Add("body", str13);
                    sParaTemp.Add("it_b_pay", str14);
                    sParaTemp.Add("extern_token", str15);
                    string s = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(sParaTemp, "get", "确认");
                    base.Response.Write(s);
                }
            }
        }
Example #4
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId, false);
            decimal          num  = 0M;
            decimal          num2 = 0M;

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

            if (orderMarkingOrderInfo[0].UserId != 0)
            {
                foreach (OrderInfo info in orderMarkingOrderInfo)
                {
                    if (info.OrderStatus != OrderStatus.BuyerAlreadyPaid)
                    {
                        num  += info.GetTotal();
                        num2 += info.GetBalancePayMoneyTotal();
                        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;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                num = orderMarkingOrderInfo[0].Amount;
            }
            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(orderMarkingOrderInfo[0].Gateway) || !(orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")))
            {
                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.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(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].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(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/", HttpContext.Current.Request.Url.Host);
                    PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, num - num2, "订单支付", "订单号-" + 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.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);
            }
        }
Example #5
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.GetMilkTotal();
                //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 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("下单成功");
                }
            }
        }
Example #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text  = base.Request.QueryString.Get("orderId");
            string text2 = base.Request.QueryString.Get("Ptype");

            if (string.IsNullOrEmpty(text))
            {
                this.infos.InnerText = "订单号为空,请返回";
                return;
            }
            if (!string.IsNullOrEmpty(text2) && text2 == "OneTao")
            {
                this.DoOneTaoPay(text);
                base.Response.End();
            }
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(text);
            if (orderMarkingOrderInfo.Count == 0)
            {
                this.infos.InnerText = "订单信息未找到!";
                return;
            }
            decimal num = 0m;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                if (current.BargainDetialId > 0)
                {
                    string text3 = BargainHelper.IsCanBuyByBarginDetailId(current.BargainDetialId);
                    if (text3 != "1")
                    {
                        current.OrderStatus = OrderStatus.Closed;
                        current.CloseReason = text3;
                        OrderHelper.UpdateOrder(current);
                        base.Response.Write("<script>alert('" + text3 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                        base.Response.End();
                        return;
                    }
                }
                else
                {
                    foreach (LineItemInfo current2 in current.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(current2.SkuId, current2.Quantity))
                        {
                            current.OrderStatus = OrderStatus.Closed;
                            current.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(current);
                            base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            base.Response.End();
                            return;
                        }
                    }
                }
                num += current.GetTotal();
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       alipay_Pid     = masterSettings.Alipay_Pid;
            string       alipay_Key     = masterSettings.Alipay_Key;
            string       text4          = "utf-8";

            Hidistro.ControlPanel.OutPay.App.Core.setConfig(alipay_Pid, "MD5", alipay_Key, text4);
            string  value  = "1";
            string  value2 = Globals.FullPath("/Pay/wap_alipay_return_url.aspx");
            string  value3 = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
            string  value4 = text;
            string  value5 = "订单支付";
            decimal num2   = num;
            string  value6 = Globals.FullPath("/Vshop/MemberOrderDetails.aspx?orderId=") + orderMarkingOrderInfo[0].OrderId;
            string  value7 = "订单号-" + orderMarkingOrderInfo[0].OrderId + " ...";
            string  value8 = "1m";
            string  value9 = "";
            string  s      = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(new System.Collections.Generic.SortedDictionary <string, string>
            {
                {
                    "partner",
                    alipay_Pid
                },
                {
                    "seller_id",
                    alipay_Pid
                },
                {
                    "_input_charset",
                    text4
                },
                {
                    "service",
                    "alipay.wap.create.direct.pay.by.user"
                },
                {
                    "payment_type",
                    value
                },
                {
                    "notify_url",
                    value3
                },
                {
                    "return_url",
                    value2
                },
                {
                    "out_trade_no",
                    value4
                },
                {
                    "subject",
                    value5
                },
                {
                    "total_fee",
                    num2.ToString("F")
                },
                {
                    "show_url",
                    value6
                },
                {
                    "body",
                    value7
                },
                {
                    "it_b_pay",
                    value8
                },
                {
                    "extern_token",
                    value9
                }
            }, "get", "确认");

            base.Response.Write(s);
        }
Example #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(text, true);
            if (orderMarkingOrderInfo.Count == 0)
            {
                return;
            }
            decimal d = 0m;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                if (current.BargainDetialId > 0)
                {
                    string text2 = BargainHelper.IsCanBuyByBarginDetailId(current.BargainDetialId);
                    if (text2 != "1")
                    {
                        current.OrderStatus = OrderStatus.Closed;
                        current.CloseReason = text2;
                        OrderHelper.UpdateOrder(current);
                        base.Response.Write("<script>alert('" + text2 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                        base.Response.End();
                        return;
                    }
                }
                else
                {
                    foreach (LineItemInfo current2 in current.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(current2.SkuId, current2.Quantity))
                        {
                            current.OrderStatus = OrderStatus.Closed;
                            current.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(current);
                            base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            base.Response.End();
                            return;
                        }
                    }
                }
                //支付金额等于牛奶配送金额
                d += current.GetMilkCashPayMoney();
                //d += current.GetCashPayMoney();
            }
            PackageInfo packageInfo = new PackageInfo();

            packageInfo.Body       = text;
            packageInfo.NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host);
            packageInfo.OutTradeNo = text;
            packageInfo.TotalFee   = (int)(d * 100m);
            if (packageInfo.TotalFee < 1m)
            {
                packageInfo.TotalFee = 1m;
            }
            string     openId        = "";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                openId = currentMember.OpenId;
            }
            packageInfo.OpenId = openId;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            PayClient    payClient;

            if (masterSettings.EnableSP)
            {
                payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            if (payClient.checkSetParams(out this.CheckValue))
            {
                if (!payClient.checkPackage(packageInfo, out this.CheckValue))
                {
                    return;
                }
                PayRequestInfo payRequestInfo = payClient.BuildPayRequest(packageInfo);
                this.pay_json = this.ConvertPayJson(payRequestInfo);
                if (!payRequestInfo.package.ToLower().StartsWith("prepay_id=wx"))
                {
                    this.CheckValue = payRequestInfo.package;
                }
                System.Data.DataTable shareActivity = ShareActHelper.GetShareActivity();
                int     num = 0;
                decimal d2  = 0m;
                if (shareActivity.Rows.Count > 0)
                {
                    for (int i = 0; i < shareActivity.Rows.Count; i++)
                    {
                        if (d != 0m && d >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                            break;
                        }
                        if (d != 0m && d <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                            break;
                        }
                        if (d != 0m && d >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                        }
                    }
                    if (d >= d2)
                    {
                        this.shareid = num;
                    }
                }
                return;
            }
        }