diff options
Diffstat (limited to 'bank-eiffel/account.e')
| -rw-r--r-- | bank-eiffel/account.e | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bank-eiffel/account.e b/bank-eiffel/account.e index fe9cc3b..a6e30ef 100644 --- a/bank-eiffel/account.e +++ b/bank-eiffel/account.e | |||
| @@ -81,16 +81,19 @@ feature -- Basic operations | |||
| 81 | require | 81 | require |
| 82 | an_authorized_signer_authorized: get_authorized_signers.has (an_authorized_signer) | 82 | an_authorized_signer_authorized: get_authorized_signers.has (an_authorized_signer) |
| 83 | transfer_minamount_ok: an_amount >= transfer_minamount | 83 | transfer_minamount_ok: an_amount >= transfer_minamount |
| 84 | balance_beneath_creditline: balance - an_amount >= creditline | ||
| 84 | do | 85 | do |
| 85 | balance := balance - an_amount | 86 | balance := balance - an_amount |
| 86 | ensure | 87 | ensure |
| 88 | balance_beneath_creditline: balance >= creditline | ||
| 87 | balance_decreased: balance < old balance | 89 | balance_decreased: balance < old balance |
| 88 | withdrawed: balance = old balance - an_amount | 90 | withdrawed: balance = old balance - an_amount |
| 89 | balance_beneath_creditline: balance >= creditline | ||
| 90 | end | 91 | end |
| 91 | 92 | ||
| 92 | transfer(an_amount: like transfer_minamount; an_authorized_signer: PERSON; | 93 | transfer(an_amount: like transfer_minamount; an_authorized_signer: PERSON; |
| 93 | an_account: like Current; another_authorized_signer: PERSON) | 94 | an_account: like Current; another_authorized_signer: PERSON) |
| 95 | require | ||
| 96 | recipient_account_not_same: Current /= an_account | ||
| 94 | do | 97 | do |
| 95 | withdraw (an_amount, an_authorized_signer) | 98 | withdraw (an_amount, an_authorized_signer) |
| 96 | an_account.deposit (an_amount, another_authorized_signer) | 99 | an_account.deposit (an_amount, another_authorized_signer) |
| @@ -107,12 +110,10 @@ feature -- Basic operations | |||
| 107 | 110 | ||
| 108 | remove_authorized_signer (an_authorized_signer: PERSON) | 111 | remove_authorized_signer (an_authorized_signer: PERSON) |
| 109 | require | 112 | require |
| 110 | authorized_signers_never_empty: (get_authorized_signers.has (an_authorized_signer) | 113 | authorized_signer_exists: (get_authorized_signers.has (an_authorized_signer)) |
| 111 | and get_authorized_signers.count >= 2) or True | 114 | authorized_signers_not_empty: get_authorized_signers.count >= 2 |
| 112 | do | 115 | do |
| 113 | if authorized_signers.has (an_authorized_signer) then | 116 | authorized_signers.prune (an_authorized_signer) |
| 114 | authorized_signers.prune (an_authorized_signer) | ||
| 115 | end | ||
| 116 | ensure | 117 | ensure |
| 117 | authorized_signers_assigned: not authorized_signers.has (an_authorized_signer) | 118 | authorized_signers_assigned: not authorized_signers.has (an_authorized_signer) |
| 118 | end | 119 | end |
