Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-11 Thread via GitHub


adamsaghy merged PR #3836:
URL: https://github.com/apache/fineract/pull/3836


-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-11 Thread via GitHub


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


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##
@@ -69,6 +69,7 @@ public final class LoanApplicationTerms {
 private final Integer repaymentEvery;
 private final PeriodFrequencyType repaymentPeriodFrequencyType;
 
+private long variationDays = 0L;

Review Comment:
   For Reschedule we have variations and each variation usually has a change in 
a date, so we have the original due date and the new or reschedule date, then 
in this variable we can store the difference in days to be consider in the case 
of Fixed Length



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-11 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1560629475


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##
@@ -69,6 +69,7 @@ public final class LoanApplicationTerms {
 private final Integer repaymentEvery;
 private final PeriodFrequencyType repaymentPeriodFrequencyType;
 
+private long variationDays = 0L;

Review Comment:
   Can you please explain this logic?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-10 Thread via GitHub


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


##
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleModelRepaymentPeriod.java:
##
@@ -55,6 +55,13 @@ public static LoanScheduleModelRepaymentPeriod 
repayment(final int periodNumber,
 interestDue, feeChargesDue, penaltyChargesDue, totalDue, 
recalculatedInterestComponent);
 }
 
+public static LoanScheduleModelRepaymentPeriod copyWithNewDueDate(final 
LoanScheduleModelRepaymentPeriod period,

Review Comment:
   Done! method removed



##
integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationLoanRepaymentScheduleTest.java:
##
@@ -3819,6 +3819,126 @@ public void uc132() {
 });
 }
 
+// UC133: Advanced payment allocation with higher Fixed Length for 50 days 
than Loan Term for 45 days (3 repayments
+// every 15 days)
+// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
+// 2. Submit Loan and approve
+// 3. Disburse
+// 4. Validate Repayment Schedule
+@Test
+public void uc133() {
+final String operationDate = "22 November 2023";
+runAt(operationDate, () -> {
+final Integer fixedLength = 50; // 50 days
+final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
+final Integer numberOfRepayments = 3;
+
+Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+
+PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+
.numberOfRepayments(numberOfRepayments).repaymentEvery(15).repaymentFrequencyType(repaymentFrequencyType.longValue())
+.fixedLength(fixedLength);
+PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(product);
+
+PostLoansRequest applicationRequest = applyLoanRequest(clientId, 
loanProductResponse.getResourceId(), "22 November 2023",
+1000.0, numberOfRepayments)
+
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY);
+
+PostLoansResponse loanResponse = 
loanTransactionHelper.applyLoan(applicationRequest);
+
+loanTransactionHelper.approveLoan(loanResponse.getLoanId(),
+new 
PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(1000)).dateFormat(DATETIME_PATTERN)
+.approvedOnDate("22 November 2023").locale("en"));
+
+loanTransactionHelper.disburseLoan(loanResponse.getLoanId(),
+new PostLoansLoanIdRequest().actualDisbursementDate("22 
November 2023").dateFormat(DATETIME_PATTERN)
+
.transactionAmount(BigDecimal.valueOf(100.0)).locale("en"));
+
+GetLoansLoanIdResponse loanDetails = 
loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
+LOG.info("Loan {} {}", 
loanDetails.getTimeline().getActualDisbursementDate(), 
loanDetails.getRepaymentSchedule().getPeriods()
+
.get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate());
+assertEquals(
+
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(),
 loanDetails.getRepaymentSchedule()
+
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 
1).getDueDate()),
+fixedLength.longValue());
+assertEquals(loanDetails.getNumberOfRepayments(), 
numberOfRepayments);
+assertTrue(loanDetails.getStatus().getActive());
+});
+}
+
+// UC134: Advanced payment allocation with Fixed Length for 120 days and 
Loan Term for 120 days (4 repayments every
+// 30
+// days) and Reschedule
+// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
+// 2. Submit Loan and approve
+// 3. Disburse
+// 4. Validate Repayment Schedule
+// 5. ReSchedule
+@Test
+public void uc134() {
+final String operationDate = "1 January 2024";
+runAt(operationDate, () -> {
+final Integer fixedLength = 120; // 120 days
+final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
+final Integer numberOfRepayments = 4;
+
+Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+

Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-10 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1559021163


##
integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationLoanRepaymentScheduleTest.java:
##
@@ -3819,6 +3819,126 @@ public void uc132() {
 });
 }
 
+// UC133: Advanced payment allocation with higher Fixed Length for 50 days 
than Loan Term for 45 days (3 repayments
+// every 15 days)
+// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
+// 2. Submit Loan and approve
+// 3. Disburse
+// 4. Validate Repayment Schedule
+@Test
+public void uc133() {
+final String operationDate = "22 November 2023";
+runAt(operationDate, () -> {
+final Integer fixedLength = 50; // 50 days
+final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
+final Integer numberOfRepayments = 3;
+
+Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+
+PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+
.numberOfRepayments(numberOfRepayments).repaymentEvery(15).repaymentFrequencyType(repaymentFrequencyType.longValue())
+.fixedLength(fixedLength);
+PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(product);
+
+PostLoansRequest applicationRequest = applyLoanRequest(clientId, 
loanProductResponse.getResourceId(), "22 November 2023",
+1000.0, numberOfRepayments)
+
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY);
+
+PostLoansResponse loanResponse = 
loanTransactionHelper.applyLoan(applicationRequest);
+
+loanTransactionHelper.approveLoan(loanResponse.getLoanId(),
+new 
PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(1000)).dateFormat(DATETIME_PATTERN)
+.approvedOnDate("22 November 2023").locale("en"));
+
+loanTransactionHelper.disburseLoan(loanResponse.getLoanId(),
+new PostLoansLoanIdRequest().actualDisbursementDate("22 
November 2023").dateFormat(DATETIME_PATTERN)
+
.transactionAmount(BigDecimal.valueOf(100.0)).locale("en"));
+
+GetLoansLoanIdResponse loanDetails = 
loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
+LOG.info("Loan {} {}", 
loanDetails.getTimeline().getActualDisbursementDate(), 
loanDetails.getRepaymentSchedule().getPeriods()
+
.get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate());
+assertEquals(
+
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(),
 loanDetails.getRepaymentSchedule()
+
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 
1).getDueDate()),
+fixedLength.longValue());
+assertEquals(loanDetails.getNumberOfRepayments(), 
numberOfRepayments);
+assertTrue(loanDetails.getStatus().getActive());
+});
+}
+
+// UC134: Advanced payment allocation with Fixed Length for 120 days and 
Loan Term for 120 days (4 repayments every
+// 30
+// days) and Reschedule
+// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
+// 2. Submit Loan and approve
+// 3. Disburse
+// 4. Validate Repayment Schedule
+// 5. ReSchedule
+@Test
+public void uc134() {
+final String operationDate = "1 January 2024";
+runAt(operationDate, () -> {
+final Integer fixedLength = 120; // 120 days
+final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
+final Integer numberOfRepayments = 4;
+
+Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+
.numberOfRepayments(numberOfRepayments).repaymentEvery(30).fixedLength(fixedLength);
+PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(product);
+PostLoansRequest applicationRequest = applyLoanRequest(clientId, 
loanProductResponse.getResourceId(), operationDate, 1000.0,
+numberOfRepayments);
+
+applicationRequest = 
applicationRequest.numberOfRepayments(numberOfRepayments).loanTermFrequency(120)
+

Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-10 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1559020673


##
integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationLoanRepaymentScheduleTest.java:
##
@@ -3819,6 +3819,126 @@ public void uc132() {
 });
 }
 
+// UC133: Advanced payment allocation with higher Fixed Length for 50 days 
than Loan Term for 45 days (3 repayments
+// every 15 days)
+// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
+// 2. Submit Loan and approve
+// 3. Disburse
+// 4. Validate Repayment Schedule
+@Test
+public void uc133() {
+final String operationDate = "22 November 2023";
+runAt(operationDate, () -> {
+final Integer fixedLength = 50; // 50 days
+final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
+final Integer numberOfRepayments = 3;
+
+Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+
+PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+
.numberOfRepayments(numberOfRepayments).repaymentEvery(15).repaymentFrequencyType(repaymentFrequencyType.longValue())
+.fixedLength(fixedLength);
+PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(product);
+
+PostLoansRequest applicationRequest = applyLoanRequest(clientId, 
loanProductResponse.getResourceId(), "22 November 2023",
+1000.0, numberOfRepayments)
+
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY);
+
+PostLoansResponse loanResponse = 
loanTransactionHelper.applyLoan(applicationRequest);
+
+loanTransactionHelper.approveLoan(loanResponse.getLoanId(),
+new 
PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(1000)).dateFormat(DATETIME_PATTERN)
+.approvedOnDate("22 November 2023").locale("en"));
+
+loanTransactionHelper.disburseLoan(loanResponse.getLoanId(),
+new PostLoansLoanIdRequest().actualDisbursementDate("22 
November 2023").dateFormat(DATETIME_PATTERN)
+
.transactionAmount(BigDecimal.valueOf(100.0)).locale("en"));
+
+GetLoansLoanIdResponse loanDetails = 
loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
+LOG.info("Loan {} {}", 
loanDetails.getTimeline().getActualDisbursementDate(), 
loanDetails.getRepaymentSchedule().getPeriods()
+
.get(loanDetails.getRepaymentSchedule().getPeriods().size() - 1).getDueDate());
+assertEquals(
+
Utils.getDifferenceInDays(loanDetails.getTimeline().getActualDisbursementDate(),
 loanDetails.getRepaymentSchedule()
+
.getPeriods().get(loanDetails.getRepaymentSchedule().getPeriods().size() - 
1).getDueDate()),
+fixedLength.longValue());
+assertEquals(loanDetails.getNumberOfRepayments(), 
numberOfRepayments);
+assertTrue(loanDetails.getStatus().getActive());
+});
+}
+
+// UC134: Advanced payment allocation with Fixed Length for 120 days and 
Loan Term for 120 days (4 repayments every
+// 30
+// days) and Reschedule
+// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
+// 2. Submit Loan and approve
+// 3. Disburse
+// 4. Validate Repayment Schedule
+// 5. ReSchedule
+@Test
+public void uc134() {
+final String operationDate = "1 January 2024";
+runAt(operationDate, () -> {
+final Integer fixedLength = 120; // 120 days
+final Integer repaymentFrequencyType = RepaymentFrequencyType.DAYS;
+final Integer numberOfRepayments = 4;
+
+Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+
.numberOfRepayments(numberOfRepayments).repaymentEvery(30).fixedLength(fixedLength);
+PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(product);
+PostLoansRequest applicationRequest = applyLoanRequest(clientId, 
loanProductResponse.getResourceId(), operationDate, 1000.0,
+numberOfRepayments);
+
+applicationRequest = 
applicationRequest.numberOfRepayments(numberOfRepayments).loanTermFrequency(120)
+

Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-10 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1559017008


##
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleModelRepaymentPeriod.java:
##
@@ -55,6 +55,13 @@ public static LoanScheduleModelRepaymentPeriod 
repayment(final int periodNumber,
 interestDue, feeChargesDue, penaltyChargesDue, totalDue, 
recalculatedInterestComponent);
 }
 
+public static LoanScheduleModelRepaymentPeriod copyWithNewDueDate(final 
LoanScheduleModelRepaymentPeriod period,

Review Comment:
   This is not used anywhere...



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-09 Thread via GitHub


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


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   Done! removed!



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-08 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1555417782


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   I still not sure we need this.



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-08 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1555417782


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   I am still not sure we need this.



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-03 Thread via GitHub


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


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   There is one option for rescheduling related to use other IR value for the 
rest of the period. Even I'm thinking for this scenarios to have Fixed Length 
with Reschedule to use a new kind of reschedule variation to support this, what 
do you thing?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1548265863


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##
@@ -1871,4 +1871,16 @@ public LocalDate getRepaymentStartDate() {
 : getSubmittedOnDate();
 }
 
+public boolean isLastInstallment(final Integer installmentNumber) {
+Integer numberOfRepayments = getNumberOfRepayments();
+if (isDownPaymentEnabled()) {

Review Comment:
   Also while the the installment number is increased when a down payment 
period added, the period number is not. So you might wanna use that to decide 
on whether it is the last or not...



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1548267907


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   Is there any reschedule type where the length of the loan does not change?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1548263958


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##
@@ -1871,4 +1871,16 @@ public LocalDate getRepaymentStartDate() {
 : getSubmittedOnDate();
 }
 
+public boolean isLastInstallment(final Integer installmentNumber) {
+Integer numberOfRepayments = getNumberOfRepayments();
+if (isDownPaymentEnabled()) {

Review Comment:
   There could be multiple disbursement and multiple down payment, so adding +1 
is not right...



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


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


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   The purpose of this is to know when the Loan account has any variation and 
If this is true that means the Loan has been rescheduled. 



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


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


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##
@@ -1871,4 +1871,16 @@ public LocalDate getRepaymentStartDate() {
 : getSubmittedOnDate();
 }
 
+public boolean isLastInstallment(final Integer installmentNumber) {
+Integer numberOfRepayments = getNumberOfRepayments();
+if (isDownPaymentEnabled()) {

Review Comment:
   Using the installment number for the last installment is different when you 
are using Down Payment (It creates a new installment) so we need to consider 
that when we need to identify the last installment



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1547549360


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##
@@ -1871,4 +1871,16 @@ public LocalDate getRepaymentStartDate() {
 : getSubmittedOnDate();
 }
 
+public boolean isLastInstallment(final Integer installmentNumber) {
+Integer numberOfRepayments = getNumberOfRepayments();
+if (isDownPaymentEnabled()) {

Review Comment:
   My gut feeling this is wrong...but i am not fully sure.
   Can you please explain a little bit what was the idea here?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1547548281


##
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsDataWrapper.java:
##
@@ -172,4 +172,8 @@ public void resetVariations() {
 this.dueDateIterator = this.dueDateVariation.listIterator();
 }
 
+public boolean hasAnyVariation() {

Review Comment:
   Could you please leave a couple sentence what this is?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-04-02 Thread via GitHub


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


##
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractProgressiveLoanScheduleGenerator.java:
##
@@ -181,6 +181,13 @@ public LoanScheduleModel generate(final MathContext mc, 
final LoanApplicationTer
 // }
 }
 
+// Fixed Length validation
+final int lastPeriodIdx = periods.size() - 1;
+LoanScheduleModelRepaymentPeriod lastPeriod = 
(LoanScheduleModelRepaymentPeriod) periods.get(lastPeriodIdx);
+if (lastPeriod.getDueDate().compareTo(loanEndDate) != 0) {

Review Comment:
   Done! Updated to validate the last installment



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] FINERACT-2065: Fix schedule handling with higher fixed length value t… [fineract]

2024-03-28 Thread via GitHub


adamsaghy commented on code in PR #3836:
URL: https://github.com/apache/fineract/pull/3836#discussion_r1543234638


##
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractProgressiveLoanScheduleGenerator.java:
##
@@ -181,6 +181,13 @@ public LoanScheduleModel generate(final MathContext mc, 
final LoanApplicationTer
 // }
 }
 
+// Fixed Length validation
+final int lastPeriodIdx = periods.size() - 1;
+LoanScheduleModelRepaymentPeriod lastPeriod = 
(LoanScheduleModelRepaymentPeriod) periods.get(lastPeriodIdx);
+if (lastPeriod.getDueDate().compareTo(loanEndDate) != 0) {

Review Comment:
   With reschedule, i dont think it will work... :/
   
   Based on the periodNumber of scheduleParams, you can decide in the 
"nextRepaymentDate()" method of DefaultScheduledDateGenerator, whether it is 
the last installment or not and you can set the proper repayment date. After 
that if the installment was rescheduled, that date would be overriden, but i 
guess that is fine.
   
   What do you think?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org