From 8770aa49cee5b03971c9ad97db52219be9d11159 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 18:56:17 +0000 Subject: [PATCH] fix: allow fund transfers of exact account balance Reverts incorrect change from commit d673b8d that changed comparison from '< 0' to '<= 0'. The correct logic should allow transfers when balance equals the transfer amount. Fixes bug where transfers of exactly R$ 5,000.00 with balance of R$ 5,000.00 were incorrectly rejected with insufficient balance error. Original correct implementation was in commit 757adbca (2023-09-13). This aligns with the pattern used in Transaction Service. Co-Authored-By: Sam Fertig --- .../service/implementation/FundTransferServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fund-Transfer/src/main/java/org/training/fundtransfer/service/implementation/FundTransferServiceImpl.java b/Fund-Transfer/src/main/java/org/training/fundtransfer/service/implementation/FundTransferServiceImpl.java index ec9b911..2857c54 100644 --- a/Fund-Transfer/src/main/java/org/training/fundtransfer/service/implementation/FundTransferServiceImpl.java +++ b/Fund-Transfer/src/main/java/org/training/fundtransfer/service/implementation/FundTransferServiceImpl.java @@ -65,7 +65,7 @@ public FundTransferResponse fundTransfer(FundTransferRequest fundTransferRequest log.error("account status is pending or inactive, please update the account status"); throw new AccountUpdateException("account is status is :pending", GlobalErrorCode.NOT_ACCEPTABLE); } - if (fromAccount.getAvailableBalance().compareTo(fundTransferRequest.getAmount()) <= 0) { + if (fromAccount.getAvailableBalance().compareTo(fundTransferRequest.getAmount()) < 0) { log.error("required amount to transfer is not available"); throw new InsufficientBalance("requested amount is not available", GlobalErrorCode.NOT_ACCEPTABLE); }