Esempio n. 1
0
        public async Task MarkPaymentsAsExpiredAsync(TimeSpan expirationPeriod)
        {
            var expirationDate     = DateTime.UtcNow - expirationPeriod;
            var expiredPaymentsIds = await _paymentsRepository.GetExpiredPaymentsAsync(expirationDate);

            foreach (var expiredPaymentId in expiredPaymentsIds)
            {
                var error = await _paymentsStatusUpdater.StartExpireRefundAsync(expiredPaymentId);

                if (error != PaymentStatusUpdateErrorCodes.None)
                {
                    _log.Warning("Failed to mark payment as expired",
                                 context: new { error, expiredPaymentId });
                }
            }
        }