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); } }
public static string SendAlipayRefundRequest(OrderInfo order, decimal RefundMoney, string RefundOrderId) { string str = "backnotify"; PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(order.PaymentTypeId); RefundMoney = (RefundMoney == 0M) ? order.GetTotal() : RefundMoney; string str2 = "hishop.plugins.refund.alipaydirect.directrequest"; string returnUrl = string.Format("http://{0}/pay/RefundReturn.aspx?HIGW={1}", HttpContext.Current.Request.Url.Host, str2); string notifyUrl = string.Format("http://{0}/pay/RefundNotify.aspx?HIGW={1}", HttpContext.Current.Request.Url.Host, order.Gateway); string[] orderId = new string[] { order.GatewayOrderId }; decimal[] amount = new decimal[] { order.GetTotal() }; decimal[] refundaAmount = new decimal[] { RefundMoney }; string[] body = new string[] { order.RefundRemark }; try { //RefundRequest.CreateInstance(str2, HiCryptographer.Decrypt(paymentMode.Settings), orderId, RefundOrderId, amount, refundaAmount, body, order.EmailAddress, DateTime.Now, returnUrl, notifyUrl, "退款").SendRequest(); } catch (Exception exception) { //Globals.WriteLog("/log/backreturn.txt", string.Format("时间:{0} 支付宝原路返回错误:{1} 订单号:{2} 金额:{3} 网关:{4}<br><br>", new object[] { DateTime.Now, exception.Message, order.OrderId, RefundMoney, order.Gateway })); str = "ERROR"; } return(str); }
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(); } }
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)); } } } }
protected override void AttachChildControls() { int.TryParse(base.GetParameter("modeId", false), out this.paymentModeId); decimal.TryParse(base.GetParameter("blance", false), 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.btnConfirm = ButtonManager.Create(this.FindControl("btnConfirm")); PageTitle.AddSiteNameTitle("充值确认"); this.btnConfirm.Click += this.btnConfirm_Click; if (!this.Page.IsPostBack) { if (this.paymentModeId == 0 || this.balance == decimal.Zero) { this.Page.Response.Redirect("/"); } 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; } } } }
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)); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.Request.QueryString["orderId"] != null) { string orderId = Page.Request.QueryString["orderId"]; OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); if (orderInfo != null) { if (orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode == null) { Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在</font></div>"); } else { string showUrl = Globals.FullPath(Globals.GetSiteUrls().Home); if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { orderInfo.OrderId })); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { orderInfo.OrderId })); } 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; } PaymentRequest.CreateInstance(paymentMode.Gateway, Cryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest(); } } else { Page.Response.Write("订单当前状态不能支付"); } } } }
private void btnPay_Click(object sender, EventArgs e) { string orderId = this.hdorderId.Value; int result = 0; int.TryParse(this.dropPayType.SelectedValue, out result); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(result); if (paymentMode != null) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); orderInfo.PaymentTypeId = paymentMode.ModeId; orderInfo.PaymentType = paymentMode.Name; orderInfo.Gateway = paymentMode.Gateway; TradeHelper.UpdateOrderPaymentType(orderInfo); } this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("sendPayment", new object[] { orderId })); }
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("PaymentReturn_url", new object[] { this.Gateway })) + "?" + this.Page.Request.Url.Query; } this.OrderId = this.Notify.GetOrderId(); this.Order = TradeHelper.GetOrderInfo(this.OrderId); if (this.Order == null) { this.ResponseStatus(true, "ordernotfound"); } else { this.Amount = this.Notify.GetOrderAmount(); if (this.Amount <= 0m) { this.Amount = this.Order.GetTotal(); } this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId(); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.Order.PaymentTypeId); if (paymentMode == 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(paymentMode.Settings)); } } }
protected override void AttachChildControls() { this.lblPaymentName = (Label)this.FindControl("lblPaymentName"); this.lblDescription = (Label)this.FindControl("lblDescription"); this.orderId = this.Page.Request.QueryString["orderId"]; PageTitle.AddSiteNameTitle("订单线下支付", HiContext.Current.Context); if (string.IsNullOrEmpty(this.orderId)) { base.GotoResourceNotFound(); } if (!this.Page.IsPostBack) { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(TradeHelper.GetOrderInfo(this.orderId).PaymentTypeId); if (paymentMode != null) { this.lblPaymentName.Text = paymentMode.Name; this.lblDescription.Text = paymentMode.Description; } } }
protected override void AttachChildControls() { this.lblPaymentName = (Label)this.FindControl("lblPaymentName"); this.lblDescription = (Label)this.FindControl("lblDescription"); this.orderId = base.GetParameter("orderId", false); PageTitle.AddSiteNameTitle("订单线下支付"); if (string.IsNullOrEmpty(this.orderId)) { base.GotoResourceNotFound(); } if (!this.Page.IsPostBack) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode != null) { this.lblPaymentName.Text = paymentMode.Name; this.lblDescription.Text = paymentMode.Description; } } }
private void btnPay_Click(object sender, EventArgs e) { string value = this.hdorderId.Value; int modeId = 0; int.TryParse(this.dropPayType.SelectedValue, out modeId); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(modeId); if (paymentMode != null) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(value); orderInfo.PaymentTypeId = paymentMode.ModeId; orderInfo.PaymentType = paymentMode.Name; orderInfo.Gateway = paymentMode.Gateway; TradeHelper.UpdateOrderPaymentType(orderInfo); } this.Page.Response.Redirect(base.GetRouteUrl("sendPayment", new { orderId = value })); }
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 = 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(); } }
protected void Page_Load(object sender, EventArgs e) { string parameter = RouteConfig.GetParameter(this, "orderId", false); this.order = TradeHelper.GetOrderInfo(parameter); this.ChoiceBankDIV.Visible = false; if (this.order == null) { this.RedirectToPayDIV.InnerHtml = "您要付款的订单已经不存在,请联系管理员确定"; } else if (this.order.OrderStatus != OrderStatus.WaitBuyerPay) { this.RedirectToPayDIV.InnerHtml = "订单当前状态不能支付"; } else { if (this.order.CountDownBuyId > 0) { string empty = string.Empty; foreach (KeyValuePair <string, LineItemInfo> lineItem in this.order.LineItems) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, this.order.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, out empty, this.order.StoreId); if (countDownInfo == null) { this.RedirectToPayDIV.InnerHtml = empty; return; } } } this.paymode = TradeHelper.GetPaymentMode(this.order.PaymentTypeId); if (this.paymode == null) { this.RedirectToPayDIV.InnerHtml = "您之前选择的支付方式已经不存在,请联系管理员修改支付方式"; } else { Dictionary <string, LineItemInfo> lineItems = this.order.LineItems; foreach (LineItemInfo value in lineItems.Values) { int productId = value.ProductId; SiteSettings masterSettings = SettingsManager.GetMasterSettings(); ProductInfo productSimpleInfo = ProductBrowser.GetProductSimpleInfo(productId); if (productSimpleInfo == null || productSimpleInfo.SaleStatus == ProductSaleStatus.Delete) { base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除")); return; } if (productSimpleInfo.SaleStatus == ProductSaleStatus.OnStock) { base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库")); return; } if (!productSimpleInfo.Skus.ContainsKey(value.SkuId)) { base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单中有商品规格不存在")); return; } } string str = ""; if (this.order == null || !TradeHelper.CheckOrderStockBeforePay(this.order, out str)) { base.Response.Redirect("/ResourceNotFound.aspx?errorMsg=" + Globals.UrlDecode(str + ",库存不足,不能进行支付")); } else if (!this.Page.IsPostBack) { string showUrl = "/user/UserOrders"; if (this.paymode.Gateway.ToLower() != "hishop.plugins.payment.podrequest") { showUrl = ((!(this.order.ParentOrderId == "-1")) ? base.Server.UrlEncode($"http://{base.Request.Url.Host}/user/OrderDetails.aspx?OrderId={this.order.OrderId}") : base.Server.UrlEncode($"http://{base.Request.Url.Host}/user/UserOrders.aspx?ParentOrderId={this.order.OrderId}")); } if (string.Compare(this.paymode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { base.Response.Redirect(Globals.FullPath(base.GetRouteUrl("bank_pay", new { orderId = this.order.OrderId }))); } if (string.Compare(this.paymode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { base.Response.Redirect(Globals.FullPath(base.GetRouteUrl("advance_pay", new { orderId = this.order.OrderId }))); } string attach = ""; HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.UserId.ToString()]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { attach = httpCookie.Value; } if (this.paymode.Gateway.ToLower() == "hishop.plugins.payment.alipay_bank.bankrequest") { this.RedirectToPayDIV.Visible = false; this.ChoiceBankDIV.Visible = true; } else { parameter += this.order.PayRandCode; try { string hIGW = this.paymode.Gateway.Replace(".", "_"); PaymentRequest paymentRequest = PaymentRequest.CreateInstance(this.paymode.Gateway, HiCryptographer.Decrypt(this.paymode.Settings), parameter, this.GetPayMoney(this.order), "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })), Globals.FullPath(base.GetRouteUrl("PaymentNotify_url", new { HIGW = hIGW })), attach); paymentRequest.SendRequest(); } catch (Exception ex) { if (!(ex is ThreadAbortException)) { base.Response.Write("<h2>支付配置错误,请联系管理员.(" + ex.Message + ")<h2>"); } } } } } } }
private void btnPay_Click(object sender, EventArgs e) { string value = this.hdorderId.Value; int modeId = 0; int.TryParse(this.dropPayType.SelectedValue, out modeId); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(modeId); OrderInfo orderInfo = TradeHelper.GetOrderInfo(value); string msg = ""; if (!TradeHelper.CheckOrderStock(orderInfo, out msg)) { this.ShowMessage(msg, false, "", 1); } else { IList <string> list = new List <string>(); list.Add("hishop.plugins.payment.podrequest"); list.Add("hishop.plugins.payment.bankrequest"); if (orderInfo.CountDownBuyId > 0) { if (list.Contains(paymentMode.Gateway.ToLower().Trim())) { msg = "限购的订单不支持货到付款和线下支付"; this.ShowMessage(msg, false, "", 1); return; } foreach (LineItemInfo value2 in orderInfo.LineItems.Values) { CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(value2.ProductId, orderInfo.CountDownBuyId, value2.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out msg, orderInfo.StoreId); if (countDownInfo == null) { this.ShowMessage(msg, false, "", 1); return; } } } if (orderInfo.FightGroupId > 0) { if (paymentMode == null || (!TradeHelper.GatewayIsCanBackReturn(paymentMode.Gateway) && paymentMode.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1))) { this.ShowMessage("火拼团订单不支付该支付方式进行支付", false, "", 1); return; } foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems) { FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem.Value.Quantity, out msg); if (fightGroupActivityInfo == null) { this.ShowMessage(msg, false, "", 1); return; } } } if (orderInfo.GroupBuyId > 0 && list.Contains(paymentMode.Gateway.ToLower().Trim())) { msg = "团购的订单不支持货到付款和线下支付"; this.ShowMessage(msg, false, "", 1); } else { if (orderInfo.PreSaleId > 0) { if (paymentMode.Gateway.ToLower().Trim() == "hishop.plugins.payment.podrequest") { this.ShowMessage("预售订单不支持货到付款", false, "", 1); return; } ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo == null) { this.ShowMessage("预售活动不存在,不能支付", false, "", 1); return; } if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now) { this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1); return; } if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { this.ShowMessage("尾款支付尚未开始", false, "", 1); return; } DateTime dateTime = productPreSaleInfo.PaymentEndDate; DateTime date = dateTime.Date; dateTime = DateTime.Now; if (date < dateTime.Date) { this.ShowMessage("尾款支付已结束", false, "", 1); return; } } } if (paymentMode != null) { orderInfo.PaymentTypeId = paymentMode.ModeId; orderInfo.PaymentType = paymentMode.Name; orderInfo.Gateway = paymentMode.Gateway; TradeHelper.UpdateOrderPaymentType(orderInfo); } this.Page.Response.Redirect(base.GetRouteUrl("sendPayment", new { orderId = value })); } } }
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, System.EventArgs e) { string orderId = this.Page.Request.QueryString["orderId"]; OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId); if (orderInfo == null) { base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>"); return; } if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) { this.Page.Response.Write("订单当前状态不能支付"); return; } if (orderInfo.CountDownBuyId > 0) { CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId); if (countDownInfoByCountDownId == null || countDownInfoByCountDownId.EndDate < System.DateTime.Now) { this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在"); return; } } PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId); if (paymentMode == null) { base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>"); return; } System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems; foreach (LineItemInfo current in lineItems.Values) { int productId = current.ProductId; ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(productId, new int?(6), new int?(6)); if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete) { base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除")); return; } if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock) { base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库")); return; } ProductInfo product = productBrowseInfo.Product; int stock = product.Stock; int shipmentQuantity = current.ShipmentQuantity; if (shipmentQuantity > stock) { base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足")); return; } } string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders"); if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest") { showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId)); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { orderInfo.OrderId })); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { orderInfo.OrderId })); } 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; } PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), attach); paymentRequest.SendRequest(); }
private void DoValidate() { string text = ""; NameValueCollection nameValueCollection = new NameValueCollection { this.Page.Request.Form, this.Page.Request.QueryString }; this.Gateway = base.GetParameter("HIGW", false); if (!string.IsNullOrEmpty(this.Gateway)) { this.Gateway = this.Gateway.ToLower().Replace("_", "."); if (this.Gateway.ToLower().IndexOf("cmpay.d") > -1) { this.Gateway = this.Gateway.ToLower().Replace("cmpay.d", "cmpay_d"); } } else { this.Gateway = ""; } if (this.Gateway == "hishop.plugins.payment.alipayqrcode.qrcoderequest" && nameValueCollection["goods_id"] != null && nameValueCollection["goods_id"] != "") { this.ValidateQRCode(nameValueCollection); } else { if (this.Gateway == "hishop.plugins.payment.wxqrcode.wxqrcoderequest") { string wXQRCodePayResult = this.GetWXQRCodePayResult(); nameValueCollection.Add("notify_data", wXQRCodePayResult); } if (this.Gateway == "hishop.plugins.payment.alipayforextrade") { nameValueCollection.Add("IsReturn", this.isBackRequest ? "false" : "true"); } if (this.Gateway == "hishop.plugins.payment.alipaydirect.directrequest") { if (this.isBackRequest) { nameValueCollection = new NameValueCollection { this.Page.Request.Form }; } else { nameValueCollection = new NameValueCollection { this.Page.Request.QueryString }; nameValueCollection.Add("IsReturn", this.isBackRequest ? "false" : "true"); } } this.Notify = PaymentNotify.CreateInstance(this.Gateway, nameValueCollection); if (this.isBackRequest) { string hIGW = this.Gateway.Replace(".", "_"); this.Notify.ReturnUrl = Globals.FullPath(base.GetRouteUrl("PaymentReturn_url", new { HIGW = hIGW })) + "?" + this.Page.Request.Url.Query; } this.OrderId = this.Notify.GetOrderId(); this.Order = TradeHelper.GetOrderInfo(this.OrderId); if (this.Order == null) { Globals.AppendLog(this.pageParam, "订单信息为空", "", "", "PayNotify"); this.ResponseStatus(true, "ordernotfound"); } else { text = "OrderId:" + this.OrderId; try { this.Amount = this.Notify.GetOrderAmount(); } catch { this.Amount = default(decimal); } if (this.Amount <= decimal.Zero) { this.Amount = this.Order.GetTotal(true); } text = text + "--Amount:" + this.Amount; this.hasNotify = !string.IsNullOrEmpty(this.Order.GatewayOrderId); if (this.Order.PreSaleId > 0 && this.Order.DepositGatewayOrderId.ToNullString() == this.Notify.GetGatewayOrderId()) { this.ResponseStatus(true, "预售订单订金已支付成功"); } else { if (this.Order.PreSaleId > 0 && !this.Order.DepositDate.HasValue) { this.Order.DepositGatewayOrderId = this.Notify.GetGatewayOrderId(); } else { this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId(); } text = text + "--GateWayOrderId:" + this.Notify.GetGatewayOrderId(); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.Order.PaymentTypeId); if (paymentMode == null) { Globals.WriteLog(nameValueCollection, "支付方式没找到" + this.Gateway, "", "", "PayNotify"); this.ResponseStatus(true, "gatewaynotfound"); } else { this.Notify.Finished += this.Notify_Finished; this.Notify.NotifyVerifyFaild += this.Notify_NotifyVerifyFaild; this.Notify.Payment += this.Notify_Payment; try { this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings)); } catch (Exception ex) { if (!(ex is ThreadAbortException)) { Globals.WriteLog(nameValueCollection, ex.Message + "---程序错误1---" + this.Gateway, "", "", "PayNotify"); } } } } } } }
public void ValidateQRCode(NameValueCollection parameters) { string str = ""; this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters); string text = ""; string text2 = ""; string text3 = ""; int num = 0; decimal d = default(decimal); text = this.Page.Request["sign"]; text2 = this.Page.Request["goods_id"]; int.TryParse(this.Page.Request["quantity"], out num); decimal.TryParse(this.Page.Request["price"], out d); Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary = this.getParamDict(parameters); string str2 = PaymentTemplatedWebControl.BuildQuery(dictionary, false); string orderId = text2; this.Order = TradeHelper.GetOrderInfo(orderId); if (this.Order == null) { Globals.WriteLog(parameters, "订单信息为空" + this.Gateway, "", "", "PayNotify"); text3 = "PARAM_ILLEGAL"; } else { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.Order.PaymentTypeId); if (paymentMode == null) { Globals.WriteLog(parameters, "支付方式为空" + this.Gateway, "", "", "PayNotify"); text3 = "PARAM_ILLEGAL"; } else { Globals.EntityCoding(paymentMode, false); ConfigData configData = new ConfigData(HiCryptographer.Decrypt(paymentMode.Settings)); string text4 = configData.SettingsXml.ToLower(); if (text4.IndexOf("<key>") > -1 && text4.IndexOf("</key>") > -1) { str = text4.Substring(text4.IndexOf("<key>") + 5, text4.IndexOf("</key>") - text4.IndexOf("<key>") - 5); } string b = FormsAuthentication.HashPasswordForStoringInConfigFile(str2 + str, "MD5").ToLower(); if (this.Order.GetTotal(true) != d) { Globals.WriteLog(parameters, "支付金额与订单金额不匹配" + this.Gateway, "", "", "PayNotify"); text3 = "PRICE_NOT_MATCH"; } if (text != b) { Globals.WriteLog(parameters, "签名不匹配" + this.Gateway, "", "", "PayNotify"); text3 = "PARAM_ILLEGAL"; } } } HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "application/json"; StringBuilder stringBuilder = new StringBuilder("{"); if (text3 != "") { stringBuilder.AppendFormat("is_success:\"F\",error_code:\"{0}\"", text3); } else { stringBuilder.AppendFormat("is_success:\"T\",out_trade_no:\"{0}\"", this.Order.OrderId); } stringBuilder.Append("}"); HttpContext.Current.Response.Write(stringBuilder.ToString()); HttpContext.Current.Response.End(); }
private void btnPay_Click(object sender, System.EventArgs e) { string value = this.hdorderId.Value; int modeId = 0; int.TryParse(this.dropPayType.SelectedValue, out modeId); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(modeId); if (paymentMode != null) { OrderInfo orderInfo = TradeHelper.GetOrderInfo(value); orderInfo.PaymentTypeId = paymentMode.ModeId; orderInfo.PaymentType = paymentMode.Name; orderInfo.Gateway = paymentMode.Gateway; TradeHelper.UpdateOrderPaymentType(orderInfo); orderInfo = TradeHelper.GetOrderInfo(value); } try { List <OrderInfo> listChildOrder = ShoppingProcessor.GetChildOrdersBySourceOrder(value); string orderIdstr = ""; List <string> orderIdIdList = new List <string>(); if (listChildOrder != null && listChildOrder.Count > 0) { listChildOrder.ForEach(t => { //单品券 if (!string.IsNullOrWhiteSpace(t.OrderId)) { string ordeId = "'" + t.OrderId + "'"; orderIdIdList.Add(ordeId); } }); } if (orderIdIdList != null && orderIdIdList.Count > 0) { orderIdstr = string.Join(",", orderIdIdList.Distinct().ToArray()); } if (!string.IsNullOrWhiteSpace(orderIdstr)) { if (paymentMode != null) { OrderInfo orderInfo = new OrderInfo(); orderInfo.PaymentTypeId = paymentMode.ModeId; orderInfo.PaymentType = paymentMode.Name; orderInfo.Gateway = paymentMode.Gateway; TradeHelper.ModifyOrderPaymentType(orderInfo, orderIdstr); } } } catch { } //判断为微信扫码支付 //if (paymentMode.Settings == "1hSUSkKQ/ENo0JDZah8KKQweixin") if (paymentMode.Gateway.ToLower() == "Ecdev.plugins.payment.WxpayQrCode.QrCodeRequest".ToLower()) { Member member = Users.GetUser(HiContext.Current.User.UserId, false) as Member; this.Page.Response.Redirect("/FinishOrder.aspx?orderId=" + value + "&umid=" + member.UserId.ToString()); } else { this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("sendPayment", new object[] { value })); } }
protected void Page_Load(object sender, EventArgs e) { string text = ""; PaymentModeInfo paymentModeInfo = null; NameValueCollection form = base.Request.Form; string parameter = this.GetParameter("FOR"); string parameter2 = this.GetParameter("HIGW"); if (string.IsNullOrEmpty(parameter2)) { parameter2 = this.GetParameter("Gateway"); } try { NameValueCollection param = new NameValueCollection { base.Request.Form, base.Request.QueryString }; if (string.IsNullOrEmpty(parameter2)) { base.Response.Write("fail"); Globals.WriteLog(param, "网关信息为空", "", "", "Outpay"); throw new Exception("网关信息为空-支付宝通知"); } paymentModeInfo = TradeHelper.GetPaymentMode(parameter2); if (paymentModeInfo == null) { base.Response.Write("fail"); Globals.WriteLog(param, "网关信息错误---" + parameter2, "", "", "Outpay"); throw new Exception("网关信息错误-支付宝通知"); } string configXml = HiCryptographer.Decrypt(paymentModeInfo.Settings); this.Notify = Hishop.Plugins.OutpayNotify.CreateInstance(parameter2, form); if (this.Notify == null) { base.Response.Write("fail"); Globals.WriteLog(param, "创建回调实例失败---" + parameter2, "", "", "Outpay"); throw new Exception("创建回调实例失败-支付宝通知"); } bool flag = false; try { flag = this.Notify.VerifyNotify(600, configXml); } catch (Exception ex) { Globals.AppendLog(param, "通知网关或者验签失败" + ex.Message + "-" + parameter2, "", "", "Outpay"); base.Response.Write("fail"); base.Response.End(); throw new Exception("通知网关或者验签失败-支付宝通知"); } if (flag) { IList <string> outpayId = this.Notify.GetOutpayId(); IList <string> gatewayOrderId = this.Notify.GetGatewayOrderId(); IList <decimal> orderAmount = this.Notify.GetOrderAmount(); IList <DateTime> payTime = this.Notify.GetPayTime(); IList <bool> status = this.Notify.GetStatus(); IList <string> errMsg = this.Notify.GetErrMsg(); if (outpayId == null || gatewayOrderId == null || orderAmount == null || payTime == null || outpayId.Count == 0 || gatewayOrderId.Count == 0 || orderAmount.Count == 0 || payTime.Count == 0) { Globals.AppendLog(param, "获取返回参数错误,参数为空-" + parameter2, "", "", "Outpay"); } else if (outpayId.Count != gatewayOrderId.Count || outpayId.Count != orderAmount.Count || outpayId.Count != payTime.Count) { Globals.AppendLog(param, "获取返回参数错误,参数不匹配-" + parameter2, "", "", "Outpay"); } else { string text2 = ""; string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; string text7 = ""; string text8 = ""; for (int i = 0; i < outpayId.Count; i++) { if (outpayId[i].ToLower().StartsWith("pre")) { if (outpayId[i].Length > 5) { text8 = outpayId[i].Substring(5); } } else { text8 = outpayId[i]; } text = text + text8 + ","; text2 = text2 + ((i == 0) ? "" : ",") + text8; text3 = text3 + ((i == 0) ? "" : ",") + gatewayOrderId[i]; text4 = text4 + ((i == 0) ? "" : ",") + orderAmount[i]; text5 = text5 + ((i == 0) ? "" : ",") + payTime[i]; text6 = text6 + ((i == 0) ? "" : ",") + status[i].ToString(); text7 = text7 + ((i == 0) ? "" : ",") + errMsg[i]; if (status[i]) { this.CheckResult(parameter.ToNullString(), outpayId[i], true, ""); } else { this.CheckResult(parameter.ToNullString(), outpayId[i], false, errMsg[i]); } } text = text.TrimEnd(','); IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("outpayIdLists", text2); dictionary.Add("getwayOrderIdLists", text3); dictionary.Add("payAmountLists", text4); dictionary.Add("payTimeLists", text5); dictionary.Add("IsSuccesss", text6); dictionary.Add("ErrMsgs", text7); base.Response.Write("success"); } goto end_IL_004c; } Globals.AppendLog(param, "验签失败-" + parameter2, "", "", "Outpay"); base.Response.Write("fail"); throw new Exception("验签失败-支付宝通知"); end_IL_004c :; } catch (Exception ex2) { if (parameter.ToLower().Equals("balancedraw")) { MemberHelper.OnLineBalanceDrawRequest_Alipay_AllError(text, ex2.Message); } else if (parameter.ToLower().Equals("splittin")) { MemberHelper.OnLineSplittinDraws_Alipay_AllError(text, ex2.Message); } else if (parameter.ToLower().Equals("balancedraw4supplier")) { BalanceHelper.OnLineBalanceDraws_Alipay_AllError(text, ex2.Message); } else if (parameter.ToLower().Equals("balancedraw4store")) { StoreBalanceHelper.OnLineBalanceDraws_Alipay_AllError(text, ex2.Message); } } }
public void LoadOrderInfo() { PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(ShoppingProcessor.GetPaymentGateway(EnumPaymentType.OfflinePay)); if (paymentMode != null) { this.litOfflinePayContent.SetWhenIsNotNull(paymentMode.Description); } this.hidOrderid.Value = this.orderId; OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId); if (orderInfo == null || (orderInfo.UserId != 0 && orderInfo.UserId != HiContext.Current.UserId)) { base.GotoResourceNotFound(); return; } MemberInfo user = Users.GetUser(HiContext.Current.UserId); this.hidHasTradePassword.Value = (string.IsNullOrWhiteSpace(user.TradePassword) ? "0" : "1"); if (orderInfo.ParentOrderId == "-1") { this.orderLink.HRef = base.GetRouteUrl("user_OrderList", new { ParentOrderId = this.orderId }); this.litOrderId.Text = OrderHelper.GetOrderIdsByParent(orderInfo.OrderId).Replace(",", " "); } else { this.orderLink.HRef = base.GetRouteUrl("user_OrderDetails", new { OrderId = this.orderId }); this.litOrderId.Text = orderInfo.OrderId; } IList <string> paymentTypes = new List <string>(); paymentTypes.Add("hishop.plugins.payment.podrequest"); paymentTypes.Add("hishop.plugins.payment.bankrequest"); paymentTypes.Add("hishop.plugins.payment.advancerequest"); if (orderInfo.PreSaleId > 0) { this.litOrderPrice.Money = orderInfo.Deposit + orderInfo.FinalPayment; } else { this.litOrderPrice.Money = orderInfo.GetTotal(false); } if (orderInfo.PreSaleId > 0) { this.hidIsPreSale.Value = "1"; if (!orderInfo.DepositDate.HasValue) { this.litDeposittxt.Text = "定金:"; this.litDeposit.Money = orderInfo.Deposit; } else { this.litDeposittxt.Text = "尾款:"; this.litDeposit.Money = orderInfo.FinalPayment; } } this.onlinePayPanel.Visible = false; this.offlinePayPanel.Visible = false; int num; if ((orderInfo.PaymentTypeId != -3 || orderInfo.PaymentTypeId != -2) && orderInfo.Gateway != "hishop.plugins.payment.bankrequest" && orderInfo.PaymentType != "到店支付" && orderInfo.Gateway != "hishop.plugins.payment.podrequest") { num = ((orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) ? 1 : 0); goto IL_02ea; } num = 0; goto IL_02ea; IL_02ea: if (num != 0) { this.onlinePayPanel.Visible = true; } else if (orderInfo.Gateway == "hishop.plugins.payment.bankrequest") { this.offlinePayPanel.Visible = true; } string text = ""; text = ((orderInfo.CountDownBuyId <= 0) ? (HiContext.Current.SiteSettings.CloseOrderDays + "天") : (HiContext.Current.SiteSettings.CountDownTime + "分钟")); PaymentModeInfo paymentMode2 = TradeHelper.GetPaymentMode("hishop.plugins.payment.podrequest"); bool flag = false; if ((orderInfo.Gateway == "hishop.plugins.payment.podrequest" || (paymentMode2 != null && paymentMode2.ModeId == orderInfo.PaymentTypeId)) && orderInfo.PreSaleId <= 0) { flag = true; } switch (orderInfo.OrderStatus) { case OrderStatus.WaitBuyerPay: if (base.GetParameter("t", false).ToNullString() == "1") { this.promptMsg.InnerHtml = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!"; this.msgTitle.InnerHtml = "付款不成功,请重新支付!"; this.divfinish.Visible = true; this.onlinePayPanel.Visible = false; this.divOrderPayInfo.Visible = false; this.imgPayResult.Src = "/templates/pccommon/images/cart/ordererror.png"; } if (orderInfo.PreSaleId > 0) { if (orderInfo.DepositDate.HasValue) { this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。"; this.msgTitle.InnerHtml = "恭喜您,您的定金已支付成功!"; } else { this.promptMsg.InnerHtml = "请支付定金。"; this.msgTitle.InnerHtml = "订单提交成功,请您尽快支付定金!"; } this.divfinish.Visible = true; } if (flag) { this.msgTitle.InnerHtml = "货到付款订单提交成功,平台将及时给您发货"; } break; case OrderStatus.BuyerAlreadyPaid: if (orderInfo.PaymentType == "上门自提") { this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您备货。"; this.msgTitle.InnerHtml = "恭喜您,您的订单已支付成功!"; } else { this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。"; this.msgTitle.InnerHtml = "恭喜您,您的订单已支付成功!"; } this.divfinish.Visible = true; break; case OrderStatus.Closed: this.promptMsg.InnerHtml = "您的订单已关闭,关闭原因:" + orderInfo.CloseReason + "。"; this.msgTitle.InnerHtml = "您的订单已关闭!"; this.divfinish.Visible = true; break; case OrderStatus.Finished: this.promptMsg.InnerHtml = "您的订单已完成."; this.msgTitle.InnerHtml = "恭喜您,您的订单已完成!"; this.divfinish.Visible = true; break; case OrderStatus.SellerAlreadySent: this.promptMsg.InnerHtml = "您的订单已发货,请注意收货。"; this.msgTitle.InnerHtml = "恭喜您,您的订单已发货!"; this.divfinish.Visible = true; break; default: this.promptMsg.InnerHtml = "您的订单已提交成功。"; this.divfinish.Visible = true; break; } if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid) { this.promptMsg.InnerHtml = "您的订单已支付成功,平台将及时给您发货。"; } else if (orderInfo.PaymentTypeId != -3 && !flag && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay) { DateTime dateTime; if (base.GetParameter("t", false).ToNullString() == "1") { if (orderInfo.PreSaleId > 0 && orderInfo.DepositDate.HasValue) { this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。"; ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo.PaymentStartDate > DateTime.Now) { HtmlGenericControl htmlGenericControl = this.promptMsg; string[] obj = new string[5] { "定金支付成功,请您在", null, null, null, null }; dateTime = productPreSaleInfo.PaymentStartDate; obj[1] = dateTime.ToString("yyyy-MM-dd"); obj[2] = "至"; dateTime = productPreSaleInfo.PreSaleEndDate; obj[3] = dateTime.ToString("yyyy-MM-dd"); obj[4] = "之间支付尾款,过期定金将不予以退还,请您谅解!"; htmlGenericControl.InnerHtml = string.Concat(obj); this.onlinePayPanel.Visible = false; } } else { this.promptMsg.InnerHtml = "银行系统可能会出现延时,如您已经支付,请耐心等待或者联系商家客服!"; } } else if (orderInfo.PreSaleId > 0) { if (orderInfo.DepositDate.HasValue) { this.promptMsg.InnerHtml = "定金支付成功,请按时支付尾款。"; ProductPreSaleInfo productPreSaleInfo2 = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId); if (productPreSaleInfo2.PaymentStartDate > DateTime.Now) { HtmlGenericControl htmlGenericControl2 = this.promptMsg; string[] obj2 = new string[5] { "定金支付成功,请您在", null, null, null, null }; dateTime = productPreSaleInfo2.PaymentStartDate; obj2[1] = dateTime.ToString("yyyy-MM-dd"); obj2[2] = "至"; dateTime = productPreSaleInfo2.PaymentStartDate; obj2[3] = dateTime.ToString("yyyy-MM-dd"); obj2[4] = "之间支付尾款,过期定金将不予以退还,请您谅解!"; htmlGenericControl2.InnerHtml = string.Concat(obj2); this.onlinePayPanel.Visible = false; } } else { this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成定金支付,否则订单自动取消。"; } } else { this.promptMsg.InnerHtml = "请您在订单提交后 <em>" + text + "</em>内完成支付,否则订单自动取消。"; } } else if (flag) { this.promptMsg.InnerHtml = "您的订单选择了货到付款,平台将及时给您发货。"; } else if (orderInfo.PaymentTypeId == -3) { this.promptMsg.InnerHtml = "您的订单选择了上门自提,门店正在备货中。"; } if (this.onlinePayPanel.Visible) { DataTable dataTable = new DataTable(); dataTable.Columns.Add(new DataColumn("ModeId")); dataTable.Columns.Add(new DataColumn("Name")); dataTable.Columns.Add(new DataColumn("GateWay")); dataTable.Columns.Add(new DataColumn("Description")); dataTable.Columns.Add(new DataColumn("OutHtml")); IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes(PayApplicationType.payOnPC); paymentModes = (from item in paymentModes where !paymentTypes.Contains(item.Gateway) select item).ToList(); if (HiContext.Current.UserId != 0 && HiContext.Current.User.IsOpenBalance) { PaymentModeInfo paymentMode3 = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.advancerequest"); if (paymentMode3 != null) { this.AdvanceId.Value = paymentMode3.ModeId.ToString(); paymentModes.Add(paymentMode3); } } if (paymentModes.Count == 0) { this.ShowMessage("商城暂未配置支付方式,请稍后支付。", false, "", 1); this.onlinePayPanel.Visible = false; } else { decimal num2 = default(decimal); if (HiContext.Current.User != null && HiContext.Current.User.UserId > 0) { num2 = HiContext.Current.User.Balance - HiContext.Current.User.RequestBalance; } string format = "<a class=\"pic\"><b><img src=\"/pay/images/{0}.png\" alt=\"{1}\"></b> <span>{1}</span></a>"; string text2 = "<a class=\"name\"><em>{0}</em> <b>可用余额 ¥{1}</b> <span><a href=\"/user/RechargeRequest.aspx\" target=\"_blank\" style=\"line-height:4.5\">去充值</a></span></a>"; string format2 = "<a class=\"name\"><em>{0}</em></a>"; int num3 = 0; foreach (PaymentModeInfo item in paymentModes) { if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest") && (orderInfo.FightGroupActivityId <= 0 || TradeHelper.GatewayIsCanBackReturn(item.Gateway) || !(item.Gateway.ToLower() != "hishop.plugins.payment.advancerequest"))) { DataRow dataRow = dataTable.NewRow(); dataRow["ModeId"] = item.ModeId; dataRow["Name"] = item.Name; dataRow["Gateway"] = item.Gateway; dataRow["Description"] = item.Description; if (!(item.Gateway.ToLower() == "hishop.plugins.payment.advancerequest")) { if (File.Exists(this.Page.Server.MapPath("/pay/images/" + item.Gateway + ".png"))) { dataRow["OutHtml"] = string.Format(format, item.Gateway, item.Name); } else { dataRow["OutHtml"] = string.Format(format2, item.Name); } dataTable.Rows.Add(dataRow); num3++; } } } this.paymentModeList.DataSource = dataTable; this.paymentModeList.DataBind(); } } }