Browse Source

Prevent user from sending money to themselves

remotes/origin/feature/loan-eligibility
fdlt3817 2 years ago
parent
commit
400b3be668
  1. 20
      src/sendmoney.c

20
src/sendmoney.c

@ -14,14 +14,22 @@ bool sendMoney(int customerID){
if(recID>1000){
bool recExists=checkCustomerExists(recID);
if(recExists){
if(withdrawSpecificAmount(customerID, amountToSend)){
if(depositSpecificAmount(recID, amountToSend)){
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID);
return true;
if(recID==customerID){
printf("\nYou cannot send money to yourself. Aborting. \n");
return false;
}
else{
if(withdrawSpecificAmount(customerID, amountToSend)){
if(depositSpecificAmount(recID, amountToSend)){
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID);
return true;
}
else{
printf("\nSomething went wrong with the transfer. Please contact staff.");
}
}
}else{
printf("\nSomething went wrong with the transfer. Please contact staff.");
}
}else{
if(withdrawSpecificAmount(customerID, amountToSend)){
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID);

Loading…
Cancel
Save