public WalletHistoryService(
            [NotNull] HistoryOperationPublisher historyOperationPublisher,
            [NotNull] IMerchantWalletService merchantWalletService,
            [NotNull] ILogFactory logFactory,
            [NotNull] RetryPolicySettings retryPolicySettings,
            [NotNull] IPayHistoryClient payHistoryClient)
        {
            _historyOperationPublisher = historyOperationPublisher ?? throw new ArgumentNullException(nameof(historyOperationPublisher));
            _merchantWalletService     = merchantWalletService ?? throw new ArgumentNullException(nameof(merchantWalletService));
            _retryPolicySettings       = retryPolicySettings ?? throw new ArgumentNullException(nameof(retryPolicySettings));
            _payHistoryClient          = payHistoryClient ?? throw new ArgumentNullException(nameof(payHistoryClient));
            _log = logFactory.CreateLog(this);

            _publisherRetryPolicy = Policy
                                    .Handle <Exception>()
                                    .WaitAndRetryAsync(
                _retryPolicySettings.DefaultAttempts,
                attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
                (ex, timespan) => _log.Error(ex, "Publish wallet history with retry"));

            _clientRetryPolicy = Policy
                                 .Handle <Exception>(ex => !(ex is PayHistoryApiException))
                                 .WaitAndRetryAsync(
                _retryPolicySettings.DefaultAttempts,
                attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
                (ex, timespan) => _log.Error(ex, "Connecting to history service with retry"));
        }
 public HistoryOperationService(
     HistoryOperationPublisher historyOperationPublisher,
     IPayHistoryClient payHistoryClient,
     RetryPolicySettings retryPolicySettings,
     ILogFactory logFactory)
 {
     _historyOperationPublisher = historyOperationPublisher;
     _payHistoryClient          = payHistoryClient;
     _log         = logFactory.CreateLog(this);
     _retryPolicy = Policy
                    .Handle <Exception>()
                    .WaitAndRetryAsync(
         retryPolicySettings.DefaultAttempts,
         attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
         (ex, timespan) => _log.Error(ex, "Publish invoice payment to history with retry"));
 }