disable ability to pass currency code and digits after decimal properties during loan creation. inherit from loan product.

This commit is contained in:
Keith Woodlock
2012-06-06 17:40:24 +01:00
parent 28b26d2463
commit 706e017da0
9 changed files with 68 additions and 73 deletions
@@ -29,7 +29,7 @@
{{#each scheduledLoanInstallments}} {{#each scheduledLoanInstallments}}
<tr> <tr>
<td>{{=$ctx.number(installmentNumber)}}</td> <td>{{=$ctx.number(installmentNumber)}}</td>
<td>{{=$ctx.globalDateAsISOString(periodEnd)}}</td> <td>{{=$ctx.globalDate(periodEnd)}}</td>
<td>{{=$ctx.money(principalDue)}}</td> <td>{{=$ctx.money(principalDue)}}</td>
<td>{{=$ctx.money(interestDue)}}</td> <td>{{=$ctx.money(interestDue)}}</td>
<td>{{=$ctx.money(totalInstallmentDue)}}</td> <td>{{=$ctx.money(totalInstallmentDue)}}</td>
@@ -55,8 +55,6 @@
<div id="formerrors"></div> <div id="formerrors"></div>
<input type="hidden" id="clientId" name="clientId" value="{{=clientId}}" /> <input type="hidden" id="clientId" name="clientId" value="{{=clientId}}" />
<input type="hidden" id="currencyCode" name="currencyCode" value="{{=selectedProduct.principal.currencyCode}}" />
<input type="hidden" id="digitsAfterDecimal" name="digitsAfterDecimal" value="{{=$ctx.number(selectedProduct.principal.digitsAfterDecimal)}}" />
<input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" /> <input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" />
<input type="hidden" id="locale" name="locale" value="${currentLocale}" /> <input type="hidden" id="locale" name="locale" value="${currentLocale}" />
@@ -607,13 +605,13 @@
<div class="row"> <div class="row">
<span class="longrowlabel"><spring:message code="label.client.account.loan.term"/></span> <span class="longrowlabel"><spring:message code="label.client.account.loan.term"/></span>
<span class="rowvalue">{{=expectedLoanTermInMonths}} <spring:message code="label.months"/> / ({{=expectedLoanTermInDays}} <spring:message code="label.days"/>)</span> <span class="rowvalue">{{=convenienceData.expectedLoanTermInMonths}} <spring:message code="label.months"/> / ({{=convenienceData.expectedLoanTermInDays}} <spring:message code="label.days"/>)</span>
</div> </div>
{{#if closedOnDate !== null}} {{#if closedOnDate !== null}}
<div class="row"> <div class="row">
<span class="longrowlabel"><spring:message code="label.client.account.loan.actual.term"/></span> <span class="longrowlabel"><spring:message code="label.client.account.loan.actual.term"/></span>
<span class="rowvalue">{{=actualLoanTermInMonths}} <spring:message code="label.months"/> / ({{=actualLoanTermInDays}} <spring:message code="label.days"/>)</span> <span class="rowvalue">{{=convenienceData.actualLoanTermInMonths}} <spring:message code="label.months"/> / ({{=convenienceData.actualLoanTermInDays}} <spring:message code="label.days"/>)</span>
</div> </div>
{{/if}} {{/if}}
@@ -134,14 +134,12 @@ public class LoansApiResource {
BigDecimal inArrearsToleranceValue = this.apiDataConversionService.convertFrom(command.getInArrearsTolerance(), "inArrearsTolerance", clientApplicationLocale); BigDecimal inArrearsToleranceValue = this.apiDataConversionService.convertFrom(command.getInArrearsTolerance(), "inArrearsTolerance", clientApplicationLocale);
BigDecimal interestRatePerPeriodValue = this.apiDataConversionService.convertFrom(command.getInterestRatePerPeriod(),"interestRatePerPeriod", clientApplicationLocale); BigDecimal interestRatePerPeriodValue = this.apiDataConversionService.convertFrom(command.getInterestRatePerPeriod(),"interestRatePerPeriod", clientApplicationLocale);
Integer digitsAfterDecimalValue = this.apiDataConversionService.convertToInteger(command.getDigitsAfterDecimal(), "digitsAfterDecimal", clientApplicationLocale);
Integer repaymentEveryValue = this.apiDataConversionService.convertToInteger(command.getRepaymentEvery(), "repaymentEvery", clientApplicationLocale); Integer repaymentEveryValue = this.apiDataConversionService.convertToInteger(command.getRepaymentEvery(), "repaymentEvery", clientApplicationLocale);
Integer numberOfRepaymentsValue = this.apiDataConversionService.convertToInteger(command.getNumberOfRepayments(), "numberOfRepayments", clientApplicationLocale); Integer numberOfRepaymentsValue = this.apiDataConversionService.convertToInteger(command.getNumberOfRepayments(), "numberOfRepayments", clientApplicationLocale);
command.setPrincipalValue(principalValue); command.setPrincipalValue(principalValue);
command.setInArrearsToleranceValue(inArrearsToleranceValue); command.setInArrearsToleranceValue(inArrearsToleranceValue);
command.setInterestRatePerPeriodValue(interestRatePerPeriodValue); command.setInterestRatePerPeriodValue(interestRatePerPeriodValue);
command.setDigitsAfterDecimalValue(digitsAfterDecimalValue);
command.setRepaymentEveryValue(repaymentEveryValue); command.setRepaymentEveryValue(repaymentEveryValue);
command.setNumberOfRepaymentsValue(numberOfRepaymentsValue); command.setNumberOfRepaymentsValue(numberOfRepaymentsValue);
@@ -9,8 +9,7 @@ import org.joda.time.LocalDate;
@XmlRootElement @XmlRootElement
public class CalculateLoanScheduleCommand { public class CalculateLoanScheduleCommand {
private String currencyCode; private Long productId;
private Integer digitsAfterDecimalValue;
private BigDecimal principalValue; private BigDecimal principalValue;
private BigDecimal inArrearsToleranceValue; private BigDecimal inArrearsToleranceValue;
@@ -32,15 +31,15 @@ public class CalculateLoanScheduleCommand {
// //
} }
public CalculateLoanScheduleCommand(final String currencyCode, public CalculateLoanScheduleCommand(
final Integer digitsAfterDecimal, final Number principal, final Long productId,
final Number principal,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod, final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod,
final LocalDate expectedDisbursementDate, final LocalDate expectedDisbursementDate,
final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate) { final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate) {
this.currencyCode = currencyCode; this.productId = productId;
this.digitsAfterDecimalValue = digitsAfterDecimal;
if (principal != null) { if (principal != null) {
this.principalValue = BigDecimal.valueOf(principal.doubleValue()); this.principalValue = BigDecimal.valueOf(principal.doubleValue());
} }
@@ -60,21 +59,21 @@ public class CalculateLoanScheduleCommand {
this.interestChargedFromLocalDate= interestCalculatedFromDate; this.interestChargedFromLocalDate= interestCalculatedFromDate;
} }
public String getCurrencyCode() { // public String getCurrencyCode() {
return currencyCode; // return currencyCode;
} // }
//
public void setCurrencyCode(String currencyCode) { // public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode; // this.currencyCode = currencyCode;
} // }
//
public Integer getDigitsAfterDecimalValue() { // public Integer getDigitsAfterDecimalValue() {
return digitsAfterDecimalValue; // return digitsAfterDecimalValue;
} // }
//
public void setDigitsAfterDecimalValue(Integer digitsAfterDecimalValue) { // public void setDigitsAfterDecimalValue(Integer digitsAfterDecimalValue) {
this.digitsAfterDecimalValue = digitsAfterDecimalValue; // this.digitsAfterDecimalValue = digitsAfterDecimalValue;
} // }
public BigDecimal getPrincipalValue() { public BigDecimal getPrincipalValue() {
return principalValue; return principalValue;
@@ -183,4 +182,12 @@ public class CalculateLoanScheduleCommand {
LocalDate interestChargedFromLocalDate) { LocalDate interestChargedFromLocalDate) {
this.interestChargedFromLocalDate = interestChargedFromLocalDate; this.interestChargedFromLocalDate = interestChargedFromLocalDate;
} }
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
} }
@@ -15,9 +15,6 @@ public class SubmitLoanApplicationCommand {
// product // product
private String locale; private String locale;
private String currencyCode;
private String digitsAfterDecimal;
private Integer digitsAfterDecimalValue;
private BigDecimal principalValue; private BigDecimal principalValue;
private String principal; private String principal;
private BigDecimal inArrearsToleranceValue; private BigDecimal inArrearsToleranceValue;
@@ -63,8 +60,8 @@ public class SubmitLoanApplicationCommand {
final LocalDate expectedDisbursementDate, final LocalDate expectedDisbursementDate,
final LocalDate repaymentsStartingFromDate, final LocalDate repaymentsStartingFromDate,
final LocalDate interestChargedFromLocalDate, final LocalDate interestChargedFromLocalDate,
final LoanSchedule loanSchedule, final String currencyCode, final LoanSchedule loanSchedule,
final Integer digitsAfterDecimal, final Number principal, final Number principal,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod, final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount) { final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount) {
this.clientId = clientId; this.clientId = clientId;
@@ -77,8 +74,6 @@ public class SubmitLoanApplicationCommand {
this.loanSchedule = loanSchedule; this.loanSchedule = loanSchedule;
this.inArrearsToleranceValue = BigDecimal.valueOf(toleranceAmount.doubleValue()); this.inArrearsToleranceValue = BigDecimal.valueOf(toleranceAmount.doubleValue());
this.currencyCode = currencyCode;
this.digitsAfterDecimalValue = digitsAfterDecimal;
this.principalValue = BigDecimal.valueOf(principal.doubleValue()); this.principalValue = BigDecimal.valueOf(principal.doubleValue());
this.interestRatePerPeriodValue = BigDecimal.valueOf(interestRatePerPeriod.doubleValue()); this.interestRatePerPeriodValue = BigDecimal.valueOf(interestRatePerPeriod.doubleValue());
this.interestRateFrequencyType = interestRateFrequencyMethod; this.interestRateFrequencyType = interestRateFrequencyMethod;
@@ -91,7 +86,8 @@ public class SubmitLoanApplicationCommand {
} }
public CalculateLoanScheduleCommand toCalculateLoanScheduleCommand() { public CalculateLoanScheduleCommand toCalculateLoanScheduleCommand() {
return new CalculateLoanScheduleCommand(currencyCode, digitsAfterDecimalValue, principalValue, interestRatePerPeriodValue, interestRateFrequencyType, interestType, interestCalculationPeriodType, repaymentEveryValue, repaymentFrequencyType, numberOfRepaymentsValue, amortizationType, return new CalculateLoanScheduleCommand(productId,
principalValue, interestRatePerPeriodValue, interestRateFrequencyType, interestType, interestCalculationPeriodType, repaymentEveryValue, repaymentFrequencyType, numberOfRepaymentsValue, amortizationType,
expectedDisbursementLocalDate, repaymentsStartingFromLocalDate, interestChargedFromLocalDate); expectedDisbursementLocalDate, repaymentsStartingFromLocalDate, interestChargedFromLocalDate);
} }
@@ -127,14 +123,6 @@ public class SubmitLoanApplicationCommand {
this.externalId = externalId; this.externalId = externalId;
} }
public String getCurrencyCode() {
return currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getDateFormat() { public String getDateFormat() {
return dateFormat; return dateFormat;
} }
@@ -159,22 +147,6 @@ public class SubmitLoanApplicationCommand {
this.locale = locale; this.locale = locale;
} }
public String getDigitsAfterDecimal() {
return digitsAfterDecimal;
}
public void setDigitsAfterDecimal(String digitsAfterDecimal) {
this.digitsAfterDecimal = digitsAfterDecimal;
}
public Integer getDigitsAfterDecimalValue() {
return digitsAfterDecimalValue;
}
public void setDigitsAfterDecimalValue(Integer digitsAfterDecimalValue) {
this.digitsAfterDecimalValue = digitsAfterDecimalValue;
}
public BigDecimal getPrincipalValue() { public BigDecimal getPrincipalValue() {
return principalValue; return principalValue;
} }
@@ -22,8 +22,8 @@ public class CalculateLoanScheduleCommandValidator {
DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan");
baseDataValidator.reset().parameter("currencyCode").value(command.getCurrencyCode()).notBlank(); // baseDataValidator.reset().parameter("currencyCode").value(command.getCurrencyCode()).notBlank();
baseDataValidator.reset().parameter("digitsAfterDecimal").value(command.getDigitsAfterDecimalValue()).notNull().inMinMaxRange(0, 6); // baseDataValidator.reset().parameter("digitsAfterDecimal").value(command.getDigitsAfterDecimalValue()).notNull().inMinMaxRange(0, 6);
baseDataValidator.reset().parameter("principal").value(command.getPrincipalValue()).notNull().positiveAmount(); baseDataValidator.reset().parameter("principal").value(command.getPrincipalValue()).notNull().positiveAmount();
baseDataValidator.reset().parameter("repaymentFrequencyType").value(command.getRepaymentFrequencyType()).notNull().inMinMaxRange(0, 3); baseDataValidator.reset().parameter("repaymentFrequencyType").value(command.getRepaymentFrequencyType()).notNull().inMinMaxRange(0, 3);
baseDataValidator.reset().parameter("repaymentEvery").value(command.getRepaymentEveryValue()).notNull().greaterThanZero(); baseDataValidator.reset().parameter("repaymentEvery").value(command.getRepaymentEveryValue()).notNull().greaterThanZero();
@@ -1,5 +1,7 @@
package org.mifosng.platform.loan.service; package org.mifosng.platform.loan.service;
import static org.mifosng.platform.Specifications.productThatMatches;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@@ -12,18 +14,23 @@ import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
import org.mifosng.platform.currency.domain.MonetaryCurrency; import org.mifosng.platform.currency.domain.MonetaryCurrency;
import org.mifosng.platform.exceptions.CurrencyNotFoundException; import org.mifosng.platform.exceptions.CurrencyNotFoundException;
import org.mifosng.platform.exceptions.LoanNotFoundException; import org.mifosng.platform.exceptions.LoanNotFoundException;
import org.mifosng.platform.exceptions.LoanProductNotFoundException;
import org.mifosng.platform.loan.domain.AmortizationMethod; import org.mifosng.platform.loan.domain.AmortizationMethod;
import org.mifosng.platform.loan.domain.InterestCalculationPeriodMethod; import org.mifosng.platform.loan.domain.InterestCalculationPeriodMethod;
import org.mifosng.platform.loan.domain.InterestMethod; import org.mifosng.platform.loan.domain.InterestMethod;
import org.mifosng.platform.loan.domain.Loan; import org.mifosng.platform.loan.domain.Loan;
import org.mifosng.platform.loan.domain.LoanPayoffSummary; import org.mifosng.platform.loan.domain.LoanPayoffSummary;
import org.mifosng.platform.loan.domain.LoanProduct;
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail; import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
import org.mifosng.platform.loan.domain.LoanProductRepository;
import org.mifosng.platform.loan.domain.LoanRepository; import org.mifosng.platform.loan.domain.LoanRepository;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
import org.mifosng.platform.loanschedule.domain.AprCalculator; import org.mifosng.platform.loanschedule.domain.AprCalculator;
import org.mifosng.platform.loanschedule.domain.DefaultLoanScheduleGeneratorFactory; import org.mifosng.platform.loanschedule.domain.DefaultLoanScheduleGeneratorFactory;
import org.mifosng.platform.loanschedule.domain.LoanScheduleGenerator; import org.mifosng.platform.loanschedule.domain.LoanScheduleGenerator;
import org.mifosng.platform.loanschedule.domain.LoanScheduleGeneratorFactory; import org.mifosng.platform.loanschedule.domain.LoanScheduleGeneratorFactory;
import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosng.platform.user.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -33,12 +40,18 @@ public class CalculationPlatformServiceImpl implements
private final LoanScheduleGeneratorFactory loanScheduleFactory; private final LoanScheduleGeneratorFactory loanScheduleFactory;
private final LoanRepository loanRepository; private final LoanRepository loanRepository;
private final LoanProductRepository loanProductRepository;
private final ApplicationCurrencyRepository applicationCurrencyRepository; private final ApplicationCurrencyRepository applicationCurrencyRepository;
private final AprCalculator aprCalculator; private final AprCalculator aprCalculator;
private final PlatformSecurityContext context;
@Autowired @Autowired
public CalculationPlatformServiceImpl(final LoanRepository loanRepository, final ApplicationCurrencyRepository applicationCurrencyRepository, final AprCalculator aprCalculator) { public CalculationPlatformServiceImpl(final PlatformSecurityContext context,
final LoanRepository loanRepository, final LoanProductRepository loanProductRepository,
final ApplicationCurrencyRepository applicationCurrencyRepository, final AprCalculator aprCalculator) {
this.context = context;
this.loanRepository = loanRepository; this.loanRepository = loanRepository;
this.loanProductRepository = loanProductRepository;
this.applicationCurrencyRepository = applicationCurrencyRepository; this.applicationCurrencyRepository = applicationCurrencyRepository;
this.aprCalculator = aprCalculator; this.aprCalculator = aprCalculator;
this.loanScheduleFactory = new DefaultLoanScheduleGeneratorFactory(); this.loanScheduleFactory = new DefaultLoanScheduleGeneratorFactory();
@@ -47,6 +60,8 @@ public class CalculationPlatformServiceImpl implements
@Override @Override
public LoanSchedule calculateLoanSchedule(final CalculateLoanScheduleCommand command) { public LoanSchedule calculateLoanSchedule(final CalculateLoanScheduleCommand command) {
AppUser currentUser = context.authenticatedUser();
CalculateLoanScheduleCommandValidator validator = new CalculateLoanScheduleCommandValidator(command); CalculateLoanScheduleCommandValidator validator = new CalculateLoanScheduleCommandValidator(command);
validator.validate(); validator.validate();
@@ -62,7 +77,12 @@ public class CalculationPlatformServiceImpl implements
final BigDecimal defaultAnnualNominalInterestRate = this.aprCalculator.calculateFrom(interestPeriodFrequencyType, defaultNominalInterestRatePerPeriod); final BigDecimal defaultAnnualNominalInterestRate = this.aprCalculator.calculateFrom(interestPeriodFrequencyType, defaultNominalInterestRatePerPeriod);
final MonetaryCurrency currency = new MonetaryCurrency(command.getCurrencyCode(), command.getDigitsAfterDecimalValue()); LoanProduct loanProduct = this.loanProductRepository.findOne(productThatMatches(currentUser.getOrganisation(), command.getProductId()));
if (loanProduct == null) {
throw new LoanProductNotFoundException(command.getProductId());
}
final MonetaryCurrency currency = loanProduct.getCurrency();
// in arrerars tolerance isnt relevant when auto-calculating a loan schedule // in arrerars tolerance isnt relevant when auto-calculating a loan schedule
final BigDecimal inArrearsTolerance = BigDecimal.ZERO; final BigDecimal inArrearsTolerance = BigDecimal.ZERO;
@@ -75,8 +95,8 @@ public class CalculationPlatformServiceImpl implements
LoanScheduleGenerator loanScheduleGenerator = this.loanScheduleFactory.create(interestMethod); LoanScheduleGenerator loanScheduleGenerator = this.loanScheduleFactory.create(interestMethod);
ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneByCode(command.getCurrencyCode()); ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneByCode(currency.getCode());
CurrencyData currencyData = new CurrencyData(applicationCurrency.getCode(), applicationCurrency.getName(), command.getDigitsAfterDecimalValue(), CurrencyData currencyData = new CurrencyData(applicationCurrency.getCode(), applicationCurrency.getName(), currency.getDigitsAfterDecimal(),
applicationCurrency.getDisplaySymbol(), applicationCurrency.getNameCode()); applicationCurrency.getDisplaySymbol(), applicationCurrency.getNameCode());
return loanScheduleGenerator.generate(loanScheduleInfo, command.getExpectedDisbursementLocalDate(), command.getRepaymentsStartingFromLocalDate(), return loanScheduleGenerator.generate(loanScheduleInfo, command.getExpectedDisbursementLocalDate(), command.getRepaymentsStartingFromLocalDate(),
@@ -60,9 +60,7 @@ public class LoanAssembler {
throw new ClientNotFoundException(command.getClientId()); throw new ClientNotFoundException(command.getClientId());
} }
// FIXME - should probably fetch applicationCurrency with currencycode to check its validity. MonetaryCurrency currency = loanProduct.getCurrency();
MonetaryCurrency currency = new MonetaryCurrency(command.getCurrencyCode(), command.getDigitsAfterDecimalValue());
final BigDecimal defaultNominalInterestRatePerPeriod = command.getInterestRatePerPeriodValue(); final BigDecimal defaultNominalInterestRatePerPeriod = command.getInterestRatePerPeriodValue();
final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.fromInt(command.getInterestRateFrequencyType()); final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.fromInt(command.getInterestRateFrequencyType());
@@ -266,8 +266,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
LocalDate interestCalculatedFromDate = loan.getInterestChargedFromDate(); LocalDate interestCalculatedFromDate = loan.getInterestChargedFromDate();
Number principalAsDecimal = loan.getLoanRepaymentScheduleDetail().getPrincipal().getAmount(); Number principalAsDecimal = loan.getLoanRepaymentScheduleDetail().getPrincipal().getAmount();
String currencyCode = loan.getLoanRepaymentScheduleDetail().getPrincipal().getCurrencyCode(); // String currencyCode = loan.getLoanRepaymentScheduleDetail().getPrincipal().getCurrencyCode();
int currencyDigits = loan.getLoanRepaymentScheduleDetail().getPrincipal().getCurrencyDigitsAfterDecimal(); // int currencyDigits = loan.getLoanRepaymentScheduleDetail().getPrincipal().getCurrencyDigitsAfterDecimal();
Number interestRatePerYear = loan.getLoanRepaymentScheduleDetail().getAnnualNominalInterestRate(); Number interestRatePerYear = loan.getLoanRepaymentScheduleDetail().getAnnualNominalInterestRate();
Integer numberOfInstallments = loan.getLoanRepaymentScheduleDetail().getNumberOfRepayments(); Integer numberOfInstallments = loan.getLoanRepaymentScheduleDetail().getNumberOfRepayments();
@@ -283,7 +283,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
Integer interestMethod = loan.getLoanRepaymentScheduleDetail().getInterestMethod().getValue(); Integer interestMethod = loan.getLoanRepaymentScheduleDetail().getInterestMethod().getValue();
Integer interestCalculationInPeriod = loan.getLoanRepaymentScheduleDetail().getInterestCalculationPeriodMethod().getValue(); Integer interestCalculationInPeriod = loan.getLoanRepaymentScheduleDetail().getInterestCalculationPeriodMethod().getValue();
CalculateLoanScheduleCommand calculateCommand = new CalculateLoanScheduleCommand(currencyCode, currencyDigits, principalAsDecimal, CalculateLoanScheduleCommand calculateCommand = new CalculateLoanScheduleCommand(
loan.getLoanProduct().getId(),
principalAsDecimal,
interestRatePerPeriod, interestRateFrequencyMethod, interestMethod, interestCalculationInPeriod, interestRatePerPeriod, interestRateFrequencyMethod, interestMethod, interestCalculationInPeriod,
repaidEvery, selectedRepaymentFrequency, numberOfInstallments, repaidEvery, selectedRepaymentFrequency, numberOfInstallments,
selectedRepaymentSchedule, actualDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate); selectedRepaymentSchedule, actualDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate);
@@ -41,7 +41,7 @@ public class SubmitLoanApplicationCommandValidator {
try { try {
// reuse calculate loan schedule validator for now // reuse calculate loan schedule validator for now
CalculateLoanScheduleCommand calculateLoanScheduleCommand = new CalculateLoanScheduleCommand( CalculateLoanScheduleCommand calculateLoanScheduleCommand = new CalculateLoanScheduleCommand(
command.getCurrencyCode(), command.getDigitsAfterDecimalValue(), command.getProductId(),
command.getPrincipalValue(), command.getInterestRatePerPeriodValue(), command.getPrincipalValue(), command.getInterestRatePerPeriodValue(),
command.getInterestRateFrequencyType(), command.getInterestRateFrequencyType(),
command.getInterestType(), command.getInterestCalculationPeriodType(), command.getInterestType(), command.getInterestCalculationPeriodType(),