protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("交易密码");
            HtmlInputHidden htmlInputHidden = (HtmlInputHidden)this.FindControl("hidkey");
            Literal         literal         = (Literal)this.FindControl("OrderId");
            Literal         literal2        = (Literal)this.FindControl("litOrderTotal");
            string          orderId         = literal.Text = this.Page.Request.QueryString["orderId"].ToNullString();
            OrderInfo       orderInfo       = ShoppingProcessor.GetOrderInfo(orderId);
            string          str             = "";

            if (orderInfo == null || !TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
            {
                base.GotoResourceNotFound(str + ",库存不足,不能进行支付");
            }
            else
            {
                HtmlInputHidden htmlInputHidden2 = (HtmlInputHidden)this.FindControl("txtIsFightGroup");
                if (htmlInputHidden2 != null)
                {
                    htmlInputHidden2.Value = ((orderInfo.FightGroupId > 0) ? "true" : "false");
                }
                decimal num = default(decimal);
                if (decimal.TryParse(this.Page.Request.QueryString["totalAmount"], out num))
                {
                    literal2.Text = num.F2ToString("f2");
                }
                else
                {
                    base.GotoResourceNotFound("传入值有误");
                }
            }
        }
Esempio n. 2
0
 public void CheckPay(HttpContext context)
 {
     if (!this.CheckUserRole())
     {
         this.ShowMessage(context, "请先登录会员!", true);
     }
     else
     {
         string    orderId   = context.Request["orderId"].ToNullString();
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId);
         string    str       = "";
         if (orderInfo == null || !TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
         {
             this.ShowMessage(context, Globals.UrlDecode(str + ",库存不足,不能进行支付"), true);
         }
         else
         {
             this.ShowMessage(context, "库存充足", false);
         }
     }
 }
Esempio n. 3
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

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

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

            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    this.litErrorMsg.Text = "预售活动不存在不能支付";
                    return;
                }
                if (!orderInfo.DepositDate.HasValue)
                {
                    if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                    {
                        this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                        return;
                    }
                    if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                    {
                        this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                        return;
                    }
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付尚未开始";
                        return;
                    }
                    DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                    if (t <= DateTime.Now)
                    {
                        this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                        return;
                    }
                }
            }
            else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
            {
                this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                return;
            }
            if (orderInfo.Gateway != "hishop.plugins.payment.bankrequest")
            {
                this.divhelper.Visible = false;
            }
            else
            {
                this.divhelper.Visible = true;
                this.litHelperText     = (Literal)this.FindControl("litHelperText");
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay));
                if (paymentMode != null)
                {
                    this.litHelperText.SetWhenIsNotNull(paymentMode.Description);
                }
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.btnToPay.Visible = false;
            }
            if (this.btnToPay != null)
            {
                this.btnToPay.HRef = "FinishOrder?orderId=" + this.orderId + "&action=topay";
            }
            else
            {
                this.GotoPay();
            }
            if (this.btnToPay != null && (orderInfo.Gateway == "hishop.plugins.payment.podrequest" || orderInfo.Gateway == "hishop.plugins.payment.bankrequest"))
            {
                this.btnToPay.Visible = false;
            }
            PageTitle.AddSiteNameTitle("下单成功");
            if (!this.Page.IsPostBack)
            {
                string text = HttpContext.Current.Request.QueryString["action"];
                if (!string.IsNullOrEmpty(text) && text == "topay")
                {
                    this.GotoPay();
                }
            }
        }
Esempio n. 4
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 + "进行支付";
                    }
                }
            }
        }
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("交易密码");
            HtmlInputHidden htmlInputHidden = (HtmlInputHidden)this.FindControl("hidkey");
            Literal         literal         = (Literal)this.FindControl("OrderId");
            Literal         literal2        = (Literal)this.FindControl("litOrderTotal");
            string          orderId         = literal.Text = this.Page.Request.QueryString["orderId"].ToNullString();
            OrderInfo       orderInfo       = ShoppingProcessor.GetOrderInfo(orderId);
            string          str             = "";

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("数据错误!");
            }
            else
            {
                if (orderInfo.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        base.GotoResourceNotFound("预售活动不存在不能支付");
                        return;
                    }
                    if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                    {
                        base.GotoResourceNotFound("您支付晚了,预售活动已经结束");
                        return;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            base.GotoResourceNotFound("尾款支付尚未开始");
                            return;
                        }
                        DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            base.GotoResourceNotFound("尾款支付已结束");
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                {
                    base.GotoResourceNotFound(str + ",库存不足,不能进行支付");
                    return;
                }
                HtmlInputHidden htmlInputHidden2 = (HtmlInputHidden)this.FindControl("txtIsFightGroup");
                if (htmlInputHidden2 != null)
                {
                    htmlInputHidden2.Value = ((orderInfo.FightGroupId > 0) ? "true" : "false");
                }
                decimal num = default(decimal);
                if (decimal.TryParse(this.Page.Request.QueryString["totalAmount"], out num))
                {
                    literal2.Text = num.F2ToString("f2");
                }
                else
                {
                    base.GotoResourceNotFound("传入值有误");
                }
            }
        }
Esempio n. 6
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 + "进行支付";
                    }
                }
            }
        }
Esempio n. 7
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>");
                                }
                            }
                        }
                    }
                }
            }
        }