/// <summary> /// 读取网关发回的数据 /// </summary> /// <returns></returns> public static GatewayData ReadNotifyData() { var gatewayData = new GatewayData(); if (IsGetRequest) { gatewayData.FromUrl(HttpUtil.QueryString); } else { if (IsXmlData) { var reader = new StreamReader(HttpUtil.Body); string xmlData = reader.ReadToEnd(); reader.Dispose(); gatewayData.FromXml(xmlData); } else { try { #if NETSTANDARD2_0 gatewayData.FromForm(HttpUtil.Form); #else gatewayData.FromNameValueCollection(HttpUtil.Form); #endif } catch { } } } return(gatewayData); }
/// <summary> /// 读取网关发回的数据 /// </summary> /// <returns></returns> public static GatewayData ReadNotifyData() { var gatewayData = new GatewayData(); if (IsGetRequest) { gatewayData.FromUrl(HttpUtil.QueryString); } else { if (IsXmlData) { var reader = new StreamReader(HttpUtil.Body); string xmlData = reader.ReadToEnd(); reader.Dispose(); gatewayData.FromXml(xmlData); } else { try { gatewayData.FromForm(HttpUtil.Form); } catch { } } } return(gatewayData); }
/// <summary> /// 网关参数数据项中是否存在指定的所有参数名 /// </summary> /// <param name="parmaName">参数名数组</param> /// <param name="gatewayData">网关数据</param> public static bool ExistParameter(string[] parmaName, GatewayData gatewayData) { int compareCount = 0; foreach (var item in parmaName) { if (gatewayData.Exists(item)) { compareCount++; } } if (compareCount == parmaName.Length) { return(true); } return(false); }
/// <summary> /// 构造函数 /// </summary> /// <param name="gatewayData">网关数据</param> protected GatewayBase(GatewayData gatewayData) { GatewayData = gatewayData; }
/// <summary> /// 构造函数 /// </summary> /// <param name="merchant">商户数据</param> /// <param name="gatewayData">网关数据</param> protected GatewayBase(IMerchant merchant, GatewayData gatewayData) { Merchant = merchant; GatewayData = gatewayData; }
/// <summary> /// 是否是微信支付网关 /// </summary> /// <param name="gatewayData">网关数据</param> /// <returns></returns> private static bool IsWechatpayGateway(GatewayData gatewayData) { return(ExistParameter(wechatpayGatewayVerifyParmaNames, gatewayData)); }
/// <summary> /// 构造函数 /// </summary> /// <param name="gatewayData">网关数据</param> protected GatewayBase(GatewayData gatewayData) { this.gatewayData = gatewayData; }
/// <summary> /// 初始化未知网关 /// </summary> /// <param name="gatewayData">网关数据</param> public NullGateway(GatewayData gatewayData) : base(gatewayData) { }