APO-1 Add transfer allowance

This commit is contained in:
Cezary Adamczak 2021-10-13 09:50:44 +02:00
parent 37fb598867
commit 5a06fac6a6

View File

@ -82,9 +82,13 @@ def TransferMoney(accountFrom, accountTo, amount):
if amount > accountFrom.credit: if amount > accountFrom.credit:
print("You dont't have enough money on your account") print("You dont't have enough money on your account")
return 0 return 0
accountFrom.subCredit(amount) if accountTo.acceptTransfers:
accountTo.addCredit(amount) accountFrom.subCredit(amount)
return 1 accountTo.addCredit(amount)
return 1
else:
print("Reciever do not allow transfers")
return 0