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
|
* 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,
|
final LoanTransaction interestAppliedTransaction = LoanTransaction.accrueInterest(getOffice(), this, interestApplied,
|
||||||
actualDisbursementDate);
|
actualDisbursementDate);
|
||||||
this.loanTransactions.add(interestAppliedTransaction);
|
this.loanTransactions.add(interestAppliedTransaction);
|
||||||
@@ -2007,10 +2008,10 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
* create a Charge applied transaction if Upfront Accrual is
|
* create a Charge applied transaction if Upfront Accrual,
|
||||||
* enabled
|
* None or Cash based accounting is enabled
|
||||||
**/
|
**/
|
||||||
if (isUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||||
handleChargeAppliedTransaction(charge, disbursedOn);
|
handleChargeAppliedTransaction(charge, disbursedOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3283,6 +3284,15 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
return this.loanProduct.isUpfrontAccrualAccountingEnabled();
|
return this.loanProduct.isUpfrontAccrualAccountingEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isAccountingDisabledOnLoanProduct() {
|
||||||
|
return this.loanProduct.isAccountingDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct() {
|
||||||
|
return isCashBasedAccountingEnabledOnLoanProduct() || isUpfrontAccrualAccountingEnabledOnLoanProduct()
|
||||||
|
|| isAccountingDisabledOnLoanProduct();
|
||||||
|
}
|
||||||
|
|
||||||
private Boolean isPeriodicAccrualAccountingEnabledOnLoanProduct() {
|
private Boolean isPeriodicAccrualAccountingEnabledOnLoanProduct() {
|
||||||
return this.loanProduct.isPeriodicAccrualAccountingEnabled();
|
return this.loanProduct.isPeriodicAccrualAccountingEnabled();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -579,7 +579,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount"));
|
changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount"));
|
||||||
changes.put("locale", command.locale());
|
changes.put("locale", command.locale());
|
||||||
changes.put("dateFormat", command.dateFormat());
|
changes.put("dateFormat", command.dateFormat());
|
||||||
changes.put("paymentTypeId",command.stringValueOfParameterNamed("paymentTypeId"));
|
changes.put("paymentTypeId", command.stringValueOfParameterNamed("paymentTypeId"));
|
||||||
|
|
||||||
final String noteText = command.stringValueOfParameterNamed("note");
|
final String noteText = command.stringValueOfParameterNamed("note");
|
||||||
if (StringUtils.isNotBlank(noteText)) {
|
if (StringUtils.isNotBlank(noteText)) {
|
||||||
@@ -656,7 +656,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount"));
|
changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount"));
|
||||||
changes.put("locale", command.locale());
|
changes.put("locale", command.locale());
|
||||||
changes.put("dateFormat", command.dateFormat());
|
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> existingTransactionIds = new ArrayList<Long>();
|
||||||
final List<Long> existingReversedTransactionIds = new ArrayList<Long>();
|
final List<Long> existingReversedTransactionIds = new ArrayList<Long>();
|
||||||
@@ -1047,7 +1047,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
* Upfront Accruals
|
* Upfront Accruals
|
||||||
**/
|
**/
|
||||||
if (loan.status().isActive()) {
|
if (loan.status().isActive()) {
|
||||||
if (loan.isUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
if (loan.isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()) {
|
||||||
final LoanTransaction applyLoanChargeTransaction = loan.handleChargeAppliedTransaction(loanCharge, null);
|
final LoanTransaction applyLoanChargeTransaction = loan.handleChargeAppliedTransaction(loanCharge, null);
|
||||||
this.loanTransactionRepository.save(applyLoanChargeTransaction);
|
this.loanTransactionRepository.save(applyLoanChargeTransaction);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -623,6 +623,10 @@ public class LoanProduct extends AbstractPersistable<Long> {
|
|||||||
return actualChanges;
|
return actualChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAccountingDisabled() {
|
||||||
|
return AccountingRuleType.NONE.getValue().equals(this.accountingRule);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCashBasedAccountingEnabled() {
|
public boolean isCashBasedAccountingEnabled() {
|
||||||
return AccountingRuleType.CASH_BASED.getValue().equals(this.accountingRule);
|
return AccountingRuleType.CASH_BASED.getValue().equals(this.accountingRule);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user