MIFOSX-1183 and adding upfront accrual transaction back for cash based and no accounting rules
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
/**Remove all existing apply interest transaction Types**/
|
||||
update m_loan_transaction set interest_portion_derived=amount where transaction_type_enum=11;
|
||||
update m_loan_transaction set transaction_type_enum=10 where transaction_type_enum=11;
|
||||
|
||||
|
||||
+15
-5
@@ -1744,10 +1744,11 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
|
||||
/**
|
||||
* Add an interest applied transaction of the interest is accrued
|
||||
* upfront (Up front accrual)
|
||||
* upfront (Up front accrual), no accounting or cash based accounting is
|
||||
* selected
|
||||
**/
|
||||
|
||||
if (isUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||
if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||
final LoanTransaction interestAppliedTransaction = LoanTransaction.accrueInterest(getOffice(), this, interestApplied,
|
||||
actualDisbursementDate);
|
||||
this.loanTransactions.add(interestAppliedTransaction);
|
||||
@@ -2007,10 +2008,10 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* create a Charge applied transaction if Upfront Accrual is
|
||||
* enabled
|
||||
* create a Charge applied transaction if Upfront Accrual,
|
||||
* None or Cash based accounting is enabled
|
||||
**/
|
||||
if (isUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||
if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||
handleChargeAppliedTransaction(charge, disbursedOn);
|
||||
}
|
||||
}
|
||||
@@ -3283,6 +3284,15 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
return this.loanProduct.isUpfrontAccrualAccountingEnabled();
|
||||
}
|
||||
|
||||
public Boolean isAccountingDisabledOnLoanProduct() {
|
||||
return this.loanProduct.isAccountingDisabled();
|
||||
}
|
||||
|
||||
public Boolean isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct() {
|
||||
return isCashBasedAccountingEnabledOnLoanProduct() || isUpfrontAccrualAccountingEnabledOnLoanProduct()
|
||||
|| isAccountingDisabledOnLoanProduct();
|
||||
}
|
||||
|
||||
private Boolean isPeriodicAccrualAccountingEnabledOnLoanProduct() {
|
||||
return this.loanProduct.isPeriodicAccrualAccountingEnabled();
|
||||
}
|
||||
|
||||
+3
-3
@@ -579,7 +579,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount"));
|
||||
changes.put("locale", command.locale());
|
||||
changes.put("dateFormat", command.dateFormat());
|
||||
changes.put("paymentTypeId",command.stringValueOfParameterNamed("paymentTypeId"));
|
||||
changes.put("paymentTypeId", command.stringValueOfParameterNamed("paymentTypeId"));
|
||||
|
||||
final String noteText = command.stringValueOfParameterNamed("note");
|
||||
if (StringUtils.isNotBlank(noteText)) {
|
||||
@@ -656,7 +656,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount"));
|
||||
changes.put("locale", command.locale());
|
||||
changes.put("dateFormat", command.dateFormat());
|
||||
changes.put("paymentTypeId",command.stringValueOfParameterNamed("paymentTypeId"));
|
||||
changes.put("paymentTypeId", command.stringValueOfParameterNamed("paymentTypeId"));
|
||||
|
||||
final List<Long> existingTransactionIds = new ArrayList<Long>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<Long>();
|
||||
@@ -1047,7 +1047,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
* Upfront Accruals
|
||||
**/
|
||||
if (loan.status().isActive()) {
|
||||
if (loan.isUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||
if (loan.isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||
final LoanTransaction applyLoanChargeTransaction = loan.handleChargeAppliedTransaction(loanCharge, null);
|
||||
this.loanTransactionRepository.save(applyLoanChargeTransaction);
|
||||
}
|
||||
|
||||
+4
@@ -623,6 +623,10 @@ public class LoanProduct extends AbstractPersistable<Long> {
|
||||
return actualChanges;
|
||||
}
|
||||
|
||||
public boolean isAccountingDisabled() {
|
||||
return AccountingRuleType.NONE.getValue().equals(this.accountingRule);
|
||||
}
|
||||
|
||||
public boolean isCashBasedAccountingEnabled() {
|
||||
return AccountingRuleType.CASH_BASED.getValue().equals(this.accountingRule);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user