private void btnConfirm_Click(object sender, EventArgs e) { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.paymentModeId); InpourRequestInfo inpourRequestInfo = new InpourRequestInfo { InpourId = this.GenerateInpourId(), TradeDate = DateTime.Now, InpourBlance = this.balance, UserId = HiContext.Current.UserId, PaymentId = paymentMode.ModeId }; if (MemberProcessor.AddInpourBlance(inpourRequestInfo)) { string attach = ""; HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.UserId.ToString()]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { attach = httpCookie.Value; } string text = inpourRequestInfo.InpourId.ToString(CultureInfo.InvariantCulture); string hIGW = paymentMode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, inpourRequestInfo.InpourBlance, "预付款充值", "操作流水号-" + text, HiContext.Current.User.Email.ToNullString(), inpourRequestInfo.TradeDate, Globals.FullPath("/"), Globals.FullPath(base.GetRouteUrl("InpourReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("InpourNotify_url", new { HIGW = hIGW })), attach); paymentRequest.SendRequest(); } }
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(); } }
private void Notify_Finished(InpourRequestInfo inpourRequest) { DateTime now = DateTime.Now; TradeTypes tradeType = TradeTypes.SelfhelpInpour; MemberInfo user = Users.GetUser(inpourRequest.UserId); decimal balance = user.Balance + inpourRequest.InpourBlance; BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo(); balanceDetailInfo.UserId = inpourRequest.UserId; balanceDetailInfo.UserName = user.UserName; balanceDetailInfo.TradeDate = now; balanceDetailInfo.TradeType = tradeType; balanceDetailInfo.Income = inpourRequest.InpourBlance; balanceDetailInfo.Balance = balance; balanceDetailInfo.InpourId = inpourRequest.InpourId; balanceDetailInfo.Remark = "充值支付方式:微信支付"; if (MemberProcessor.Recharge(balanceDetailInfo)) { base.Response.Write("success"); } else { base.Response.Write("success"); } }
private void btnConfirm_Click(object sender, System.EventArgs e) { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.paymentModeId); InpourRequestInfo inpourRequestInfo = new InpourRequestInfo { InpourId = this.GenerateInpourId(), TradeDate = System.DateTime.Now, InpourBlance = this.balance, UserId = HiContext.Current.User.UserId, PaymentId = paymentMode.ModeId }; if (MemberProcessor.AddInpourBlance(inpourRequestInfo)) { string attach = ""; System.Web.HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { attach = httpCookie.Value; } string orderId = inpourRequestInfo.InpourId.ToString(System.Globalization.CultureInfo.InvariantCulture); string configXml = HiCryptographer.Decrypt(paymentMode.Settings); decimal amount = inpourRequestInfo.InpourBlance + (decimal)this.ViewState["PayCharge"]; PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, configXml, orderId, amount, "预付款充值", "操作流水号-" + orderId, HiContext.Current.User.Email, inpourRequestInfo.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourNotify_url", new object[] { paymentMode.Gateway })), attach); } }
private void DoValidate() { NameValueCollection nameValueCollection = new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }; this.Gateway = base.GetParameter("HIGW", false); this.Gateway = this.Gateway.Replace("_", "."); if (this.Gateway == "hishop.plugins.payment.wxqrcode.wxqrcoderequest") { string wXQRCodePayResult = this.GetWXQRCodePayResult(); nameValueCollection.Add("notify_data", wXQRCodePayResult); } this.Notify = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection); if (this.Notify == null) { Globals.AppendLog(nameValueCollection, "通知对象获取失败" + this.Amount, this.Page.Request.Url.ToString(), "", "WapInpourPage"); this.ResponseStatus(true, "verifyfaild"); } else { if (this.isBackRequest) { string hIGW = this.Gateway.Replace(".", "_"); this.Notify.ReturnUrl = Globals.FullPath(base.GetRouteUrl("InpourReturn_url", new { HIGW = hIGW })) + "?" + this.Page.Request.Url.Query; } this.InpourId = this.Notify.GetOrderId(); this.Amount = this.Notify.GetOrderAmount(); this.InpourRequest = MemberProcessor.GetInpourBlance(this.InpourId); if (this.InpourRequest == null) { Globals.AppendLog(nameValueCollection, "未找到相应的充值记录---Amount:" + this.Amount, this.Page.Request.Url.ToString(), "", "WapInpourPage"); this.ResponseStatus(true, "success"); } else { this.Amount = this.InpourRequest.InpourBlance; this.paymode = TradeHelper.GetPaymentMode(this.InpourRequest.PaymentId); if (this.paymode == null) { Globals.AppendLog(nameValueCollection, "未获取到支付方式信息", this.Page.Request.Url.ToString(), "", "WapInpourPage"); this.ResponseStatus(true, "gatewaynotfound"); } else { this.Notify.Finished += this.Notify_Finished; this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild; this.Notify.Payment += this.Notify_Payment; this.Notify.VerifyNotify(600000, HiCryptographer.Decrypt(this.paymode.Settings)); } } } }
private void Pay(InpourRequestInfo request) { string inpourId = request.InpourId; PayGatewayInfo gatewayInfo = this.GetGatewayInfo(request.PaymentId.ToString()); gatewayInfo.InpourRequest = request; if (gatewayInfo.GatewayTypeName == "hishop.plugins.payment.weixinrequest") { string empty = string.Empty; MemberInfo user = HiContext.Current.User; if (user.UserId != 0) { MemberOpenIdInfo memberOpenIdInfo = user.MemberOpenIds.FirstOrDefault((MemberOpenIdInfo item) => item.OpenIdType.ToLower() == "hishop.plugins.openid.weixin"); if (memberOpenIdInfo != null) { empty = memberOpenIdInfo.OpenId; } } else { this.Page.Response.Redirect("/" + base.ClientType.ToString() + "/Login.aspx", true); } this.Page.Response.Redirect("/pay/WeiXinInpourSubmit?orderId=" + inpourId, true); } if (gatewayInfo.GatewayTypeName == "hishop.plugins.payment.alipaywx.alipaywxrequest") { HttpContext.Current.Response.Redirect("~/vshop/WXAliPay.aspx?orderId=" + inpourId + "&status=1"); } if (gatewayInfo.GatewayTypeName == "hishop.plugins.payment.ws_apppay.wswappayrequest") { HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + inpourId, true); } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string text = $"http://{HttpContext.Current.Request.Url.Host}/{HiContext.Current.GetClientPath}/"; string hIGW = gatewayInfo.GatewayTypeName.Replace(".", "_"); string wapInpourNotifyUrl = Globals.FullPath(base.GetRouteUrl("WapInpourNotify", new { HIGW = hIGW })); string wapInpourReturnUrl = Globals.FullPath(base.GetRouteUrl("WapInpourReturn", new { HIGW = hIGW })); PaymentModeInfo paymentModeInfo = gatewayInfo.Paymode = ShoppingProcessor.GetPaymentMode(gatewayInfo.GatewayTypeName); gatewayInfo.OrderId = inpourId; if (paymentModeInfo == null) { this.ShowWapMessage("错误的支付方式", this.Page.Request.Url.ToString()); } else { gatewayInfo.WapInpourNotifyUrl = wapInpourNotifyUrl; gatewayInfo.WapInpourReturnUrl = wapInpourReturnUrl; this.SendRequest(gatewayInfo); } }
protected override void AttachChildControls() { string a = this.Page.Request["action"].ToNullString(); this.balanceWapPaymentTypeSelect = (this.FindControl("paymenttypeselect") as Common_WAPPaymentTypeSelect); this.spadvancetip = (HtmlGenericControl)this.FindControl("spadvancetip"); this.divReCharge = (HtmlGenericControl)this.FindControl("divReCharge"); this.divReChargeGift = (HtmlGenericControl)this.FindControl("divReChargeGift"); this.rptReChargeGift = (WapTemplatedRepeater)this.FindControl("rptReChargeGift"); this.hidRechargeMoney = (HtmlInputHidden)this.FindControl("hidRechargeMoney"); if (HiContext.Current.SiteSettings.IsOpenRechargeGift) { List <RechargeGiftInfo> rechargeGiftItemList = PromoteHelper.GetRechargeGiftItemList(); this.rptReChargeGift.DataSource = rechargeGiftItemList; this.rptReChargeGift.DataBind(); this.divReCharge.Visible = false; this.divReChargeGift.Visible = true; this.spadvancetip.Visible = true; } else { this.divReCharge.Visible = true; this.divReChargeGift.Visible = false; this.spadvancetip.Visible = !HiContext.Current.SiteSettings.EnableBulkPaymentAdvance; } this.SaveClientTypeCookie(((int)base.ClientType).ToString()); if (this.balanceWapPaymentTypeSelect != null) { this.balanceWapPaymentTypeSelect.ClientType = base.ClientType; this.balanceWapPaymentTypeSelect.ShowBalancePay = false; } if (a == "toPay") { string text = this.Page.Request["InpourBlanceId"].ToNullString(); if (text == "") { this.ShowWapMessage("预付款充值ID为空", "RechargeRequest.aspx"); } else { InpourRequestInfo inpourBlance = MemberProcessor.GetInpourBlance(text); if (inpourBlance == null) { this.ShowWapMessage("错误的预付款充值ID", "RechargeRequest.aspx"); } else { this.Pay(inpourBlance); } } } }
public InpourRequestInfo GetInpourBlance(string inpourId) { DbCommand sqlStringCommand = base.database.GetSqlStringCommand("SELECT * FROM Hishop_InpourRequest WHERE InpourId = @InpourId;"); base.database.AddInParameter(sqlStringCommand, "InpourId", DbType.String, inpourId); InpourRequestInfo result = null; using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand)) { result = DataHelper.ReaderToModel <InpourRequestInfo>(objReader); } return(result); }
public override InpourRequestInfo GetInpouRequest(string inpourId) { InpourRequestInfo info = null; DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_DistributorInpourRequest WHERE InpourId = @InpourId"); this.database.AddInParameter(sqlStringCommand, "InpourId", DbType.String, inpourId); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { while (reader.Read()) { info = DataMapper.PopulateInpourRequest(reader); } } return info; }
protected void Page_Load(object sender, EventArgs e) { string text = base.Request.QueryString.Get("orderId"); if (!string.IsNullOrEmpty(text)) { InpourRequestInfo inpourBlance = MemberProcessor.GetInpourBlance(text); if (inpourBlance != null) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); PackageInfo packageInfo = new PackageInfo(); packageInfo.Body = inpourBlance.InpourId; packageInfo.NotifyUrl = Globals.GetProtocal(HttpContext.Current) + "://" + $"{base.Request.Url.Host}/pay/WeiXinInpourNotify"; packageInfo.OutTradeNo = inpourBlance.InpourId; packageInfo.TotalFee = (int)(inpourBlance.InpourBlance * 100m); if (packageInfo.TotalFee < decimal.One) { packageInfo.TotalFee = decimal.One; } string text2 = ""; if (string.IsNullOrEmpty(text2)) { PayConfig payConfig = new PayConfig(); payConfig.AppId = masterSettings.WeixinAppId; payConfig.Key = masterSettings.WeixinPartnerKey; payConfig.MchID = masterSettings.WeixinPartnerID; payConfig.AppSecret = masterSettings.WeixinAppSecret; JsApiPay jsApiPay = new JsApiPay(); NameValueCollection openidAndAccessToken = JsApiPay.GetOpenidAndAccessToken(this.Page, payConfig.AppId, payConfig.AppSecret, false); if (openidAndAccessToken.HasKeys()) { text2 = openidAndAccessToken["openId"]; } } if (!string.IsNullOrEmpty(masterSettings.Main_AppId) && !string.IsNullOrEmpty(masterSettings.Main_Mch_ID)) { packageInfo.sub_openid = text2; } else { packageInfo.OpenId = text2; } packageInfo.sub_mch_id = masterSettings.WeixinPartnerID; PayClient payClient = null; payClient = ((string.IsNullOrEmpty(masterSettings.Main_AppId) || string.IsNullOrEmpty(masterSettings.Main_Mch_ID)) ? new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "", "") : new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, masterSettings.WeixinPartnerID, masterSettings.WeixinAppId, "")); PayRequestInfo req = payClient.BuildPayRequest(packageInfo); this.pay_json = this.ConvertPayJson(req); } } }
public override InpourRequestInfo GetInpouRequest(string inpourId) { InpourRequestInfo result = null; System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_DistributorInpourRequest WHERE InpourId = @InpourId"); this.database.AddInParameter(sqlStringCommand, "InpourId", System.Data.DbType.String, inpourId); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { while (dataReader.Read()) { result = DataMapper.PopulateInpourRequest(dataReader); } } return(result); }
public override bool AddInpourBlance(InpourRequestInfo inpourRequest) { if (null == inpourRequest) { return false; } DbCommand storedProcCommand = this.database.GetStoredProcCommand("sub_DistributorInpourRequest_Create"); this.database.AddOutParameter(storedProcCommand, "Status", DbType.Int32, 4); this.database.AddInParameter(storedProcCommand, "InpourId", DbType.String, inpourRequest.InpourId); this.database.AddInParameter(storedProcCommand, "TradeDate", DbType.DateTime, inpourRequest.TradeDate); this.database.AddInParameter(storedProcCommand, "InpourBlance", DbType.Currency, inpourRequest.InpourBlance); this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, inpourRequest.UserId); this.database.AddInParameter(storedProcCommand, "PaymentId", DbType.String, inpourRequest.PaymentId); this.database.ExecuteNonQuery(storedProcCommand); return (((int) this.database.GetParameterValue(storedProcCommand, "Status")) == 0); }
public override InpourRequestInfo GetInpourBlance(string inpourId) { DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM Hishop_InpourRequest WHERE InpourId = @InpourId;"); database.AddInParameter(sqlStringCommand, "InpourId", DbType.String, inpourId); InpourRequestInfo info = null; using (IDataReader reader = database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulateInpourRequest(reader); } } return(info); }
public InpourRequestInfo GetInpourBlance(string inpourId) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Ecshop_InpourRequest WHERE InpourId = @InpourId;"); this.database.AddInParameter(sqlStringCommand, "InpourId", DbType.String, inpourId); InpourRequestInfo result = null; using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { if (dataReader.Read()) { result = DataMapper.PopulateInpourRequest(dataReader); } } return(result); }
public override bool AddInpourBlance(InpourRequestInfo inpourRequest) { if (null == inpourRequest) { return(false); } DbCommand storedProcCommand = database.GetStoredProcCommand("ac_Underling_InpourRequest_Create"); database.AddInParameter(storedProcCommand, "InpourId", DbType.String, inpourRequest.InpourId); database.AddInParameter(storedProcCommand, "TradeDate", DbType.DateTime, inpourRequest.TradeDate); database.AddInParameter(storedProcCommand, "InpourBlance", DbType.Currency, inpourRequest.InpourBlance); database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, inpourRequest.UserId); database.AddInParameter(storedProcCommand, "PaymentId", DbType.String, inpourRequest.PaymentId); database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId); database.AddOutParameter(storedProcCommand, "Status", DbType.Int32, 4); database.ExecuteNonQuery(storedProcCommand); return(((int)database.GetParameterValue(storedProcCommand, "Status")) == 0); }
private void DoValidate() { System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }; this.Gateway = this.Page.Request.QueryString["HIGW"]; this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters); if (this.isBackRequest) { this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[] { this.Gateway })); PaymentNotify expr_AC = this.Notify; expr_AC.ReturnUrl = expr_AC.ReturnUrl + "?" + this.Page.Request.Url.Query; } this.InpourId = this.Notify.GetOrderId(); this.Amount = this.Notify.GetOrderAmount(); this.InpourRequest = SubsiteStoreHelper.GetInpouRequest(this.InpourId); if (this.InpourRequest == null) { this.ResponseStatus(true, "success"); } else { this.Amount = this.InpourRequest.InpourBlance; this.paymode = SubsiteStoreHelper.GetPaymentMode(this.InpourRequest.PaymentId); if (this.paymode == null) { this.ResponseStatus(true, "gatewaynotfound"); } else { this.Notify.Finished += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished); this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild); this.Notify.Payment += new System.EventHandler(this.Notify_Payment); this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(this.paymode.Settings)); } } }
protected void Page_Load(object sender, EventArgs e) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); NotifyClient notifyClient = null; notifyClient = ((string.IsNullOrEmpty(masterSettings.Main_Mch_ID) || string.IsNullOrEmpty(masterSettings.Main_AppId)) ? new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "") : new NotifyClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID)); PayNotify payNotify = notifyClient.GetPayNotify(base.Request.InputStream); if (payNotify != null) { string outTradeNo = payNotify.PayInfo.OutTradeNo; this.inpourRequest = MemberProcessor.GetInpourBlance(outTradeNo); if (this.inpourRequest == null) { base.Response.Write("success"); } else { this.Notify_Finished(this.inpourRequest); } } }
void DoValidate() { NameValueCollection values2 = new NameValueCollection(); values2.Add(Page.Request.Form); values2.Add(Page.Request.QueryString); NameValueCollection parameters = values2; Gateway = Page.Request.QueryString["HIGW"]; Notify = PaymentNotify.CreateInstance(Gateway, parameters); if (isBackRequest) { Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[] { Gateway })); Notify.ReturnUrl = Notify.ReturnUrl + "?" + Page.Request.Url.Query; } InpourId = Notify.GetOrderId(); Amount = Notify.GetOrderAmount(); InpourRequest = SubsiteStoreHelper.GetInpouRequest(InpourId); if (InpourRequest == null) { ResponseStatus(true, "success"); } else { Amount = InpourRequest.InpourBlance; paymode = SubsiteStoreHelper.GetPaymentMode(InpourRequest.PaymentId); if (paymode == null) { ResponseStatus(true, "gatewaynotfound"); } else { Notify.Finished += new EventHandler <FinishedEventArgs>(Notify_Finished); Notify.NotifyVerifyFaild += new EventHandler(Notify_NotifyVerifyFaild); Notify.Payment += new EventHandler(Notify_Payment); Notify.VerifyNotify(0x7530, Cryptographer.Decrypt(paymode.Settings)); } } }
public bool AddInpourBlance(InpourRequestInfo inpourRequest) { bool result; if (null == inpourRequest) { result = false; } else { DbCommand storedProcCommand = this.database.GetStoredProcCommand("ac_Member_InpourRequest_Create"); this.database.AddInParameter(storedProcCommand, "InpourId", DbType.String, inpourRequest.InpourId); this.database.AddInParameter(storedProcCommand, "TradeDate", DbType.DateTime, inpourRequest.TradeDate); this.database.AddInParameter(storedProcCommand, "InpourBlance", DbType.Currency, inpourRequest.InpourBlance); this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, inpourRequest.UserId); this.database.AddInParameter(storedProcCommand, "PaymentId", DbType.String, inpourRequest.PaymentId); this.database.AddOutParameter(storedProcCommand, "Status", DbType.Int32, 4); this.database.ExecuteNonQuery(storedProcCommand); result = ((int)this.database.GetParameterValue(storedProcCommand, "Status") == 0); } return(result); }
public void XmlBalancePay(string orderId) { this.OrderId = orderId; InpourRequestInfo inpourBlance = MemberProcessor.GetInpourBlance(this.OrderId); if (inpourBlance == null) { this.ShowWapMessage("错误的预付款充值ID", "RechargeRequest.aspx"); } else { string attach = ""; PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.alipaywx.alipaywxrequest"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string showUrl = $"http://{HttpContext.Current.Request.Url.Host}/{HiContext.Current.GetClientPath}/"; string hIGW = paymentMode.Gateway.Replace(".", "_"); string notifyUrl = Globals.FullPath(base.GetRouteUrl("WapInpourNotify", new { HIGW = hIGW })); string returnUrl = Globals.FullPath(base.GetRouteUrl("WapInpourReturn", new { HIGW = hIGW })); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.OrderId, inpourBlance.InpourBlance + default(decimal), "预付款充值", "操作流水号-" + this.OrderId, HiContext.Current.User.Email.ToNullString(), inpourBlance.TradeDate, showUrl, returnUrl, notifyUrl, attach); object obj = paymentRequest.SendRequest_Ret(); if (obj.ToNullString().IndexOf("error:") > -1) { this.ShowWapMessage("支付错误:" + obj.ToNullString().Replace("error:", ""), ""); } else { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(obj.ToNullString()); HttpContext.Current.Response.End(); } } }
private void DoValidate() { NameValueCollection values2 = new NameValueCollection(); values2.Add(this.Page.Request.Form); values2.Add(this.Page.Request.QueryString); NameValueCollection parameters = values2; this.Gateway = this.Page.Request.QueryString["HIGW"]; this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters); if (this.isBackRequest) { this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[] { this.Gateway })) + "?" + this.Page.Request.Url.Query; } this.InpourId = this.Notify.GetOrderId(); this.Amount = this.Notify.GetOrderAmount(); this.InpourRequest = PersonalHelper.GetInpourBlance(this.InpourId); if (this.InpourRequest == null) { this.ResponseStatus(true, "success"); } else { this.Amount = this.InpourRequest.InpourBlance; this.paymode = TradeHelper.GetPaymentMode(this.InpourRequest.PaymentId); if (this.paymode == 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); this.Notify.VerifyNotify(0x7530, HiCryptographer.Decrypt(this.paymode.Settings)); } } }
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(); } }
private void btnConfirm_Click(object sender, EventArgs e) { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.paymentModeId); InpourRequestInfo info3 = new InpourRequestInfo(); info3.InpourId = this.GenerateInpourId(); info3.TradeDate = DateTime.Now; info3.InpourBlance = this.balance; info3.UserId = HiContext.Current.User.UserId; info3.PaymentId = paymentMode.ModeId; InpourRequestInfo inpourRequest = info3; if (PersonalHelper.AddInpourBlance(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, HiCryptographer.Decrypt(paymentMode.Settings), orderId, inpourRequest.InpourBlance + ((decimal)this.ViewState["PayCharge"]), "预付款充值", "操作流水号-" + orderId, HiContext.Current.User.Email, inpourRequest.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest(); } }
public static bool AddInpourBlance(InpourRequestInfo inpourRequest) { return(new InpourRequestDao().AddInpourBlance(inpourRequest)); }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary <string, string> requestPost = this.GetRequestPost(); if (requestPost.Count > 0) { Notify notify = new Notify(); if (notify.Verify(requestPost, base.Request.Form["notify_id"], base.Request.Form["sign"])) { string text = base.Request.Form["out_trade_no"]; string text2 = base.Request.Form["trade_no"]; string text3 = base.Request.Form["subject"]; string a = base.Request.Form["trade_status"]; if (!(a == "TRADE_FINISHED") && a == "TRADE_SUCCESS") { if (text3.Trim().Equals("预付款充值")) { InpourRequestInfo inpourBlance = MemberProcessor.GetInpourBlance(text); if (inpourBlance == null) { app_alipay_notify_url.writeLog("没有找到充值申请记录"); base.Response.Write("success"); return; } MemberProcessor.AddBalanceDetailInfo(inpourBlance, "支付宝app支付"); } else if (text3.Trim().Equals("订单支付")) { if (!string.IsNullOrEmpty(text) && text.Length > 5) { text = text.Substring(0, text.Length - 5); } OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(text); if (orderInfo == null) { base.Response.Write("success"); base.Response.End(); return; } this.hasNotify = !string.IsNullOrEmpty(orderInfo.GatewayOrderId); if (orderInfo.PreSaleId > 0 && orderInfo.DepositGatewayOrderId.ToNullString() == text2) { base.Response.Write("success"); base.Response.End(); return; } if (orderInfo.PreSaleId > 0 && !orderInfo.DepositDate.HasValue) { orderInfo.DepositGatewayOrderId = text2; } else { orderInfo.GatewayOrderId = text2; } this.UserPayOrder(orderInfo); } } base.Response.Write("success"); base.Response.End(); } else { base.Response.Write("fail"); base.Response.End(); } } else { base.Response.Write("无通知参数"); base.Response.End(); } }
private void DoValidate() { NameValueCollection nameValueCollection = new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }; if (!this.isBackRequest) { nameValueCollection.Add("IsReturn", "true"); } this.Gateway = RouteConfig.GetParameter(this.Page, "HIGW", false); this.Gateway = this.Gateway.Replace("_", "."); this.Gateway = this.Gateway.Replace("ws.wappay", "ws_wappay"); this.Notify = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection); if (this.Notify == null) { this.ResponseStatus(false, "verifyfaild"); Globals.AppendLog(nameValueCollection, "获取支付通知信息失败", this.Page.Request.Url.ToString(), "", "WapInpourPage"); } else { if (this.isBackRequest) { string hIGW = this.Gateway.Replace(".", "_"); this.Notify.ReturnUrl = Globals.FullPath(base.GetRouteUrl("WapInpourNotify", new { HIGW = hIGW })) + "?" + this.Page.Request.Url.Query; } this.InpourId = this.Notify.GetOrderId(); this.Amount = this.Notify.GetOrderAmount(); this.InpourRequest = MemberProcessor.GetInpourBlance(this.InpourId); if (this.InpourRequest == null) { if (this.isBackRequest) { Globals.AppendLog(nameValueCollection, "未找到相应的充值记录...Amount:" + this.Notify.GetOrderAmount(), this.Page.Request.Url.ToString(), "", "WapInpourPage"); this.ResponseStatus(true, "fail"); } else { BalanceDetailInfo balanceDetailInfoOfInpurId = MemberProcessor.GetBalanceDetailInfoOfInpurId(this.InpourId); if (balanceDetailInfoOfInpurId == null) { Globals.AppendLog(nameValueCollection, "未找到相应的明细记录...InpourId:" + this.InpourId, this.Page.Request.Url.ToString(), "", "WapInpourPage"); this.ResponseStatus(true, "fail"); } else { if (balanceDetailInfoOfInpurId.Income.HasValue) { this.Amount = balanceDetailInfoOfInpurId.Income.Value.ToDecimal(0); } else { this.Amount = default(decimal); } this.ResponseStatus(true, "success"); } } } else { if (this.InpourRequest != null) { this.Amount = this.InpourRequest.InpourBlance; } this.paymode = TradeHelper.GetPaymentMode(this.Gateway); if (this.paymode == null) { Globals.AppendLog(nameValueCollection, "未获取到支付方式信息", this.Page.Request.Url.ToString(), "", "WapInpourPage"); this.ResponseStatus(true, "gatewaynotfound"); } else { this.Notify.Finished += this.Notify_Finished; this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild; this.Notify.Payment += this.Notify_Payment; this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(this.paymode.Settings)); } } } }
protected void Page_Load(object sender, EventArgs e) { SiteSettings siteSettings = HiContext.Current.SiteSettings; NotifyClient notifyClient = null; notifyClient = ((string.IsNullOrEmpty(siteSettings.Main_Mch_ID) || string.IsNullOrEmpty(siteSettings.Main_AppId)) ? new NotifyClient(siteSettings.AppWxAppId, siteSettings.AppWxAppSecret, siteSettings.AppWxMchId, siteSettings.AppWxPartnerKey, "", "", "") : new NotifyClient(siteSettings.AppWX_Main_AppId, siteSettings.AppWxAppSecret, siteSettings.AppWX_Main_MchID, siteSettings.AppWxPartnerKey, "", siteSettings.AppWxAppId, siteSettings.AppWxMchId)); PayNotify payNotify = notifyClient.GetPayNotify(base.Request.InputStream); if (payNotify != null) { this.OrderId = payNotify.PayInfo.OutTradeNo; string attach = payNotify.PayInfo.Attach; if (attach == "1") { this.IsRecharge = true; } NameValueCollection nameValueCollection = new NameValueCollection { base.Request.Form, base.Request.QueryString }; if (this.IsRecharge) { InpourRequestInfo inpourBlance = MemberProcessor.GetInpourBlance(this.OrderId); if (inpourBlance == null) { this.ResponseReturn(true, ""); } else { MemberProcessor.AddBalanceDetailInfo(inpourBlance, "APP微信支付"); } } else { this.Order = ShoppingProcessor.GetOrderInfo(this.OrderId); if (this.Order == null && !string.IsNullOrEmpty(payNotify.PayInfo.OutTradeNo)) { this.Order = ShoppingProcessor.GetOrderInfo(payNotify.PayInfo.OutTradeNo); } if (this.Order == null) { this.ResponseReturn(true, ""); } else if (this.Order.PreSaleId > 0 && this.Order.DepositGatewayOrderId.ToNullString() == payNotify.PayInfo.TransactionId) { this.ResponseReturn(true, ""); } else { this.hasNotify = !string.IsNullOrEmpty(this.Order.GatewayOrderId); if (this.Order.PreSaleId > 0 && !this.Order.DepositDate.HasValue) { this.Order.DepositGatewayOrderId = payNotify.PayInfo.TransactionId; } else { this.Order.GatewayOrderId = payNotify.PayInfo.TransactionId; } this.UserPayOrder(); } } } }
public static bool AddInpourBalance(InpourRequestInfo inpourRequest) { return(SubsiteStoreProvider.Instance().AddInpourBlance(inpourRequest)); }
public static bool AddInpourBlance(InpourRequestInfo inpourRequest) { return(PersonalProvider.Instance().AddInpourBlance(inpourRequest)); }
public abstract bool AddInpourBlance(InpourRequestInfo inpourRequest);