public void Notify() { // 使用Dictionary保存参数 Dictionary <string, string> resData = new Dictionary <string, string>(); IFormCollection forms = Request.Form; string[] requestItem = forms.Keys.ToArray(); for (int i = 0; i < requestItem.Length; i++) { resData.Add(requestItem[i], Request.Form[requestItem[i]]); } // 验证成功 if (Factory.Payment.Common().VerifyNotify(resData) == true) { AliPayNotify.Add(resData); //string json = JsonConvert.SerializeObject(resData, Formatting.Indented); //Utils.WriteLog($"{DateTime.Now.ToString()}-验证成功:" + json); } }
protected void Page_Load(object sender, EventArgs e) { int num = 0; SortedDictionary <string, string> requestPost = this.GetRequestPost(); if (requestPost.Count > 0) { string openIdType = "hishop.plugins.openid.alipay.alipayservice"; OpenIdSettingsInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType); if (openIdSettings == null) { base.Response.Write("登录失败,没有找到对应的插件配置信息。"); return; } XmlDocument document = new XmlDocument(); document.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings)); AliPayNotify notify = new AliPayNotify(requestPost, base.Request.Form["notify_id"], document.FirstChild.SelectSingleNode("Partner").InnerText, document.FirstChild.SelectSingleNode("Key").InnerText); string responseTxt = notify.ResponseTxt; string str3 = base.Request.Form["sign"]; string mysign = notify.Mysign; if ((responseTxt == "true") && (str3 == mysign)) { string str5 = base.Request.Form["receive_address"]; if (!string.IsNullOrEmpty(str5)) { XmlDocument document2 = new XmlDocument(); document2.LoadXml(str5); ShippingAddressInfo shippingAddress = new ShippingAddressInfo(); shippingAddress.UserId = HiContext.Current.User.UserId; if ((document2.SelectSingleNode("/receiveAddress/address") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/address").InnerText)) { shippingAddress.Address = Globals.HtmlEncode(document2.SelectSingleNode("/receiveAddress/address").InnerText); } if ((document2.SelectSingleNode("/receiveAddress/fullname") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/fullname").InnerText)) { shippingAddress.ShipTo = Globals.HtmlEncode(document2.SelectSingleNode("/receiveAddress/fullname").InnerText); } if ((document2.SelectSingleNode("/receiveAddress/post") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/post").InnerText)) { shippingAddress.Zipcode = document2.SelectSingleNode("/receiveAddress/post").InnerText; } if ((document2.SelectSingleNode("/receiveAddress/mobile_phone") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText)) { shippingAddress.CellPhone = document2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText; } if ((document2.SelectSingleNode("/receiveAddress/phone") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/phone").InnerText)) { shippingAddress.TelPhone = document2.SelectSingleNode("/receiveAddress/phone").InnerText; } string innerText = string.Empty; string str7 = string.Empty; string str8 = string.Empty; if ((document2.SelectSingleNode("/receiveAddress/area") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/area").InnerText)) { innerText = document2.SelectSingleNode("/receiveAddress/area").InnerText; } if ((document2.SelectSingleNode("/receiveAddress/city") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/city").InnerText)) { str7 = document2.SelectSingleNode("/receiveAddress/city").InnerText; } if ((document2.SelectSingleNode("/receiveAddress/prov") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/prov").InnerText)) { str8 = document2.SelectSingleNode("/receiveAddress/prov").InnerText; } if ((string.IsNullOrEmpty(innerText) && string.IsNullOrEmpty(str7)) && string.IsNullOrEmpty(str8)) { shippingAddress.RegionId = 0; } else { shippingAddress.RegionId = RegionHelper.GetRegionId(innerText, str7, str8); } SiteSettings siteSettings = HiContext.Current.SiteSettings; if (PersonalHelper.GetShippingAddressCount(HiContext.Current.User.UserId) < HiContext.Current.Config.ShippingAddressQuantity) { num = PersonalHelper.AddShippingAddress(shippingAddress); } } } } this.Page.Response.Redirect(Globals.ApplicationPath + "/SubmmitOrder.aspx?shippingId=" + num); }
protected void Page_Load(object sender, EventArgs e) { int num = 0; SortedDictionary <string, string> requestPost = this.GetRequestPost(); if (requestPost.Count > 0) { string openIdType = "hishop.plugins.openid.alipay.alipayservice"; OpenIdSettingInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType); if (openIdSettings == null) { base.Response.Write("登录失败,没有找到对应的插件配置信息。"); return; } XmlDocument xmlDocument = new XmlDocument(); xmlDocument.XmlResolver = null; xmlDocument.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings)); AliPayNotify aliPayNotify = new AliPayNotify(requestPost, base.Request.Form["notify_id"], xmlDocument.FirstChild.SelectSingleNode("Partner").InnerText, xmlDocument.FirstChild.SelectSingleNode("Key").InnerText); string responseTxt = aliPayNotify.ResponseTxt; string a = base.Request.Form["sign"]; string mysign = aliPayNotify.Mysign; if (responseTxt == "true" && a == mysign) { string text = base.Request.Form["receive_address"]; if (!string.IsNullOrEmpty(text)) { XmlDocument xmlDocument2 = new XmlDocument(); xmlDocument.XmlResolver = null; xmlDocument2.LoadXml(text); ShippingAddressInfo shippingAddressInfo = new ShippingAddressInfo(); shippingAddressInfo.UserId = HiContext.Current.UserId; if (xmlDocument2.SelectSingleNode("/receiveAddress/address") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText)) { shippingAddressInfo.Address = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText); } if (xmlDocument2.SelectSingleNode("/receiveAddress/fullname") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText)) { shippingAddressInfo.ShipTo = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText); } if (xmlDocument2.SelectSingleNode("/receiveAddress/post") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText)) { shippingAddressInfo.Zipcode = xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText; } if (xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText)) { shippingAddressInfo.CellPhone = xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText; } if (xmlDocument2.SelectSingleNode("/receiveAddress/phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText)) { shippingAddressInfo.TelPhone = xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText; } string text2 = string.Empty; string text3 = string.Empty; string text4 = string.Empty; if (xmlDocument2.SelectSingleNode("/receiveAddress/area") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText)) { text2 = xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText; } if (xmlDocument2.SelectSingleNode("/receiveAddress/city") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText)) { text3 = xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText; } if (xmlDocument2.SelectSingleNode("/receiveAddress/prov") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText)) { text4 = xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText; } if (string.IsNullOrEmpty(text2) && string.IsNullOrEmpty(text3) && string.IsNullOrEmpty(text4)) { shippingAddressInfo.RegionId = 0; } else { shippingAddressInfo.RegionId = RegionHelper.GetRegionId(text2, text3, text4); } SiteSettings siteSettings = HiContext.Current.SiteSettings; if (MemberProcessor.GetShippingAddressCount(HiContext.Current.UserId) < HiContext.Current.Config.ShippingAddressQuantity) { shippingAddressInfo.FullRegionPath = RegionHelper.GetFullPath(shippingAddressInfo.RegionId, true); num = MemberProcessor.AddShippingAddress(shippingAddressInfo); } } } } this.Page.Response.Redirect("/SubmmitOrder.aspx?shippingId=" + num); }