public async Task SendPaymentRequests(IList <PaymentDto> payments)
        {
            var paymentRequests = payments.Select(x => x.Map(_obfuscateSensitiveData)).ToList();

            LogNonSensitiveRequestData(paymentRequests);

            await _businessCentralFinancePaymentsService.SendPaymentRequests(payments);
        }
コード例 #2
0
        private async Task Send(List <PaymentDto> payments, long accountLegalEntityId, DateTime paidDate, CancellationToken cancellationToken = default)
        {
            var paymentsToSend = payments.Take(_businessCentralFinancePaymentsService.PaymentRequestsLimit).ToList();

            if (!paymentsToSend.Any())
            {
                return;
            }

            await _businessCentralFinancePaymentsService.SendPaymentRequests(paymentsToSend);

            await _paymentRepository.RecordPaymentsSent(paymentsToSend.Select(s => s.PaymentId).ToList(), accountLegalEntityId, paidDate);

            if (payments.Count > paymentsToSend.Count)
            {
                await Send(payments.Skip(_businessCentralFinancePaymentsService.PaymentRequestsLimit).ToList(), accountLegalEntityId, paidDate, cancellationToken);
            }
        }
        private async Task Send(List <PaymentDto> clawbacks, long accountLegalEntityId, DateTime clawbackDate, CancellationToken cancellationToken = default)
        {
            var clawbacksToSend = clawbacks.Take(_businessCentralFinancePaymentsService.PaymentRequestsLimit).ToList();

            if (!clawbacksToSend.Any())
            {
                return;
            }

            await _businessCentralFinancePaymentsService.SendPaymentRequests(clawbacksToSend);

            await _accountRepository.UpdateClawbackDateForClawbackIds(clawbacksToSend.Select(s => s.PaymentId).ToList(), accountLegalEntityId, clawbackDate);

            if (clawbacks.Count > clawbacksToSend.Count)
            {
                await Send(clawbacks.Skip(_businessCentralFinancePaymentsService.PaymentRequestsLimit).ToList(), accountLegalEntityId, clawbackDate, cancellationToken);
            }
        }