예제 #1
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();
            }
        }
        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);
                }
            }
        }