diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-02 13:33:34 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-02 13:33:34 -0400 |
commit | 22df0d963e09520339dfa9c681caeaaec790df8e (patch) | |
tree | e11ad39a87f8ee6523d30585c27111d7f4011936 | |
parent | 726b527af983025a95daae67864122761bcc4e78 (diff) | |
download | JellySolutions-22df0d963e09520339dfa9c681caeaaec790df8e.tar.gz JellySolutions-22df0d963e09520339dfa9c681caeaaec790df8e.tar.bz2 JellySolutions-22df0d963e09520339dfa9c681caeaaec790df8e.zip |
Added check to checkout to stop checking out decimal values for physical needs
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java index 993e7c1..859194a 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java @@ -119,6 +119,9 @@ public class CupboardService { if (checkoutAmount <= 0) { throw new IllegalArgumentException("Amount must be greater than 0"); } + if ((checkoutAmount % 1 != 0) && (cupboardDAO.getNeed(id).getType() == Need.GoalType.PHYSICAL)) { + throw new IllegalArgumentException("Physical amounts must be whole numbers"); + } authService.keyIsValid(key); Need need = cupboardDAO.getNeed(id); need.incrementCurrent(checkoutAmount); |