/// <summary> /// 获取网关 /// </summary> /// <param name="gateways">网关列表</param> /// <returns></returns> public static GatewayBase GetGateway(IGateways gateways) { var gatewayData = ReadNotifyData(); GatewayBase gateway = null; foreach (var item in gateways.GetList()) { if (ExistParameter(item.NotifyVerifyParameter, gatewayData)) { if (item.Merchant.AppId == gatewayData .GetStringValue(item.NotifyVerifyParameter.FirstOrDefault())) { gateway = item; break; } } } if (gateway is null) { gateway = new NullGateway(); } gateway.GatewayData = gatewayData; return(gateway); }
/// <summary> /// 获取网关 /// </summary> public static GatewayBase GetGateway(ICollection <GatewayBase> gatewayList) { var gatewayData = ReadNotifyData(); GatewayBase gateway; if (IsAlipayGateway(gatewayData)) { gateway = gatewayList.GetGateway(GatewayType.Alipay); } else if (IsWechatpayGateway(gatewayData)) { gateway = gatewayList.GetGateway(GatewayType.Wechatpay); } else if (IsTenpayGateway(gatewayData)) { gateway = gatewayList.GetGateway(GatewayType.Tenpay); } else if (IsYeepayGateway(gatewayData)) { gateway = gatewayList.GetGateway(GatewayType.Yeepay); } else { gateway = new NullGateway(); } gateway.GatewayData = gatewayData; return(gateway); }
/// <summary> /// 获取网关 /// </summary> /// <param name="gateways">网关列表</param> /// <returns></returns> public static GatewayBase GetGateway(IGateways gateways) { var gatewayData = ReadNotifyData(); GatewayBase gateway; if (IsAlipayGateway(gatewayData)) { gateway = gateways.Get(GatewayType.Alipay); } else if (IsWechatpayGateway(gatewayData)) { gateway = gateways.Get(GatewayType.Wechatpay); } else { gateway = new NullGateway(); } gateway.GatewayData = gatewayData; return(gateway); }
/// <summary> /// 获取网关 /// </summary> /// <param name="gateways">网关列表</param> /// <returns></returns> public static GatewayBase GetGateway(IGateways gateways) { var gatewayData = ReadNotifyData(); GatewayBase gateway = null; foreach (var item in gateways.GetList()) { if (ExistParameter(item.NotifyVerifyParameter, gatewayData)) { gateway = item; break; } } if (gateway is null) { gateway = new NullGateway(); } gateway.GatewayData = gatewayData; return(gateway); }