update loan loan charge functionality to show percentage value correctly if percentage of amount type of charge.
This commit is contained in:
+7
-1
@@ -108,7 +108,13 @@ public class ChargeData implements Comparable<ChargeData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LoanChargeData toLoanChargeData() {
|
public LoanChargeData toLoanChargeData() {
|
||||||
return LoanChargeData.newLoanChargeDetails(this.id, this.name, this.currency, this.amount, this.chargeTimeType,
|
|
||||||
|
BigDecimal percentage = null;
|
||||||
|
if (this.chargeCalculationType.getId() == 2) {
|
||||||
|
percentage = this.amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LoanChargeData.newLoanChargeDetails(this.id, this.name, this.currency, this.amount, percentage, this.chargeTimeType,
|
||||||
this.chargeCalculationType, this.penalty);
|
this.chargeCalculationType, this.penalty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
-6
@@ -67,7 +67,7 @@ public class LoanChargeData {
|
|||||||
private final boolean penalty;
|
private final boolean penalty;
|
||||||
|
|
||||||
public static LoanChargeData template(final Collection<ChargeData> chargeOptions) {
|
public static LoanChargeData template(final Collection<ChargeData> chargeOptions) {
|
||||||
return new LoanChargeData(null, null, null, null, null, null, null, chargeOptions, false);
|
return new LoanChargeData(null, null, null, null, null, null, null, null, chargeOptions, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,8 +75,9 @@ public class LoanChargeData {
|
|||||||
* charges)
|
* charges)
|
||||||
*/
|
*/
|
||||||
public static LoanChargeData newLoanChargeDetails(final Long chargeId, final String name, final CurrencyData currency,
|
public static LoanChargeData newLoanChargeDetails(final Long chargeId, final String name, final CurrencyData currency,
|
||||||
final BigDecimal value, final EnumOptionData chargeTimeType, final EnumOptionData chargeCalculationType, final boolean penalty) {
|
final BigDecimal amount, final BigDecimal percentage, final EnumOptionData chargeTimeType,
|
||||||
return new LoanChargeData(null, chargeId, name, currency, value, chargeTimeType, chargeCalculationType, null, penalty);
|
final EnumOptionData chargeCalculationType, final boolean penalty) {
|
||||||
|
return new LoanChargeData(null, chargeId, name, currency, amount, percentage, chargeTimeType, chargeCalculationType, null, penalty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
public LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
||||||
@@ -110,8 +111,8 @@ public class LoanChargeData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
private LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
||||||
final EnumOptionData chargeTimeType, final EnumOptionData chargeCalculationType, final Collection<ChargeData> chargeOptions,
|
final BigDecimal pecentage, final EnumOptionData chargeTimeType, final EnumOptionData chargeCalculationType,
|
||||||
final boolean penalty) {
|
final Collection<ChargeData> chargeOptions, final boolean penalty) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.chargeId = chargeId;
|
this.chargeId = chargeId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -124,7 +125,7 @@ public class LoanChargeData {
|
|||||||
this.chargeTimeType = chargeTimeType;
|
this.chargeTimeType = chargeTimeType;
|
||||||
this.dueDate = null;
|
this.dueDate = null;
|
||||||
this.chargeCalculationType = chargeCalculationType;
|
this.chargeCalculationType = chargeCalculationType;
|
||||||
this.percentage = null;
|
this.percentage = pecentage;
|
||||||
this.amountPercentageAppliedTo = null;
|
this.amountPercentageAppliedTo = null;
|
||||||
this.penalty = penalty;
|
this.penalty = penalty;
|
||||||
|
|
||||||
|
|||||||
+2
-24
@@ -833,20 +833,11 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
//FIXME: AA - We may require separate api command to move loan from one group to another
|
//FIXME: AA - We may require separate api command to move loan from one group to another
|
||||||
final String groupIdParamName = "groupId";
|
final String groupIdParamName = "groupId";
|
||||||
final Long groupId = this.group == null ? null : this.group.getId();
|
final Long groupId = this.group == null ? null : this.group.getId();
|
||||||
if (command.isChangeInLongParameterNamed(clientIdParamName, groupId)) {
|
if (command.isChangeInLongParameterNamed(groupIdParamName, groupId)) {
|
||||||
final Long newValue = command.longValueOfParameterNamed(groupIdParamName);
|
final Long newValue = command.longValueOfParameterNamed(groupIdParamName);
|
||||||
actualChanges.put(groupIdParamName, newValue);
|
actualChanges.put(groupIdParamName, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do not support loan type modification
|
|
||||||
/*final String loanTypeParamName = "loanType";
|
|
||||||
final String loanTypeStr = LoanType.fromInt(this.loanType).getName();
|
|
||||||
if (command.isChangeInStringParameterNamed(loanTypeParamName, loanTypeStr)) {
|
|
||||||
final String newValue = command.stringValueOfParameterNamed(loanTypeParamName);
|
|
||||||
actualChanges.put(loanTypeParamName, newValue);
|
|
||||||
this.loanType = LoanType.fromName(newValue).getValue();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
final String productIdParamName = "productId";
|
final String productIdParamName = "productId";
|
||||||
if (command.isChangeInLongParameterNamed(productIdParamName, this.loanProduct.getId())) {
|
if (command.isChangeInLongParameterNamed(productIdParamName, this.loanProduct.getId())) {
|
||||||
final Long newValue = command.longValueOfParameterNamed(productIdParamName);
|
final Long newValue = command.longValueOfParameterNamed(productIdParamName);
|
||||||
@@ -912,7 +903,6 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
final LocalDate newValue = command.localDateValueOfParameterNamed(expectedDisbursementDateParamName);
|
final LocalDate newValue = command.localDateValueOfParameterNamed(expectedDisbursementDateParamName);
|
||||||
this.expectedDisbursementDate = newValue.toDate();
|
this.expectedDisbursementDate = newValue.toDate();
|
||||||
removeFirstDisbursementTransaction();
|
removeFirstDisbursementTransaction();
|
||||||
disburse(getExpectedDisbursedOnLocalDate());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final String repaymentsStartingFromDateParamName = "repaymentsStartingFromDate";
|
final String repaymentsStartingFromDateParamName = "repaymentsStartingFromDate";
|
||||||
@@ -1252,18 +1242,6 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
return actualChanges;
|
return actualChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disburse(final LocalDate expectedDisbursedOnLocalDate) {
|
|
||||||
this.actualDisbursementDate = expectedDisbursedOnLocalDate.toDate();
|
|
||||||
updateLoanScheduleDependentDerivedFields();
|
|
||||||
/****
|
|
||||||
* Vishwas TODO: Re-factor to skip unnecessary creation of Disbursement
|
|
||||||
* and fees applied transactions (though they are not persisted) on
|
|
||||||
* modifications to loan application modification
|
|
||||||
*****/
|
|
||||||
PaymentDetail paymentDetail = null;
|
|
||||||
handleDisbursementTransaction(paymentDetail, expectedDisbursedOnLocalDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Collection<Long> findExistingTransactionIds() {
|
private Collection<Long> findExistingTransactionIds() {
|
||||||
|
|
||||||
Collection<Long> ids = new ArrayList<Long>();
|
Collection<Long> ids = new ArrayList<Long>();
|
||||||
@@ -1988,7 +1966,7 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
private boolean hasDisbursementTransaction() {
|
private boolean hasDisbursementTransaction() {
|
||||||
boolean hasRepaymentTransaction = false;
|
boolean hasRepaymentTransaction = false;
|
||||||
for (LoanTransaction loanTransaction : this.loanTransactions) {
|
for (LoanTransaction loanTransaction : this.loanTransactions) {
|
||||||
if (loanTransaction.isDisbursement()) {
|
if (loanTransaction.isDisbursement() && loanTransaction.isNotReversed()) {
|
||||||
hasRepaymentTransaction = true;
|
hasRepaymentTransaction = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user