Beispiel #1
0
        public virtual async Task RollbackRefundAsync(Payment payment, Refund refund)
        {
            using var uow = _unitOfWorkManager.Begin(isTransactional: true);

            uow.OnCompleted(async() =>
                            await _distributedEventBus.PublishAsync(new PaymentRefundRollbackEto(
                                                                        _objectMapper.Map <Payment, PaymentEto>(payment), _objectMapper.Map <Refund, RefundEto>(refund))));

            payment.RollbackRefund();

            await _paymentRepository.UpdateAsync(payment, true);

            refund.CancelRefund(_clock.Now);

            await _refundRepository.UpdateAsync(refund, true);

            await uow.CompleteAsync();
        }