/// <summary> /// execute withdraw operation. /// Throws exception when amount is higher than balance value /// records balance after operation into operation record /// </summary> public override void Execute() { if (Executed) { return; } if (_targetAccount.GetBalanceValue() < _amount) { throw new BankException(ResponseStatus.InsufficientFunds); } _targetAccount.SubstractFromBalance(_amount); Executed = true; RecordBalanceAfterOperation(_targetAccount.GetBalanceValue()); _targetAccount.AddOperationToHistory(OperationRecord); }