You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "adamsaghy (via GitHub)" <gi...@apache.org> on 2023/05/02 18:58:57 UTC

[GitHub] [fineract] adamsaghy opened a new pull request, #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

adamsaghy opened a new pull request, #3150:
URL: https://github.com/apache/fineract/pull/3150

   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   
   - [ ] Create/update unit or integration tests for verifying the changes made.
   
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] mohitsinha commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "mohitsinha (via GitHub)" <gi...@apache.org>.
mohitsinha commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182965441


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -773,8 +773,10 @@ private void handleChargePaidTransaction(final LoanCharge charge, final LoanTran
         LocalDate startDate = getDisbursementDate();
         List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
         for (final LoanRepaymentScheduleInstallment installment : installments) {
-            if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) {
-
+            boolean isDue = installment.isFirstPeriod()
+                    ? charge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())
+                    : charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate());

Review Comment:
   For this condition, do we need to check from `disbursementDate` of loan?
   A charge is due if it is less than `installment.getDueDate()`



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] adamsaghy merged pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #3150:
URL: https://github.com/apache/fineract/pull/3150


-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] mohitsinha commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "mohitsinha (via GitHub)" <gi...@apache.org>.
mohitsinha commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182961875


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -773,8 +773,10 @@ private void handleChargePaidTransaction(final LoanCharge charge, final LoanTran
         LocalDate startDate = getDisbursementDate();
         List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
         for (final LoanRepaymentScheduleInstallment installment : installments) {
-            if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) {
-
+            boolean isDue = installment.isFirstPeriod()
+                    ? charge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())

Review Comment:
   Can both the cases be handled using `installment.getFromDate(), installment.getDueDate()`?



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] mohitsinha commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "mohitsinha (via GitHub)" <gi...@apache.org>.
mohitsinha commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182974125


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -110,10 +110,10 @@ public ChangedTransactionDetail handleTransaction(final LocalDate disbursementDa
                 LocalDate startDate = disbursementDate;
                 for (final LoanRepaymentScheduleInstallment installment : installments) {
                     for (final LoanCharge loanCharge : transferCharges) {
-                        if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())
-                                // Special case for Loan Charges (Due Date) added the same disbursement date
-                                || (startDate.equals(disbursementDate) && loanCharge.getDueDate() != null
-                                        && loanCharge.getDueDate().equals(disbursementDate))) {
+                        boolean isDue = installment.isFirstPeriod()
+                                ? loanCharge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())
+                                : loanCharge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate());

Review Comment:
   Again this is independent of `installment.getFromDate()`, so any date less than `installment.getDueDate()` should be sufficient.



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] adamsaghy commented on pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #3150:
URL: https://github.com/apache/fineract/pull/3150#issuecomment-1532051755

   > Left comments regarding 2 cases, where we just check if `loanCharge` is due or not. The `startDate` in both these cases is `disbursementDate` and `endDate` is `installment.getDueDate()`, so only `installment.dueDate` parameter is sufficient.
   > 
   > Can there be 1 IT for this flow?
   
   Thank you for your review!
   
   I have replied to your comments and i am working on the IT test case.


-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] mohitsinha commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "mohitsinha (via GitHub)" <gi...@apache.org>.
mohitsinha commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182965441


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -773,8 +773,10 @@ private void handleChargePaidTransaction(final LoanCharge charge, final LoanTran
         LocalDate startDate = getDisbursementDate();
         List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
         for (final LoanRepaymentScheduleInstallment installment : installments) {
-            if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) {
-
+            boolean isDue = installment.isFirstPeriod()
+                    ? charge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())
+                    : charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate());

Review Comment:
   Cmiiw
   For this condition, do we need to check from `disbursementDate` of loan?
   A charge is due if it is less than `installment.getDueDate()`
   This logic seems to be independent of `installment.getFromDate()`, so a date less than `dueDate` should suffice. 



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182980853


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -110,10 +110,10 @@ public ChangedTransactionDetail handleTransaction(final LocalDate disbursementDa
                 LocalDate startDate = disbursementDate;
                 for (final LoanRepaymentScheduleInstallment installment : installments) {
                     for (final LoanCharge loanCharge : transferCharges) {
-                        if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())
-                                // Special case for Loan Charges (Due Date) added the same disbursement date
-                                || (startDate.equals(disbursementDate) && loanCharge.getDueDate() != null
-                                        && loanCharge.getDueDate().equals(disbursementDate))) {
+                        boolean isDue = installment.isFirstPeriod()
+                                ? loanCharge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())
+                                : loanCharge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate());

Review Comment:
   Not entirely true. We are going through on each installment and the startDate need to be included only for the very first period. For 2nd period, the start date is not inclusive as the start date of the second installment and due date of the 1st installment is the same



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] mohitsinha commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "mohitsinha (via GitHub)" <gi...@apache.org>.
mohitsinha commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182965441


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -773,8 +773,10 @@ private void handleChargePaidTransaction(final LoanCharge charge, final LoanTran
         LocalDate startDate = getDisbursementDate();
         List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
         for (final LoanRepaymentScheduleInstallment installment : installments) {
-            if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) {
-
+            boolean isDue = installment.isFirstPeriod()
+                    ? charge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())
+                    : charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate());

Review Comment:
   Cmiiw
   For this condition, do we need to check from `disbursementDate` of loan?
   A charge is due if it is less than `installment.getDueDate()`
   This logic seems to be independent of `installment.getFromDate()` as `startDate` is fixed to `disbursementDate`, so a date less than `dueDate` should suffice. 



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182976060


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -773,8 +773,10 @@ private void handleChargePaidTransaction(final LoanCharge charge, final LoanTran
         LocalDate startDate = getDisbursementDate();
         List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
         for (final LoanRepaymentScheduleInstallment installment : installments) {
-            if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) {
-
+            boolean isDue = installment.isFirstPeriod()
+                    ? charge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())
+                    : charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate());

Review Comment:
   Not entirely true. We are going through on each installment and the startDate need to be included only for the very first period. For 2nd period, the start date is not inclusive as the start date of the second installment and due date of the 1st installment is the same



-- 
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-unsubscribe@fineract.apache.org

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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #3150: FINERACT-1724: Fee's are not included in total balance amount, when we have multiple disbursements on first day

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #3150:
URL: https://github.com/apache/fineract/pull/3150#discussion_r1182963422


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -773,8 +773,10 @@ private void handleChargePaidTransaction(final LoanCharge charge, final LoanTran
         LocalDate startDate = getDisbursementDate();
         List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
         for (final LoanRepaymentScheduleInstallment installment : installments) {
-            if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) {
-
+            boolean isDue = installment.isFirstPeriod()
+                    ? charge.isDueForCollectionFromIncludingAndUpToAndIncluding(startDate, installment.getDueDate())

Review Comment:
   Probably yes.



-- 
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-unsubscribe@fineract.apache.org

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