Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        /// <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);
        }
Exemple #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="gatewayData">网关数据</param>
 protected GatewayBase(GatewayData gatewayData)
 {
     GatewayData = gatewayData;
 }
Exemple #5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="merchant">商户数据</param>
 /// <param name="gatewayData">网关数据</param>
 protected GatewayBase(IMerchant merchant, GatewayData gatewayData)
 {
     Merchant    = merchant;
     GatewayData = gatewayData;
 }
Exemple #6
0
 /// <summary>
 /// 是否是微信支付网关
 /// </summary>
 /// <param name="gatewayData">网关数据</param>
 /// <returns></returns>
 private static bool IsWechatpayGateway(GatewayData gatewayData)
 {
     return(ExistParameter(wechatpayGatewayVerifyParmaNames, gatewayData));
 }
Exemple #7
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="gatewayData">网关数据</param>
 protected GatewayBase(GatewayData gatewayData)
 {
     this.gatewayData = gatewayData;
 }
Exemple #8
0
 /// <summary>
 /// 初始化未知网关
 /// </summary>
 /// <param name="gatewayData">网关数据</param>
 public NullGateway(GatewayData gatewayData)
     : base(gatewayData)
 {
 }