adamsaghy commented on code in PR #2436:
URL: https://github.com/apache/fineract/pull/2436#discussion_r939972817
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java:
##########
@@ -1573,21 +1576,36 @@ public void
validateAccountBalanceDoesNotBecomeNegative(final String transaction
throw new
PlatformApiDataValidationException(dataValidationErrors);
}
}
-
}
lastSavingsDate = transaction.transactionLocalDate();
-
}
- BigDecimal withdrawalFee = null;
- BigDecimal transactionAmount = null;
if (isOverdraft()) {
if (runningBalance.minus(minRequiredBalance).isLessThanZero()) {
- throw new
InsufficientAccountBalanceException("transactionAmount", getAccountBalance(),
withdrawalFee, transactionAmount);
+ overdraftLimitExceededException("transactionAmount",
getAccountBalance(), transactionAmount);
+ }
+ }
+ }
+
+ public void validateAccountBalanceDoesNotViolateOverdraft(final
List<SavingsAccountTransaction> savingsAccountTransaction,
+ final BigDecimal amountPaid) {
+ if (savingsAccountTransaction != null) {
+ SavingsAccountTransaction savingsAccountTransactionFirst =
savingsAccountTransaction.get(0);
Review Comment:
@rrpawar96 You can use Pageable, or something like this:
Optional<Passenger>
findFirstBySavingsAccountAndReversedFalseAndDateOfEqualsOrderByIdDesc();
However I have changed a little bit the query...
Provided transaction date is equals or less... do we really need the "less"
part?
Order by date is not enough as multiple transaction could happen on that
day. Use Id as the secondary order by param to get the last transaction.
However i was wondering what is the purpose of this query. Shall it return
the very last transaction of the savings account which is not reversed? In that
case we dont need the transaction date and just order by id Desc.
Please help me to understand better this query...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]