|
|
@ -81,22 +81,21 @@ bool withdraw(int user_id) { |
|
|
|
bool withdrawSpecificAmount(int user_id, float amountToWithdraw) { |
|
|
|
float remainingAccountBalance; |
|
|
|
|
|
|
|
|
|
|
|
float availableAccountBalance = getAvailableAccountBalance(user_id); |
|
|
|
if (amountToWithdraw > 0) { |
|
|
|
|
|
|
|
if (amountToWithdraw > 0) { |
|
|
|
if (amountToWithdraw <= availableAccountBalance) { |
|
|
|
|
|
|
|
remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); |
|
|
|
if (updateAvailableAccountBalance(user_id, remainingAccountBalance)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// int main(){ |
|
|
|
// withdraw(1234); |
|
|
|
// return 1; |