aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunther6070 <haydenhartman10@yahoo.com>2025-04-02 13:33:34 -0400
committerGunther6070 <haydenhartman10@yahoo.com>2025-04-02 13:33:34 -0400
commit22df0d963e09520339dfa9c681caeaaec790df8e (patch)
treee11ad39a87f8ee6523d30585c27111d7f4011936
parent726b527af983025a95daae67864122761bcc4e78 (diff)
downloadJellySolutions-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.java3
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);