private string ExecuteService(double?amount) { _service.ValidateWithdraw(amount); var resultData = _service.Withdraw(amount); return(string.Join(", ", resultData.Select(item => $"{item.Quantity} x {item.Note}"))); }
public WithdrawResponse Withdraw(WithdrawRequest request) { var response = new WithdrawResponse(request); try { _accountBalance.ValidateWithdraw(request.Amount); _withdrawNotesService.ValidateWithdraw(request.Amount); _accountBalance.Withdraw(request.Amount); response.Notes = _withdrawNotesService.Withdraw(request.Amount); response.IsSucceeded = true; } catch (ArgumentException ex) { response.Message = ex.Message; } catch (Exception) { throw; } return(response); }