Example #1
0
        /// <summary>
        /// 创建支付二维码(路径)
        /// </summary>
        /// <param name="orderInfo">订单信息</param>
        /// <param name="appId"></param>
        /// <param name="partnerId"></param>
        /// <returns></returns>
        private string CreatePayQRCode(OrderInfo orderInfo, string appId, string partnerId)
        {
            string         orderId        = orderInfo.OrderId;
            VCodePayEntity vCodePayEntity = new VCodePayEntity();

            vCodePayEntity.appid        = appId;
            vCodePayEntity.mch_id       = partnerId;
            vCodePayEntity.body         = orderId;
            vCodePayEntity.nonce_str    = VCodePayHelper.CreateRandom(20);
            vCodePayEntity.out_trade_no = orderId;
            vCodePayEntity.fee_type     = "CNY";
            //1 = 1分
            vCodePayEntity.total_fee        = (int)(orderInfo.GetTotal() * 100);
            vCodePayEntity.spbill_create_ip = "127.0.0.1";
            vCodePayEntity.notify_url       = "http://" + base.Context.Request.Url.Host + "/pay/wx_PayQRcode_notify_url.aspx";
            vCodePayEntity.product_id       = orderId;
            string vCodePayPath = VCodePayHelper.RequestWeixin(vCodePayEntity);

            return(vCodePayPath);
        }
Example #2
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("");
            }
            this.litOrderId     = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderId");
            this.litOrderTotal  = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal");
            this.litPaymentType = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litPaymentType");
            this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
            this.litOrderId.SetWhenIsNotNull(this.orderId);
            this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal().ToString("F2"));
            this.divhelper = (System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("helper");
            if (orderInfo.Gateway != "ecdev.plugins.payment.bankrequest")
            {
                this.divhelper.Visible = false;
            }
            else
            {
                this.divhelper.Visible = true;
                this.litHelperText     = (System.Web.UI.WebControls.Literal) this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
            }
            this.btnToPay = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("btnToPay");
            if (this.btnToPay != null)
            {
                //判断为微信手机网页支付
                if (orderInfo.Gateway == "Ecdev.plugins.payment.weixinwaprequest")
                {
                    SiteSettings          masterSettings = SettingsManager.GetMasterSettings(false);
                    VCodePayResponsEntity rpsEntity      = VCodePayHelper.CreateWeixinPay(new Ecdev.Weixin.Pay.Domain.VCodePayEntity()
                    {
                        appid = masterSettings.WeixinAppId,
                        //appid = "wx45cd46b5f561deee",
                        //mch_id = "D4DE77CE6F6C9E3A",
                        mch_id       = masterSettings.WeixinPartnerID,
                        body         = orderInfo.OrderId,
                        nonce_str    = VCodePayHelper.CreateRandom(20),
                        out_trade_no = orderInfo.OrderId,
                        fee_type     = "CNY",
                        //1 = 1分
                        total_fee        = (int)(orderInfo.GetTotal() * 100),
                        spbill_create_ip = "192.168.1.40",
                        notify_url       = "http://" + base.Context.Request.Url.Host + "/pay/wx_Pay_notify_url.aspx",
                        product_id       = orderInfo.OrderId.ToString()
                    });
                    string javascript = string.Format("weixin://wap/pay?appid={0}&noncestr={1}&package=WAP&prepayid={2}&timestamp={3}&sign={4}",
                                                      rpsEntity.appid, rpsEntity.Nonce_str, rpsEntity.prepay_id, ConvertDateTimeInt(DateTime.Now), rpsEntity.sign);
                    this.btnToPay.Target = "_blank";
                    this.btnToPay.HRef   = javascript;
                }
                else
                {
                    this.btnToPay.HRef = "FinishOrder.aspx?orderId=" + this.orderId + "&action=topay";
                }
            }
            else
            {
                this.GotoPay();
            }
            if (this.btnToPay != null && (orderInfo.Gateway == "ecdev.plugins.payment.podrequest" || orderInfo.Gateway == "ecdev.plugins.payment.bankrequest"))
            {
                this.btnToPay.Visible = false;
            }
            if (!this.Page.IsPostBack)
            {
                string text = System.Web.HttpContext.Current.Request.QueryString["action"];
                if (!string.IsNullOrEmpty(text) && text == "topay")
                {
                    this.GotoPay();
                }
            }
        }