We're updating the issue view to help you get more done. 

Loan Prepayment with flat rate and interest recalculation not working

Description

To get the scenario

  • Set up a loan product with the following properties

  • Interest calculation: flat

  • Recalculation enabled: yes, select any options under this

  • Create a loan with this product

  • Try making a prepayment, if a loan is 3 months, make a prepayment in the 1st or 2nd month

The prepayment fails with no error on the UI, in the backend the error message below is raised:
ERROR o.s.boot.context.web.ErrorPageFilter - Forwarding to error page from request /api/v1/loans/18/transactions due to exception [null]
java.lang.NullPointerException: null
at org.apache.fineract.portfolio.loanaccount.loanschedule.domain.AbstractLoanScheduleGenerator.handleRecalculationForTransactions(AbstractLoanScheduleGenerator.java:519) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.loanschedule.domain.AbstractLoanScheduleGenerator.generate(AbstractLoanScheduleGenerator.java:329) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.loanschedule.domain.AbstractLoanScheduleGenerator.rescheduleNextInstallments(AbstractLoanScheduleGenerator.java:2340) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.loanschedule.domain.AbstractLoanScheduleGenerator.rescheduleNextInstallments(AbstractLoanScheduleGenerator.java:2051) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.domain.Loan.getRecalculatedSchedule(Loan.java:5344) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.domain.Loan.regenerateRepaymentScheduleWithInterestRecalculation(Loan.java:5103) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.domain.Loan.handleRepaymentOrRecoveryOrWaiverTransaction(Loan.java:3067) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.domain.Loan.makeRepayment(Loan.java:2899) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.domain.LoanAccountDomainServiceJpa.makeRepayment(LoanAccountDomainServiceJpa.java:191) ~[classes/:na]
at org.apache.fineract.portfolio.loanaccount.domain.LoanAccountDomainServiceJpa.makeRepayment(LoanAccountDomainServiceJpa.java:142) ~[classes/:na]
at sun.reflect.GeneratedMethodAccessor249.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) ~[spring-tx-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) ~[spring-tx-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) ~[spring-tx-4.0.7.RELEASE.jar:4.0.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at com.sun.proxy.$Proxy218.makeRepayment(Unknown Source) ~[na:na]
at org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformServiceJpaRepositoryImpl.makeLoanRepayment(LoanWritePlatformServiceJpaRepositoryImpl.java:758) ~[classes/:na]
at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.0.8.RELEASE.jar:4.0.8.RELEASE]

Environment

The same environment as the demo server

Status

Assignee

Unassigned

Reporter

John Gathogo

Labels

None

Implementation Priority

Must

URL

None

Story Points

None

Team

Core

Scheduled For

None

50% Estimate

None

90% Estimate

None

Deployment

None

Epic

None

Request Type

None

Requestor

None

Number of Support Tickets

None

Customer

None

Notify

None

productboard URL

None

Components

Affects versions

1.17.1.RELEASE

Priority

Blocker