using System; using PaySharp.Core.Response; using PaySharp.Core.Utils; namespace PaySharp.Core { /// /// 事件数据的基类 /// public abstract class NotifyEventArgs : EventArgs { #region 私有字段 protected BaseGateway _gateway; #endregion #region 构造函数 /// /// 构造函数 /// /// 支付网关 protected NotifyEventArgs(BaseGateway gateway) { _gateway = gateway; NotifyServerHostAddress = HttpUtil.RemoteIpAddress; } #endregion #region 属性 /// /// 发送支付通知的网关IP地址 /// public string NotifyServerHostAddress { get; private set; } /// /// 网关的数据 /// public GatewayData GatewayData => _gateway.GatewayData; /// /// 网关类型 /// public Type GatewayType => _gateway.GetType(); /// /// 通知数据 /// public IResponse NotifyResponse => _gateway.NotifyResponse; /// /// 通知类型 /// public NotifyType NotifyType => HttpUtil.RequestType == "GET" ? NotifyType.Sync : NotifyType.Async; #endregion } }