/// <summary> /// 注册回调逻辑 /// </summary> /// <param name="paymentCallbackAction"></param> /// <returns></returns> public virtual async Task RegisterCallbackAction(IPaymentCallbackAction paymentCallbackAction) { if (!await IsRegisterCallbackAction(paymentCallbackAction)) { PaymentCallbackActions.Add(paymentCallbackAction); } await Task.FromResult(0); }
/// <summary> /// 卸载 /// </summary> /// <param name="paymentCallbackAction"></param> /// <returns></returns> public async Task UnRegisterCallbackAction(IPaymentCallbackAction paymentCallbackAction) { if (await IsRegisterCallbackAction(paymentCallbackAction)) { PaymentCallbackActions.Remove(PaymentCallbackActions.First(p => p.Key == paymentCallbackAction.Key)); } await Task.FromResult(0); }
/// <summary> /// 是否注册回调逻辑 /// </summary> /// <param name="paymentCallbackAction"></param> /// <returns></returns> public virtual async Task <bool> IsRegisterCallbackAction(IPaymentCallbackAction paymentCallbackAction) { return(await Task.FromResult(PaymentCallbackActions.Contains(paymentCallbackAction) || PaymentCallbackActions.Any(p => p.Key == paymentCallbackAction.Key))); }