Esempio n. 1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            NotifyClient notifyClient;

            if (masterSettings.EnableSP)
            {
                notifyClient = new NotifyClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                notifyClient = new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            PayNotify payNotify = notifyClient.GetPayNotify(base.Request.InputStream);

            if (payNotify == null)
            {
                return;
            }
            this.PayId = payNotify.PayInfo.OutTradeNo;
            this.model = MemberAmountProcessor.GetAmountDetailByPayId(this.PayId);
            if (this.model == null)
            {
                base.Response.Write("success");
                return;
            }
            this.model.GatewayPayId = payNotify.PayInfo.TransactionId;
            this.UserPayOrder();
        }
Esempio n. 2
0
        protected override void AttachChildControls()
        {
            string payId = this.Page.Request.QueryString["PayId"];
            MemberAmountDetailedInfo amountDetailByPayId = MemberAmountProcessor.GetAmountDetailByPayId(payId);

            if (amountDetailByPayId == null)
            {
                this.Page.Response.Redirect("/Vshop/MemberRecharge.aspx");
            }
            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=" + payId);
            }
            else if (amountDetailByPayId.TradeWays == TradeWays.WeChatWallet)
            {
                this.Page.Response.Redirect("~/pay/wx_SubmitCharge.aspx?PayId=" + payId);
            }
            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/", HttpContext.Current.Request.Url.Host);
                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), payId, amountDetailByPayId.TradeAmount, "会员充值", "充值号-" + payId, "", amountDetailByPayId.TradeTime, showUrl, Globals.FullPath("/pay/RePaymentReturn_url.aspx"), Globals.FullPath("/pay/RePaymentNotify_url.aspx"), attach).SendRequest();
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.QueryString.Get("PayId");

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            MemberAmountDetailedInfo amountDetailByPayId = MemberAmountProcessor.GetAmountDetailByPayId(text);

            if (amountDetailByPayId == null)
            {
                return;
            }
            decimal     tradeAmount = amountDetailByPayId.TradeAmount;
            PackageInfo packageInfo = new PackageInfo();

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

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

            if (masterSettings.EnableSP)
            {
                payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            if (!payClient.checkSetParams(out this.CheckValue))
            {
                return;
            }
            if (!payClient.checkPackage(packageInfo, out this.CheckValue))
            {
                return;
            }
            PayRequestInfo payRequestInfo = payClient.BuildPayRequest(packageInfo);

            this.pay_json = this.ConvertPayJson(payRequestInfo);
            if (!payRequestInfo.package.ToLower().StartsWith("prepay_id=wx"))
            {
                this.CheckValue = payRequestInfo.package;
            }
        }
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

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

            if (!this.isBackRequest)
            {
                parameters.Add("IsReturn", "true");
            }
            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            Globals.Debuglog("充值支付:0-" + JsonConvert.SerializeObject(this.Notify), "_DebugAlipayPayNotify.txt");
            try
            {
                StringBuilder builder = new StringBuilder();
                foreach (string str in parameters)
                {
                    builder.Append(str + ":" + parameters[str] + ";");
                }
                Globals.Debuglog(builder.ToString(), "_DebugAlipayPayNotify.txt");
            }
            catch (Exception)
            {
            }
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath("/pay/RePaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query;
            }
            Globals.Debuglog("充值支付:1-" + JsonConvert.SerializeObject(this.Notify), "_DebugAlipayPayNotify.txt");
            this.PayId = this.Notify.GetOrderId();
            this.Model = MemberAmountProcessor.GetAmountDetailByPayId(this.PayId);
            if (this.Model != null)
            {
                this.Amount             = this.Model.TradeAmount;
                this.Model.GatewayPayId = this.Notify.GetGatewayOrderId();
                PaymentModeInfo paymentMode = MemberAmountProcessor.GetPaymentMode(this.Model.TradeWays);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    string configXml = HiCryptographer.Decrypt(paymentMode.Settings);
                    this.Notify.VerifyNotify(0x7530, configXml);
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("PayId");

            if (!string.IsNullOrEmpty(str))
            {
                MemberAmountDetailedInfo amountDetailByPayId = MemberAmountProcessor.GetAmountDetailByPayId(str);
                if (amountDetailByPayId != null)
                {
                    PayClient   client;
                    decimal     tradeAmount = amountDetailByPayId.TradeAmount;
                    PackageInfo package     = new PackageInfo
                    {
                        Body       = str,
                        NotifyUrl  = string.Format("http://{0}/pay/wx_PayCharge.aspx", base.Request.Url.Host),
                        OutTradeNo = str,
                        TotalFee   = (int)(tradeAmount * 100M)
                    };
                    if (package.TotalFee < 1M)
                    {
                        package.TotalFee = 1M;
                    }
                    string     openId        = "";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null)
                    {
                        openId = currentMember.OpenId;
                    }
                    package.OpenId = openId;
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                    if (masterSettings.EnableSP)
                    {
                        client = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
                    }
                    else
                    {
                        client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
                    }
                    if (client.checkSetParams(out this.CheckValue) && client.checkPackage(package, out this.CheckValue))
                    {
                        PayRequestInfo req = client.BuildPayRequest(package);
                        this.pay_json = this.ConvertPayJson(req);
                        if (!req.package.ToLower().StartsWith("prepay_id=wx"))
                        {
                            this.CheckValue = req.package;
                        }
                    }
                }
            }
        }