protected override void AttachChildControls()
 {
     int.TryParse(this.Page.Request.QueryString["modeId"], out this.paymentModeId);
     decimal.TryParse(this.Page.Request.QueryString["blance"], out this.balance);
     this.litUserName    = (Literal)this.FindControl("litUserName");
     this.lblPaymentName = (Literal)this.FindControl("lblPaymentName");
     this.imgPayment     = (HiImage)this.FindControl("imgPayment");
     this.lblBlance      = (FormatedMoneyLabel)this.FindControl("lblBlance");
     this.litPayCharge   = (Literal)this.FindControl("litPayCharge");
     this.btnConfirm     = ButtonManager.Create(this.FindControl("btnConfirm"));
     PageTitle.AddSiteNameTitle("充值确认", HiContext.Current.Context);
     this.btnConfirm.Click += new EventHandler(this.btnConfirm_Click);
     if (!this.Page.IsPostBack)
     {
         if ((this.paymentModeId == 0) || (this.balance == 0M))
         {
             this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("user_InpourRequest"));
         }
         else
         {
             PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.paymentModeId);
             this.litUserName.Text = HiContext.Current.User.Username;
             if (paymentMode != null)
             {
                 this.lblPaymentName.Text    = paymentMode.Name;
                 this.lblBlance.Money        = this.balance;
                 this.ViewState["PayCharge"] = paymentMode.CalcPayCharge(this.balance);
                 this.litPayCharge.Text      = Globals.FormatMoney(paymentMode.CalcPayCharge(this.balance));
             }
         }
     }
 }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int.TryParse(Page.Request.QueryString["modeId"], out paymentModeId);
     decimal.TryParse(Page.Request.QueryString["blance"], out balance);
     btnConfirm.Click += new EventHandler(btnConfirm_Click);
     if ((!Page.IsPostBack && (paymentModeId > 0)) && (balance > 0M))
     {
         PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(paymentModeId);
         litRealName.Text = HiContext.Current.User.Username;
         if (paymentMode != null)
         {
             lblPaymentName.Text    = paymentMode.Name;
             lblBlance.Money        = balance;
             ViewState["PayCharge"] = paymentMode.CalcPayCharge(balance);
             litPayCharge.Text      = Globals.FormatMoney(paymentMode.CalcPayCharge(balance));
         }
     }
 }
Esempio n. 3
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     int.TryParse(this.Page.Request.QueryString["modeId"], out this.paymentModeId);
     decimal.TryParse(this.Page.Request.QueryString["blance"], out this.balance);
     this.btnConfirm.Click += new System.EventHandler(this.btnConfirm_Click);
     if (!this.Page.IsPostBack && this.paymentModeId > 0 && this.balance > 0m)
     {
         PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(this.paymentModeId);
         this.litRealName.Text = Hidistro.Membership.Context.HiContext.Current.User.Username;
         if (paymentMode != null)
         {
             this.lblPaymentName.Text    = paymentMode.Name;
             this.lblBlance.Money        = this.balance;
             this.ViewState["PayCharge"] = paymentMode.CalcPayCharge(this.balance);
             this.litPayCharge.Text      = Globals.FormatMoney(paymentMode.CalcPayCharge(this.balance));
         }
     }
 }
Esempio n. 4
0
        public virtual void ProcessRequest(HttpContext context)
        {
            //支付ID
            int paymentModeId = Globals.SafeInt(context.Request.QueryString["modeId"], 0);
            //充值金额
            decimal balance = Globals.SafeDecimal(context.Request.QueryString["blance"], 0M);

            //参数 NULL ERROR返回首页
            if ((paymentModeId == 0) || (balance == 0M))
            {
                //Add ErrorLog..
                return;
            }

            T user = GetCurrentUser(context);
            PayConfiguration config      = PayConfiguration.GetConfig();
            PaymentModeInfo  paymentMode = PaymentModeManage.GetPaymentModeById(paymentModeId);
            GatewayProvider  provider    = config.Providers[paymentMode.Gateway.ToLower()] as GatewayProvider;

            //计算支付手续费
            decimal payCharge = paymentMode.CalcPayCharge(balance);

#warning 未支持多币种支付手续费
            //根据多币种货币换算, 计算手续费
            //decimal payCharge = Sales.ScaleMoney(paymentMode.CalcPayCharge(balance));

            if (provider != null)
            {
                RechargeRequestInfo info2 = null;
                info2 = new RechargeRequestInfo
                {
                    TradeDate      = DateTime.Now,
                    RechargeBlance = balance,
                    UserId         = user.UserId,
                    PaymentGateway = paymentMode.Gateway
                };
                info2.RechargeId = PaymentModeManage.AddRechargeBalance(info2);
                if (info2.RechargeId > 0L)
                {
                    PaymentRequest.Instance(
                        provider.RequestType,
                        this.GetPayee(paymentMode),
                        this.GetGateway(paymentMode.Gateway.ToLower()),
                        this.GetTrade(info2, payCharge, user)
                        ).SendRequest();
                }
            }
        }
Esempio n. 5
0
        private void ProcessorPaymentMode(System.Web.HttpContext context)
        {
            decimal money = 0m;

            if (!string.IsNullOrEmpty(context.Request.Params["ModeId"]))
            {
                int             modeId      = int.Parse(context.Request["ModeId"], System.Globalization.NumberStyles.None);
                decimal         cartMoney   = decimal.Parse(context.Request["TotalPrice"]);
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                money = paymentMode.CalcPayCharge(cartMoney);
            }
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.Append("{");
            stringBuilder.Append("\"Status\":\"OK\",");
            stringBuilder.AppendFormat("\"Charge\":\"{0}\"", Globals.FormatMoney(money));
            stringBuilder.Append("}");
            context.Response.ContentType = "text/plain";
            context.Response.Write(stringBuilder.ToString());
        }
Esempio n. 6
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            PaymentModeInfo   paymentMode   = SubsiteStoreHelper.GetPaymentMode(paymentModeId);
            InpourRequestInfo inpourRequest = new InpourRequestInfo();

            inpourRequest.InpourId     = GenerateInpourId();
            inpourRequest.TradeDate    = DateTime.Now;
            inpourRequest.InpourBlance = balance;
            inpourRequest.UserId       = HiContext.Current.User.UserId;
            inpourRequest.PaymentId    = paymentMode.ModeId;

            if (SubsiteStoreHelper.AddInpourBalance(inpourRequest))
            {
                string     attach = "";
                HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                if (!((cookie == null) || string.IsNullOrEmpty(cookie.Value)))
                {
                    attach = cookie.Value;
                }
                string orderId = inpourRequest.InpourId.ToString(CultureInfo.InvariantCulture);
                PaymentRequest.CreateInstance(paymentMode.Gateway, Cryptographer.Decrypt(paymentMode.Settings), orderId, inpourRequest.InpourBlance + paymentMode.CalcPayCharge(inpourRequest.InpourBlance), "预付款充值", "操作流水号-" + orderId, HiContext.Current.User.Email, inpourRequest.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).SendRequest();
            }
        }
Esempio n. 7
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();
            }
        }