fix minor issues in Mifosx-437

This commit is contained in:
andrew-dzak
2013-10-18 13:19:17 +02:00
parent 7d9e4ca9c1
commit 961e581f63
2 changed files with 25 additions and 2 deletions
+20
View File
@@ -11072,6 +11072,26 @@ Request Body:
This field is mandatory if <i>chargeTimeType</i> is of type <b>Monthly Fee</b>
</td>
</tr>
<tr class=alt>
<td>minCap</td>
</tr>
<tr>
<td class=fielddesc>minimum cap: a 2% fee with a minimum cap of 500<br/>
In case of a 5000 loan, the 2% is 100, and therefore automatically 500 is used as the value of the charge.<br/>
This field is optional and can be used along when ChargeCalculationType equals (2) PERCENT_OF_AMOUNT
</td>
</tr>
<tr class=alt>
<td>maxCap</td>
</tr>
<tr>
<td class=fielddesc>maximum cap: A 2% fee, with a maximum of 2000. <br/>
In case of a 150000 loan, the 2% adds up to 3000 charge, and therefore the maximum cap of 2000 will be used. <br />
This field is optional and can be used along when ChargeCalculationType equals (2) PERCENT_OF_AMOUNT
</td>
</tr>
</table>
</div>
</div>
@@ -123,8 +123,7 @@ public class Charge extends AbstractPersistable<Long> {
this.penalty = penalty;
this.active = active;
this.chargePaymentMode = paymentMode == null ? null : paymentMode.getValue();
this.minCap = minCap;
this.maxCap = maxCap;
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges");
@@ -162,6 +161,10 @@ public class Charge extends AbstractPersistable<Long> {
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.time.for.loan");
}
}
if(isPercentageOfAmount()){
this.minCap = minCap;
this.maxCap = maxCap;
}
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
}