squash changes in interest-calculation-extension branch

This commit is contained in:
Keith Woodlock
2012-05-01 17:31:32 +01:00
parent ff120f925c
commit d3d40cabe0
37 changed files with 1639 additions and 406 deletions
@@ -128,6 +128,7 @@ public class LoanController {
@RequestParam(value="nominalInterestRate", required=false) String nominalInterestRate,
@RequestParam(value="selectedInterestFrequencyOption", required=false) Integer interestRateFrequencyMethod,
@RequestParam(value="selectedInterestMethodOption", required=false) Integer interestMethod,
@RequestParam(value="interestRateCalculatedInPeriod", required=false) Integer interestRateCalculatedInPeriod,
@RequestParam(value="expectedDisbursementDate", required=false) String expectedDisbursementDateStr,
@RequestParam(value="repaymentsStartingFromDate", required=false) String repaymentsStartingFromDateStr,
@RequestParam(value="interestCalculatedFromDate", required=false) String interestCalculatedFromDateStr
@@ -146,7 +147,7 @@ public class LoanController {
final LocalDate interestCalculatedFromDate = parseStringToLocalDate(interestCalculatedFromDateStr, "interestCalculatedFromDate");
CalculateLoanScheduleCommand calculateLoanScheduleCommand = new CalculateLoanScheduleCommand(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod,
interestRateFrequencyMethod, interestMethod, repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod,
interestRateFrequencyMethod, interestMethod, interestRateCalculatedInPeriod, repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod,
flexibleRepaymentSchedule, interestRebateAllowed, expectedDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate);
LoanSchedule loanSchedule = this.commonRestOperations.calculateLoanSchedule(calculateLoanScheduleCommand);
@@ -154,7 +155,7 @@ public class LoanController {
SubmitLoanApplicationCommand command = new SubmitLoanApplicationCommand(applicantId, productId,
submittedOnDate, submittedOnNote, expectedDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate,
loanSchedule, currencyCode, digitsAfterDecimal, principal,
interestRatePerPeriod, interestRateFrequencyMethod, interestMethod,
interestRatePerPeriod, interestRateFrequencyMethod, interestMethod, interestRateCalculatedInPeriod,
repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod,
toleranceAmount, flexibleRepaymentSchedule, interestRebateAllowed);
@@ -175,6 +176,7 @@ public class LoanController {
@RequestParam(value="nominalInterestRate", required=false) String nominalInterestRate,
@RequestParam(value="selectedInterestFrequencyOption", required=false) Integer interestRateFrequencyMethod,
@RequestParam(value="selectedInterestMethodOption", required=false) Integer interestMethod,
@RequestParam(value="interestRateCalculatedInPeriod", required=false) Integer interestRateCalculatedInPeriod,
@RequestParam(value="expectedDisbursementDate", required=false) String expectedDisbursementDateStr,
@RequestParam(value="repaymentsStartingFromDate", required=false) String repaymentsStartingFromDateStr,
@RequestParam(value="interestCalculatedFromDate", required=false) String interestCalculatedFromDateStr
@@ -189,7 +191,7 @@ public class LoanController {
final LocalDate interestCalculatedFromDate = parseStringToLocalDate(interestCalculatedFromDateStr, "interestCalculatedFromDate");
CalculateLoanScheduleCommand command = new CalculateLoanScheduleCommand(currencyCode, digitsAfterDecimal, principal, interestRatePerPeriod,
interestRateFrequencyMethod, interestMethod, repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod,
interestRateFrequencyMethod, interestMethod, interestRateCalculatedInPeriod, repaymentEvery, repaymentFrequency, numberOfRepayments, amortizationMethod,
flexibleRepaymentSchedule, interestRebateAllowed, expectedDisbursementDate, repaymentsStartingFromDate, interestCalculatedFromDate);
return this.commonRestOperations.calculateLoanSchedule(command);
@@ -102,7 +102,8 @@ public class LoanProductController {
@RequestParam("inArrearsTolerance") String inArrearsToleranceAsNumber,
@RequestParam("nominalInterestRate") String nominalInterestRatePerPeriodAsNumber,
@RequestParam("selectedInterestFrequencyOption") Integer nominalInterestRatePerPeriodFrequency,
@RequestParam("selectedInterestMethodOption") Integer interestMethod
@RequestParam("selectedInterestMethodOption") Integer interestMethod,
@RequestParam(value="interestRateCalculatedInPeriod", required=false) Integer interestCalculationPeriodMethod
) {
CreateLoanProductCommand command = new CreateLoanProductCommand();
@@ -132,6 +133,7 @@ public class LoanProductController {
}
command.setInterestRateFrequencyMethod(nominalInterestRatePerPeriodFrequency);
command.setInterestMethod(interestMethod);
command.setInterestCalculationPeriodMethod(interestCalculationPeriodMethod);
return this.commonRestOperations.createLoanProduct(command);
}
@@ -155,7 +157,8 @@ public class LoanProductController {
@RequestParam("inArrearsTolerance") String inArrearsToleranceAsNumber,
@RequestParam("nominalInterestRate") String nominalInterestRatePerPeriodAsNumber,
@RequestParam("selectedInterestFrequencyOption") Integer nominalInterestRatePerPeriodFrequency,
@RequestParam("selectedInterestMethodOption") Integer interestMethod
@RequestParam("selectedInterestMethodOption") Integer interestMethod,
@RequestParam(value="interestRateCalculatedInPeriod", required=false) Integer interestCalculationPeriodMethod
) {
UpdateLoanProductCommand command = new UpdateLoanProductCommand();
@@ -187,6 +190,7 @@ public class LoanProductController {
}
command.setInterestRateFrequencyMethod(nominalInterestRatePerPeriodFrequency);
command.setInterestMethod(interestMethod);
command.setInterestCalculationPeriodMethod(interestCalculationPeriodMethod);
return this.commonRestOperations.updateLoanProduct(command);
}
@@ -237,6 +237,7 @@ form.label.loan.product.amortization=Amortization:
form.label.loan.product.arrears.tolerance=Arrears tolerance:
form.label.loan.product.nominal.interestrate=Nominal interest rate %:
form.label.loan.product.interest.method=Interest method:
form.label.loan.product.interest.rate.calcutated.in.period=Interest calculation period:
validation.msg.product.name.cannot.be.blank=Product name cannot be blank.
validation.msg.product.description.exceeds.max.length=The content of the description has exceeded max allowed length of 500 characters.
@@ -236,6 +236,7 @@ form.label.loan.product.amortization=Amortization:(fr)
form.label.loan.product.arrears.tolerance=Arrears tolerance:(fr)
form.label.loan.product.nominal.interestrate=Nominal interest rate %:(fr)
form.label.loan.product.interest.method=Interest method:(fr)
form.label.loan.product.interest.rate.calcutated.in.period=Interest calculation period:(fr)
validation.msg.product.name.cannot.be.blank=Product name cannot be blank.(fr)
validation.msg.product.description.exceeds.max.length=The content of the description has exceeded max allowed length of 500 characters.(fr)
@@ -82,26 +82,6 @@
<input id="numberOfRepayments" name="numberOfRepayments" title="" style="width: 50px;" value="{{=$ctx.number(numberOfRepayments)}}"/>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.amortization"/></td>
<td>
<select id="selectedAmortizationMethodOption" name="selectedAmortizationMethodOption" title="" style="width: 178px;">
{{#each possibleAmortizationOptions}}
{{#if $ctx.number($parent.parent.data.amortizationMethod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.arrears.tolerance"/></td>
<td>
<input id="inArrearsTolerance" name="inArrearsTolerance" title="" style="width: 125px;" value="{{=$ctx.money(inArrearsTolerance)}}" />
</td>
</tr>
</table>
</td>
<td valign="top" style="padding-left: 5px; padding-right: 5px; border-right: 1px solid;">
@@ -109,15 +89,29 @@
<tr>
<td><spring:message code="form.label.loan.product.nominal.interestrate"/></td>
<td>
<input id="nominalInterestRate" name="nominalInterestRate" title="" style="width: 60px;" value="{{=$ctx.decimal(interestRatePerPeriod, 4)}}" />
<input id="nominalInterestRate" name="nominalInterestRate" title="" style="width: 70px;" value="{{=$ctx.decimal(interestRatePerPeriod, 4)}}" />
<select id="selectedInterestFrequencyOption" name="selectedInterestFrequencyOption" title="" style="width: 115px;">
<select id="selectedInterestFrequencyOption" name="selectedInterestFrequencyOption" title="" style="width: 139px;">
{{#each interestFrequencyOptions}}
{{#if $ctx.number($parent.parent.data.interestRatePeriod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.amortization"/></td>
<td>
<select id="selectedAmortizationMethodOption" name="selectedAmortizationMethodOption" title="" style="width: 220px;">
{{#each possibleAmortizationOptions}}
{{#if $ctx.number($parent.parent.data.amortizationMethod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
@@ -125,7 +119,7 @@
<tr>
<td><spring:message code="form.label.loan.product.interest.method"/></td>
<td>
<select id="selectedInterestMethodOption" name="selectedInterestMethodOption" title="" style="width: 180px;">
<select id="selectedInterestMethodOption" name="selectedInterestMethodOption" title="" style="width: 220px;">
{{#each possibleInterestOptions}}
{{#if $ctx.number($parent.parent.data.interestMethod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
@@ -136,6 +130,26 @@
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.interest.rate.calcutated.in.period"/></td>
<td>
<select id="interestRateCalculatedInPeriod" name="interestRateCalculatedInPeriod" title="" style="width: 220px;">
{{#each possibleInterestRateCalculatedInPeriodOptions}}
{{#if $ctx.number($parent.parent.data.interestRateCalculatedInPeriod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.arrears.tolerance"/></td>
<td>
<input id="inArrearsTolerance" name="inArrearsTolerance" title="" style="width: 215px;" value="{{=$ctx.money(inArrearsTolerance)}}" />
</td>
</tr>
</table>
</td>
</tr>
@@ -201,20 +201,6 @@ $(document).ready(function() {
calculateLoanSchedule();
});
$('#nominalInterestRate').change(function() {
calculateAnnualPercentageRate();
calculateLoanSchedule();
});
$('#selectedInterestFrequencyOption').change(function() {
calculateAnnualPercentageRate();
calculateLoanSchedule();
});
$('#selectedInterestMethodOption').change(function() {
calculateLoanSchedule();
});
$('#repaidEvery').change(function() {
calculateLoanSchedule();
});
@@ -227,10 +213,6 @@ $(document).ready(function() {
calculateLoanSchedule();
});
$('#selectedAmortizationMethodOption').change(function() {
calculateLoanSchedule();
});
$('#expectedDisbursementDate').change(function() {
calculateLoanSchedule();
});
@@ -239,6 +221,28 @@ $(document).ready(function() {
calculateLoanSchedule();
});
$('#nominalInterestRate').change(function() {
calculateAnnualPercentageRate();
calculateLoanSchedule();
});
$('#selectedInterestFrequencyOption').change(function() {
calculateAnnualPercentageRate();
calculateLoanSchedule();
});
$('#selectedAmortizationMethodOption').change(function() {
calculateLoanSchedule();
});
$('#selectedInterestMethodOption').change(function() {
calculateLoanSchedule();
});
$('#interestRateCalculatedInPeriod').change(function() {
calculateLoanSchedule();
});
$('#interestCalculatedFromDate').change(function() {
calculateLoanSchedule();
});
@@ -128,27 +128,6 @@
<input id="numberOfRepayments" name="numberOfRepayments" title="" type="text" value="{{=$ctx.number(selectedProduct.numberOfRepayments)}}" style="width: 50px;" />
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.amortization"/></td>
<td>
<select name="selectedAmortizationMethodOption" id="selectedAmortizationMethodOption" title="" style="width: 178px;">
{{#each selectedProduct.possibleAmortizationOptions}}
{{#if $ctx.number($parent.parent.data.selectedProduct.amortizationMethod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.arrears.tolerance"/></td>
<td>
<input id="inArrearsTolerance" name="inArrearsTolerance" title="" type="text" value="{{=$ctx.money(selectedProduct.inArrearsTolerance)}}" style="width: 125px;" />
<input id="inArrearsTolerance.currencyCode" name="inArrearsTolerance.currencyCode" title="" type="text" value="{{=selectedProduct.inArrearsTolerance.displaySymbol}}" style="width: 40px;" disabled="disabled" />
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.expected.disbursement.date.on"/></td>
<td>
@@ -188,6 +167,20 @@
<input id="interestRatePerYear" name="interestRatePerYear" title="" type="text" style="width: 60px;" disabled="disabled" />
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.amortization"/></td>
<td>
<select name="selectedAmortizationMethodOption" id="selectedAmortizationMethodOption" title="" style="width: 178px;">
{{#each selectedProduct.possibleAmortizationOptions}}
{{#if $ctx.number($parent.parent.data.selectedProduct.amortizationMethod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.interest.method"/></td>
<td>
@@ -202,12 +195,33 @@
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.interest.rate.calcutated.in.period"/></td>
<td>
<select id="interestRateCalculatedInPeriod" name="interestRateCalculatedInPeriod" title="" style="width: 220px;">
{{#each selectedProduct.possibleInterestRateCalculatedInPeriodOptions}}
{{#if $ctx.number($parent.parent.data.selectedProduct.interestRateCalculatedInPeriod)===$ctx.number(id)}}
<option value="{{=$ctx.number(id)}}" selected="selected">{{=value}}</option>
{{#else}}
<option value="{{=$ctx.number(id)}}">{{=value}}</option>
{{/if}}
{{/each}}
</select>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.interest.charged.from"/></td>
<td>
<input id="interestCalculatedFromDate" name="interestCalculatedFromDate" title="" type="text" class="datepickerfield" value="{{=$ctx.globalDate(interestCalculatedFromDate)}}" style="width:172px;"/>
</td>
</tr>
<tr>
<td><spring:message code="form.label.loan.product.arrears.tolerance"/></td>
<td>
<input id="inArrearsTolerance" name="inArrearsTolerance" title="" type="text" value="{{=$ctx.money(selectedProduct.inArrearsTolerance)}}" style="width: 125px;" />
<input id="inArrearsTolerance.currencyCode" name="inArrearsTolerance.currencyCode" title="" type="text" value="{{=selectedProduct.inArrearsTolerance.displaySymbol}}" style="width: 40px;" disabled="disabled" />
</td>
</tr>
</table>
</td>
<td>