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

[PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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

   Remove hardcoded MoneyHelper dependency during progressive loan
   
   ## 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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java:
##########
@@ -18,27 +18,21 @@
  */
 package org.apache.fineract.organisation.monetary.domain;
 
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.math.RoundingMode;
 import java.util.Iterator;
+import lombok.Getter;
 import org.apache.fineract.organisation.monetary.data.CurrencyData;
 
-@Embeddable

Review Comment:
   I dont think we are using it in any JPA entity, but worth to double check.



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java:
##########
@@ -40,6 +43,16 @@ public class Money implements Comparable<Money> {
     @Column(name = "amount", scale = 6, precision = 19)
     private BigDecimal amount;
 
+    private final MathContext mc;
+
+    protected Money() {

Review Comment:
   It is not used. can be deleted 



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -48,18 +49,25 @@
 @DependsOn("moneyHelper")

Review Comment:
   Fixed.



##########
fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleGeneratorTest.java:
##########
@@ -87,7 +71,7 @@ void testGenerateLoanSchedule() {
 
         ScheduledDateGenerator mockScheduledDateGenerator = Mockito.mock(ScheduledDateGenerator.class);
         ProgressiveLoanScheduleGenerator generator = new ProgressiveLoanScheduleGenerator(mockScheduledDateGenerator, emiCalculator);
-        when(mockScheduledDateGenerator.generateRepaymentPeriods(any(), any(), any())).thenReturn(expectedRepaymentPeriods);
+        when(mockScheduledDateGenerator.generateRepaymentPeriods(any(), any(), any(), any())).thenReturn(expectedRepaymentPeriods);

Review Comment:
   Fixed.



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanScheduleGeneratorTest.java:
##########
@@ -87,7 +71,7 @@ void testGenerateLoanSchedule() {
 
         ScheduledDateGenerator mockScheduledDateGenerator = Mockito.mock(ScheduledDateGenerator.class);
         ProgressiveLoanScheduleGenerator generator = new ProgressiveLoanScheduleGenerator(mockScheduledDateGenerator, emiCalculator);
-        when(mockScheduledDateGenerator.generateRepaymentPeriods(any(), any(), any())).thenReturn(expectedRepaymentPeriods);
+        when(mockScheduledDateGenerator.generateRepaymentPeriods(any(), any(), any(), any())).thenReturn(expectedRepaymentPeriods);

Review Comment:
   Please dont do any mocks... we should be able to generate the loan schedule without any mocking!



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -48,18 +49,25 @@
 @DependsOn("moneyHelper")
 public final class ProgressiveEMICalculator implements EMICalculator {
 
+    private MathContext mc;
+
     private static final BigDecimal DIVISOR_100 = new BigDecimal("100");
     private static final BigDecimal ONE_WEEK_IN_DAYS = BigDecimal.valueOf(7);
 
+    @Override
+    public void setMathContext(final MathContext mc) {

Review Comment:
   We dont need this. EmiCalculator always work with `ProgressiveLoanInterestScheduleModel` and it already has the MathContext



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

Posted by "kulminsky (via GitHub)" <gi...@apache.org>.
kulminsky closed pull request #4109: FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan
URL: https://github.com/apache/fineract/pull/4109


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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java:
##########
@@ -18,27 +18,21 @@
  */
 package org.apache.fineract.organisation.monetary.domain;
 
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.math.RoundingMode;
 import java.util.Iterator;
+import lombok.Getter;
 import org.apache.fineract.organisation.monetary.data.CurrencyData;
 
-@Embeddable

Review Comment:
   I mean guys, I'm okay with removing the JPA annotations if it 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-unsubscribe@fineract.apache.org

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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -48,18 +49,25 @@
 @DependsOn("moneyHelper")

Review Comment:
   We can remove this now



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java:
##########
@@ -18,27 +18,21 @@
  */
 package org.apache.fineract.organisation.monetary.domain;
 
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.math.RoundingMode;
 import java.util.Iterator;
+import lombok.Getter;
 import org.apache.fineract.organisation.monetary.data.CurrencyData;
 
-@Embeddable

Review Comment:
   Isn't this going to be a breaking change? Is there any JPA entity using this class as an embeddable?



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


Re: [PR] FINERACT-1981: Remove hardcoded MoneyHelper dependency during progressive loan [fineract]

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


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java:
##########
@@ -18,27 +18,21 @@
  */
 package org.apache.fineract.organisation.monetary.domain;
 
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.math.RoundingMode;
 import java.util.Iterator;
+import lombok.Getter;
 import org.apache.fineract.organisation.monetary.data.CurrencyData;
 
-@Embeddable

Review Comment:
   Fixed.



##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -48,18 +49,25 @@
 @DependsOn("moneyHelper")
 public final class ProgressiveEMICalculator implements EMICalculator {
 
+    private MathContext mc;
+
     private static final BigDecimal DIVISOR_100 = new BigDecimal("100");
     private static final BigDecimal ONE_WEEK_IN_DAYS = BigDecimal.valueOf(7);
 
+    @Override
+    public void setMathContext(final MathContext mc) {

Review Comment:
   Fixed.



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