Пример #1
0
        protected override void AttachChildControls()
        {
            string text = this.Page.Request.QueryString["PayId"];
            MemberAmountDetailedInfo amountDetailByPayId = MemberAmountProcessor.GetAmountDetailByPayId(text);

            if (amountDetailByPayId == null)
            {
                this.Page.Response.Redirect("/Vshop/MemberRecharge.aspx");
            }
            string text2     = this.Page.Request.Url.ToString().ToLower();
            int    num       = Globals.RequestQueryNum("IsAlipay");
            string userAgent = this.Page.Request.UserAgent;

            if (num != 1 && userAgent.ToLower().Contains("micromessenger") && amountDetailByPayId.TradeWays == TradeWays.Alipay)
            {
                this.Page.Response.Redirect("/Pay/IframeAlipayCharge.aspx?PayId=" + text);
            }
            else if (amountDetailByPayId.TradeWays == TradeWays.WeChatWallet)
            {
                this.Page.Response.Redirect("~/pay/wx_SubmitCharge.aspx?PayId=" + text);
            }
            else if (amountDetailByPayId.TradeWays != TradeWays.WeChatWallet && amountDetailByPayId.TradeWays != TradeWays.LineTransfer)
            {
                PaymentModeInfo paymentMode    = MemberAmountProcessor.GetPaymentMode(amountDetailByPayId.TradeWays);
                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), text, amountDetailByPayId.TradeAmount, "会员充值", "充值号-" + text, "", amountDetailByPayId.TradeTime, showUrl, Globals.FullPath("/pay/RePaymentReturn_url.aspx"), Globals.FullPath("/pay/RePaymentNotify_url.aspx"), attach);
                paymentRequest.SendRequest();
            }
        }
Пример #2
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();
            }
        }
Пример #3
0
        private void btnConfirm_Click(object sender, System.EventArgs e)
        {
            PaymentModeInfo   paymentMode       = SubsiteStoreHelper.GetPaymentMode(this.paymentModeId);
            InpourRequestInfo inpourRequestInfo = new InpourRequestInfo
            {
                InpourId     = this.GenerateInpourId(),
                TradeDate    = System.DateTime.Now,
                InpourBlance = this.balance,
                UserId       = Hidistro.Membership.Context.HiContext.Current.User.UserId,
                PaymentId    = paymentMode.ModeId
            };

            if (SubsiteStoreHelper.AddInpourBalance(inpourRequestInfo))
            {
                string attach = "";
                System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
                if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                {
                    attach = httpCookie.Value;
                }
                string         text           = inpourRequestInfo.InpourId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, inpourRequestInfo.InpourBlance + paymentMode.CalcPayCharge(inpourRequestInfo.InpourBlance), "预付款充值", "操作流水号-" + text, Hidistro.Membership.Context.HiContext.Current.User.Email, inpourRequestInfo.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[]
                {
                    paymentMode.Gateway
                })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourNotify_url", new object[]
                {
                    paymentMode.Gateway
                })), attach);
                paymentRequest.SendRequest();
            }
        }
Пример #4
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            PaymentModeInfo   paymentMode       = TradeHelper.GetPaymentMode(this.paymentModeId);
            InpourRequestInfo inpourRequestInfo = new InpourRequestInfo
            {
                InpourId     = this.GenerateInpourId(),
                TradeDate    = DateTime.Now,
                InpourBlance = this.balance,
                UserId       = HiContext.Current.UserId,
                PaymentId    = paymentMode.ModeId
            };

            if (MemberProcessor.AddInpourBlance(inpourRequestInfo))
            {
                string     attach     = "";
                HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.UserId.ToString()];
                if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                {
                    attach = httpCookie.Value;
                }
                string         text           = inpourRequestInfo.InpourId.ToString(CultureInfo.InvariantCulture);
                string         hIGW           = paymentMode.Gateway.Replace(".", "_");
                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, inpourRequestInfo.InpourBlance, "预付款充值", "操作流水号-" + text, HiContext.Current.User.Email.ToNullString(), inpourRequestInfo.TradeDate, Globals.FullPath("/"), Globals.FullPath(base.GetRouteUrl("InpourReturn_url", new
                {
                    HIGW = hIGW
                })), Globals.FullPath(base.GetRouteUrl("InpourNotify_url", new
                {
                    HIGW = hIGW
                })), attach);
                paymentRequest.SendRequest();
            }
        }
Пример #5
0
        private void SendRequest(PayGatewayInfo payGatewayInfo)
        {
            string         attach         = "";
            string         showUrl        = $"http://{HttpContext.Current.Request.Url.Host}/{HiContext.Current.GetClientPath}/";
            PaymentRequest paymentRequest = PaymentRequest.CreateInstance(payGatewayInfo.Paymode.Gateway, HiCryptographer.Decrypt(payGatewayInfo.Paymode.Settings), payGatewayInfo.OrderId, payGatewayInfo.InpourRequest.InpourBlance + default(decimal), "预付款充值", "操作流水号-" + payGatewayInfo.OrderId, HiContext.Current.User.Email.ToNullString(), payGatewayInfo.InpourRequest.TradeDate, showUrl, payGatewayInfo.WapInpourReturnUrl, payGatewayInfo.WapInpourNotifyUrl, attach);

            paymentRequest.SendRequest();
        }
Пример #6
0
        private void SendRequest(PayGatewayInfo payGatewayInfo)
        {
            if (payGatewayInfo.GatewayTypeName == "hishop.plugins.payment.ws_apppay.wswappayrequest")
            {
                HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit.aspx?orderId=" + payGatewayInfo.OrderId + "&isrecharge=1");
            }
            string         attach         = "";
            string         showUrl        = string.Format("http://{0}/{1}/", HttpContext.Current.Request.Url.Host, "appshop");
            PaymentRequest paymentRequest = PaymentRequest.CreateInstance(payGatewayInfo.Paymode.Gateway, HiCryptographer.Decrypt(payGatewayInfo.Paymode.Settings), payGatewayInfo.OrderId, payGatewayInfo.InpourRequest.InpourBlance + default(decimal), "预付款充值", "操作流水号-" + payGatewayInfo.OrderId, HiContext.Current.User.Email, payGatewayInfo.InpourRequest.TradeDate, showUrl, payGatewayInfo.WapInpourReturnUrl, payGatewayInfo.WapInpourNotifyUrl, attach);

            paymentRequest.SendRequest();
        }
Пример #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string text = this.txtBankCode.Value.Trim();

            if (string.IsNullOrEmpty(text) || this.paymode.Gateway.ToLower() != "hishop.plugins.payment.alipay_bank.bankrequest")
            {
                base.Response.Redirect("SendPayment.aspx?OrderId=" + this.order.OrderId);
            }
            else
            {
                string         showUrl        = base.Server.UrlEncode($"http://{base.Request.Url.Host}/user/OrderDetails.aspx?OrderId={this.order.OrderId}");
                string         hIGW           = this.paymode.Gateway.Replace(".", "_");
                string         orderId        = this.order.OrderId + new Random().Next(10000, 99999).ToString();
                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(this.paymode.Gateway, HiCryptographer.Decrypt(this.paymode.Settings), orderId, this.GetPayMoney(this.order), "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new
                {
                    HIGW = hIGW
                })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new
                {
                    HIGW = hIGW
                })), text);
                paymentRequest.SendRequest();
            }
        }
Пример #8
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("下单成功");
                }
            }
        }
Пример #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string    orderId   = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId);

            if (orderInfo == null)
            {
                base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>");
                return;
            }
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.Page.Response.Write("订单当前状态不能支付");
                return;
            }
            if (orderInfo.CountDownBuyId > 0)
            {
                CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId);
                if (countDownInfoByCountDownId == null || countDownInfoByCountDownId.EndDate < System.DateTime.Now)
                {
                    this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在");
                    return;
                }
            }
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId);

            if (paymentMode == null)
            {
                base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>");
                return;
            }
            System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
            foreach (LineItemInfo current in lineItems.Values)
            {
                int productId = current.ProductId;
                ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(productId, new int?(6), new int?(6));
                if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除"));
                    return;
                }
                if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库"));
                    return;
                }
                ProductInfo product          = productBrowseInfo.Product;
                int         stock            = product.Stock;
                int         shipmentQuantity = current.ShipmentQuantity;
                if (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 = "";

            System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
            if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
            {
                attach = httpCookie.Value;
            }
            PaymentRequest paymentRequest = 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);

            paymentRequest.SendRequest();
        }
Пример #10
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("下单成功");
            }
        }
Пример #11
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 + "进行支付";
                    }
                }
            }
        }
Пример #12
0
        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 + "进行支付";
                    }
                }
            }
        }
Пример #13
0
        protected override void AttachChildControls()
        {
            this.isOffline      = this.Page.Request["IsOffline"].ToBool();
            this.orderId        = Globals.StripAllTags(this.Page.Request.QueryString["orderId"].ToNullString());
            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.linkToDetail   = (HtmlAnchor)this.FindControl("linkToDetail");
            this.litErrorMsg    = (Literal)this.FindControl("litErrorMsg");
            this.loadPanel      = (HtmlGenericControl)this.FindControl("loadPanel");
            this.errorPanel     = (HtmlGenericControl)this.FindControl("errorPanel");
            this.btnToPay       = (HtmlAnchor)this.FindControl("btnToPay");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       text           = "";
            string       userAgent      = HttpContext.Current.Request.UserAgent;

            this.loadPanel.Visible = true;
            StoreCollectionInfo storeCollectionInfo = null;

            if (this.isOffline)
            {
                storeCollectionInfo = StoresHelper.GetStoreCollectionInfo(this.orderId);
                if (storeCollectionInfo == null)
                {
                    this.litErrorMsg.Text   = "错误的订单编号";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                if (storeCollectionInfo.Status != 0)
                {
                    this.litErrorMsg.Text   = "订单状态不是待支付状态";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                if (this.linkToDetail != null)
                {
                    this.linkToDetail.Visible = false;
                }
            }
            else
            {
                this.order = ShoppingProcessor.GetOrderInfo(this.orderId);
                if (this.order == null)
                {
                    this.litErrorMsg.Text   = "错误的订单编号";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                if (this.order.OrderStatus != OrderStatus.WaitBuyerPay)
                {
                    this.litErrorMsg.Text   = "订单状态不是待支付状态";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                    return;
                }
                storeCollectionInfo      = StoresHelper.GetStoreCollectionInfoOfOrderId(this.orderId);
                this.litPaymentName.Text = this.order.PaymentType;
                this.litPaymentType.SetWhenIsNotNull(this.order.PaymentTypeId.ToString());
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                this.litOrderTotal.SetWhenIsNotNull(this.order.GetTotal(false).F2ToString("f2"));
                if (this.linkToDetail != null)
                {
                    this.linkToDetail.Visible = true;
                    this.linkToDetail.HRef    = "MemberOrderDetails?OrderId=" + this.orderId;
                }
            }
            if (base.ClientType == ClientType.VShop)
            {
                if (!string.IsNullOrEmpty(masterSettings.WeixinAppId) && !string.IsNullOrEmpty(masterSettings.WeixinAppSecret) && !string.IsNullOrEmpty(masterSettings.WeixinPartnerID) && !string.IsNullOrEmpty(masterSettings.WeixinPartnerKey))
                {
                    if (!this.isOffline)
                    {
                        this.order.Gateway       = "hishop.plugins.payment.weixinrequest";
                        this.order.PaymentTypeId = -2;
                        this.order.PaymentType   = "微信支付";
                        TradeHelper.UpdateOrderPaymentType(this.order);
                    }
                    if (storeCollectionInfo != null)
                    {
                        storeCollectionInfo.GateWay         = "hishop.plugins.payment.weixinrequest";
                        storeCollectionInfo.PaymentTypeName = "微信支付";
                        storeCollectionInfo.PaymentTypeId   = 1;
                        StoresHelper.UpdateStoreCollectionInfo(storeCollectionInfo);
                    }
                    HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.orderId + "&IsOffline=" + this.isOffline.ToString() + "&from=appstore");
                }
                else
                {
                    this.litErrorMsg.Text   = "未配置微信支付";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                }
            }
            else
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
                if (paymentMode != null)
                {
                    decimal  amount     = default(decimal);
                    string   subject    = "门店APP订单支付";
                    string   buyerEmail = "";
                    DateTime date       = DateTime.Now;
                    if (!this.isOffline)
                    {
                        subject                  = "门店APP线下支付";
                        text                     = paymentMode.Gateway;
                        this.order.Gateway       = paymentMode.Gateway;
                        this.order.PaymentTypeId = paymentMode.ModeId;
                        this.order.PaymentType   = paymentMode.Name;
                        TradeHelper.UpdateOrderPaymentType(this.order);
                        amount     = this.order.GetTotal(false);
                        buyerEmail = this.order.EmailAddress;
                        date       = this.order.OrderDate;
                    }
                    if (storeCollectionInfo != null)
                    {
                        amount = storeCollectionInfo.PayAmount;
                        storeCollectionInfo.GateWay         = paymentMode.Gateway;
                        storeCollectionInfo.PaymentTypeName = paymentMode.Name;
                        storeCollectionInfo.PaymentTypeId   = 2;
                        StoresHelper.UpdateStoreCollectionInfo(storeCollectionInfo);
                        date = storeCollectionInfo.CreateTime;
                    }
                    string         attach         = "";
                    string         showUrl        = string.Format("http://{0}/{1}/", HttpContext.Current.Request.Url.Host, "AliOH");
                    PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, amount, subject, "订单号-" + this.orderId, buyerEmail, date, showUrl, Globals.FullPath("/pay/appstore_wapalipay_return_url"), Globals.FullPath("/pay/appstore_wapalipay_notify_url"), attach);
                    paymentRequest.SendRequest();
                }
                else
                {
                    this.litErrorMsg.Text   = "未配置支付宝网页支付";
                    this.loadPanel.Visible  = false;
                    this.errorPanel.Visible = true;
                }
            }
        }
Пример #14
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnConfirmPay.Click += new System.EventHandler(this.btnConfirmPay_Click);
     this.btnBack.Click       += new System.EventHandler(this.btnBack_Click);
     this.btnBack1.Click      += new System.EventHandler(this.btnBack_Click);
     this.imgBtnBack.Click    += new System.Web.UI.ImageClickEventHandler(this.btnBack_Click);
     if (string.IsNullOrEmpty(base.Request.QueryString["PurchaseOrderId"]))
     {
         base.GotoResourceNotFound();
         return;
     }
     this.purchaseOrderId = base.Request.QueryString["PurchaseOrderId"];
     this.purchaseOrder   = SubsiteSalesHelper.GetPurchaseOrder(this.purchaseOrderId);
     if (!base.IsPostBack)
     {
         if (this.purchaseOrder == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         int num;
         int.TryParse(base.Request["PayMode"], out num);
         PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(num);
         if (num > 0 && paymentMode.Gateway != "hishop.plugins.payment.advancerequest")
         {
             SubsiteStoreHelper.GetDistributor();
             string showUrl = Globals.FullPath(Globals.GetSiteUrls().Home);
             if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
             {
                 showUrl = base.Server.UrlEncode(string.Format("http://{0}/shopadmin/purchaseorder/MyPurchaseOrderDetails.aspx?purchaseOrderId={1}", base.Request.Url.Host, this.purchaseOrder.PurchaseOrderId));
             }
             if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
             {
                 showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[]
                 {
                     this.purchaseOrder.PurchaseOrderId
                 }));
             }
             if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
             {
                 showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[]
                 {
                     this.purchaseOrder.PurchaseOrderId
                 }));
             }
             string attach = "";
             System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
             if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
             {
                 attach = httpCookie.Value;
             }
             PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.purchaseOrder.PurchaseOrderId, this.purchaseOrder.GetPurchaseTotal(), "采购单支付", "采购单号-" + this.purchaseOrder.PurchaseOrderId, "", this.purchaseOrder.PurchaseDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[]
             {
                 paymentMode.Gateway
             })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[]
             {
                 paymentMode.Gateway
             })), attach);
             paymentRequest.SendRequest();
         }
         if (this.purchaseOrder.IsManualPurchaseOrder)
         {
             this.litorder.Visible   = false;
             this.litOrderId.Visible = false;
         }
         else
         {
             this.litOrderId.Text = this.purchaseOrder.OrderId;
         }
         this.litPurchaseOrderId.Text = this.purchaseOrder.PurchaseOrderId;
         this.lblPurchaseDate.Time    = this.purchaseOrder.PurchaseDate;
         this.lblTotalPrice.Money     = this.purchaseOrder.GetPurchaseTotal();
         AccountSummaryInfo myAccountSummary = SubsiteStoreHelper.GetMyAccountSummary();
         this.lblUseableBalance.Money = myAccountSummary.UseableBalance;
     }
 }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string parameter = RouteConfig.GetParameter(this, "orderId", false);

            this.order = TradeHelper.GetOrderInfo(parameter);
            this.ChoiceBankDIV.Visible = false;
            if (this.order == null)
            {
                this.RedirectToPayDIV.InnerHtml = "您要付款的订单已经不存在,请联系管理员确定";
            }
            else if (this.order.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.RedirectToPayDIV.InnerHtml = "订单当前状态不能支付";
            }
            else
            {
                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.RedirectToPayDIV.InnerHtml = empty;
                            return;
                        }
                    }
                }
                this.paymode = TradeHelper.GetPaymentMode(this.order.PaymentTypeId);
                if (this.paymode == null)
                {
                    this.RedirectToPayDIV.InnerHtml = "您之前选择的支付方式已经不存在,请联系管理员修改支付方式";
                }
                else
                {
                    Dictionary <string, LineItemInfo> lineItems = this.order.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)
                        {
                            base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除"));
                            return;
                        }
                        if (productSimpleInfo.SaleStatus == ProductSaleStatus.OnStock)
                        {
                            base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库"));
                            return;
                        }
                        if (!productSimpleInfo.Skus.ContainsKey(value.SkuId))
                        {
                            base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单中有商品规格不存在"));
                            return;
                        }
                    }
                    string str = "";
                    if (this.order == null || !TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                    {
                        base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlDecode(str + ",库存不足,不能进行支付"));
                    }
                    else if (!this.Page.IsPostBack)
                    {
                        string showUrl = "/user/UserOrders";
                        if (this.paymode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
                        {
                            showUrl = ((!(this.order.ParentOrderId == "-1")) ? base.Server.UrlEncode($"http://{base.Request.Url.Host}/user/OrderDetails.aspx?OrderId={this.order.OrderId}") : base.Server.UrlEncode($"http://{base.Request.Url.Host}/user/UserOrders.aspx?ParentOrderId={this.order.OrderId}"));
                        }
                        if (string.Compare(this.paymode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
                        {
                            base.Response.Redirect(Globals.FullPath(base.GetRouteUrl("bank_pay", new
                            {
                                orderId = this.order.OrderId
                            })));
                        }
                        if (string.Compare(this.paymode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
                        {
                            base.Response.Redirect(Globals.FullPath(base.GetRouteUrl("advance_pay", new
                            {
                                orderId = this.order.OrderId
                            })));
                        }
                        string     attach     = "";
                        HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.UserId.ToString()];
                        if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                        {
                            attach = httpCookie.Value;
                        }
                        if (this.paymode.Gateway.ToLower() == "hishop.plugins.payment.alipay_bank.bankrequest")
                        {
                            this.RedirectToPayDIV.Visible = false;
                            this.ChoiceBankDIV.Visible    = true;
                        }
                        else
                        {
                            parameter += this.order.PayRandCode;
                            try
                            {
                                string         hIGW           = this.paymode.Gateway.Replace(".", "_");
                                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(this.paymode.Gateway, HiCryptographer.Decrypt(this.paymode.Settings), parameter, this.GetPayMoney(this.order), "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new
                                {
                                    HIGW = hIGW
                                })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new
                                {
                                    HIGW = hIGW
                                })), attach);
                                paymentRequest.SendRequest();
                            }
                            catch (Exception ex)
                            {
                                if (!(ex is ThreadAbortException))
                                {
                                    base.Response.Write("<h2>支付配置错误,请联系管理员.(" + ex.Message + ")<h2>");
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #16
0
        public virtual void ProcessRequest(HttpContext context)
        {
            //Safe
            if (!VerifySendPayment(context))
            {
                return;
            }

            //订单ID字符串
            string orderIdStr = string.Empty;

            //获取全部订单ID
            string[] orderIds = OrderProcessor.GetQueryString4OrderIds(context.Request, out orderIdStr);

            //订单ID NULL ERROR返回首页
            if (orderIds == null || orderIds.Length < 1)
            {
                //Add ErrorLog..
                HttpContext.Current.Response.Redirect("~/");
                return;
            }

            //合并支付 订单支付信息以第一份订单为主
            T orderInfo = Option.GetOrderInfo(orderIds[0]);

            if (orderInfo == null)
            {
                return;
            }

            //计算订单支付金额
            decimal totalMoney = this.GetOrderTotalMoney(orderIds, orderInfo);

            if (totalMoney < 0)
            {
                return;
            }

            if (orderInfo.PaymentStatus != PaymentStatus.NotYet)
            {
                //订单已支付
                context.Response.Write(
                    HttpContext.GetGlobalResourceObject("Resources", "IDS_ErrorMessage_SentPayment").ToString());
                return;
            }

            PaymentModeInfo paymentMode = GetPaymentMode(orderInfo);

            if (paymentMode == null || string.IsNullOrWhiteSpace(paymentMode.Gateway))
            {
                //订单历史的支付方式不存在
                context.Response.Write(
                    HttpContext.GetGlobalResourceObject("Resources", "IDS_ErrorMessage_NoPayment").ToString());
                return;
            }

            string getwayName = paymentMode.Gateway.ToLower();

            //获取支付网关
            GatewayProvider provider =
                PayConfiguration.GetConfig().Providers[getwayName] as GatewayProvider;

            if (provider == null)
            {
                return;
            }

            //支付网关
            GatewayInfo gatewayInfo = this.GetGateway(getwayName);

            //交易信息
            TradeInfo tradeInfo = this.GetTrade(orderIdStr, totalMoney, orderInfo);

            #region 测试模式
            //DONE: 测试模式埋点
            if (Globals.IsPaymentTestMode && !Globals.ExcludeGateway.Contains(getwayName.ToLower()))
            {
                System.Text.StringBuilder url = new System.Text.StringBuilder(gatewayInfo.ReturnUrl);
                url.AppendFormat("&out_trade_no={0}", tradeInfo.OrderId);
                url.AppendFormat("&total_fee={0}", tradeInfo.TotalMoney);
                url.AppendFormat("&sign={0}", Globals.GetMd5(System.Text.Encoding.UTF8, url.ToString()));
                HttpContext.Current.Response.Redirect(
                    gatewayInfo.ReturnUrl.Contains("?")
                        ? url.ToString()
                        : url.ToString().Replace("&out_trade_no", "?out_trade_no"), true);
                return;
            }
            #endregion

            #region 发送支付请求
            //发送支付请求
            PaymentRequest paymentRequest = PaymentRequest.Instance(
                provider.RequestType,
                this.GetPayee(paymentMode),
                gatewayInfo,
                tradeInfo
                );
            if (paymentRequest == null)
            {
                return;
            }
            paymentRequest.SendRequest();
            #endregion
        }