コード例 #1
0
        public virtual async Task <WithdrawalRequestDto> ReviewAsync(Guid id, ReviewWithdrawalRequestInput input)
        {
            var request = await _repository.GetAsync(id);

            var account = await _accountRepository.GetAsync(request.AccountId);

            request.CheckReviewable();

            if (account.GetPendingWithdrawalAmount() != request.Amount)
            {
                throw new UnexpectedWithdrawalAmountException();
            }

            request.Review(Clock.Now, CurrentUser.GetId(), input.IsApproved);

            await _repository.UpdateAsync(request, true);

            if (input.IsApproved)
            {
                await _accountWithdrawalManager.CompleteWithdrawalAsync(account);
            }
            else
            {
                await _accountWithdrawalManager.CancelWithdrawalAsync(account);
            }

            return(await MapToGetOutputDtoAsync(request));
        }
コード例 #2
0
 public virtual Task <WithdrawalRequestDto> ReviewAsync(Guid id, ReviewWithdrawalRequestInput input)
 {
     return(_service.ReviewAsync(id, input));
 }