alberto-art3ch commented on code in PR #6514:
URL: https://github.com/apache/fineract/pull/6514#discussion_r4149496239


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/calc/ProjectedAmortizationScheduleModel.java:
##########
@@ -93,6 +93,18 @@ public final class ProjectedAmortizationScheduleModel {
      */
     public static final int MAX_CALCULABLE_TOTAL_DAYS = 100_000;
 
+    /**
+     * Cap on the calculated annual EIR, as a percentage. A schedule whose 
payments repay the balance in a handful of
+     * days earns its whole discount fee over that handful of days, and 
compounding that daily return over the day count
+     * produces a rate of astronomical magnitude - 5.8E+55 % for a 100 balance 
against a 150 fee repaid in five days.
+     * Such a rate is not merely meaningless, it is wider than the {@code 
decimal(27,8)} Avro field every external event
+     * carries the account in, where encoding it fails with the schedule 
already written and the approval already done.
+     * The cap is that field's own ceiling, so nothing calculable here is 
unpublishable there, and it turns what was a
+     * failure deep in the event pipeline into the ordinary "not calculable" 
rejection every entry point already handles
+     * - both feasibility pre-checks run the same solve.
+     */
+    public static final BigDecimal MAX_CALCULABLE_ANNUAL_EIR = new 
BigDecimal("1E+19");

Review Comment:
   Agreed, capped at 999999 and enforced in the loan and product validators as 
well



-- 
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]

Reply via email to