FINERACT-821 Added and Enforced Typename checkstyle
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
014c6bba40
commit
baa1177854
@@ -71,6 +71,10 @@
|
||||
<property name="format" value="\.printStackTrace?\("/>
|
||||
<property name="message" value="Line contains printStacktrace()."/>
|
||||
<property name="ignoreComments" value="false" />
|
||||
</module>
|
||||
<module name="TypeName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="PackageName">
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9_]*)*$"/>
|
||||
@@ -158,11 +162,6 @@
|
||||
<property name="tokens" value="COMMA"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
|
||||
<module name="TypeName">
|
||||
<message key="name.invalidPattern"
|
||||
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.exception.DuplicateFinancialActivityAccountFoundException;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.exception.FinancialActivityAccountInvalidException;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
@@ -50,8 +50,8 @@ public class FinancialActivityAccountsTest {
|
||||
private RequestSpecification requestSpec;
|
||||
private AccountHelper accountHelper;
|
||||
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
||||
private final Integer assetTransferFinancialActivityId = FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue();
|
||||
public static final Integer liabilityTransferFinancialActivityId = FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue();
|
||||
private final Integer assetTransferFinancialActivityId = FinancialActivity.ASSET_TRANSFER.getValue();
|
||||
public static final Integer liabilityTransferFinancialActivityId = FinancialActivity.LIABILITY_TRANSFER.getValue();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -2501,7 +2501,7 @@ public class FixedDepositTest {
|
||||
}
|
||||
|
||||
private Account getMappedLiabilityFinancialAccount() {
|
||||
final Integer liabilityTransferFinancialActivityId = FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue();
|
||||
final Integer liabilityTransferFinancialActivityId = FinancialActivity.LIABILITY_TRANSFER.getValue();
|
||||
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
|
||||
final Account financialAccount;
|
||||
/***
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -3137,7 +3137,7 @@ public class RecurringDepositTest {
|
||||
}
|
||||
|
||||
private Account getMappedLiabilityFinancialAccount() {
|
||||
final Integer liabilityTransferFinancialActivityId = FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue();
|
||||
final Integer liabilityTransferFinancialActivityId = FinancialActivity.LIABILITY_TRANSFER.getValue();
|
||||
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
|
||||
final Account financialAccount;
|
||||
/***
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class GLClosureInvalidException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons for invalid Accounting Closure **/
|
||||
public static enum GL_CLOSURE_INVALID_REASON {
|
||||
public static enum GlClosureInvalidReason {
|
||||
FUTURE_DATE, ACCOUNTING_CLOSED;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -45,7 +45,7 @@ public class GLClosureInvalidException extends AbstractPlatformDomainRuleExcepti
|
||||
}
|
||||
}
|
||||
|
||||
public GLClosureInvalidException(final GL_CLOSURE_INVALID_REASON reason, final Date date) {
|
||||
public GLClosureInvalidException(final GlClosureInvalidReason reason, final Date date) {
|
||||
super(reason.errorCode(), reason.errorMessage(), date);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -27,7 +27,7 @@ import org.apache.fineract.accounting.closure.domain.GLClosureRepository;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureDuplicateException;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureInvalidDeleteException;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureInvalidException;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureInvalidException.GL_CLOSURE_INVALID_REASON;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureInvalidException.GlClosureInvalidReason;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureNotFoundException;
|
||||
import org.apache.fineract.accounting.closure.serialization.GLClosureCommandFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -75,12 +75,12 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
|
||||
// ensure closure date is not in the future
|
||||
final Date todaysDate = new Date();
|
||||
final Date closureDate = command.DateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue());
|
||||
if (closureDate.after(todaysDate)) { throw new GLClosureInvalidException(GL_CLOSURE_INVALID_REASON.FUTURE_DATE, closureDate); }
|
||||
if (closureDate.after(todaysDate)) { throw new GLClosureInvalidException(GlClosureInvalidReason.FUTURE_DATE, closureDate); }
|
||||
// shouldn't be before an existing accounting closure
|
||||
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
|
||||
if (latestGLClosure != null) {
|
||||
if (latestGLClosure.getClosingDate().after(closureDate)) { throw new GLClosureInvalidException(
|
||||
GL_CLOSURE_INVALID_REASON.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate()); }
|
||||
GlClosureInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate()); }
|
||||
}
|
||||
final GLClosure glClosure = GLClosure.fromJson(office, command);
|
||||
|
||||
|
||||
+43
-43
@@ -28,13 +28,13 @@ import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
public class AccountingConstants {
|
||||
|
||||
/*** Accounting placeholders for cash based accounting for loan products ***/
|
||||
public static enum CASH_ACCOUNTS_FOR_LOAN {
|
||||
public static enum CashAccountsForLoan {
|
||||
FUND_SOURCE(1), LOAN_PORTFOLIO(2), INTEREST_ON_LOANS(3), INCOME_FROM_FEES(4), INCOME_FROM_PENALTIES(5), LOSSES_WRITTEN_OFF(6), TRANSFERS_SUSPENSE(
|
||||
10), OVERPAYMENT(11), INCOME_FROM_RECOVERY(12);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private CASH_ACCOUNTS_FOR_LOAN(final Integer value) {
|
||||
private CashAccountsForLoan(final Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -47,27 +47,27 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_LOAN> intToEnumMap = new HashMap<>();
|
||||
private static final Map<Integer, CashAccountsForLoan> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final CASH_ACCOUNTS_FOR_LOAN type : CASH_ACCOUNTS_FOR_LOAN.values()) {
|
||||
for (final CashAccountsForLoan type : CashAccountsForLoan.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
}
|
||||
}
|
||||
|
||||
public static CASH_ACCOUNTS_FOR_LOAN fromInt(final int i) {
|
||||
final CASH_ACCOUNTS_FOR_LOAN type = intToEnumMap.get(Integer.valueOf(i));
|
||||
public static CashAccountsForLoan fromInt(final int i) {
|
||||
final CashAccountsForLoan type = intToEnumMap.get(Integer.valueOf(i));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
/*** Accounting placeholders for accrual based accounting for loan products ***/
|
||||
public static enum ACCRUAL_ACCOUNTS_FOR_LOAN {
|
||||
public static enum AccrualAccountsForLoan {
|
||||
FUND_SOURCE(1), LOAN_PORTFOLIO(2), INTEREST_ON_LOANS(3), INCOME_FROM_FEES(4), INCOME_FROM_PENALTIES(5), LOSSES_WRITTEN_OFF(6), INTEREST_RECEIVABLE(
|
||||
7), FEES_RECEIVABLE(8), PENALTIES_RECEIVABLE(9), TRANSFERS_SUSPENSE(10), OVERPAYMENT(11), INCOME_FROM_RECOVERY(12);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private ACCRUAL_ACCOUNTS_FOR_LOAN(final Integer value) {
|
||||
private AccrualAccountsForLoan(final Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -80,15 +80,15 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, ACCRUAL_ACCOUNTS_FOR_LOAN> intToEnumMap = new HashMap<>();
|
||||
private static final Map<Integer, AccrualAccountsForLoan> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final ACCRUAL_ACCOUNTS_FOR_LOAN type : ACCRUAL_ACCOUNTS_FOR_LOAN.values()) {
|
||||
for (final AccrualAccountsForLoan type : AccrualAccountsForLoan.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
}
|
||||
}
|
||||
|
||||
public static ACCRUAL_ACCOUNTS_FOR_LOAN fromInt(final int i) {
|
||||
final ACCRUAL_ACCOUNTS_FOR_LOAN type = intToEnumMap.get(Integer.valueOf(i));
|
||||
public static AccrualAccountsForLoan fromInt(final int i) {
|
||||
final AccrualAccountsForLoan type = intToEnumMap.get(Integer.valueOf(i));
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class AccountingConstants {
|
||||
* Enum of all accounting related input parameter names used while
|
||||
* creating/updating a loan product
|
||||
***/
|
||||
public static enum LOAN_PRODUCT_ACCOUNTING_PARAMS {
|
||||
public static enum LoanProductAccountingParams {
|
||||
FUND_SOURCE("fundSourceAccountId"), LOAN_PORTFOLIO("loanPortfolioAccountId"), INTEREST_ON_LOANS("interestOnLoanAccountId"), INCOME_FROM_FEES(
|
||||
"incomeFromFeeAccountId"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccountId"), LOSSES_WRITTEN_OFF("writeOffAccountId"), OVERPAYMENT(
|
||||
"overpaymentLiabilityAccountId"), INTEREST_RECEIVABLE("receivableInterestAccountId"), FEES_RECEIVABLE(
|
||||
@@ -110,7 +110,7 @@ public class AccountingConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private LOAN_PRODUCT_ACCOUNTING_PARAMS(final String value) {
|
||||
private LoanProductAccountingParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class AccountingConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS {
|
||||
public static enum LoanProductAccountingDataParams {
|
||||
FUND_SOURCE("fundSourceAccount"), LOAN_PORTFOLIO("loanPortfolioAccount"), INTEREST_ON_LOANS("interestOnLoanAccount"), INCOME_FROM_FEES(
|
||||
"incomeFromFeeAccount"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccount"), LOSSES_WRITTEN_OFF("writeOffAccount"), OVERPAYMENT(
|
||||
"overpaymentLiabilityAccount"), INTEREST_RECEIVABLE("receivableInterestAccount"), FEES_RECEIVABLE("receivableFeeAccount"), PENALTIES_RECEIVABLE(
|
||||
@@ -133,7 +133,7 @@ public class AccountingConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS(final String value) {
|
||||
private LoanProductAccountingDataParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -148,13 +148,13 @@ public class AccountingConstants {
|
||||
}
|
||||
|
||||
/*** Accounting placeholders for cash based accounting for savings products ***/
|
||||
public static enum CASH_ACCOUNTS_FOR_SAVINGS {
|
||||
public static enum CashAccountsForSavings {
|
||||
SAVINGS_REFERENCE(1), SAVINGS_CONTROL(2), INTEREST_ON_SAVINGS(3), INCOME_FROM_FEES(4), INCOME_FROM_PENALTIES(5), TRANSFERS_SUSPENSE(
|
||||
10), OVERDRAFT_PORTFOLIO_CONTROL(11), INCOME_FROM_INTEREST(12), LOSSES_WRITTEN_OFF(13), ESCHEAT_LIABILITY(14);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private CASH_ACCOUNTS_FOR_SAVINGS(final Integer value) {
|
||||
private CashAccountsForSavings(final Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -167,15 +167,15 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_SAVINGS> intToEnumMap = new HashMap<>();
|
||||
private static final Map<Integer, CashAccountsForSavings> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final CASH_ACCOUNTS_FOR_SAVINGS type : CASH_ACCOUNTS_FOR_SAVINGS.values()) {
|
||||
for (final CashAccountsForSavings type : CashAccountsForSavings.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
}
|
||||
}
|
||||
|
||||
public static CASH_ACCOUNTS_FOR_SAVINGS fromInt(final int i) {
|
||||
final CASH_ACCOUNTS_FOR_SAVINGS type = intToEnumMap.get(Integer.valueOf(i));
|
||||
public static CashAccountsForSavings fromInt(final int i) {
|
||||
final CashAccountsForSavings type = intToEnumMap.get(Integer.valueOf(i));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class AccountingConstants {
|
||||
* Enum of all accounting related input parameter names used while
|
||||
* creating/updating a savings product
|
||||
***/
|
||||
public static enum SAVINGS_PRODUCT_ACCOUNTING_PARAMS {
|
||||
public static enum SavingProductAccountingParams {
|
||||
SAVINGS_REFERENCE("savingsReferenceAccountId"), SAVINGS_CONTROL("savingsControlAccountId"), INCOME_FROM_FEES(
|
||||
"incomeFromFeeAccountId"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccountId"), INTEREST_ON_SAVINGS(
|
||||
"interestOnSavingsAccountId"), PAYMENT_CHANNEL_FUND_SOURCE_MAPPING("paymentChannelToFundSourceMappings"), PAYMENT_TYPE(
|
||||
@@ -195,7 +195,7 @@ public class AccountingConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private SAVINGS_PRODUCT_ACCOUNTING_PARAMS(final String value) {
|
||||
private SavingProductAccountingParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public class AccountingConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS {
|
||||
public static enum SavingProductAccountingDataParams {
|
||||
SAVINGS_REFERENCE("savingsReferenceAccount"), SAVINGS_CONTROL("savingsControlAccount"), INCOME_FROM_FEES("incomeFromFeeAccount"), INCOME_FROM_PENALTIES(
|
||||
"incomeFromPenaltyAccount"), INTEREST_ON_SAVINGS("interestOnSavingsAccount"), PAYMENT_TYPE("paymentType"), FUND_SOURCE(
|
||||
"fundSourceAccount"), TRANSFERS_SUSPENSE("transfersInSuspenseAccount"), PENALTY_INCOME_ACCOUNT_MAPPING(
|
||||
@@ -219,7 +219,7 @@ public class AccountingConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS(final String value) {
|
||||
private SavingProductAccountingDataParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ public class AccountingConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum FINANCIAL_ACTIVITY {
|
||||
public static enum FinancialActivity {
|
||||
ASSET_TRANSFER(100, "assetTransfer", GLAccountType.ASSET), LIABILITY_TRANSFER(200, "liabilityTransfer", GLAccountType.LIABILITY), CASH_AT_MAINVAULT(
|
||||
101, "cashAtMainVault", GLAccountType.ASSET), CASH_AT_TELLER(102, "cashAtTeller", GLAccountType.ASSET), OPENING_BALANCES_TRANSFER_CONTRA(
|
||||
300, "openingBalancesTransferContra", GLAccountType.EQUITY), ASSET_FUND_SOURCE(103, "fundSource", GLAccountType.ASSET), PAYABLE_DIVIDENDS(
|
||||
@@ -246,13 +246,13 @@ public class AccountingConstants {
|
||||
private static List<FinancialActivityData> financialActivities;
|
||||
static {
|
||||
financialActivities = new ArrayList<>();
|
||||
for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) {
|
||||
for (final FinancialActivity type : FinancialActivity.values()) {
|
||||
FinancialActivityData financialActivityData = convertToFinancialActivityData(type);
|
||||
financialActivities.add(financialActivityData);
|
||||
}
|
||||
}
|
||||
|
||||
private FINANCIAL_ACTIVITY(final Integer value, final String code, final GLAccountType mappedGLAccountType) {
|
||||
private FinancialActivity(final Integer value, final String code, final GLAccountType mappedGLAccountType) {
|
||||
this.value = value;
|
||||
this.code = code;
|
||||
this.mappedGLAccountType = mappedGLAccountType;
|
||||
@@ -279,20 +279,20 @@ public class AccountingConstants {
|
||||
return this.value.toString();
|
||||
}
|
||||
|
||||
private static final Map<Integer, FINANCIAL_ACTIVITY> intToEnumMap = new HashMap<>();
|
||||
private static final Map<Integer, FinancialActivity> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) {
|
||||
for (final FinancialActivity type : FinancialActivity.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
}
|
||||
}
|
||||
|
||||
public static FINANCIAL_ACTIVITY fromInt(final int financialActivityId) {
|
||||
final FINANCIAL_ACTIVITY type = intToEnumMap.get(Integer.valueOf(financialActivityId));
|
||||
public static FinancialActivity fromInt(final int financialActivityId) {
|
||||
final FinancialActivity type = intToEnumMap.get(Integer.valueOf(financialActivityId));
|
||||
return type;
|
||||
}
|
||||
|
||||
public static FinancialActivityData toFinancialActivityData(final int financialActivityId) {
|
||||
final FINANCIAL_ACTIVITY type = fromInt(financialActivityId);
|
||||
final FinancialActivity type = fromInt(financialActivityId);
|
||||
return convertToFinancialActivityData(type);
|
||||
}
|
||||
|
||||
@@ -300,19 +300,19 @@ public class AccountingConstants {
|
||||
return financialActivities;
|
||||
}
|
||||
|
||||
private static FinancialActivityData convertToFinancialActivityData(final FINANCIAL_ACTIVITY type) {
|
||||
private static FinancialActivityData convertToFinancialActivityData(final FinancialActivity type) {
|
||||
FinancialActivityData financialActivityData = new FinancialActivityData(type.value, type.code, type.getMappedGLAccountType());
|
||||
return financialActivityData;
|
||||
}
|
||||
}
|
||||
|
||||
/*** Accounting placeholders for cash based accounting for Share products ***/
|
||||
public static enum CASH_ACCOUNTS_FOR_SHARES {
|
||||
public static enum CashAccountsForShares {
|
||||
SHARES_REFERENCE(1), SHARES_SUSPENSE(2), INCOME_FROM_FEES(3), SHARES_EQUITY(4);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private CASH_ACCOUNTS_FOR_SHARES(final Integer value) {
|
||||
private CashAccountsForShares(final Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -325,15 +325,15 @@ public class AccountingConstants {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Integer, CASH_ACCOUNTS_FOR_SHARES> intToEnumMap = new HashMap<>();
|
||||
private static final Map<Integer, CashAccountsForShares> intToEnumMap = new HashMap<>();
|
||||
static {
|
||||
for (final CASH_ACCOUNTS_FOR_SHARES type : CASH_ACCOUNTS_FOR_SHARES.values()) {
|
||||
for (final CashAccountsForShares type : CashAccountsForShares.values()) {
|
||||
intToEnumMap.put(type.value, type);
|
||||
}
|
||||
}
|
||||
|
||||
public static CASH_ACCOUNTS_FOR_SHARES fromInt(final int i) {
|
||||
final CASH_ACCOUNTS_FOR_SHARES type = intToEnumMap.get(Integer.valueOf(i));
|
||||
public static CashAccountsForShares fromInt(final int i) {
|
||||
final CashAccountsForShares type = intToEnumMap.get(Integer.valueOf(i));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -342,13 +342,13 @@ public class AccountingConstants {
|
||||
* Enum of all accounting related input parameter names used while
|
||||
* creating/updating a savings product
|
||||
***/
|
||||
public static enum SHARES_PRODUCT_ACCOUNTING_PARAMS {
|
||||
public static enum SharesProductAccountingParams {
|
||||
SHARES_REFERENCE("shareReferenceId"), SHARES_SUSPENSE("shareSuspenseId"), INCOME_FROM_FEES("incomeFromFeeAccountId"), SHARES_EQUITY(
|
||||
"shareEquityId");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SHARES_PRODUCT_ACCOUNTING_PARAMS(final String value) {
|
||||
private SharesProductAccountingParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.financialactivityaccount.exception;
|
||||
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FinancialActivityAccountInvalidException extends AbstractPlatformDo
|
||||
|
||||
private final static String errorCode = "error.msg.financialActivityAccount.invalid";
|
||||
|
||||
public FinancialActivityAccountInvalidException(final FINANCIAL_ACTIVITY financialActivity, final GLAccount glAccount) {
|
||||
public FinancialActivityAccountInvalidException(final FinancialActivity financialActivity, final GLAccount glAccount) {
|
||||
super(errorCode, "Financial Activity '" + financialActivity.getCode() + "' with Id :" + financialActivity.getValue()
|
||||
+ "' can only be associated with a Ledger Account of Type " + financialActivity.getMappedGLAccountType().getCode()
|
||||
+ " the provided Ledger Account '" + glAccount.getName() + "(" + glAccount.getGlCode()
|
||||
|
||||
+8
-8
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.api.FinancialActivityAccountsJsonInputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -64,10 +64,10 @@ public final class FinancialActivityAccountDataValidator {
|
||||
|
||||
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
||||
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).notNull().isOneOfTheseValues(
|
||||
FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||
FINANCIAL_ACTIVITY.CASH_AT_MAINVAULT.getValue(), FINANCIAL_ACTIVITY.CASH_AT_TELLER.getValue(),
|
||||
FINANCIAL_ACTIVITY.OPENING_BALANCES_TRANSFER_CONTRA.getValue(), FINANCIAL_ACTIVITY.ASSET_FUND_SOURCE.getValue(),
|
||||
FINANCIAL_ACTIVITY.PAYABLE_DIVIDENDS.getValue());
|
||||
FinancialActivity.ASSET_TRANSFER.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
FinancialActivity.CASH_AT_MAINVAULT.getValue(), FinancialActivity.CASH_AT_TELLER.getValue(),
|
||||
FinancialActivity.OPENING_BALANCES_TRANSFER_CONTRA.getValue(), FinancialActivity.ASSET_FUND_SOURCE.getValue(),
|
||||
FinancialActivity.PAYABLE_DIVIDENDS.getValue());
|
||||
|
||||
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed(paramNameForGLAccount, element);
|
||||
baseDataValidator.reset().parameter(paramNameForGLAccount).value(glAccountId).notNull().integerGreaterThanZero();
|
||||
@@ -92,9 +92,9 @@ public final class FinancialActivityAccountDataValidator {
|
||||
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).ignoreIfNull().isOneOfTheseValues(
|
||||
FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||
FINANCIAL_ACTIVITY.OPENING_BALANCES_TRANSFER_CONTRA.getValue(), FINANCIAL_ACTIVITY.ASSET_FUND_SOURCE.getValue(),
|
||||
FINANCIAL_ACTIVITY.PAYABLE_DIVIDENDS.getValue());
|
||||
FinancialActivity.ASSET_TRANSFER.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
FinancialActivity.OPENING_BALANCES_TRANSFER_CONTRA.getValue(), FinancialActivity.ASSET_FUND_SOURCE.getValue(),
|
||||
FinancialActivity.PAYABLE_DIVIDENDS.getValue());
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(paramNameForGLAccount, element)) {
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityAccountData;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityData;
|
||||
@@ -75,7 +75,7 @@ public class FinancialActivityAccountReadPlatformServiceImpl implements Financia
|
||||
public FinancialActivityAccountData addTemplateDetails(FinancialActivityAccountData financialActivityAccountData) {
|
||||
final Map<String, List<GLAccountData>> accountOptions = this.accountingDropdownReadPlatformService.retrieveAccountMappingOptions();
|
||||
financialActivityAccountData.setAccountingMappingOptions(accountOptions);
|
||||
financialActivityAccountData.setFinancialActivityOptions(FINANCIAL_ACTIVITY.getAllFinancialActivities());
|
||||
financialActivityAccountData.setFinancialActivityOptions(FinancialActivity.getAllFinancialActivities());
|
||||
return financialActivityAccountData;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class FinancialActivityAccountReadPlatformServiceImpl implements Financia
|
||||
final String glCode = rs.getString("glCode");
|
||||
|
||||
final GLAccountData glAccountData = new GLAccountData(glAccountId, glAccountName, glCode);
|
||||
final FinancialActivityData financialActivityData = FINANCIAL_ACTIVITY.toFinancialActivityData(financialActivityId);
|
||||
final FinancialActivityData financialActivityData = FinancialActivity.toFinancialActivityData(financialActivityId);
|
||||
|
||||
final FinancialActivityAccountData financialActivityAccountData = new FinancialActivityAccountData(id, financialActivityData,
|
||||
glAccountData);
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.PersistenceException;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.api.FinancialActivityAccountsJsonInputParams;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccountRepositoryWrapper;
|
||||
@@ -91,7 +91,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
|
||||
* Activity Type
|
||||
**/
|
||||
private void validateFinancialActivityAndAccountMapping(FinancialActivityAccount financialActivityAccount) {
|
||||
FINANCIAL_ACTIVITY financialActivity = FINANCIAL_ACTIVITY.fromInt(financialActivityAccount.getFinancialActivityType());
|
||||
FinancialActivity financialActivity = FinancialActivity.fromInt(financialActivityAccount.getFinancialActivityType());
|
||||
GLAccount glAccount = financialActivityAccount.getGlAccount();
|
||||
if (!financialActivity.getMappedGLAccountType().getValue().equals(glAccount.getType())) { throw new FinancialActivityAccountInvalidException(
|
||||
financialActivity, glAccount); }
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** Enum of reasons for invalid delete **/
|
||||
public static enum GL_ACCOUNT_INVALID_DELETE_REASON {
|
||||
public static enum GlAccountInvalidDeleteReason {
|
||||
TRANSANCTIONS_LOGGED, HAS_CHILDREN;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -45,7 +45,7 @@ public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleE
|
||||
}
|
||||
}
|
||||
|
||||
public GLAccountInvalidDeleteException(final GL_ACCOUNT_INVALID_DELETE_REASON reason, final Long glAccountId) {
|
||||
public GLAccountInvalidDeleteException(final GlAccountInvalidDeleteReason reason, final Long glAccountId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), glAccountId);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class GLAccountInvalidUpdateException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** Enum of reasons for invalid delete **/
|
||||
public static enum GL_ACCOUNT_INVALID_UPDATE_REASON {
|
||||
public static enum GlAccountInvalidUpdateReason {
|
||||
TRANSANCTIONS_LOGGED;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -41,7 +41,7 @@ public class GLAccountInvalidUpdateException extends AbstractPlatformDomainRuleE
|
||||
}
|
||||
}
|
||||
|
||||
public GLAccountInvalidUpdateException(final GL_ACCOUNT_INVALID_UPDATE_REASON reason, final Long glAccountId) {
|
||||
public GLAccountInvalidUpdateException(final GlAccountInvalidUpdateReason reason, final Long glAccountId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), glAccountId);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -29,10 +29,10 @@ import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountDisableException;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountDuplicateException;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidDeleteException;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidDeleteException.GL_ACCOUNT_INVALID_DELETE_REASON;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidDeleteException.GlAccountInvalidDeleteReason;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidParentException;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidUpdateException;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidUpdateException.GL_ACCOUNT_INVALID_UPDATE_REASON;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountInvalidUpdateException.GlAccountInvalidUpdateReason;
|
||||
import org.apache.fineract.accounting.glaccount.exception.GLAccountNotFoundException;
|
||||
import org.apache.fineract.accounting.glaccount.exception.InvalidParentGLAccountHeadException;
|
||||
import org.apache.fineract.accounting.glaccount.serialization.GLAccountCommandFromApiJsonDeserializer;
|
||||
@@ -160,7 +160,7 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
|
||||
final List<JournalEntry> journalEntriesForAccount = this.glJournalEntryRepository
|
||||
.findFirstJournalEntryForAccount(glAccountId);
|
||||
if (journalEntriesForAccount.size() > 0) { throw new GLAccountInvalidUpdateException(
|
||||
GL_ACCOUNT_INVALID_UPDATE_REASON.TRANSANCTIONS_LOGGED, glAccountId); }
|
||||
GlAccountInvalidUpdateReason.TRANSANCTIONS_LOGGED, glAccountId); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,12 +195,12 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
|
||||
|
||||
// validate this isn't a header account that has children
|
||||
if (glAccount.isHeaderAccount() && glAccount.getChildren().size() > 0) { throw new GLAccountInvalidDeleteException(
|
||||
GL_ACCOUNT_INVALID_DELETE_REASON.HAS_CHILDREN, glAccountId); }
|
||||
GlAccountInvalidDeleteReason.HAS_CHILDREN, glAccountId); }
|
||||
|
||||
// does this account have transactions logged against it
|
||||
final List<JournalEntry> journalEntriesForAccount = this.glJournalEntryRepository.findFirstJournalEntryForAccount(glAccountId);
|
||||
if (journalEntriesForAccount.size() > 0) { throw new GLAccountInvalidDeleteException(
|
||||
GL_ACCOUNT_INVALID_DELETE_REASON.TRANSANCTIONS_LOGGED, glAccountId); }
|
||||
GlAccountInvalidDeleteReason.TRANSANCTIONS_LOGGED, glAccountId); }
|
||||
this.glAccountRepository.delete(glAccount);
|
||||
|
||||
return new CommandProcessingResultBuilder().withEntityId(glAccountId).build();
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class JournalEntryInvalidException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons for invalid Journal Entry **/
|
||||
public static enum GL_JOURNAL_ENTRY_INVALID_REASON {
|
||||
public static enum GlJournalEntryInvalidReason {
|
||||
FUTURE_DATE, ACCOUNTING_CLOSED, NO_DEBITS_OR_CREDITS, DEBIT_CREDIT_SUM_MISMATCH_WITH_AMOUNT, DEBIT_CREDIT_SUM_MISMATCH, DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, GL_ACCOUNT_DISABLED, GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, INVALID_DEBIT_OR_CREDIT_ACCOUNTS;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -71,7 +71,7 @@ public class JournalEntryInvalidException extends AbstractPlatformDomainRuleExce
|
||||
}
|
||||
}
|
||||
|
||||
public JournalEntryInvalidException(final GL_JOURNAL_ENTRY_INVALID_REASON reason, final Date date, final String accountName,
|
||||
public JournalEntryInvalidException(final GlJournalEntryInvalidReason reason, final Date date, final String accountName,
|
||||
final String accountGLCode) {
|
||||
super(reason.errorCode(), reason.errorMessage(), date, accountName, accountGLCode);
|
||||
}
|
||||
|
||||
+24
-24
@@ -27,11 +27,11 @@ import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosureRepository;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SHARES;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccountRepositoryWrapper;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
@@ -50,7 +50,7 @@ import org.apache.fineract.accounting.journalentry.domain.JournalEntry;
|
||||
import org.apache.fineract.accounting.journalentry.domain.JournalEntryRepository;
|
||||
import org.apache.fineract.accounting.journalentry.domain.JournalEntryType;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryInvalidException;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryInvalidException.GL_JOURNAL_ENTRY_INVALID_REASON;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryInvalidException.GlJournalEntryInvalidReason;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.domain.PortfolioProductType;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMapping;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMappingRepository;
|
||||
@@ -502,7 +502,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createCreditJournalEntryOrReversalForLoan(final Office office, final String currencyCode,
|
||||
final CASH_ACCOUNTS_FOR_LOAN accountMappingType, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final CashAccountsForLoan accountMappingType, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final int accountMappingTypeId = accountMappingType.getValue();
|
||||
createCreditJournalEntryOrReversalForLoan(office, currencyCode, accountMappingTypeId, loanProductId, paymentTypeId, loanId,
|
||||
@@ -510,7 +510,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createCreditJournalEntryOrReversalForLoan(final Office office, final String currencyCode,
|
||||
final ACCRUAL_ACCOUNTS_FOR_LOAN accountMappingType, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final AccrualAccountsForLoan accountMappingType, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final int accountMappingTypeId = accountMappingType.getValue();
|
||||
createCreditJournalEntryOrReversalForLoan(office, currencyCode, accountMappingTypeId, loanProductId, paymentTypeId, loanId,
|
||||
@@ -528,7 +528,7 @@ public class AccountingProcessorHelper {
|
||||
**/
|
||||
if (latestGLClosure != null) {
|
||||
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(), null, null); }
|
||||
GlJournalEntryInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(), null, null); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ public class AccountingProcessorHelper {
|
||||
* @param taxDetails
|
||||
*/
|
||||
public void createCashBasedJournalEntriesAndReversalsForSavingsTax(final Office office, final String currencyCode,
|
||||
final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeDebited, final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeCredited,
|
||||
final CashAccountsForSavings accountTypeToBeDebited, final CashAccountsForSavings accountTypeToBeCredited,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long savingsId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal amount, final Boolean isReversal, final List<TaxPaymentDTO> taxDetails) {
|
||||
|
||||
@@ -738,7 +738,7 @@ public class AccountingProcessorHelper {
|
||||
* @param chargePaymentDTOs chargePaymentDTOs
|
||||
*/
|
||||
public void createCashBasedJournalEntriesAndReversalsForSavingsCharges(final Office office, final String currencyCode,
|
||||
final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeDebited, final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeCredited,
|
||||
final CashAccountsForSavings accountTypeToBeDebited, final CashAccountsForSavings accountTypeToBeCredited,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long loanId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
@@ -969,7 +969,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createCashBasedJournalEntriesForSharesCharges(final Office office, final String currencyCode,
|
||||
final CASH_ACCOUNTS_FOR_SHARES accountTypeToBeDebited, final CASH_ACCOUNTS_FOR_SHARES accountTypeToBeCredited,
|
||||
final CashAccountsForShares accountTypeToBeDebited, final CashAccountsForShares accountTypeToBeCredited,
|
||||
final Long shareProductId, final Long paymentTypeId, final Long shareAccountId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal totalAmount, final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
|
||||
@@ -980,7 +980,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createCashBasedJournalEntryForSharesCharges(final Office office, final String currencyCode,
|
||||
final CASH_ACCOUNTS_FOR_SHARES accountTypeToBeCredited, final Long shareProductId, final Long shareAccountId,
|
||||
final CashAccountsForShares accountTypeToBeCredited, final Long shareProductId, final Long shareAccountId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal totalAmount,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
|
||||
@@ -1011,7 +1011,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void revertCashBasedJournalEntryForSharesCharges(final Office office, final String currencyCode,
|
||||
final CASH_ACCOUNTS_FOR_SHARES accountTypeToBeCredited, final Long shareProductId, final Long shareAccountId,
|
||||
final CashAccountsForShares accountTypeToBeCredited, final Long shareProductId, final Long shareAccountId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal totalAmount,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
|
||||
@@ -1094,7 +1094,7 @@ public class AccountingProcessorHelper {
|
||||
* payment channels). Note that fund source placeholder ID would be
|
||||
* same for both cash and accrual accounts
|
||||
***/
|
||||
if (accountMappingTypeId == CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue()) {
|
||||
if (accountMappingTypeId == CashAccountsForLoan.FUND_SOURCE.getValue()) {
|
||||
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
|
||||
.findByProductIdAndProductTypeAndFinancialAccountTypeAndPaymentTypeId(loanProductId,
|
||||
PortfolioProductType.LOAN.getValue(), accountMappingTypeId, paymentTypeId);
|
||||
@@ -1104,7 +1104,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
if (accountMapping == null) { throw new ProductToGLAccountMappingNotFoundException(PortfolioProductType.LOAN, loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.OVERPAYMENT.toString()); }
|
||||
AccrualAccountsForLoan.OVERPAYMENT.toString()); }
|
||||
glAccount = accountMapping.getGlAccount();
|
||||
}
|
||||
return glAccount;
|
||||
@@ -1121,8 +1121,8 @@ public class AccountingProcessorHelper {
|
||||
*****/
|
||||
|
||||
// Vishwas TODO: remove this condition as it should always be true
|
||||
if (accountMappingTypeId == CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue()
|
||||
|| accountMappingTypeId == CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue()) {
|
||||
if (accountMappingTypeId == CashAccountsForLoan.INCOME_FROM_FEES.getValue()
|
||||
|| accountMappingTypeId == CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue()) {
|
||||
final ProductToGLAccountMapping chargeSpecificIncomeAccountMapping = this.accountMappingRepository
|
||||
.findByProductIdAndProductTypeAndFinancialAccountTypeAndChargeId(loanProductId, PortfolioProductType.LOAN.getValue(),
|
||||
accountMappingTypeId, chargeId);
|
||||
@@ -1144,8 +1144,8 @@ public class AccountingProcessorHelper {
|
||||
*****/
|
||||
|
||||
// Vishwas TODO: remove this condition as it should always be true
|
||||
if (accountMappingTypeId == CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES.getValue()
|
||||
|| accountMappingTypeId == CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue()) {
|
||||
if (accountMappingTypeId == CashAccountsForSavings.INCOME_FROM_FEES.getValue()
|
||||
|| accountMappingTypeId == CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue()) {
|
||||
final ProductToGLAccountMapping chargeSpecificIncomeAccountMapping = this.accountMappingRepository
|
||||
.findByProductIdAndProductTypeAndFinancialAccountTypeAndChargeId(savingsProductId,
|
||||
PortfolioProductType.SAVING.getValue(), accountMappingTypeId, chargeId);
|
||||
@@ -1171,7 +1171,7 @@ public class AccountingProcessorHelper {
|
||||
* payment channels). Note that fund source placeholder ID would be
|
||||
* same for both cash and accrual accounts
|
||||
***/
|
||||
if (accountMappingTypeId == CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue()) {
|
||||
if (accountMappingTypeId == CashAccountsForSavings.SAVINGS_REFERENCE.getValue()) {
|
||||
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
|
||||
.findByProductIdAndProductTypeAndFinancialAccountTypeAndPaymentTypeId(savingsProductId,
|
||||
PortfolioProductType.SAVING.getValue(), accountMappingTypeId, paymentTypeId);
|
||||
@@ -1194,7 +1194,7 @@ public class AccountingProcessorHelper {
|
||||
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(shareProductId,
|
||||
PortfolioProductType.SHARES.getValue(), accountMappingTypeId);
|
||||
|
||||
if (accountMappingTypeId == CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue()) {
|
||||
if (accountMappingTypeId == CashAccountsForShares.SHARES_REFERENCE.getValue()) {
|
||||
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
|
||||
.findByProductIdAndProductTypeAndFinancialAccountTypeAndPaymentTypeId(shareProductId,
|
||||
PortfolioProductType.SHARES.getValue(), accountMappingTypeId, paymentTypeId);
|
||||
@@ -1228,7 +1228,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
private boolean isOrganizationAccount(final int accountMappingTypeId) {
|
||||
boolean isOrganizationAccount = false;
|
||||
if (FINANCIAL_ACTIVITY.fromInt(accountMappingTypeId) != null) {
|
||||
if (FinancialActivity.fromInt(accountMappingTypeId) != null) {
|
||||
isOrganizationAccount = true;
|
||||
}
|
||||
return isOrganizationAccount;
|
||||
@@ -1274,7 +1274,7 @@ public class AccountingProcessorHelper {
|
||||
public void createDebitJournalEntryOrReversalForClientChargePayments(final Office office, final String currencyCode,
|
||||
final Long clientId, final Long transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final GLAccount account = financialActivityAccountRepository.findByFinancialActivityTypeWithNotFoundDetection(
|
||||
FINANCIAL_ACTIVITY.ASSET_FUND_SOURCE.getValue()).getGlAccount();
|
||||
FinancialActivity.ASSET_FUND_SOURCE.getValue()).getGlAccount();
|
||||
if (isReversal) {
|
||||
createCreditJournalEntryForClientPayments(office, currencyCode, account, clientId, transactionId, transactionDate, amount);
|
||||
} else {
|
||||
|
||||
+29
-29
@@ -26,9 +26,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanDTO;
|
||||
@@ -125,15 +125,15 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
// reversal)
|
||||
if(loanTransactionDTO.isLoanToLoanTransfer()){
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), FinancialActivity.ASSET_TRANSFER.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, disbursalAmount, isReversed);
|
||||
} else if (loanTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, disbursalAmount, isReversed);
|
||||
} else {
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), AccrualAccountsForLoan.FUND_SOURCE.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, disbursalAmount, isReversed);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
if (principalAmount != null && !(principalAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(principalAmount);
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), paymentTypeId);
|
||||
accountMap.put(account, principalAmount);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
if (interestAmount != null && !(interestAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(interestAmount);
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.INTEREST_RECEIVABLE.getValue(), paymentTypeId);
|
||||
if (accountMap.containsKey(account)) {
|
||||
BigDecimal amount = accountMap.get(account).add(interestAmount);
|
||||
accountMap.put(account, amount);
|
||||
@@ -229,7 +229,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
if (isIncomeFromFee) {
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.INCOME_FROM_FEES.getValue(), paymentTypeId);
|
||||
if (accountMap.containsKey(account)) {
|
||||
BigDecimal amount = accountMap.get(account).add(feesAmount);
|
||||
accountMap.put(account, amount);
|
||||
@@ -238,7 +238,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
}
|
||||
} else {
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.FEES_RECEIVABLE.getValue(), paymentTypeId);
|
||||
if (accountMap.containsKey(account)) {
|
||||
BigDecimal amount = accountMap.get(account).add(feesAmount);
|
||||
accountMap.put(account, amount);
|
||||
@@ -253,7 +253,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
totalDebitAmount = totalDebitAmount.add(penaltiesAmount);
|
||||
if (isIncomeFromFee) {
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.INCOME_FROM_PENALTIES.getValue(), paymentTypeId);
|
||||
if (accountMap.containsKey(account)) {
|
||||
BigDecimal amount = accountMap.get(account).add(penaltiesAmount);
|
||||
accountMap.put(account, amount);
|
||||
@@ -262,7 +262,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
}
|
||||
} else {
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.PENALTIES_RECEIVABLE.getValue(), paymentTypeId);
|
||||
if (accountMap.containsKey(account)) {
|
||||
BigDecimal amount = accountMap.get(account).add(penaltiesAmount);
|
||||
accountMap.put(account, amount);
|
||||
@@ -275,7 +275,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
if (overPaymentAmount != null && !(overPaymentAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(overPaymentAmount);
|
||||
GLAccount account = this.helper.getLinkedGLAccountForLoanProduct(loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), paymentTypeId);
|
||||
AccrualAccountsForLoan.OVERPAYMENT.getValue(), paymentTypeId);
|
||||
if (accountMap.containsKey(account)) {
|
||||
BigDecimal amount = accountMap.get(account).add(overPaymentAmount);
|
||||
accountMap.put(account, amount);
|
||||
@@ -296,20 +296,20 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
if (!(totalDebitAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
if (writeOff) {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
transactionDate, totalDebitAmount, isReversal);
|
||||
} else {
|
||||
if(loanTransactionDTO.isLoanToLoanTransfer()){
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode,
|
||||
FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
FinancialActivity.ASSET_TRANSFER.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
transactionDate, totalDebitAmount, isReversal);
|
||||
} else if (loanTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode,
|
||||
FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
transactionDate, totalDebitAmount, isReversal);
|
||||
} else {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
AccrualAccountsForLoan.FUND_SOURCE.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
transactionDate, totalDebitAmount, isReversal);
|
||||
}
|
||||
}
|
||||
@@ -338,7 +338,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.FUND_SOURCE.getValue(), AccrualAccountsForLoan.INCOME_FROM_RECOVERY.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, amount, isReversal);
|
||||
|
||||
}
|
||||
@@ -378,20 +378,20 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
// create journal entries for recognizing interest (or reversal)
|
||||
if (interestAmount != null && !(interestAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.getValue(),
|
||||
AccrualAccountsForLoan.INTEREST_RECEIVABLE.getValue(), AccrualAccountsForLoan.INTEREST_ON_LOANS.getValue(),
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, interestAmount, isReversed);
|
||||
}
|
||||
// create journal entries for the fees application (or reversal)
|
||||
if (feesAmount != null && !(feesAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoanCharges(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(),
|
||||
AccrualAccountsForLoan.FEES_RECEIVABLE.getValue(), AccrualAccountsForLoan.INCOME_FROM_FEES.getValue(),
|
||||
loanProductId, loanId, transactionId, transactionDate, feesAmount, isReversed, loanTransactionDTO.getFeePayments());
|
||||
}
|
||||
// create journal entries for the penalties application (or reversal)
|
||||
if (penaltiesAmount != null && !(penaltiesAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
|
||||
this.helper.createAccrualBasedJournalEntriesAndReversalsForLoanCharges(office, currencyCode,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(),
|
||||
AccrualAccountsForLoan.PENALTIES_RECEIVABLE.getValue(), AccrualAccountsForLoan.INCOME_FROM_PENALTIES.getValue(),
|
||||
loanProductId, loanId, transactionId, transactionDate, penaltiesAmount, isReversed,
|
||||
loanTransactionDTO.getPenaltyPayments());
|
||||
}
|
||||
@@ -412,11 +412,11 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
if (loanTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, refundAmount, isReversal);
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, refundAmount, isReversal);
|
||||
}
|
||||
}
|
||||
@@ -443,13 +443,13 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
if (principalAmount != null && !(principalAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(principalAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.LOAN_PORTFOLIO,
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, principalAmount, !isReversal);
|
||||
}
|
||||
|
||||
if (interestAmount != null && !(interestAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(interestAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.INTEREST_ON_LOANS,
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, interestAmount, !isReversal);
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
: chargePaymentDTO.getAmount()));
|
||||
}
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
!isReversal, chargePaymentDTOs);
|
||||
}
|
||||
|
||||
@@ -479,18 +479,18 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
}
|
||||
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
|
||||
CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
|
||||
penaltiesAmount, !isReversal, chargePaymentDTOs);
|
||||
}
|
||||
|
||||
if (overPaymentAmount != null && !(overPaymentAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(overPaymentAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT, loanProductId,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.OVERPAYMENT, loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, overPaymentAmount, !isReversal);
|
||||
}
|
||||
|
||||
/*** create a single debit entry (or reversal) for the entire amount **/
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(),
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, !isReversal);
|
||||
|
||||
}
|
||||
|
||||
+26
-26
@@ -23,8 +23,8 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanTransactionDTO;
|
||||
@@ -90,7 +90,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
|
||||
if (principalAmount != null && !(principalAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.getValue(), CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(),
|
||||
CashAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(), CashAccountsForLoan.LOAN_PORTFOLIO.getValue(),
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, principalAmount,
|
||||
loanTransactionDTO.isReversed());
|
||||
|
||||
@@ -133,15 +133,15 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
if(loanTransactionDTO.isLoanToLoanTransfer()){
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOAN_PORTFOLIO.getValue(), FinancialActivity.ASSET_TRANSFER.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, disbursalAmount, isReversal);
|
||||
} else if (loanTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOAN_PORTFOLIO.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, disbursalAmount, isReversal);
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOAN_PORTFOLIO.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, disbursalAmount, isReversal);
|
||||
}
|
||||
|
||||
@@ -173,11 +173,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
if (loanTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, refundAmount, isReversal);
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, refundAmount, isReversal);
|
||||
}
|
||||
}
|
||||
@@ -212,45 +212,45 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
if (principalAmount != null && !(principalAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(principalAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.LOAN_PORTFOLIO,
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, principalAmount, isReversal);
|
||||
}
|
||||
|
||||
if (interestAmount != null && !(interestAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(interestAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.INTEREST_ON_LOANS,
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, interestAmount, isReversal);
|
||||
}
|
||||
|
||||
if (feesAmount != null && !(feesAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(feesAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
isReversal, loanTransactionDTO.getFeePayments());
|
||||
}
|
||||
|
||||
if (penaltiesAmount != null && !(penaltiesAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(penaltiesAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
|
||||
CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
|
||||
penaltiesAmount, isReversal, loanTransactionDTO.getPenaltyPayments());
|
||||
}
|
||||
|
||||
if (overPaymentAmount != null && !(overPaymentAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(overPaymentAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT, loanProductId,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.OVERPAYMENT, loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, overPaymentAmount, isReversal);
|
||||
}
|
||||
|
||||
/*** create a single debit entry (or reversal) for the entire amount **/
|
||||
if(loanTransactionDTO.isLoanToLoanTransfer()){
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(),
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, FinancialActivity.ASSET_TRANSFER.getValue(),
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, isReversal);
|
||||
} else if (loanTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, isReversal);
|
||||
} else {
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(),
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, isReversal);
|
||||
}
|
||||
}
|
||||
@@ -276,8 +276,8 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode, CashAccountsForLoan.FUND_SOURCE.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(), loanProductId, paymentTypeId, loanId, transactionId,
|
||||
transactionDate, amount, isReversal);
|
||||
|
||||
}
|
||||
@@ -310,12 +310,12 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
if (loanTransactionDTO.getTransactionType().isInitiateTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.getValue(), CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
CashAccountsForLoan.TRANSFERS_SUSPENSE.getValue(), CashAccountsForLoan.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
null, loanId, transactionId, transactionDate, principalAmount, isReversal);
|
||||
} else if (loanTransactionDTO.getTransactionType().isApproveTransfer()
|
||||
|| loanTransactionDTO.getTransactionType().isWithdrawTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForLoan(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOAN_PORTFOLIO.getValue(), CashAccountsForLoan.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
null, loanId, transactionId, transactionDate, principalAmount, isReversal);
|
||||
}
|
||||
}
|
||||
@@ -341,13 +341,13 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
if (principalAmount != null && !(principalAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(principalAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.LOAN_PORTFOLIO,
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, principalAmount, !isReversal);
|
||||
}
|
||||
|
||||
if (interestAmount != null && !(interestAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(interestAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.INTEREST_ON_LOANS,
|
||||
loanProductId, paymentTypeId, loanId, transactionId, transactionDate, interestAmount, !isReversal);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)):chargePaymentDTO.getAmount() ));
|
||||
}
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
!isReversal, chargePaymentDTOs);
|
||||
}
|
||||
|
||||
@@ -375,18 +375,18 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
}
|
||||
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
|
||||
CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
|
||||
penaltiesAmount, !isReversal, chargePaymentDTOs);
|
||||
}
|
||||
|
||||
if (overPaymentAmount != null && !(overPaymentAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
totalDebitAmount = totalDebitAmount.add(overPaymentAmount);
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT, loanProductId,
|
||||
this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.OVERPAYMENT, loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, overPaymentAmount, !isReversal);
|
||||
}
|
||||
|
||||
/*** create a single debit entry (or reversal) for the entire amount **/
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
|
||||
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CashAccountsForLoan.FUND_SOURCE.getValue(), loanProductId,
|
||||
paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, !isReversal);
|
||||
|
||||
}
|
||||
|
||||
+40
-40
@@ -22,8 +22,8 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SavingsDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SavingsTransactionDTO;
|
||||
@@ -63,48 +63,48 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
if (savingsTransactionDTO.getTransactionType().isWithdrawal() && savingsTransactionDTO.isOverdraftTransaction()) {
|
||||
if (savingsTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), savingsProductId, paymentTypeId, savingsId, transactionId,
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), savingsProductId, paymentTypeId, savingsId, transactionId,
|
||||
transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate,
|
||||
amount.subtract(overdraftAmount), isReversal);
|
||||
}
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal);
|
||||
}
|
||||
}
|
||||
} else if (savingsTransactionDTO.getTransactionType().isDeposit() && savingsTransactionDTO.isOverdraftTransaction()) {
|
||||
if (savingsTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate,
|
||||
amount.subtract(overdraftAmount), isReversal);
|
||||
}
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal);
|
||||
}
|
||||
}
|
||||
@@ -114,11 +114,11 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
else if (savingsTransactionDTO.getTransactionType().isDeposit()) {
|
||||
if (savingsTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
}
|
||||
@@ -126,25 +126,25 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
/** Handle Deposits and reversals of Dividend pay outs **/
|
||||
else if (savingsTransactionDTO.getTransactionType().isDividendPayout()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
FINANCIAL_ACTIVITY.PAYABLE_DIVIDENDS.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
FinancialActivity.PAYABLE_DIVIDENDS.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
/** Handle withdrawals and reversals of withdrawals **/
|
||||
else if (savingsTransactionDTO.getTransactionType().isWithdrawal()) {
|
||||
if (savingsTransactionDTO.isAccountTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), CashAccountsForSavings.SAVINGS_REFERENCE.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
}
|
||||
|
||||
else if (savingsTransactionDTO.getTransactionType().isEscheat()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), CashAccountsForSavings.ESCHEAT_LIABILITY.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
/**
|
||||
@@ -156,13 +156,13 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
// zero
|
||||
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal);
|
||||
}
|
||||
}
|
||||
@@ -173,14 +173,14 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
// zero
|
||||
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
}
|
||||
|
||||
else if (savingsTransactionDTO.getTransactionType().isWithholdTax()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsTax(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, savingsProductId,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.SAVINGS_REFERENCE, savingsProductId,
|
||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal,
|
||||
savingsTransactionDTO.getTaxPayments());
|
||||
}
|
||||
@@ -190,23 +190,23 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
// Is the Charge a penalty?
|
||||
if (penaltyPayments.size() > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES,
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL, CashAccountsForSavings.INCOME_FROM_PENALTIES,
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, overdraftAmount, isReversal,
|
||||
penaltyPayments);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.INCOME_FROM_PENALTIES,
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate,
|
||||
amount.subtract(overdraftAmount), isReversal, penaltyPayments);
|
||||
}
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES,
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL, CashAccountsForSavings.INCOME_FROM_FEES,
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, overdraftAmount, isReversal,
|
||||
feePayments);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES, savingsProductId,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.INCOME_FROM_FEES, savingsProductId,
|
||||
paymentTypeId, savingsId, transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal,
|
||||
feePayments);
|
||||
}
|
||||
@@ -217,11 +217,11 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
// Is the Charge a penalty?
|
||||
if (penaltyPayments.size() > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES, savingsProductId,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.INCOME_FROM_PENALTIES, savingsProductId,
|
||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal, penaltyPayments);
|
||||
} else {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES, savingsProductId,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.INCOME_FROM_FEES, savingsProductId,
|
||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal, feePayments);
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
/** Handle Transfers proposal **/
|
||||
else if (savingsTransactionDTO.getTransactionType().isInitiateTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), CashAccountsForSavings.TRANSFERS_SUSPENSE.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
|
||||
@@ -237,23 +237,23 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
else if (savingsTransactionDTO.getTransactionType().isWithdrawTransfer()
|
||||
|| savingsTransactionDTO.getTransactionType().isApproveTransfer()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
CashAccountsForSavings.TRANSFERS_SUSPENSE.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
|
||||
/** overdraft **/
|
||||
else if (savingsTransactionDTO.getTransactionType().isOverdraftInterest()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(), CashAccountsForSavings.INCOME_FROM_INTEREST.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
} else if (savingsTransactionDTO.getTransactionType().isWrittenoff()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
CashAccountsForSavings.LOSSES_WRITTEN_OFF.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, amount, isReversal);
|
||||
} else if (savingsTransactionDTO.getTransactionType().isOverdraftFee()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES, savingsProductId,
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE, CashAccountsForSavings.INCOME_FROM_FEES, savingsProductId,
|
||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal, feePayments);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-20
@@ -22,7 +22,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SHARES;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares;
|
||||
import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SharesDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SharesTransactionDTO;
|
||||
@@ -65,8 +65,8 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
paymentTypeId, amount, chargeAmount, feePayments);
|
||||
|
||||
} else if (transactionDTO.getTransactionType().isChargePayment()) {
|
||||
this.helper.createCashBasedJournalEntriesForSharesCharges(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE,
|
||||
CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES, shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
this.helper.createCashBasedJournalEntriesForSharesCharges(office, currencyCode, CashAccountsForShares.SHARES_REFERENCE,
|
||||
CashAccountsForShares.INCOME_FROM_FEES, shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount, feePayments);
|
||||
}
|
||||
}
|
||||
@@ -77,15 +77,15 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
final Date transactionDate, final String transactionId, final Office office, final Long paymentTypeId, final BigDecimal amount,
|
||||
final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) != 1) {
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_EQUITY.getValue(),
|
||||
CashAccountsForShares.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount);
|
||||
} else {
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY.getValue(),
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_EQUITY.getValue(),
|
||||
shareProductId, paymentTypeId, shareAccountId, transactionId, transactionDate, amount.add(chargeAmount));
|
||||
this.helper.createCreditJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(),
|
||||
this.helper.createCreditJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_REFERENCE.getValue(),
|
||||
shareProductId, paymentTypeId, shareAccountId, transactionId, transactionDate, amount);
|
||||
this.helper.createCashBasedJournalEntryForSharesCharges(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES,
|
||||
this.helper.createCashBasedJournalEntryForSharesCharges(office, currencyCode, CashAccountsForShares.INCOME_FROM_FEES,
|
||||
shareProductId, shareAccountId, transactionId, transactionDate, chargeAmount, feePayments);
|
||||
}
|
||||
}
|
||||
@@ -95,15 +95,15 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
final Long paymentTypeId, final BigDecimal amount, final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
if (transactionDTO.getTransactionStatus().isApplied()) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) != 1) {
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_REFERENCE.getValue(),
|
||||
CashAccountsForShares.SHARES_SUSPENSE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount);
|
||||
} else {
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(),
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_REFERENCE.getValue(),
|
||||
shareProductId, paymentTypeId, shareAccountId, transactionId, transactionDate, amount);
|
||||
this.helper.createCreditJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
|
||||
this.helper.createCreditJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_SUSPENSE.getValue(),
|
||||
shareProductId, paymentTypeId, shareAccountId, transactionId, transactionDate, amount.subtract(chargeAmount));
|
||||
this.helper.createCashBasedJournalEntryForSharesCharges(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES,
|
||||
this.helper.createCashBasedJournalEntryForSharesCharges(office, currencyCode, CashAccountsForShares.INCOME_FROM_FEES,
|
||||
shareProductId, shareAccountId, transactionId, transactionDate, chargeAmount, feePayments);
|
||||
}
|
||||
} else if (transactionDTO.getTransactionStatus().isApproved()) {
|
||||
@@ -111,21 +111,21 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
if (chargeAmount != null && chargeAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
amountForJE = amount.subtract(chargeAmount);
|
||||
}
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_SUSPENSE.getValue(),
|
||||
CashAccountsForShares.SHARES_EQUITY.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amountForJE);
|
||||
} else if (transactionDTO.getTransactionStatus().isRejected()) {
|
||||
if (chargeAmount != null && chargeAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
this.helper.revertCashBasedJournalEntryForSharesCharges(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES,
|
||||
this.helper.revertCashBasedJournalEntryForSharesCharges(office, currencyCode, CashAccountsForShares.INCOME_FROM_FEES,
|
||||
shareProductId, shareAccountId, transactionId, transactionDate, chargeAmount, feePayments);
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(), shareProductId, paymentTypeId, shareAccountId,
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_SUSPENSE.getValue(), shareProductId, paymentTypeId, shareAccountId,
|
||||
transactionId, transactionDate, amount.subtract(chargeAmount));
|
||||
this.helper.createCreditJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId,
|
||||
this.helper.createCreditJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId,
|
||||
transactionId, transactionDate, amount);
|
||||
|
||||
}else{
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_SUSPENSE.getValue(),
|
||||
CashAccountsForShares.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount);
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -51,7 +51,7 @@ import org.apache.fineract.accounting.journalentry.domain.JournalEntryRepository
|
||||
import org.apache.fineract.accounting.journalentry.domain.JournalEntryType;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntriesNotFoundException;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryInvalidException;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryInvalidException.GL_JOURNAL_ENTRY_INVALID_REASON;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryInvalidException.GlJournalEntryInvalidReason;
|
||||
import org.apache.fineract.accounting.journalentry.exception.JournalEntryRuntimeException;
|
||||
import org.apache.fineract.accounting.journalentry.serialization.JournalEntryCommandFromApiJsonDeserializer;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.domain.PortfolioProductType;
|
||||
@@ -169,7 +169,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
|
||||
if (accountingRule.getAccountToCredit() == null) {
|
||||
if (journalEntryCommand.getCredits() == null) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.NO_DEBITS_OR_CREDITS, null, null, null); }
|
||||
GlJournalEntryInvalidReason.NO_DEBITS_OR_CREDITS, null, null, null); }
|
||||
if (journalEntryCommand.getDebits() != null) {
|
||||
checkDebitOrCreditAccountsAreValid(accountingRule, journalEntryCommand.getCredits(),
|
||||
journalEntryCommand.getDebits());
|
||||
@@ -188,7 +188,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
|
||||
if (accountingRule.getAccountToDebit() == null) {
|
||||
if (journalEntryCommand.getDebits() == null) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.NO_DEBITS_OR_CREDITS, null, null, null); }
|
||||
GlJournalEntryInvalidReason.NO_DEBITS_OR_CREDITS, null, null, null); }
|
||||
if (journalEntryCommand.getCredits() != null) {
|
||||
checkDebitOrCreditAccountsAreValid(accountingRule, journalEntryCommand.getCredits(),
|
||||
journalEntryCommand.getDebits());
|
||||
@@ -228,10 +228,10 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
* should have only one entry and it must be same as existing account
|
||||
*/
|
||||
if (creditOrDebits.length != 1) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null); }
|
||||
GlJournalEntryInvalidReason.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null); }
|
||||
for (final SingleDebitOrCreditEntryCommand creditOrDebit : creditOrDebits) {
|
||||
if (!glaccount.getId().equals(creditOrDebit.getGlAccountId())) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null); }
|
||||
GlJournalEntryInvalidReason.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,16 +283,16 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
BigDecimal debitsSum = BigDecimal.ZERO;
|
||||
for (final SingleDebitOrCreditEntryCommand creditEntryCommand : credits) {
|
||||
if (creditEntryCommand.getAmount() == null || creditEntryCommand.getGlAccountId() == null) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, null, null, null); }
|
||||
GlJournalEntryInvalidReason.DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, null, null, null); }
|
||||
creditsSum = creditsSum.add(creditEntryCommand.getAmount());
|
||||
}
|
||||
for (final SingleDebitOrCreditEntryCommand debitEntryCommand : debits) {
|
||||
if (debitEntryCommand.getAmount() == null || debitEntryCommand.getGlAccountId() == null) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, null, null, null); }
|
||||
GlJournalEntryInvalidReason.DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, null, null, null); }
|
||||
debitsSum = debitsSum.add(debitEntryCommand.getAmount());
|
||||
}
|
||||
if (creditsSum.compareTo(debitsSum) != 0) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.DEBIT_CREDIT_SUM_MISMATCH, null, null, null); }
|
||||
GlJournalEntryInvalidReason.DEBIT_CREDIT_SUM_MISMATCH, null, null, null); }
|
||||
}
|
||||
|
||||
private void validateGLAccountForTransaction(final GLAccount creditOrDebitAccountHead) {
|
||||
@@ -301,10 +301,10 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
* disabled
|
||||
**/
|
||||
if (creditOrDebitAccountHead.isDisabled()) {
|
||||
throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.GL_ACCOUNT_DISABLED, null,
|
||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_DISABLED, null,
|
||||
creditOrDebitAccountHead.getName(), creditOrDebitAccountHead.getGlCode());
|
||||
} else if (!creditOrDebitAccountHead.isManualEntriesAllowed()) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, null, creditOrDebitAccountHead.getName(),
|
||||
GlJournalEntryInvalidReason.GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, null, creditOrDebitAccountHead.getName(),
|
||||
creditOrDebitAccountHead.getGlCode()); }
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
|| latestGLClosureByBranch.getClosingDate().equals(journalEntriesTransactionDate)) {
|
||||
final String accountName = null;
|
||||
final String accountGLCode = null;
|
||||
throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED,
|
||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.ACCOUNTING_CLOSED,
|
||||
latestGLClosureByBranch.getClosingDate(), accountName, accountGLCode);
|
||||
}
|
||||
}
|
||||
@@ -578,13 +578,13 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
final Date transactionDate = entryLocalDate.toDateTimeAtStartOfDay().toDate();
|
||||
// shouldn't be in the future
|
||||
final Date todaysDate = new Date();
|
||||
if (transactionDate.after(todaysDate)) { throw new JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.FUTURE_DATE,
|
||||
if (transactionDate.after(todaysDate)) { throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.FUTURE_DATE,
|
||||
transactionDate, null, null); }
|
||||
// shouldn't be before an accounting closure
|
||||
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(command.getOfficeId());
|
||||
if (latestGLClosure != null) {
|
||||
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(), null, null); }
|
||||
GlJournalEntryInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(), null, null); }
|
||||
}
|
||||
|
||||
/*** check if credits and debits are valid **/
|
||||
@@ -593,7 +593,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
|
||||
// atleast one debit or credit must be present
|
||||
if (credits == null || credits.length <= 0 || debits == null || debits.length <= 0) { throw new JournalEntryInvalidException(
|
||||
GL_JOURNAL_ENTRY_INVALID_REASON.NO_DEBITS_OR_CREDITS, null, null, null); }
|
||||
GlJournalEntryInvalidReason.NO_DEBITS_OR_CREDITS, null, null, null); }
|
||||
|
||||
checkDebitAndCreditAmounts(credits, debits);
|
||||
}
|
||||
|
||||
+55
-55
@@ -27,9 +27,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SharesProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.service.ProductToGLAccountMappingWritePlatformService;
|
||||
@@ -92,49 +92,49 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
|
||||
if (isCashBasedAccounting(accountingRuleType) || isAccrualBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(),
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.FUND_SOURCE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).value(fundAccountId).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.FUND_SOURCE.getValue()).value(fundAccountId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
|
||||
final Long loanPortfolioAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue()).value(loanPortfolioAccountId)
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.LOAN_PORTFOLIO.getValue()).value(loanPortfolioAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromInterestId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue()).value(incomeFromInterestId)
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INTEREST_ON_LOANS.getValue()).value(incomeFromInterestId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromRecoveryAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue())
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue())
|
||||
.value(incomeFromRecoveryAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long writeOffAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue()).value(writeOffAccountId)
|
||||
LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writeOffAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long overpaymentAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue()).value(overpaymentAccountId)
|
||||
LoanProductAccountingParams.OVERPAYMENT.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.OVERPAYMENT.getValue()).value(overpaymentAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
}
|
||||
@@ -142,18 +142,18 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
if (isAccrualBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long receivableInterestAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue())
|
||||
LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue())
|
||||
.value(receivableInterestAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivableFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue()).value(receivableFeeAccountId)
|
||||
LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.FEES_RECEIVABLE.getValue()).value(receivableFeeAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivablePenaltyAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue())
|
||||
LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue())
|
||||
.value(receivablePenaltyAccountId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
@@ -177,57 +177,57 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
if (isCashBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long savingsControlAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_CONTROL.getValue())
|
||||
.value(savingsControlAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long savingsReferenceAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue())
|
||||
.value(savingsReferenceAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long interestOnSavingsAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue())
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue())
|
||||
.value(interestOnSavingsAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
SavingProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue())
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue())
|
||||
.value(incomeFromPenaltyId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Boolean isDormancyTrackingActive = this.fromApiJsonHelper.extractBooleanNamed(isDormancyTrackingActiveParamName, element);
|
||||
if(null != isDormancyTrackingActive && isDormancyTrackingActive){
|
||||
final Long escheatLiabilityId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue())
|
||||
SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue())
|
||||
.value(escheatLiabilityId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
if (!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
|
||||
final Long overdraftAccount = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||
SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||
.value(overdraftAccount).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromInterest = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue())
|
||||
SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue())
|
||||
.value(incomeFromInterest).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long writtenOff = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue()).value(writtenOff)
|
||||
SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writtenOff)
|
||||
.notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
@@ -253,23 +253,23 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
if (isCashBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long shareReferenceId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue())
|
||||
SharesProductAccountingParams.SHARES_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SharesProductAccountingParams.SHARES_REFERENCE.getValue())
|
||||
.value(shareReferenceId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue())
|
||||
SharesProductAccountingParams.SHARES_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SharesProductAccountingParams.SHARES_SUSPENSE.getValue())
|
||||
.value(shareSuspenseId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue())
|
||||
SharesProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SharesProductAccountingParams.INCOME_FROM_FEES.getValue())
|
||||
.value(incomeFromFeeAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long shareEquityId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue())
|
||||
SharesProductAccountingParams.SHARES_EQUITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SharesProductAccountingParams.SHARES_EQUITY.getValue())
|
||||
.value(shareEquityId).notNull().integerGreaterThanZero();
|
||||
|
||||
}
|
||||
|
||||
+77
-77
@@ -21,9 +21,9 @@ package org.apache.fineract.accounting.producttoaccountmapping.service;
|
||||
import com.google.gson.JsonElement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
|
||||
@@ -126,32 +126,32 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
final AccountingRuleType accountingRuleType) {
|
||||
final Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), element);
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.FUND_SOURCE.getValue(), element);
|
||||
final Long loanPortfolioAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), element);
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), element);
|
||||
final Long incomeFromInterestId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), element);
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), element);
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
element);
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
|
||||
final Long incomeFromRecoveryAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
|
||||
final Long writeOffAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
final Long overPaymentAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(),
|
||||
LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
final Long overPaymentAccountId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.OVERPAYMENT.getValue(),
|
||||
element);
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
|
||||
final Long receivableInterestAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), element);
|
||||
LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(), element);
|
||||
final Long receivableFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), element);
|
||||
LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), element);
|
||||
final Long receivablePenaltyAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
|
||||
switch (accountingRuleType) {
|
||||
case NONE:
|
||||
@@ -182,9 +182,9 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
final Long incomeFromRecoveryAccountId, final Long receivableInterestAccountId, final Long receivableFeeAccountId,
|
||||
final Long receivablePenaltyAccountId) {
|
||||
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), receivableInterestAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), receivableFeeAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), receivablePenaltyAccountId);
|
||||
changes.put(LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(), receivableInterestAccountId);
|
||||
changes.put(LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), receivableFeeAccountId);
|
||||
changes.put(LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), receivablePenaltyAccountId);
|
||||
|
||||
populateChangesForCashBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId, incomeFromFeeId,
|
||||
incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId, incomeFromRecoveryAccountId);
|
||||
@@ -195,15 +195,15 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
final Long loanPortfolioAccountId, final Long incomeFromInterestId, final Long incomeFromFeeId, final Long incomeFromPenaltyId,
|
||||
final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,
|
||||
final Long incomeFromRecoveryAccountId) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), fundAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanPortfolioAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), incomeFromInterestId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), incomeFromFeeId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), incomeFromPenaltyId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), writeOffAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), overPaymentAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), transfersInSuspenseAccountId);
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), incomeFromRecoveryAccountId);
|
||||
changes.put(LoanProductAccountingParams.FUND_SOURCE.getValue(), fundAccountId);
|
||||
changes.put(LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), loanPortfolioAccountId);
|
||||
changes.put(LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), incomeFromInterestId);
|
||||
changes.put(LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), incomeFromFeeId);
|
||||
changes.put(LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), incomeFromPenaltyId);
|
||||
changes.put(LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), writeOffAccountId);
|
||||
changes.put(LoanProductAccountingParams.OVERPAYMENT.getValue(), overPaymentAccountId);
|
||||
changes.put(LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), transfersInSuspenseAccountId);
|
||||
changes.put(LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), incomeFromRecoveryAccountId);
|
||||
|
||||
}
|
||||
|
||||
@@ -223,76 +223,76 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
break;
|
||||
case CASH_BASED:
|
||||
// asset
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.getValue(), CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.FUND_SOURCE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue(), CashAccountsForLoan.FUND_SOURCE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOAN_PORTFOLIO.getValue(), CashAccountsForLoan.LOAN_PORTFOLIO.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.TRANSFERS_SUSPENSE.getValue(), CashAccountsForLoan.TRANSFERS_SUSPENSE.toString(), changes);
|
||||
|
||||
// income
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.getValue(), CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
loanProductId, CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(),
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(),
|
||||
loanProductId, CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.getValue(),
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
CashAccountsForLoan.INTEREST_ON_LOANS.getValue(), CashAccountsForLoan.INTEREST_ON_LOANS.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue(), CashAccountsForLoan.INCOME_FROM_FEES.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(),
|
||||
loanProductId, CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_PENALTIES.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(),
|
||||
loanProductId, CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
CashAccountsForLoan.INCOME_FROM_RECOVERY.toString(), changes);
|
||||
|
||||
// expenses
|
||||
mergeLoanToExpenseAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
loanProductId, CASH_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.getValue(),
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.toString(), changes);
|
||||
mergeLoanToExpenseAccountMappingChanges(element, LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
loanProductId, CashAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(),
|
||||
CashAccountsForLoan.LOSSES_WRITTEN_OFF.toString(), changes);
|
||||
|
||||
// liabilities
|
||||
mergeLoanToLiabilityAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.toString(), changes);
|
||||
mergeLoanToLiabilityAccountMappingChanges(element, LoanProductAccountingParams.OVERPAYMENT.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue(), CashAccountsForLoan.OVERPAYMENT.toString(), changes);
|
||||
break;
|
||||
case ACCRUAL_UPFRONT:
|
||||
// fall through to periodic accrual
|
||||
case ACCRUAL_PERIODIC:
|
||||
// assets (including receivables)
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.toString(),
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.FUND_SOURCE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.FUND_SOURCE.getValue(), AccrualAccountsForLoan.FUND_SOURCE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue(), AccrualAccountsForLoan.LOAN_PORTFOLIO.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.TRANSFERS_SUSPENSE.getValue(), AccrualAccountsForLoan.TRANSFERS_SUSPENSE.toString(),
|
||||
changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(),
|
||||
loanProductId, ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE.getValue(),
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(),
|
||||
loanProductId, ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE.getValue(),
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(),
|
||||
loanProductId, AccrualAccountsForLoan.INTEREST_RECEIVABLE.getValue(),
|
||||
AccrualAccountsForLoan.INTEREST_RECEIVABLE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.FEES_RECEIVABLE.getValue(), AccrualAccountsForLoan.FEES_RECEIVABLE.toString(), changes);
|
||||
mergeLoanToAssetAccountMappingChanges(element, LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(),
|
||||
loanProductId, AccrualAccountsForLoan.PENALTIES_RECEIVABLE.getValue(),
|
||||
AccrualAccountsForLoan.PENALTIES_RECEIVABLE.toString(), changes);
|
||||
|
||||
// income
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.toString(),
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INTEREST_ON_LOANS.getValue(), AccrualAccountsForLoan.INTEREST_ON_LOANS.toString(),
|
||||
changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue(), ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.toString(),
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INCOME_FROM_FEES.getValue(), AccrualAccountsForLoan.INCOME_FROM_FEES.toString(),
|
||||
changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
loanProductId, ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(),
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(),
|
||||
loanProductId, ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.getValue(),
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(),
|
||||
loanProductId, AccrualAccountsForLoan.INCOME_FROM_PENALTIES.getValue(),
|
||||
AccrualAccountsForLoan.INCOME_FROM_PENALTIES.toString(), changes);
|
||||
mergeLoanToIncomeAccountMappingChanges(element, LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(),
|
||||
loanProductId, AccrualAccountsForLoan.INCOME_FROM_RECOVERY.getValue(),
|
||||
AccrualAccountsForLoan.INCOME_FROM_RECOVERY.toString(), changes);
|
||||
|
||||
// expenses
|
||||
mergeLoanToExpenseAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
loanProductId, ACCRUAL_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.getValue(),
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.toString(), changes);
|
||||
mergeLoanToExpenseAccountMappingChanges(element, LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
loanProductId, AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(),
|
||||
AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.toString(), changes);
|
||||
|
||||
// liabilities
|
||||
mergeLoanToLiabilityAccountMappingChanges(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue(), CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.toString(), changes);
|
||||
mergeLoanToLiabilityAccountMappingChanges(element, LoanProductAccountingParams.OVERPAYMENT.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue(), CashAccountsForLoan.OVERPAYMENT.toString(), changes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+32
-32
@@ -27,8 +27,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
|
||||
@@ -136,16 +136,16 @@ public class ProductToGLAccountMappingHelper {
|
||||
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
final Map<String, Object> changes, final PortfolioProductType portfolioProductType) {
|
||||
final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
if (paymentChannelMappingArray != null) {
|
||||
if (changes != null) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
command.jsonFragment(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue()));
|
||||
changes.put(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
command.jsonFragment(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue()));
|
||||
}
|
||||
for (int i = 0; i < paymentChannelMappingArray.size(); i++) {
|
||||
final JsonObject jsonObject = paymentChannelMappingArray.get(i).getAsJsonObject();
|
||||
final Long paymentTypeId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).getAsLong();
|
||||
final Long paymentTypeId = jsonObject.get(LoanProductAccountingParams.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(LoanProductAccountingParams.FUND_SOURCE.getValue()).getAsLong();
|
||||
savePaymentChannelToFundSourceMapping(productId, paymentTypeId, paymentSpecificFundAccountId, portfolioProductType);
|
||||
}
|
||||
}
|
||||
@@ -164,21 +164,21 @@ public class ProductToGLAccountMappingHelper {
|
||||
final Map<String, Object> changes, final PortfolioProductType portfolioProductType, final boolean isPenalty) {
|
||||
String arrayName;
|
||||
if (isPenalty) {
|
||||
arrayName = LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
arrayName = LoanProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
} else {
|
||||
arrayName = LOAN_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
arrayName = LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
}
|
||||
|
||||
final JsonArray chargeToIncomeAccountMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(arrayName, element);
|
||||
if (chargeToIncomeAccountMappingArray != null) {
|
||||
if (changes != null) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
command.jsonFragment(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue()));
|
||||
changes.put(LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
command.jsonFragment(LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue()));
|
||||
}
|
||||
for (int i = 0; i < chargeToIncomeAccountMappingArray.size(); i++) {
|
||||
final JsonObject jsonObject = chargeToIncomeAccountMappingArray.get(i).getAsJsonObject();
|
||||
final Long chargeId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue()).getAsLong();
|
||||
final Long incomeAccountId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue()).getAsLong();
|
||||
final Long chargeId = jsonObject.get(LoanProductAccountingParams.CHARGE_ID.getValue()).getAsLong();
|
||||
final Long incomeAccountId = jsonObject.get(LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue()).getAsLong();
|
||||
saveChargeToFundSourceMapping(productId, chargeId, incomeAccountId, portfolioProductType, isPenalty);
|
||||
}
|
||||
}
|
||||
@@ -199,11 +199,11 @@ public class ProductToGLAccountMappingHelper {
|
||||
if (isPenalty) {
|
||||
existingChargeToIncomeAccountMappings = this.accountMappingRepository.findAllPenaltyToIncomeAccountMappings(productId,
|
||||
portfolioProductType.getValue());
|
||||
arrayFragmentName = LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
arrayFragmentName = LoanProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
} else {
|
||||
existingChargeToIncomeAccountMappings = this.accountMappingRepository.findAllFeeToIncomeAccountMappings(productId,
|
||||
portfolioProductType.getValue());
|
||||
arrayFragmentName = LOAN_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
arrayFragmentName = LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
}
|
||||
|
||||
final JsonArray chargeToIncomeAccountMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(arrayFragmentName, element);
|
||||
@@ -225,8 +225,8 @@ public class ProductToGLAccountMappingHelper {
|
||||
|
||||
for (int i = 0; i < chargeToIncomeAccountMappingArray.size(); i++) {
|
||||
final JsonObject jsonObject = chargeToIncomeAccountMappingArray.get(i).getAsJsonObject();
|
||||
final Long chargeId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue()).getAsLong();
|
||||
final Long incomeAccountId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue()).getAsLong();
|
||||
final Long chargeId = jsonObject.get(LoanProductAccountingParams.CHARGE_ID.getValue()).getAsLong();
|
||||
final Long incomeAccountId = jsonObject.get(LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue()).getAsLong();
|
||||
inputChargeToIncomeAccountMap.put(chargeId, incomeAccountId);
|
||||
}
|
||||
|
||||
@@ -252,11 +252,11 @@ public class ProductToGLAccountMappingHelper {
|
||||
if (!newGLAccountId.equals(chargeToIncomeAccountMapping.getGlAccount().getId())) {
|
||||
final GLAccount glAccount;
|
||||
if (isPenalty) {
|
||||
glAccount = getAccountByIdAndType(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(),
|
||||
glAccount = getAccountByIdAndType(LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue(),
|
||||
GLAccountType.INCOME, newGLAccountId);
|
||||
} else {
|
||||
List<GLAccountType> allowedAccountTypes = getAllowedAccountTypesForFeeMapping();
|
||||
glAccount = getAccountByIdAndType(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(),
|
||||
glAccount = getAccountByIdAndType(LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue(),
|
||||
allowedAccountTypes, newGLAccountId);
|
||||
}
|
||||
chargeToIncomeAccountMapping.setGlAccount(glAccount);
|
||||
@@ -292,7 +292,7 @@ public class ProductToGLAccountMappingHelper {
|
||||
final List<ProductToGLAccountMapping> existingPaymentChannelToFundSourceMappings = this.accountMappingRepository
|
||||
.findAllPaymentTypeToFundSourceMappings(productId, portfolioProductType.getValue());
|
||||
final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
/**
|
||||
* Variable stores a map representation of Payment channels (key) and
|
||||
* their fund sources (value) extracted from the passed in Jsoncommand
|
||||
@@ -305,14 +305,14 @@ public class ProductToGLAccountMappingHelper {
|
||||
final Set<Long> existingPaymentTypes = new HashSet<>();
|
||||
if (paymentChannelMappingArray != null) {
|
||||
if (changes != null) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
command.jsonFragment(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue()));
|
||||
changes.put(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
command.jsonFragment(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < paymentChannelMappingArray.size(); i++) {
|
||||
final JsonObject jsonObject = paymentChannelMappingArray.get(i).getAsJsonObject();
|
||||
final Long paymentTypeId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).getAsLong();
|
||||
final Long paymentTypeId = jsonObject.get(LoanProductAccountingParams.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(LoanProductAccountingParams.FUND_SOURCE.getValue()).getAsLong();
|
||||
inputPaymentChannelFundSourceMap.put(paymentTypeId, paymentSpecificFundAccountId);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class ProductToGLAccountMappingHelper {
|
||||
if (inputPaymentChannelFundSourceMap.containsKey(currentPaymentChannelId)) {
|
||||
final Long newGLAccountId = inputPaymentChannelFundSourceMap.get(currentPaymentChannelId);
|
||||
if (!newGLAccountId.equals(existingPaymentChannelToFundSourceMapping.getGlAccount().getId())) {
|
||||
final GLAccount glAccount = getAccountByIdAndType(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(),
|
||||
final GLAccount glAccount = getAccountByIdAndType(LoanProductAccountingParams.FUND_SOURCE.getValue(),
|
||||
GLAccountType.ASSET, newGLAccountId);
|
||||
existingPaymentChannelToFundSourceMapping.setGlAccount(glAccount);
|
||||
this.accountMappingRepository.save(existingPaymentChannelToFundSourceMapping);
|
||||
@@ -366,10 +366,10 @@ public class ProductToGLAccountMappingHelper {
|
||||
private void savePaymentChannelToFundSourceMapping(final Long productId, final Long paymentTypeId,
|
||||
final Long paymentTypeSpecificFundAccountId, final PortfolioProductType portfolioProductType) {
|
||||
final PaymentType paymentType = this.paymentTypeRepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId);
|
||||
final GLAccount glAccount = getAccountByIdAndType(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), GLAccountType.ASSET,
|
||||
final GLAccount glAccount = getAccountByIdAndType(LoanProductAccountingParams.FUND_SOURCE.getValue(), GLAccountType.ASSET,
|
||||
paymentTypeSpecificFundAccountId);
|
||||
final ProductToGLAccountMapping accountMapping = new ProductToGLAccountMapping(glAccount, productId,
|
||||
portfolioProductType.getValue(), CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), paymentType);
|
||||
portfolioProductType.getValue(), CashAccountsForLoan.FUND_SOURCE.getValue(), paymentType);
|
||||
this.accountMappingRepository.save(accountMapping);
|
||||
}
|
||||
|
||||
@@ -389,16 +389,16 @@ public class ProductToGLAccountMappingHelper {
|
||||
* Both CASH and Accrual placeholders have the same value for income
|
||||
* from Interest and penalties
|
||||
**/
|
||||
CASH_ACCOUNTS_FOR_LOAN placeHolderAccountType;
|
||||
CashAccountsForLoan placeHolderAccountType;
|
||||
if (isPenalty) {
|
||||
glAccount = getAccountByIdAndType(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(), GLAccountType.INCOME,
|
||||
glAccount = getAccountByIdAndType(LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue(), GLAccountType.INCOME,
|
||||
incomeAccountId);
|
||||
placeHolderAccountType = CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES;
|
||||
placeHolderAccountType = CashAccountsForLoan.INCOME_FROM_PENALTIES;
|
||||
} else {
|
||||
List<GLAccountType> allowedAccountTypes = getAllowedAccountTypesForFeeMapping();
|
||||
glAccount = getAccountByIdAndType(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(), allowedAccountTypes,
|
||||
glAccount = getAccountByIdAndType(LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue(), allowedAccountTypes,
|
||||
incomeAccountId);
|
||||
placeHolderAccountType = CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES;
|
||||
placeHolderAccountType = CashAccountsForLoan.INCOME_FROM_FEES;
|
||||
}
|
||||
final ProductToGLAccountMapping accountMapping = new ProductToGLAccountMapping(glAccount, productId,
|
||||
portfolioProductType.getValue(), placeHolderAccountType.getValue(), charge);
|
||||
|
||||
+81
-81
@@ -24,13 +24,13 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SHARES;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingDataParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingDataParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SharesProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
|
||||
@@ -116,31 +116,31 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
for (final Map<String, Object> productToGLAccountMap : listOfProductToGLAccountMaps) {
|
||||
|
||||
final Integer financialAccountType = (Integer) productToGLAccountMap.get("financialAccountType");
|
||||
final CASH_ACCOUNTS_FOR_LOAN glAccountForLoan = CASH_ACCOUNTS_FOR_LOAN.fromInt(financialAccountType);
|
||||
final CashAccountsForLoan glAccountForLoan = CashAccountsForLoan.fromInt(financialAccountType);
|
||||
|
||||
final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId");
|
||||
final String glAccountName = (String) productToGLAccountMap.get("glAccountName");
|
||||
final String glCode = (String) productToGLAccountMap.get("glCode");
|
||||
final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode);
|
||||
|
||||
if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.FUND_SOURCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_LOANS.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOAN_PORTFOLIO.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOSSES_WRITTEN_OFF.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERPAYMENT.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_RECOVERY.getValue(), gLAccountData);
|
||||
if (glAccountForLoan.equals(CashAccountsForLoan.FUND_SOURCE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.FUND_SOURCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.INCOME_FROM_PENALTIES)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.INTEREST_ON_LOANS)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INTEREST_ON_LOANS.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.LOAN_PORTFOLIO)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.LOAN_PORTFOLIO.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.TRANSFERS_SUSPENSE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.LOSSES_WRITTEN_OFF)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.LOSSES_WRITTEN_OFF.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.OVERPAYMENT)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.OVERPAYMENT.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(CashAccountsForLoan.INCOME_FROM_RECOVERY)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_RECOVERY.getValue(), gLAccountData);
|
||||
}
|
||||
}
|
||||
} else if (AccountingRuleType.ACCRUAL_UPFRONT.getValue().equals(accountingType)
|
||||
@@ -148,37 +148,37 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
|
||||
for (final Map<String, Object> productToGLAccountMap : listOfProductToGLAccountMaps) {
|
||||
final Integer financialAccountType = (Integer) productToGLAccountMap.get("financialAccountType");
|
||||
final ACCRUAL_ACCOUNTS_FOR_LOAN glAccountForLoan = ACCRUAL_ACCOUNTS_FOR_LOAN.fromInt(financialAccountType);
|
||||
final AccrualAccountsForLoan glAccountForLoan = AccrualAccountsForLoan.fromInt(financialAccountType);
|
||||
|
||||
final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId");
|
||||
final String glAccountName = (String) productToGLAccountMap.get("glAccountName");
|
||||
final String glCode = (String) productToGLAccountMap.get("glCode");
|
||||
final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode);
|
||||
|
||||
if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.FUND_SOURCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_LOANS.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOAN_PORTFOLIO.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.OVERPAYMENT)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERPAYMENT.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOSSES_WRITTEN_OFF.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_RECEIVABLE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.FEES_RECEIVABLE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE)) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.PENALTIES_RECEIVABLE.getValue(), gLAccountData);
|
||||
} else if ((glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY))) {
|
||||
accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_RECOVERY.getValue(), gLAccountData);
|
||||
if (glAccountForLoan.equals(AccrualAccountsForLoan.FUND_SOURCE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.FUND_SOURCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.INCOME_FROM_PENALTIES)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.INTEREST_ON_LOANS)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INTEREST_ON_LOANS.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.LOAN_PORTFOLIO)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.LOAN_PORTFOLIO.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.OVERPAYMENT)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.OVERPAYMENT.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.TRANSFERS_SUSPENSE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.LOSSES_WRITTEN_OFF)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.LOSSES_WRITTEN_OFF.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.INTEREST_RECEIVABLE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INTEREST_RECEIVABLE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.FEES_RECEIVABLE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.FEES_RECEIVABLE.getValue(), gLAccountData);
|
||||
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.PENALTIES_RECEIVABLE)) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.PENALTIES_RECEIVABLE.getValue(), gLAccountData);
|
||||
} else if ((glAccountForLoan.equals(AccrualAccountsForLoan.INCOME_FROM_RECOVERY))) {
|
||||
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_RECOVERY.getValue(), gLAccountData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,33 +202,33 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
for (final Map<String, Object> productToGLAccountMap : listOfProductToGLAccountMaps) {
|
||||
|
||||
final Integer financialAccountType = (Integer) productToGLAccountMap.get("financialAccountType");
|
||||
final CASH_ACCOUNTS_FOR_SAVINGS glAccountForSavings = CASH_ACCOUNTS_FOR_SAVINGS.fromInt(financialAccountType);
|
||||
final CashAccountsForSavings glAccountForSavings = CashAccountsForSavings.fromInt(financialAccountType);
|
||||
|
||||
final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId");
|
||||
final String glAccountName = (String) productToGLAccountMap.get("glAccountName");
|
||||
final String glCode = (String) productToGLAccountMap.get("glCode");
|
||||
final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode);
|
||||
|
||||
if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.SAVINGS_REFERENCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.SAVINGS_CONTROL.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_SAVINGS.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.LOSSES_WRITTEN_OFF.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_INTEREST.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY)) {
|
||||
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.ESCHEAT_LIABILITY.getValue(), gLAccountData);
|
||||
if (glAccountForSavings.equals(CashAccountsForSavings.SAVINGS_REFERENCE)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.SAVINGS_REFERENCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.SAVINGS_CONTROL)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.SAVINGS_CONTROL.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INCOME_FROM_PENALTIES)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.TRANSFERS_SUSPENSE)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INTEREST_ON_SAVINGS)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.INTEREST_ON_SAVINGS.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.LOSSES_WRITTEN_OFF)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.LOSSES_WRITTEN_OFF.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INCOME_FROM_INTEREST)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_INTEREST.getValue(), gLAccountData);
|
||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.ESCHEAT_LIABILITY)) {
|
||||
accountMappingDetails.put(SavingProductAccountingDataParams.ESCHEAT_LIABILITY.getValue(), gLAccountData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,21 +343,21 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
if (AccountingRuleType.CASH_BASED.getValue().equals(accountingType)) {
|
||||
for (final Map<String, Object> productToGLAccountMap : listOfProductToGLAccountMaps) {
|
||||
final Integer financialAccountType = (Integer) productToGLAccountMap.get("financialAccountType");
|
||||
final CASH_ACCOUNTS_FOR_SHARES glAccountForShares = CASH_ACCOUNTS_FOR_SHARES.fromInt(financialAccountType);
|
||||
final CashAccountsForShares glAccountForShares = CashAccountsForShares.fromInt(financialAccountType);
|
||||
|
||||
final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId");
|
||||
final String glAccountName = (String) productToGLAccountMap.get("glAccountName");
|
||||
final String glCode = (String) productToGLAccountMap.get("glCode");
|
||||
final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode);
|
||||
|
||||
if (glAccountForShares.equals(CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE)) {
|
||||
accountMappingDetails.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForShares.equals(CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE)) {
|
||||
accountMappingDetails.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForShares.equals(CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForShares.equals(CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY)) {
|
||||
accountMappingDetails.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(), gLAccountData);
|
||||
if (glAccountForShares.equals(CashAccountsForShares.SHARES_REFERENCE)) {
|
||||
accountMappingDetails.put(SharesProductAccountingParams.SHARES_REFERENCE.getValue(), gLAccountData);
|
||||
} else if (glAccountForShares.equals(CashAccountsForShares.SHARES_SUSPENSE)) {
|
||||
accountMappingDetails.put(SharesProductAccountingParams.SHARES_SUSPENSE.getValue(), gLAccountData);
|
||||
} else if (glAccountForShares.equals(CashAccountsForShares.INCOME_FROM_FEES)) {
|
||||
accountMappingDetails.put(SharesProductAccountingParams.INCOME_FROM_FEES.getValue(), gLAccountData);
|
||||
} else if (glAccountForShares.equals(CashAccountsForShares.SHARES_EQUITY)) {
|
||||
accountMappingDetails.put(SharesProductAccountingParams.SHARES_EQUITY.getValue(), gLAccountData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+77
-77
@@ -25,13 +25,13 @@ import com.google.gson.JsonElement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SHARES;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SharesProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.serialization.ProductToGLAccountMappingFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -76,38 +76,38 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
case CASH_BASED:
|
||||
// asset
|
||||
this.loanProductToGLAccountMappingHelper
|
||||
.saveLoanToAssetAccountMapping(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue());
|
||||
.saveLoanToAssetAccountMapping(element, LoanProductAccountingParams.FUND_SOURCE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.FUND_SOURCE.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue());
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOAN_PORTFOLIO.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.getValue());
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
CashAccountsForLoan.TRANSFERS_SUSPENSE.getValue());
|
||||
|
||||
// income
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.getValue());
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
CashAccountsForLoan.INTEREST_ON_LOANS.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue());
|
||||
LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue());
|
||||
LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), loanProductId,
|
||||
CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.getValue());
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), loanProductId,
|
||||
CashAccountsForLoan.INCOME_FROM_RECOVERY.getValue());
|
||||
|
||||
// expenses
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToExpenseAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.getValue());
|
||||
LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), loanProductId,
|
||||
CashAccountsForLoan.LOSSES_WRITTEN_OFF.getValue());
|
||||
|
||||
// liabilities
|
||||
this.loanProductToGLAccountMappingHelper
|
||||
.saveLoanToLiabilityAccountMapping(element, LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), loanProductId,
|
||||
CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue());
|
||||
.saveLoanToLiabilityAccountMapping(element, LoanProductAccountingParams.OVERPAYMENT.getValue(), loanProductId,
|
||||
CashAccountsForLoan.OVERPAYMENT.getValue());
|
||||
|
||||
// advanced accounting mappings
|
||||
this.loanProductToGLAccountMappingHelper.savePaymentChannelToFundSourceMappings(command, element, loanProductId, null);
|
||||
@@ -118,47 +118,47 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
case ACCRUAL_PERIODIC:
|
||||
// assets (including receivables)
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue());
|
||||
LoanProductAccountingParams.FUND_SOURCE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.FUND_SOURCE.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO.getValue());
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.LOAN_PORTFOLIO.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE.getValue());
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.TRANSFERS_SUSPENSE.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE.getValue());
|
||||
LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INTEREST_RECEIVABLE.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE.getValue());
|
||||
LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.FEES_RECEIVABLE.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToAssetAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE.getValue());
|
||||
LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.PENALTIES_RECEIVABLE.getValue());
|
||||
|
||||
// income
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS.getValue());
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INTEREST_ON_LOANS.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES.getValue());
|
||||
LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INCOME_FROM_FEES.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue());
|
||||
LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INCOME_FROM_PENALTIES.getValue());
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToIncomeAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY.getValue());
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.INCOME_FROM_RECOVERY.getValue());
|
||||
|
||||
// expenses
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToExpenseAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF.getValue());
|
||||
LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue());
|
||||
|
||||
// liabilities
|
||||
this.loanProductToGLAccountMappingHelper.saveLoanToLiabilityAccountMapping(element,
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), loanProductId,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.OVERPAYMENT.getValue());
|
||||
LoanProductAccountingParams.OVERPAYMENT.getValue(), loanProductId,
|
||||
AccrualAccountsForLoan.OVERPAYMENT.getValue());
|
||||
|
||||
// advanced accounting mappings
|
||||
this.loanProductToGLAccountMappingHelper.savePaymentChannelToFundSourceMappings(command, element, loanProductId, null);
|
||||
@@ -181,54 +181,54 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
case CASH_BASED:
|
||||
// asset
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToAssetAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue());
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), savingProductId,
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue());
|
||||
|
||||
if (!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToAssetAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue());
|
||||
SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingProductId,
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue());
|
||||
}
|
||||
|
||||
// income
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToIncomeAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES.getValue());
|
||||
SavingProductAccountingParams.INCOME_FROM_FEES.getValue(), savingProductId,
|
||||
CashAccountsForSavings.INCOME_FROM_FEES.getValue());
|
||||
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToIncomeAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES.getValue());
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), savingProductId,
|
||||
CashAccountsForSavings.INCOME_FROM_PENALTIES.getValue());
|
||||
|
||||
if (!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToIncomeAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST.getValue());
|
||||
SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), savingProductId,
|
||||
CashAccountsForSavings.INCOME_FROM_INTEREST.getValue());
|
||||
}
|
||||
|
||||
// expenses
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToExpenseAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.getValue());
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), savingProductId,
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue());
|
||||
|
||||
if (!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToExpenseAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF.getValue());
|
||||
SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), savingProductId,
|
||||
CashAccountsForSavings.LOSSES_WRITTEN_OFF.getValue());
|
||||
}
|
||||
|
||||
// liability
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue());
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), savingProductId,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue());
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue());
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), savingProductId,
|
||||
CashAccountsForSavings.TRANSFERS_SUSPENSE.getValue());
|
||||
|
||||
final Boolean isDormancyTrackingActive = this.fromApiJsonHelper.extractBooleanNamed(isDormancyTrackingActiveParamName, element);
|
||||
if(null != isDormancyTrackingActive && isDormancyTrackingActive){
|
||||
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), savingProductId,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue());
|
||||
SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), savingProductId,
|
||||
CashAccountsForSavings.ESCHEAT_LIABILITY.getValue());
|
||||
}
|
||||
|
||||
// advanced accounting mappings
|
||||
@@ -257,23 +257,23 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
case CASH_BASED:
|
||||
// asset
|
||||
this.shareProductToGLAccountMappingHelper.saveSharesToAssetAccountMapping(element,
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(), shareProductId,
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue());
|
||||
SharesProductAccountingParams.SHARES_REFERENCE.getValue(), shareProductId,
|
||||
CashAccountsForShares.SHARES_REFERENCE.getValue());
|
||||
|
||||
// income
|
||||
this.shareProductToGLAccountMappingHelper.saveSharesToIncomeAccountMapping(element,
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), shareProductId,
|
||||
CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES.getValue());
|
||||
SharesProductAccountingParams.INCOME_FROM_FEES.getValue(), shareProductId,
|
||||
CashAccountsForShares.INCOME_FROM_FEES.getValue());
|
||||
|
||||
// expenses
|
||||
this.shareProductToGLAccountMappingHelper.saveSharesToEquityAccountMapping(element,
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(), shareProductId,
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY.getValue());
|
||||
SharesProductAccountingParams.SHARES_EQUITY.getValue(), shareProductId,
|
||||
CashAccountsForShares.SHARES_EQUITY.getValue());
|
||||
|
||||
// liability
|
||||
this.shareProductToGLAccountMappingHelper.saveSharesToLiabilityAccountMapping(element,
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(), shareProductId,
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue());
|
||||
SharesProductAccountingParams.SHARES_SUSPENSE.getValue(), shareProductId,
|
||||
CashAccountsForShares.SHARES_SUSPENSE.getValue());
|
||||
|
||||
// advanced accounting mappings
|
||||
this.savingsProductToGLAccountMappingHelper.savePaymentChannelToFundSourceMappings(command, element, shareProductId, null);
|
||||
|
||||
+49
-49
@@ -21,8 +21,8 @@ package org.apache.fineract.accounting.producttoaccountmapping.service;
|
||||
import com.google.gson.JsonElement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
|
||||
@@ -133,36 +133,36 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
||||
final Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
final Long savingsReferenceId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), element);
|
||||
final Long incomeFromFeesId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
SavingProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
final Long incomeFromPenaltiesId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
final Long interestOnSavingsId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
final Long savingsControlId = this.fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(),
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
final Long savingsControlId = this.fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.SAVINGS_CONTROL.getValue(),
|
||||
element);
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
final Long overdraftControlId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
final Long incomeFromInterest = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), element);
|
||||
final Long writeOffId = this.fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element);
|
||||
final Long writeOffId = this.fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
element);
|
||||
switch (accountingRuleType) {
|
||||
case NONE:
|
||||
break;
|
||||
case CASH_BASED:
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), savingsControlId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), savingsReferenceId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), interestOnSavingsId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), incomeFromFeesId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), incomeFromPenaltiesId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), transfersInSuspenseAccountId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), overdraftControlId);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), incomeFromInterest);
|
||||
changes.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), writeOffId);
|
||||
changes.put(SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), savingsControlId);
|
||||
changes.put(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), savingsReferenceId);
|
||||
changes.put(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), interestOnSavingsId);
|
||||
changes.put(SavingProductAccountingParams.INCOME_FROM_FEES.getValue(), incomeFromFeesId);
|
||||
changes.put(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), incomeFromPenaltiesId);
|
||||
changes.put(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), transfersInSuspenseAccountId);
|
||||
changes.put(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), overdraftControlId);
|
||||
changes.put(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), incomeFromInterest);
|
||||
changes.put(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), writeOffId);
|
||||
break;
|
||||
case ACCRUAL_PERIODIC:
|
||||
break;
|
||||
@@ -190,44 +190,44 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
||||
break;
|
||||
case CASH_BASED:
|
||||
// asset
|
||||
mergeSavingsToAssetAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.toString(), changes);
|
||||
mergeSavingsToAssetAccountMappingChanges(element, SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.SAVINGS_REFERENCE.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.toString(), changes);
|
||||
|
||||
mergeSavingsToAssetAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.toString(), changes);
|
||||
mergeSavingsToAssetAccountMappingChanges(element, SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.toString(), changes);
|
||||
|
||||
// income
|
||||
mergeSavingsToIncomeAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES.toString(), changes);
|
||||
mergeSavingsToIncomeAccountMappingChanges(element, SavingProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.INCOME_FROM_FEES.getValue(),
|
||||
CashAccountsForSavings.INCOME_FROM_FEES.toString(), changes);
|
||||
|
||||
mergeSavingsToIncomeAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES.toString(), changes);
|
||||
mergeSavingsToIncomeAccountMappingChanges(element, SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.INCOME_FROM_PENALTIES.getValue(),
|
||||
CashAccountsForSavings.INCOME_FROM_PENALTIES.toString(), changes);
|
||||
|
||||
mergeSavingsToIncomeAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST.toString(), changes);
|
||||
mergeSavingsToIncomeAccountMappingChanges(element, SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.INCOME_FROM_INTEREST.getValue(),
|
||||
CashAccountsForSavings.INCOME_FROM_INTEREST.toString(), changes);
|
||||
|
||||
// expenses
|
||||
mergeSavingsToExpenseAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.toString(), changes);
|
||||
mergeSavingsToExpenseAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF.toString(), changes);
|
||||
mergeSavingsToExpenseAccountMappingChanges(element, SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(),
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.toString(), changes);
|
||||
mergeSavingsToExpenseAccountMappingChanges(element, SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.LOSSES_WRITTEN_OFF.getValue(),
|
||||
CashAccountsForSavings.LOSSES_WRITTEN_OFF.toString(), changes);
|
||||
|
||||
// liability
|
||||
mergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.toString(), changes);
|
||||
mergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.toString(), changes);
|
||||
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(),
|
||||
savingsProductId, CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue(),
|
||||
mergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.toString(), changes);
|
||||
mergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.TRANSFERS_SUSPENSE.getValue(),
|
||||
CashAccountsForSavings.TRANSFERS_SUSPENSE.toString(), changes);
|
||||
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(),
|
||||
savingsProductId, CashAccountsForSavings.ESCHEAT_LIABILITY.getValue(),
|
||||
changes);
|
||||
break;
|
||||
case ACCRUAL_PERIODIC:
|
||||
|
||||
+22
-22
@@ -21,8 +21,8 @@ package org.apache.fineract.accounting.producttoaccountmapping.service;
|
||||
import com.google.gson.JsonElement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SHARES;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SharesProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
|
||||
@@ -124,23 +124,23 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
|
||||
final AccountingRuleType accountingRuleType) {
|
||||
final Map<String, Object> changes = new HashMap<>();
|
||||
|
||||
final Long shareReferenceId = this.fromApiJsonHelper.extractLongNamed(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
|
||||
final Long shareReferenceId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_REFERENCE.getValue(),
|
||||
element);
|
||||
final Long incomeFromFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(),
|
||||
SharesProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_SUSPENSE.getValue(),
|
||||
element);
|
||||
final Long shareEquityId = this.fromApiJsonHelper.extractLongNamed(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
|
||||
final Long shareEquityId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_EQUITY.getValue(),
|
||||
element);
|
||||
|
||||
switch (accountingRuleType) {
|
||||
case NONE:
|
||||
break;
|
||||
case CASH_BASED:
|
||||
changes.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(), shareReferenceId);
|
||||
changes.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), incomeFromFeeAccountId);
|
||||
changes.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(), shareSuspenseId);
|
||||
changes.put(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(), shareEquityId);
|
||||
changes.put(SharesProductAccountingParams.SHARES_REFERENCE.getValue(), shareReferenceId);
|
||||
changes.put(SharesProductAccountingParams.INCOME_FROM_FEES.getValue(), incomeFromFeeAccountId);
|
||||
changes.put(SharesProductAccountingParams.SHARES_SUSPENSE.getValue(), shareSuspenseId);
|
||||
changes.put(SharesProductAccountingParams.SHARES_EQUITY.getValue(), shareEquityId);
|
||||
break;
|
||||
case ACCRUAL_PERIODIC:
|
||||
break;
|
||||
@@ -168,24 +168,24 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
|
||||
break;
|
||||
case CASH_BASED:
|
||||
// asset
|
||||
mergeSharesToAssetAccountMappingChanges(element, SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
|
||||
sharesProductId, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.toString(), changes);
|
||||
mergeSharesToAssetAccountMappingChanges(element, SharesProductAccountingParams.SHARES_REFERENCE.getValue(),
|
||||
sharesProductId, CashAccountsForShares.SHARES_REFERENCE.getValue(),
|
||||
CashAccountsForShares.SHARES_REFERENCE.toString(), changes);
|
||||
|
||||
// income
|
||||
mergeSharesToIncomeAccountMappingChanges(element, SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
sharesProductId, CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.INCOME_FROM_FEES.toString(), changes);
|
||||
mergeSharesToIncomeAccountMappingChanges(element, SharesProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
sharesProductId, CashAccountsForShares.INCOME_FROM_FEES.getValue(),
|
||||
CashAccountsForShares.INCOME_FROM_FEES.toString(), changes);
|
||||
|
||||
// liability
|
||||
mergeSharesToLiabilityAccountMappingChanges(element, SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(),
|
||||
sharesProductId, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.toString(), changes);
|
||||
mergeSharesToLiabilityAccountMappingChanges(element, SharesProductAccountingParams.SHARES_SUSPENSE.getValue(),
|
||||
sharesProductId, CashAccountsForShares.SHARES_SUSPENSE.getValue(),
|
||||
CashAccountsForShares.SHARES_SUSPENSE.toString(), changes);
|
||||
|
||||
// equity
|
||||
mergeSharesToEquityAccountMappingChanges(element, SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
|
||||
sharesProductId, CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_EQUITY.toString(), changes);
|
||||
mergeSharesToEquityAccountMappingChanges(element, SharesProductAccountingParams.SHARES_EQUITY.getValue(),
|
||||
sharesProductId, CashAccountsForShares.SHARES_EQUITY.getValue(),
|
||||
CashAccountsForShares.SHARES_EQUITY.toString(), changes);
|
||||
break;
|
||||
case ACCRUAL_PERIODIC:
|
||||
break;
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class AccountingRuleInvalidException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons for invalid Accounting Closure **/
|
||||
public static enum GL_CLOSURE_INVALID_REASON {
|
||||
public static enum GlClosureInvalidReason {
|
||||
FUTURE_DATE, ACCOUNTING_CLOSED;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -45,7 +45,7 @@ public class AccountingRuleInvalidException extends AbstractPlatformDomainRuleEx
|
||||
}
|
||||
}
|
||||
|
||||
public AccountingRuleInvalidException(final GL_CLOSURE_INVALID_REASON reason, final Date date) {
|
||||
public AccountingRuleInvalidException(final GlClosureInvalidReason reason, final Date date) {
|
||||
super(reason.errorCode(), reason.errorMessage(), date);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -199,7 +199,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
|
||||
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
|
||||
|
||||
final Long documentId = this.documentWritePlatformService.createInternalDocument(
|
||||
DocumentWritePlatformServiceJpaRepositoryImpl.DOCUMENT_MANAGEMENT_ENTITY.IMPORT.name(),
|
||||
DocumentWritePlatformServiceJpaRepositoryImpl.DocumentManagementEntity.IMPORT.name(),
|
||||
this.securityContext.authenticatedUser().getId(), null, clonedInputStreamWorkbook,
|
||||
URLConnection.guessContentTypeFromName(fileName), fileName, null, fileName);
|
||||
final Document document = this.documentRepository.findById(documentId).orElse(null);
|
||||
|
||||
+28
-28
@@ -41,8 +41,8 @@ import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepository;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
@@ -97,15 +97,15 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
|
||||
@PostConstruct
|
||||
public void addListners() {
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_APPROVED, new SendSmsOnLoanApproved());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_REJECTED, new SendSmsOnLoanRejected());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_MAKE_REPAYMENT, new SendSmsOnLoanRepayment());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.CLIENTS_ACTIVATE, new ClientActivatedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.CLIENTS_REJECT, new ClientRejectedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_ACTIVATE, new SavingsAccountActivatedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_REJECT, new SavingsAccountRejectedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_DEPOSIT, new SavingsAccountTransactionListener(true));
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_WITHDRAWAL, new SavingsAccountTransactionListener(false));
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new SendSmsOnLoanApproved());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_REJECTED, new SendSmsOnLoanRejected());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT, new SendSmsOnLoanRepayment());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CLIENTS_ACTIVATE, new ClientActivatedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CLIENTS_REJECT, new ClientRejectedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_ACTIVATE, new SavingsAccountActivatedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_REJECT, new SavingsAccountRejectedListener());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_DEPOSIT, new SavingsAccountTransactionListener(true));
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_WITHDRAWAL, new SavingsAccountTransactionListener(false));
|
||||
}
|
||||
|
||||
private void notifyRejectedLoanOwner(Loan loan) {
|
||||
@@ -392,7 +392,7 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private abstract class SmsBusinessEventAdapter implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventToBeExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
//Nothing to do
|
||||
}
|
||||
}
|
||||
@@ -400,8 +400,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class SendSmsOnLoanApproved extends SmsBusinessEventAdapter{
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.LOAN);
|
||||
if (entity instanceof Loan) {
|
||||
Loan loan = (Loan) entity;
|
||||
notifyAcceptedLoanOwner(loan);
|
||||
@@ -412,8 +412,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class SendSmsOnLoanRejected extends SmsBusinessEventAdapter{
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.LOAN);
|
||||
if (entity instanceof Loan) {
|
||||
Loan loan = (Loan) entity;
|
||||
notifyRejectedLoanOwner(loan);
|
||||
@@ -424,8 +424,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class SendSmsOnLoanRepayment extends SmsBusinessEventAdapter{
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.LOAN_TRANSACTION);
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.LOAN_TRANSACTION);
|
||||
if (entity instanceof LoanTransaction) {
|
||||
LoanTransaction loanTransaction = (LoanTransaction) entity;
|
||||
sendSmsForLoanRepayment(loanTransaction);
|
||||
@@ -436,8 +436,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class ClientActivatedListener extends SmsBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.CLIENT);
|
||||
if(entity instanceof Client) {
|
||||
notifyClientActivated((Client)entity);
|
||||
}
|
||||
@@ -447,8 +447,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class ClientRejectedListener extends SmsBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.CLIENT);
|
||||
if(entity instanceof Client) {
|
||||
notifyClientRejected((Client)entity);
|
||||
}
|
||||
@@ -459,8 +459,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class SavingsAccountActivatedListener extends SmsBusinessEventAdapter{
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVING);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.SAVING);
|
||||
if(entity instanceof SavingsAccount) {
|
||||
notifySavingsAccountActivated((SavingsAccount)entity);
|
||||
}
|
||||
@@ -471,8 +471,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
private class SavingsAccountRejectedListener extends SmsBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVING);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.SAVING);
|
||||
if(entity instanceof SavingsAccount) {
|
||||
notifySavingsAccountRejected((SavingsAccount)entity);
|
||||
}
|
||||
@@ -488,8 +488,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVINGS_TRANSACTION);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.SAVINGS_TRANSACTION);
|
||||
if(entity instanceof SavingsAccountTransaction) {
|
||||
sendSmsForSavingsTransaction((SavingsAccountTransaction)entity, this.isDeposit);
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,19 +27,19 @@ public class CodeConstants {
|
||||
* Enum of all parameters passed in while creating/updating a code and code
|
||||
* value
|
||||
***/
|
||||
public static enum CODEVALUE_JSON_INPUT_PARAMS {
|
||||
public static enum CodevalueJSONinputParams {
|
||||
CODEVALUE_ID("id"), NAME("name"), POSITION("position"), DESCRIPTION("description"), IS_ACTIVE("isActive"),
|
||||
IS_MANDATORY("isMandatory");
|
||||
|
||||
private final String value;
|
||||
|
||||
private CODEVALUE_JSON_INPUT_PARAMS(final String value) {
|
||||
private CodevalueJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final CODEVALUE_JSON_INPUT_PARAMS type : CODEVALUE_JSON_INPUT_PARAMS.values()) {
|
||||
for (final CodevalueJSONinputParams type : CodevalueJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -45,7 +45,7 @@ import javax.ws.rs.core.UriInfo;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.codes.CodeConstants.CODEVALUE_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.codes.CodeConstants.CodevalueJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeData;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.codes.service.CodeValueReadPlatformService;
|
||||
@@ -71,10 +71,10 @@ public class CodeValuesApiResource {
|
||||
* The set of parameters that are supported in response for {@link CodeData}
|
||||
*/
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(CODEVALUE_JSON_INPUT_PARAMS.CODEVALUE_ID.getValue(),
|
||||
CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue(), CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue(),
|
||||
CODEVALUE_JSON_INPUT_PARAMS.IS_MANDATORY.getValue(),
|
||||
CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue()));
|
||||
Arrays.asList(CodevalueJSONinputParams.CODEVALUE_ID.getValue(),
|
||||
CodevalueJSONinputParams.NAME.getValue(), CodevalueJSONinputParams.POSITION.getValue(),
|
||||
CodevalueJSONinputParams.IS_MANDATORY.getValue(),
|
||||
CodevalueJSONinputParams.DESCRIPTION.getValue()));
|
||||
private final String resourceNameForPermissions = "CODEVALUE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
+10
-10
@@ -27,7 +27,7 @@ import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.codes.CodeConstants.CODEVALUE_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.codes.CodeConstants.CodevalueJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@@ -84,10 +84,10 @@ public class CodeValue extends AbstractPersistableCustom {
|
||||
|
||||
public static CodeValue fromJson(final Code code, final JsonCommand command) {
|
||||
|
||||
final String label = command.stringValueOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue());
|
||||
Integer position = command.integerValueSansLocaleOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue());
|
||||
String description = command.stringValueOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue());
|
||||
Boolean isActiveObj = command.booleanObjectValueOfParameterNamed(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue());
|
||||
final String label = command.stringValueOfParameterNamed(CodevalueJSONinputParams.NAME.getValue());
|
||||
Integer position = command.integerValueSansLocaleOfParameterNamed(CodevalueJSONinputParams.POSITION.getValue());
|
||||
String description = command.stringValueOfParameterNamed(CodevalueJSONinputParams.DESCRIPTION.getValue());
|
||||
Boolean isActiveObj = command.booleanObjectValueOfParameterNamed(CodevalueJSONinputParams.IS_ACTIVE.getValue());
|
||||
boolean isActive = true;
|
||||
if (isActiveObj != null) {
|
||||
isActive = isActiveObj;
|
||||
@@ -97,7 +97,7 @@ public class CodeValue extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
Boolean mandatory = command.booleanPrimitiveValueOfParameterNamed(
|
||||
CODEVALUE_JSON_INPUT_PARAMS.IS_MANDATORY.getValue());
|
||||
CodevalueJSONinputParams.IS_MANDATORY.getValue());
|
||||
|
||||
// if the "mandatory" Boolean object is null, then set it to false by default
|
||||
if (mandatory == null) {
|
||||
@@ -111,28 +111,28 @@ public class CodeValue extends AbstractPersistableCustom {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(2);
|
||||
|
||||
final String labelParamName = CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue();
|
||||
final String labelParamName = CodevalueJSONinputParams.NAME.getValue();
|
||||
if (command.isChangeInStringParameterNamed(labelParamName, this.label)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(labelParamName);
|
||||
actualChanges.put(labelParamName, newValue);
|
||||
this.label = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
final String decriptionParamName = CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue();
|
||||
final String decriptionParamName = CodevalueJSONinputParams.DESCRIPTION.getValue();
|
||||
if (command.isChangeInStringParameterNamed(decriptionParamName, this.description)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(decriptionParamName);
|
||||
actualChanges.put(decriptionParamName, newValue);
|
||||
this.description = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
final String positionParamName = CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue();
|
||||
final String positionParamName = CodevalueJSONinputParams.POSITION.getValue();
|
||||
if (command.isChangeInIntegerSansLocaleParameterNamed(positionParamName, this.position)) {
|
||||
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(positionParamName);
|
||||
actualChanges.put(positionParamName, newValue);
|
||||
this.position = newValue.intValue();
|
||||
}
|
||||
|
||||
final String isActiveParamName = CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue();
|
||||
final String isActiveParamName = CodevalueJSONinputParams.IS_ACTIVE.getValue();
|
||||
if (command.isChangeInBooleanParameterNamed(isActiveParamName, this.isActive)) {
|
||||
final Boolean newValue = command.booleanPrimitiveValueOfParameterNamed(isActiveParamName);
|
||||
actualChanges.put(isActiveParamName, newValue);
|
||||
|
||||
+23
-23
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.codes.CodeConstants.CODEVALUE_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.codes.CodeConstants.CodevalueJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
@@ -44,7 +44,7 @@ public final class CodeValueCommandFromApiJsonDeserializer {
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = CODEVALUE_JSON_INPUT_PARAMS.getAllValues();
|
||||
private final Set<String> supportedParameters = CodevalueJSONinputParams.getAllValues();
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
@@ -63,24 +63,24 @@ public final class CodeValueCommandFromApiJsonDeserializer {
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue()).value(name).notBlank().notExceedingLengthOf(100);
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(CodevalueJSONinputParams.NAME.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CodevalueJSONinputParams.NAME.getValue()).value(name).notBlank().notExceedingLengthOf(100);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CodevalueJSONinputParams.DESCRIPTION.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue()).value(description)
|
||||
baseDataValidator.reset().parameter(CodevalueJSONinputParams.DESCRIPTION.getValue()).value(description)
|
||||
.notExceedingLengthOf(500);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.POSITION.getValue(), element)) {
|
||||
// Validate input value is a valid Integer
|
||||
this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue(), element);
|
||||
this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CodevalueJSONinputParams.POSITION.getValue(), element);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue(), element)) {
|
||||
final Boolean isActive = this.fromApiJsonHelper.extractBooleanNamed(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue()).value(isActive).validateForBooleanValue();
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.IS_ACTIVE.getValue(), element)) {
|
||||
final Boolean isActive = this.fromApiJsonHelper.extractBooleanNamed(CodevalueJSONinputParams.IS_ACTIVE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CodevalueJSONinputParams.IS_ACTIVE.getValue()).value(isActive).validateForBooleanValue();
|
||||
}
|
||||
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
@@ -97,26 +97,26 @@ public final class CodeValueCommandFromApiJsonDeserializer {
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue(), element)) {
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue()).value(name).notBlank()
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.NAME.getValue(), element)) {
|
||||
final String name = this.fromApiJsonHelper.extractStringNamed(CodevalueJSONinputParams.NAME.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CodevalueJSONinputParams.NAME.getValue()).value(name).notBlank()
|
||||
.notExceedingLengthOf(100);
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CodevalueJSONinputParams.DESCRIPTION.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CODEVALUE_JSON_INPUT_PARAMS.DESCRIPTION.getValue()).value(description)
|
||||
baseDataValidator.reset().parameter(CodevalueJSONinputParams.DESCRIPTION.getValue()).value(description)
|
||||
.notExceedingLengthOf(500);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.POSITION.getValue(), element)) {
|
||||
// Validate input value is a valid Integer
|
||||
this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CODEVALUE_JSON_INPUT_PARAMS.POSITION.getValue(), element);
|
||||
this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CodevalueJSONinputParams.POSITION.getValue(), element);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue(), element)) {
|
||||
final Boolean isActive = this.fromApiJsonHelper.extractBooleanNamed(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CODEVALUE_JSON_INPUT_PARAMS.IS_ACTIVE.getValue()).value(isActive).validateForBooleanValue();
|
||||
if (this.fromApiJsonHelper.parameterExists(CodevalueJSONinputParams.IS_ACTIVE.getValue(), element)) {
|
||||
final Boolean isActive = this.fromApiJsonHelper.extractBooleanNamed(CodevalueJSONinputParams.IS_ACTIVE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CodevalueJSONinputParams.IS_ACTIVE.getValue()).value(isActive).validateForBooleanValue();
|
||||
}
|
||||
|
||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||
|
||||
+6
-6
@@ -26,8 +26,8 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.configuration.data.ExternalServicesPropertiesData;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.SMTP_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.ExternalservicePropertiesJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.SMTPJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
|
||||
@Entity
|
||||
@@ -51,18 +51,18 @@ public class ExternalServicesProperties {
|
||||
|
||||
}
|
||||
public static ExternalServicesProperties fromJson(final ExternalService externalService, final JsonCommand command) {
|
||||
final String name = command.stringValueOfParameterNamed(EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS.NAME.getValue());
|
||||
final String value = command.stringValueOfParameterNamed(EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS.VALUE.getValue());
|
||||
final String name = command.stringValueOfParameterNamed(ExternalservicePropertiesJSONinputParams.NAME.getValue());
|
||||
final String value = command.stringValueOfParameterNamed(ExternalservicePropertiesJSONinputParams.VALUE.getValue());
|
||||
return new ExternalServicesProperties(new ExternalServicePropertiesPK(externalService.getId(), name), value);
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command, String paramName) {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(2);
|
||||
|
||||
final String valueParamName = EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS.VALUE.getValue();
|
||||
final String valueParamName = ExternalservicePropertiesJSONinputParams.VALUE.getValue();
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.value)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
if (paramName.equals(SMTP_JSON_INPUT_PARAMS.PASSWORD.getValue()) && newValue.equals("XXXX")) {
|
||||
if (paramName.equals(SMTPJSONinputParams.PASSWORD.getValue()) && newValue.equals("XXXX")) {
|
||||
// If Param Name is Password and ParamValue is XXXX that means
|
||||
// the password has not been changed.
|
||||
} else {
|
||||
|
||||
+8
-8
@@ -24,10 +24,10 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.configuration.exception.ExternalServiceConfigurationNotFoundException;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.NOTIFICATION_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.S3_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.SMS_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.SMTP_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.NotificationJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.S3JSONinputParams;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.SMSJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.configuration.service.ExternalServicesConstants.SMTPJSONinputParams;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -36,10 +36,10 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class ExternalServicesPropertiesCommandFromApiJsonDeserializer {
|
||||
|
||||
private final Set<String> S3SupportedParameters = S3_JSON_INPUT_PARAMS.getAllValues();
|
||||
private final Set<String> SMTPSupportedParameters = SMTP_JSON_INPUT_PARAMS.getAllValues();
|
||||
private final Set<String> SMSSupportedParameters = SMS_JSON_INPUT_PARAMS.getAllValues();
|
||||
private final Set<String> NotificationSupportedParameters = NOTIFICATION_JSON_INPUT_PARAMS.getAllValues();
|
||||
private final Set<String> S3SupportedParameters = S3JSONinputParams.getAllValues();
|
||||
private final Set<String> SMTPSupportedParameters = SMTPJSONinputParams.getAllValues();
|
||||
private final Set<String> SMSSupportedParameters = SMSJSONinputParams.getAllValues();
|
||||
private final Set<String> NotificationSupportedParameters = NotificationJSONinputParams.getAllValues();
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
|
||||
+15
-15
@@ -48,19 +48,19 @@ public class ExternalServicesConstants {
|
||||
public static final String NOTIFICATION_GCM_END_POINT = "gcm_end_point";
|
||||
public static final String NOTIFICATION_FCM_END_POINT = "fcm_end_point";
|
||||
|
||||
public static enum EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS {
|
||||
public static enum ExternalservicePropertiesJSONinputParams {
|
||||
EXTERNAL_SERVICE_ID("external_service_id"), NAME("name"), VALUE("value");
|
||||
|
||||
private final String value;
|
||||
|
||||
private EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS(final String value) {
|
||||
private ExternalservicePropertiesJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
|
||||
static {
|
||||
for (final EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS type : EXTERNALSERVICEPROPERTIES_JSON_INPUT_PARAMS.values()) {
|
||||
for (final ExternalservicePropertiesJSONinputParams type : ExternalservicePropertiesJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
@@ -79,19 +79,19 @@ public class ExternalServicesConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SMTP_JSON_INPUT_PARAMS {
|
||||
public static enum SMTPJSONinputParams {
|
||||
USERNAME("username"), PASSWORD("password"), HOST("host"), PORT("port"), USETLS("useTLS"), FROM_EMAIL("fromEmail"), FROM_NAME("fromName");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SMTP_JSON_INPUT_PARAMS(final String value) {
|
||||
private SMTPJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
|
||||
static {
|
||||
for (final SMTP_JSON_INPUT_PARAMS type : SMTP_JSON_INPUT_PARAMS.values()) {
|
||||
for (final SMTPJSONinputParams type : SMTPJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
@@ -110,19 +110,19 @@ public class ExternalServicesConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SMS_JSON_INPUT_PARAMS {
|
||||
public static enum SMSJSONinputParams {
|
||||
HASTNAME("host_name"), PORT("port_number"), END_POINT("end_point"), TENANT_APP_KEY("tenant_app_key");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SMS_JSON_INPUT_PARAMS(final String value) {
|
||||
private SMSJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
|
||||
static {
|
||||
for (final SMS_JSON_INPUT_PARAMS type : SMS_JSON_INPUT_PARAMS.values()) {
|
||||
for (final SMSJSONinputParams type : SMSJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
@@ -141,19 +141,19 @@ public class ExternalServicesConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum S3_JSON_INPUT_PARAMS {
|
||||
public static enum S3JSONinputParams {
|
||||
S3_ACCESS_KEY("s3_access_key"), S3_BUCKET_NAME("s3_bucket_name"), S3_SECRET_KEY("s3_secret_key");
|
||||
|
||||
private final String value;
|
||||
|
||||
private S3_JSON_INPUT_PARAMS(final String value) {
|
||||
private S3JSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
|
||||
static {
|
||||
for (final S3_JSON_INPUT_PARAMS type : S3_JSON_INPUT_PARAMS.values()) {
|
||||
for (final S3JSONinputParams type : S3JSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
@@ -172,19 +172,19 @@ public class ExternalServicesConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum NOTIFICATION_JSON_INPUT_PARAMS {
|
||||
public static enum NotificationJSONinputParams {
|
||||
SERVER_KEY("server_key"), GCM_END_POINT("gcm_end_point"), FCM_END_POINT("fcm_end_point");
|
||||
|
||||
private final String value;
|
||||
|
||||
private NOTIFICATION_JSON_INPUT_PARAMS(final String value) {
|
||||
private NotificationJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
|
||||
static {
|
||||
for (final NOTIFICATION_JSON_INPUT_PARAMS type : NOTIFICATION_JSON_INPUT_PARAMS.values()) {
|
||||
for (final NotificationJSONinputParams type : NotificationJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -42,7 +42,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.domain.Base64EncodedImage;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepositoryUtils;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepositoryUtils.IMAGE_FILE_EXTENSION;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepositoryUtils.ImageFileExtension;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.data.ImageData;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.exception.InvalidEntityTypeForImageManagementException;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.service.ImageReadPlatformService;
|
||||
@@ -121,9 +121,9 @@ public class ImagesApiResource {
|
||||
@QueryParam("maxWidth") final Integer maxWidth, @QueryParam("maxHeight") final Integer maxHeight,
|
||||
@QueryParam("output") final String output) {
|
||||
validateEntityTypeforImage(entityName);
|
||||
if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equalsIgnoreCase(entityName)) {
|
||||
if (EntityTypeForImages.CLIENTS.toString().equalsIgnoreCase(entityName)) {
|
||||
this.context.authenticatedUser().validateHasReadPermission("CLIENTIMAGE");
|
||||
} else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equalsIgnoreCase(entityName)) {
|
||||
} else if (EntityTypeForImages.STAFF.toString().equalsIgnoreCase(entityName)) {
|
||||
this.context.authenticatedUser().validateHasReadPermission("STAFFIMAGE");
|
||||
}
|
||||
|
||||
@@ -133,11 +133,11 @@ public class ImagesApiResource {
|
||||
final ImageData imageData = this.imageReadPlatformService.retrieveImage(entityName, entityId);
|
||||
|
||||
// TODO: Need a better way of determining image type
|
||||
String imageDataURISuffix = ContentRepositoryUtils.IMAGE_DATA_URI_SUFFIX.JPEG.getValue();
|
||||
if (StringUtils.endsWith(imageData.location(), ContentRepositoryUtils.IMAGE_FILE_EXTENSION.GIF.getValue())) {
|
||||
imageDataURISuffix = ContentRepositoryUtils.IMAGE_DATA_URI_SUFFIX.GIF.getValue();
|
||||
} else if (StringUtils.endsWith(imageData.location(), ContentRepositoryUtils.IMAGE_FILE_EXTENSION.PNG.getValue())) {
|
||||
imageDataURISuffix = ContentRepositoryUtils.IMAGE_DATA_URI_SUFFIX.PNG.getValue();
|
||||
String imageDataURISuffix = ContentRepositoryUtils.ImageDataURIsuffix.JPEG.getValue();
|
||||
if (StringUtils.endsWith(imageData.location(), ContentRepositoryUtils.ImageFileExtension.GIF.getValue())) {
|
||||
imageDataURISuffix = ContentRepositoryUtils.ImageDataURIsuffix.GIF.getValue();
|
||||
} else if (StringUtils.endsWith(imageData.location(), ContentRepositoryUtils.ImageFileExtension.PNG.getValue())) {
|
||||
imageDataURISuffix = ContentRepositoryUtils.ImageDataURIsuffix.PNG.getValue();
|
||||
}
|
||||
|
||||
final String clientImageAsBase64Text = imageDataURISuffix + Base64.encodeBytes(imageData.getContentOfSize(maxWidth, maxHeight));
|
||||
@@ -151,9 +151,9 @@ public class ImagesApiResource {
|
||||
@QueryParam("maxWidth") final Integer maxWidth, @QueryParam("maxHeight") final Integer maxHeight,
|
||||
@QueryParam("output") String output) {
|
||||
validateEntityTypeforImage(entityName);
|
||||
if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equalsIgnoreCase(entityName)) {
|
||||
if (EntityTypeForImages.CLIENTS.toString().equalsIgnoreCase(entityName)) {
|
||||
this.context.authenticatedUser().validateHasReadPermission("CLIENTIMAGE");
|
||||
} else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equalsIgnoreCase(entityName)) {
|
||||
} else if (EntityTypeForImages.STAFF.toString().equalsIgnoreCase(entityName)) {
|
||||
this.context.authenticatedUser().validateHasReadPermission("STAFFIMAGE");
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public class ImagesApiResource {
|
||||
final ResponseBuilder response = Response.ok(imageData.getContentOfSize(maxWidth, maxHeight));
|
||||
String dispositionType = "inline_octet".equals(output) ? "inline" : "attachment";
|
||||
response.header("Content-Disposition", dispositionType + "; filename=\"" + imageData.getEntityDisplayName()
|
||||
+ IMAGE_FILE_EXTENSION.JPEG + "\"");
|
||||
+ ImageFileExtension.JPEG + "\"");
|
||||
|
||||
// TODO: Need a better way of determining image type
|
||||
|
||||
@@ -207,7 +207,7 @@ public class ImagesApiResource {
|
||||
}
|
||||
|
||||
/*** Entities for document Management **/
|
||||
public static enum ENTITY_TYPE_FOR_IMAGES {
|
||||
public static enum EntityTypeForImages {
|
||||
STAFF, CLIENTS;
|
||||
|
||||
@Override
|
||||
@@ -221,7 +221,7 @@ public class ImagesApiResource {
|
||||
}
|
||||
|
||||
private static boolean checkValidEntityType(final String entityType) {
|
||||
for (final ENTITY_TYPE_FOR_IMAGES entities : ENTITY_TYPE_FOR_IMAGES.values()) {
|
||||
for (final EntityTypeForImages entities : EntityTypeForImages.values()) {
|
||||
if (entities.name().equalsIgnoreCase(entityType)) { return true; }
|
||||
}
|
||||
return false;
|
||||
|
||||
+27
-27
@@ -33,12 +33,12 @@ public class ContentRepositoryUtils {
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
public static enum IMAGE_MIME_TYPE {
|
||||
public static enum ImageMIMEtype {
|
||||
GIF("image/gif"), JPEG("image/jpeg"), PNG("image/png");
|
||||
|
||||
private final String value;
|
||||
|
||||
private IMAGE_MIME_TYPE(final String value) {
|
||||
private ImageMIMEtype(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -46,27 +46,27 @@ public class ContentRepositoryUtils {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static IMAGE_MIME_TYPE fromFileExtension(IMAGE_FILE_EXTENSION fileExtension) {
|
||||
public static ImageMIMEtype fromFileExtension(ImageFileExtension fileExtension) {
|
||||
switch (fileExtension) {
|
||||
case GIF:
|
||||
return IMAGE_MIME_TYPE.GIF;
|
||||
return ImageMIMEtype.GIF;
|
||||
case JPG:
|
||||
case JPEG:
|
||||
return IMAGE_MIME_TYPE.JPEG;
|
||||
return ImageMIMEtype.JPEG;
|
||||
case PNG:
|
||||
return IMAGE_MIME_TYPE.PNG;
|
||||
return ImageMIMEtype.PNG;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum IMAGE_FILE_EXTENSION {
|
||||
public static enum ImageFileExtension {
|
||||
GIF(".gif"), JPEG(".jpeg"), JPG(".jpg"), PNG(".png");
|
||||
|
||||
private final String value;
|
||||
|
||||
private IMAGE_FILE_EXTENSION(final String value) {
|
||||
private ImageFileExtension(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -78,27 +78,27 @@ public class ContentRepositoryUtils {
|
||||
return this.value.substring(1);
|
||||
}
|
||||
|
||||
public IMAGE_FILE_EXTENSION getFileExtension() {
|
||||
public ImageFileExtension getFileExtension() {
|
||||
switch (this) {
|
||||
case GIF:
|
||||
return IMAGE_FILE_EXTENSION.GIF;
|
||||
return ImageFileExtension.GIF;
|
||||
case JPEG:
|
||||
return IMAGE_FILE_EXTENSION.JPEG;
|
||||
return ImageFileExtension.JPEG;
|
||||
case PNG:
|
||||
return IMAGE_FILE_EXTENSION.PNG;
|
||||
return ImageFileExtension.PNG;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum IMAGE_DATA_URI_SUFFIX {
|
||||
GIF("data:" + IMAGE_MIME_TYPE.GIF.getValue() + ";base64,"), JPEG("data:" + IMAGE_MIME_TYPE.JPEG.getValue() + ";base64,"), PNG(
|
||||
"data:" + IMAGE_MIME_TYPE.PNG.getValue() + ";base64,");
|
||||
public static enum ImageDataURIsuffix {
|
||||
GIF("data:" + ImageMIMEtype.GIF.getValue() + ";base64,"), JPEG("data:" + ImageMIMEtype.JPEG.getValue() + ";base64,"), PNG(
|
||||
"data:" + ImageMIMEtype.PNG.getValue() + ";base64,");
|
||||
|
||||
private final String value;
|
||||
|
||||
private IMAGE_DATA_URI_SUFFIX(final String value) {
|
||||
private ImageDataURIsuffix(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ public class ContentRepositoryUtils {
|
||||
* @param mimeType
|
||||
*/
|
||||
public static void validateImageMimeType(final String mimeType) {
|
||||
if (!(mimeType.equalsIgnoreCase(IMAGE_MIME_TYPE.GIF.getValue()) || mimeType.equalsIgnoreCase(IMAGE_MIME_TYPE.JPEG.getValue()) || mimeType
|
||||
.equalsIgnoreCase(IMAGE_MIME_TYPE.PNG.getValue()))) { throw new ImageUploadException(); }
|
||||
if (!(mimeType.equalsIgnoreCase(ImageMIMEtype.GIF.getValue()) || mimeType.equalsIgnoreCase(ImageMIMEtype.JPEG.getValue()) || mimeType
|
||||
.equalsIgnoreCase(ImageMIMEtype.PNG.getValue()))) { throw new ImageUploadException(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,15 +125,15 @@ public class ContentRepositoryUtils {
|
||||
public static Base64EncodedImage extractImageFromDataURL(final String dataURL) {
|
||||
String fileExtension = "";
|
||||
String base64EncodedString = null;
|
||||
if (StringUtils.startsWith(dataURL, IMAGE_DATA_URI_SUFFIX.GIF.getValue())) {
|
||||
base64EncodedString = dataURL.replaceAll(IMAGE_DATA_URI_SUFFIX.GIF.getValue(), "");
|
||||
fileExtension = IMAGE_FILE_EXTENSION.GIF.getValue();
|
||||
} else if (StringUtils.startsWith(dataURL, IMAGE_DATA_URI_SUFFIX.PNG.getValue())) {
|
||||
base64EncodedString = dataURL.replaceAll(IMAGE_DATA_URI_SUFFIX.PNG.getValue(), "");
|
||||
fileExtension = IMAGE_FILE_EXTENSION.PNG.getValue();
|
||||
} else if (StringUtils.startsWith(dataURL, IMAGE_DATA_URI_SUFFIX.JPEG.getValue())) {
|
||||
base64EncodedString = dataURL.replaceAll(IMAGE_DATA_URI_SUFFIX.JPEG.getValue(), "");
|
||||
fileExtension = IMAGE_FILE_EXTENSION.JPEG.getValue();
|
||||
if (StringUtils.startsWith(dataURL, ImageDataURIsuffix.GIF.getValue())) {
|
||||
base64EncodedString = dataURL.replaceAll(ImageDataURIsuffix.GIF.getValue(), "");
|
||||
fileExtension = ImageFileExtension.GIF.getValue();
|
||||
} else if (StringUtils.startsWith(dataURL, ImageDataURIsuffix.PNG.getValue())) {
|
||||
base64EncodedString = dataURL.replaceAll(ImageDataURIsuffix.PNG.getValue(), "");
|
||||
fileExtension = ImageFileExtension.PNG.getValue();
|
||||
} else if (StringUtils.startsWith(dataURL, ImageDataURIsuffix.JPEG.getValue())) {
|
||||
base64EncodedString = dataURL.replaceAll(ImageDataURIsuffix.JPEG.getValue(), "");
|
||||
fileExtension = ImageFileExtension.JPEG.getValue();
|
||||
} else {
|
||||
throw new ImageDataURLNotValidException();
|
||||
}
|
||||
|
||||
+8
-8
@@ -48,7 +48,7 @@ public class ImageData {
|
||||
private final String entityDisplayName;
|
||||
|
||||
private File file;
|
||||
private ContentRepositoryUtils.IMAGE_FILE_EXTENSION fileExtension;
|
||||
private ContentRepositoryUtils.ImageFileExtension fileExtension;
|
||||
private InputStream inputStream;
|
||||
|
||||
public ImageData(final Long imageId, final String location, final Integer storageType, final String entityDisplayName) {
|
||||
@@ -94,7 +94,7 @@ public class ImageData {
|
||||
|
||||
int newWidth = (int) (src.getWidth() / scaleRatio);
|
||||
int newHeight = (int) (src.getHeight() / scaleRatio);
|
||||
int colorModel = fileExtension == ContentRepositoryUtils.IMAGE_FILE_EXTENSION.JPEG ? BufferedImage.TYPE_INT_RGB
|
||||
int colorModel = fileExtension == ContentRepositoryUtils.ImageFileExtension.JPEG ? BufferedImage.TYPE_INT_RGB
|
||||
: BufferedImage.TYPE_INT_ARGB;
|
||||
BufferedImage target = new BufferedImage(newWidth, newHeight, colorModel);
|
||||
Graphics2D g = target.createGraphics();
|
||||
@@ -135,12 +135,12 @@ public class ImageData {
|
||||
}
|
||||
|
||||
private void setImageContentType(String filename) {
|
||||
fileExtension = ContentRepositoryUtils.IMAGE_FILE_EXTENSION.JPEG;
|
||||
fileExtension = ContentRepositoryUtils.ImageFileExtension.JPEG;
|
||||
|
||||
if (StringUtils.endsWith(filename.toLowerCase(), ContentRepositoryUtils.IMAGE_FILE_EXTENSION.GIF.getValue())) {
|
||||
fileExtension = ContentRepositoryUtils.IMAGE_FILE_EXTENSION.GIF;
|
||||
} else if (StringUtils.endsWith(filename, ContentRepositoryUtils.IMAGE_FILE_EXTENSION.PNG.getValue())) {
|
||||
fileExtension = ContentRepositoryUtils.IMAGE_FILE_EXTENSION.PNG;
|
||||
if (StringUtils.endsWith(filename.toLowerCase(), ContentRepositoryUtils.ImageFileExtension.GIF.getValue())) {
|
||||
fileExtension = ContentRepositoryUtils.ImageFileExtension.GIF;
|
||||
} else if (StringUtils.endsWith(filename, ContentRepositoryUtils.ImageFileExtension.PNG.getValue())) {
|
||||
fileExtension = ContentRepositoryUtils.ImageFileExtension.PNG;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ImageData {
|
||||
}
|
||||
|
||||
public String contentType() {
|
||||
return ContentRepositoryUtils.IMAGE_MIME_TYPE.fromFileExtension(this.fileExtension).getValue();
|
||||
return ContentRepositoryUtils.ImageMIMEtype.fromFileExtension(this.fileExtension).getValue();
|
||||
}
|
||||
|
||||
public StorageType storageType() {
|
||||
|
||||
+2
-2
@@ -168,14 +168,14 @@ public class DocumentWritePlatformServiceJpaRepositoryImpl implements DocumentWr
|
||||
}
|
||||
|
||||
private static boolean checkValidEntityType(final String entityType) {
|
||||
for (final DOCUMENT_MANAGEMENT_ENTITY entities : DOCUMENT_MANAGEMENT_ENTITY.values()) {
|
||||
for (final DocumentManagementEntity entities : DocumentManagementEntity.values()) {
|
||||
if (entities.name().equalsIgnoreCase(entityType)) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*** Entities for document Management **/
|
||||
public static enum DOCUMENT_MANAGEMENT_ENTITY {
|
||||
public static enum DocumentManagementEntity {
|
||||
CLIENTS, CLIENT_IDENTIFIERS, STAFF, LOANS, SAVINGS, GROUPS,IMPORT;
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.api.ImagesApiResource.ENTITY_TYPE_FOR_IMAGES;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.api.ImagesApiResource.EntityTypeForImages;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepository;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepositoryFactory;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.data.ImageData;
|
||||
@@ -64,9 +64,9 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService {
|
||||
|
||||
public String schema(String entityType) {
|
||||
StringBuilder builder = new StringBuilder("image.id as id, image.location as location, image.storage_type_enum as storageType ");
|
||||
if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equalsIgnoreCase(entityType)) {
|
||||
if (EntityTypeForImages.CLIENTS.toString().equalsIgnoreCase(entityType)) {
|
||||
builder.append(" from m_image image , m_client client " + " where client.image_id = image.id and client.id=?");
|
||||
} else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equalsIgnoreCase(entityType)) {
|
||||
} else if (EntityTypeForImages.STAFF.toString().equalsIgnoreCase(entityType)) {
|
||||
builder.append("from m_image image , m_staff staff " + " where staff.image_id = image.id and staff.id=?");
|
||||
}
|
||||
return builder.toString();
|
||||
@@ -87,10 +87,10 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService {
|
||||
try {
|
||||
Object owner;
|
||||
String displayName = null;
|
||||
if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equalsIgnoreCase(entityType)) {
|
||||
if (EntityTypeForImages.CLIENTS.toString().equalsIgnoreCase(entityType)) {
|
||||
owner = this.clientRepositoryWrapper.findOneWithNotFoundDetection(entityId);
|
||||
displayName = ((Client) owner).getDisplayName();
|
||||
} else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equalsIgnoreCase(entityType)) {
|
||||
} else if (EntityTypeForImages.STAFF.toString().equalsIgnoreCase(entityType)) {
|
||||
owner = this.staffRepositoryWrapper.findOneWithNotFoundDetection(entityId);
|
||||
displayName = ((Staff) owner).displayName();
|
||||
}
|
||||
|
||||
+5
-5
@@ -21,7 +21,7 @@ package org.apache.fineract.infrastructure.documentmanagement.service;
|
||||
import java.io.InputStream;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.domain.Base64EncodedImage;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.api.ImagesApiResource.ENTITY_TYPE_FOR_IMAGES;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.api.ImagesApiResource.EntityTypeForImages;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepository;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.contentrepository.ContentRepositoryFactory;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.domain.Image;
|
||||
@@ -80,14 +80,14 @@ public class ImageWritePlatformServiceJpaRepositoryImpl implements ImageWritePla
|
||||
public CommandProcessingResult deleteImage(String entityName, final Long clientId) {
|
||||
Object owner = null;
|
||||
Image image = null;
|
||||
if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equals(entityName)) {
|
||||
if (EntityTypeForImages.CLIENTS.toString().equals(entityName)) {
|
||||
owner = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
|
||||
Client client = (Client) owner;
|
||||
image = client.getImage();
|
||||
client.setImage(null);
|
||||
this.clientRepositoryWrapper.save(client);
|
||||
|
||||
} else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equals(entityName)) {
|
||||
} else if (EntityTypeForImages.STAFF.toString().equals(entityName)) {
|
||||
owner = this.staffRepositoryWrapper.findOneWithNotFoundDetection(clientId);
|
||||
Staff staff = (Staff) owner;
|
||||
image = staff.getImage();
|
||||
@@ -114,11 +114,11 @@ public class ImageWritePlatformServiceJpaRepositoryImpl implements ImageWritePla
|
||||
private Object deletePreviousImage(String entityName, final Long entityId) {
|
||||
Object owner = null;
|
||||
Image image = null;
|
||||
if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equals(entityName)) {
|
||||
if (EntityTypeForImages.CLIENTS.toString().equals(entityName)) {
|
||||
Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(entityId);
|
||||
image = client.getImage();
|
||||
owner = client;
|
||||
} else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equals(entityName)) {
|
||||
} else if (EntityTypeForImages.STAFF.toString().equals(entityName)) {
|
||||
Staff staff = this.staffRepositoryWrapper.findOneWithNotFoundDetection(entityId);
|
||||
image = staff.getImage();
|
||||
owner = staff;
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ public class FineractEntityAccessConstants {
|
||||
/***
|
||||
* Enum of all parameters passed in while creating/updating an entity access
|
||||
***/
|
||||
public static enum ENTITY_ACCESS_JSON_INPUT_PARAMS {
|
||||
public static enum EntityAccessJSONinputParams {
|
||||
ENTITY_TYPE("entityType"),
|
||||
ENTITY_ID("entityId"),
|
||||
ENTITY_ACCESS_TYPE_ID("entityAccessTypeId"),
|
||||
@@ -37,7 +37,7 @@ public class FineractEntityAccessConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private ENTITY_ACCESS_JSON_INPUT_PARAMS(final String value) {
|
||||
private EntityAccessJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -73,13 +73,13 @@ public class FineractEntityAccess extends AbstractPersistableCustom {
|
||||
|
||||
public static FineractEntityAccess fromJson(final CodeValue accessType, final JsonCommand command) {
|
||||
final String entityType = command.stringValueOfParameterNamed(
|
||||
FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.ENTITY_TYPE.getValue());
|
||||
FineractEntityAccessConstants.EntityAccessJSONinputParams.ENTITY_TYPE.getValue());
|
||||
final Long entityId = command.longValueOfParameterNamed(
|
||||
FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.ENTITY_ID.getValue());
|
||||
FineractEntityAccessConstants.EntityAccessJSONinputParams.ENTITY_ID.getValue());
|
||||
final String secondEntityType = command.stringValueOfParameterNamed(
|
||||
FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.SECOND_ENTITY_ID.getValue());
|
||||
FineractEntityAccessConstants.EntityAccessJSONinputParams.SECOND_ENTITY_ID.getValue());
|
||||
final Long secondEntityId = command.longValueOfParameterNamed(
|
||||
FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.SECOND_ENTITY_ID.getValue());
|
||||
FineractEntityAccessConstants.EntityAccessJSONinputParams.SECOND_ENTITY_ID.getValue());
|
||||
|
||||
return new FineractEntityAccess (entityType, entityId, accessType,
|
||||
secondEntityType, secondEntityId);
|
||||
@@ -92,14 +92,14 @@ public class FineractEntityAccess extends AbstractPersistableCustom {
|
||||
|
||||
String paramName = null;
|
||||
|
||||
paramName = FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.ENTITY_TYPE.getValue();
|
||||
paramName = FineractEntityAccessConstants.EntityAccessJSONinputParams.ENTITY_TYPE.getValue();
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.entityType)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.entityType = newValue;
|
||||
}
|
||||
|
||||
paramName = FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.ENTITY_ID.getValue();
|
||||
paramName = FineractEntityAccessConstants.EntityAccessJSONinputParams.ENTITY_ID.getValue();
|
||||
if (command.isChangeInLongParameterNamed(paramName, getEntityId())) {
|
||||
this.entityId = command.longValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, this.entityId);
|
||||
@@ -110,20 +110,20 @@ public class FineractEntityAccess extends AbstractPersistableCustom {
|
||||
existingAccessTypeId = this.accessType.getId();
|
||||
}
|
||||
|
||||
paramName = FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.ENTITY_ACCESS_TYPE_ID.getValue();
|
||||
paramName = FineractEntityAccessConstants.EntityAccessJSONinputParams.ENTITY_ACCESS_TYPE_ID.getValue();
|
||||
if (command.isChangeInLongParameterNamed(paramName, existingAccessTypeId)) {
|
||||
final Long newValue = command.longValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
}
|
||||
|
||||
paramName = FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.SECOND_ENTITY_TYPE.getValue();
|
||||
paramName = FineractEntityAccessConstants.EntityAccessJSONinputParams.SECOND_ENTITY_TYPE.getValue();
|
||||
if (command.isChangeInStringParameterNamed(paramName, this.secondEntityType)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, newValue);
|
||||
this.secondEntityType = newValue;
|
||||
}
|
||||
|
||||
paramName = FineractEntityAccessConstants.ENTITY_ACCESS_JSON_INPUT_PARAMS.SECOND_ENTITY_ID.getValue();
|
||||
paramName = FineractEntityAccessConstants.EntityAccessJSONinputParams.SECOND_ENTITY_ID.getValue();
|
||||
if (command.isChangeInLongParameterNamed(paramName, getSecondEntityId())) {
|
||||
this.secondEntityId = command.longValueOfParameterNamed(paramName);
|
||||
actualChanges.put(paramName, this.secondEntityId);
|
||||
|
||||
+60
-60
@@ -36,8 +36,8 @@ import org.apache.fineract.notification.eventandlistener.SpringEventPublisher;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepository;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
@@ -82,58 +82,58 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
|
||||
@PostConstruct
|
||||
public void addListeners() {
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.CLIENTS_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CLIENTS_CREATE,
|
||||
new ClientCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_APPROVE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_APPROVE,
|
||||
new SavingsAccountApprovedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.CENTERS_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.CENTERS_CREATE,
|
||||
new CenterCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.GROUPS_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.GROUPS_CREATE,
|
||||
new GroupCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_DEPOSIT,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_DEPOSIT,
|
||||
new SavingsAccountDepositListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SHARE_PRODUCT_DIVIDENDS_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SHARE_PRODUCT_DIVIDENDS_CREATE,
|
||||
new ShareProductDividendCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.FIXED_DEPOSIT_ACCOUNT_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.FIXED_DEPOSIT_ACCOUNT_CREATE,
|
||||
new FixedDepositAccountCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.RECURRING_DEPOSIT_ACCOUNT_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.RECURRING_DEPOSIT_ACCOUNT_CREATE,
|
||||
new RecurringDepositAccountCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_POST_INTEREST,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_POST_INTEREST,
|
||||
new SavingsPostInterestListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CREATE,
|
||||
new LoanCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_APPROVED,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED,
|
||||
new LoanApprovedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_CLOSE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CLOSE,
|
||||
new LoanClosedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_CLOSE_AS_RESCHEDULE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CLOSE_AS_RESCHEDULE,
|
||||
new LoanCloseAsRescheduledListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_MAKE_REPAYMENT,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT,
|
||||
new LoanMakeRepaymentListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_PRODUCT_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_PRODUCT_CREATE,
|
||||
new LoanProductCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_CREATE,
|
||||
new SavingsAccountCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_CLOSE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SAVINGS_CLOSE,
|
||||
new SavingsAccountClosedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SHARE_ACCOUNT_CREATE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SHARE_ACCOUNT_CREATE,
|
||||
new ShareAccountCreatedListener());
|
||||
businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SHARE_ACCOUNT_APPROVE,
|
||||
businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.SHARE_ACCOUNT_APPROVE,
|
||||
new ShareAccountApprovedListener());
|
||||
}
|
||||
|
||||
private abstract class NotificationBusinessEventAdapter implements BusinessEventListner {
|
||||
@Override
|
||||
public void businessEventToBeExecuted(Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventToBeExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {
|
||||
}
|
||||
}
|
||||
|
||||
private class ClientCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Client client;
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BusinessEntity.CLIENT);
|
||||
if (entity != null) {
|
||||
client = (Client) entity;
|
||||
buildNotification(
|
||||
@@ -152,9 +152,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class CenterCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {
|
||||
CommandProcessingResult commandProcessingResult;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.GROUP);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.GROUP);
|
||||
if (entity != null) {
|
||||
commandProcessingResult = (CommandProcessingResult) entity;
|
||||
buildNotification(
|
||||
@@ -173,9 +173,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class GroupCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEventNotificationConstants.BusinessEntity, Object> businessEventEntity) {
|
||||
CommandProcessingResult commandProcessingResult;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.GROUP);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.GROUP);
|
||||
if (entity != null) {
|
||||
commandProcessingResult = (CommandProcessingResult) entity;
|
||||
buildNotification(
|
||||
@@ -194,9 +194,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class SavingsAccountDepositListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
SavingsAccountTransaction savingsAccountTransaction;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SAVINGS_TRANSACTION);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SAVINGS_TRANSACTION);
|
||||
if (entity != null) {
|
||||
savingsAccountTransaction = (SavingsAccountTransaction) entity;
|
||||
buildNotification(
|
||||
@@ -215,9 +215,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class ShareProductDividendCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Long shareProductId;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SHARE_PRODUCT);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SHARE_PRODUCT);
|
||||
if (entity != null) {
|
||||
shareProductId = (Long) entity;
|
||||
buildNotification(
|
||||
@@ -236,9 +236,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class FixedDepositAccountCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
FixedDepositAccount fixedDepositAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.DEPOSIT_ACCOUNT);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.DEPOSIT_ACCOUNT);
|
||||
if (entity != null) {
|
||||
fixedDepositAccount = (FixedDepositAccount) entity;
|
||||
buildNotification(
|
||||
@@ -257,9 +257,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class RecurringDepositAccountCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
RecurringDepositAccount recurringDepositAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.DEPOSIT_ACCOUNT);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.DEPOSIT_ACCOUNT);
|
||||
if (entity != null) {
|
||||
recurringDepositAccount = (RecurringDepositAccount) entity;
|
||||
buildNotification(
|
||||
@@ -278,9 +278,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class SavingsAccountApprovedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
SavingsAccount savingsAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SAVING);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SAVING);
|
||||
if (entity != null) {
|
||||
savingsAccount = (SavingsAccount) entity;
|
||||
if (savingsAccount.depositAccountType().equals(DepositAccountType.FIXED_DEPOSIT)) {
|
||||
@@ -324,9 +324,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class SavingsPostInterestListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
SavingsAccount savingsAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SAVING);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SAVING);
|
||||
if (entity != null) {
|
||||
savingsAccount = (SavingsAccount) entity;
|
||||
buildNotification(
|
||||
@@ -345,9 +345,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class LoanCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Loan loan;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity != null) {
|
||||
loan = (Loan) entity;
|
||||
buildNotification(
|
||||
@@ -367,9 +367,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class LoanApprovedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Loan loan;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity != null) {
|
||||
loan = (Loan) entity;
|
||||
buildNotification(
|
||||
@@ -388,10 +388,10 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class LoanClosedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
|
||||
Loan loan;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity != null) {
|
||||
loan = (Loan) entity;
|
||||
buildNotification(
|
||||
@@ -410,9 +410,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class LoanCloseAsRescheduledListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Loan loan;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity != null) {
|
||||
loan = (Loan) entity;
|
||||
buildNotification(
|
||||
@@ -431,9 +431,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class LoanMakeRepaymentListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Loan loan;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity != null) {
|
||||
loan = (Loan) entity;
|
||||
buildNotification(
|
||||
@@ -452,10 +452,10 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class LoanProductCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
|
||||
LoanProduct loanProduct;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_PRODUCT);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN_PRODUCT);
|
||||
if (entity != null) {
|
||||
loanProduct = (LoanProduct) entity;
|
||||
buildNotification(
|
||||
@@ -474,9 +474,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class SavingsAccountCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
SavingsAccount savingsAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SAVING);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SAVING);
|
||||
if (entity != null) {
|
||||
savingsAccount = (SavingsAccount) entity;
|
||||
buildNotification(
|
||||
@@ -495,9 +495,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class SavingsAccountClosedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
SavingsAccount savingsAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SAVING);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SAVING);
|
||||
if (entity != null) {
|
||||
savingsAccount = (SavingsAccount) entity;
|
||||
buildNotification(
|
||||
@@ -516,9 +516,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class ShareAccountCreatedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
ShareAccount shareAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SHARE_ACCOUNT);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SHARE_ACCOUNT);
|
||||
if (entity != null) {
|
||||
shareAccount = (ShareAccount) entity;
|
||||
buildNotification(
|
||||
@@ -537,9 +537,9 @@ public class NotificationDomainServiceImpl implements NotificationDomainService
|
||||
private class ShareAccountApprovedListener extends NotificationBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
ShareAccount shareAccount;
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.SHARE_ACCOUNT);
|
||||
Object entity = businessEventEntity.get(BusinessEntity.SHARE_ACCOUNT);
|
||||
if (entity != null) {
|
||||
shareAccount = (ShareAccount) entity;
|
||||
buildNotification(
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourc
|
||||
*/
|
||||
public class StaffRoleException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public static enum STAFF_ROLE {
|
||||
public static enum StaffRole {
|
||||
LOAN_OFFICER, BRANCH_MANAGER,SAVINGS_OFFICER;
|
||||
|
||||
@Override
|
||||
@@ -34,7 +34,7 @@ public class StaffRoleException extends AbstractPlatformResourceNotFoundExceptio
|
||||
}
|
||||
}
|
||||
|
||||
public StaffRoleException(final Long id, final STAFF_ROLE role) {
|
||||
public StaffRoleException(final Long id, final StaffRole role) {
|
||||
super("error.msg.staff.id.invalid.role", "Staff with identifier " + id + " is not a " + role.toString(), id);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -22,7 +22,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.persistence.PersistenceException;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FINANCIAL_ACTIVITY;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccountRepositoryWrapper;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
@@ -411,9 +411,9 @@ public class TellerWritePlatformServiceJpaImpl implements TellerWritePlatformSer
|
||||
|
||||
// Pass the journal entries
|
||||
FinancialActivityAccount mainVaultFinancialActivityAccount = this.financialActivityAccountRepositoryWrapper
|
||||
.findByFinancialActivityTypeWithNotFoundDetection(FINANCIAL_ACTIVITY.CASH_AT_MAINVAULT.getValue());
|
||||
.findByFinancialActivityTypeWithNotFoundDetection(FinancialActivity.CASH_AT_MAINVAULT.getValue());
|
||||
FinancialActivityAccount tellerCashFinancialActivityAccount = this.financialActivityAccountRepositoryWrapper
|
||||
.findByFinancialActivityTypeWithNotFoundDetection(FINANCIAL_ACTIVITY.CASH_AT_TELLER.getValue());
|
||||
.findByFinancialActivityTypeWithNotFoundDetection(FinancialActivity.CASH_AT_TELLER.getValue());
|
||||
GLAccount creditAccount = null;
|
||||
GLAccount debitAccount = null;
|
||||
if (txnType.equals(CashierTxnType.ALLOCATE)) {
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ public class CalendarConstants {
|
||||
|
||||
public static final String CALENDAR_RESOURCE_NAME = "calendar";
|
||||
|
||||
public static enum CALENDAR_SUPPORTED_PARAMETERS {
|
||||
public static enum CalendarSupportedParameters {
|
||||
CALENDAR_ID("id"), ENTITY_TYPE("entityType"), ENTITY_ID("entityId"), TITLE("title"), DESCRIPTION("description"), LOCATION(
|
||||
"location"), START_DATE("startDate"), END_DATE("endDate"), CREATED_DATE("createdDate"), DURATION("duration"), TYPE_ID(
|
||||
"typeId"), REPEATING("repeating"), REMIND_BY_ID("remindById"), FIRST_REMINDER("firstReminder"), SECOND_REMINDER(
|
||||
@@ -36,13 +36,13 @@ public class CalendarConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private CALENDAR_SUPPORTED_PARAMETERS(final String value) {
|
||||
private CalendarSupportedParameters(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final CALENDAR_SUPPORTED_PARAMETERS param : CALENDAR_SUPPORTED_PARAMETERS.values()) {
|
||||
for (final CalendarSupportedParameters param : CalendarSupportedParameters.values()) {
|
||||
values.add(param.value);
|
||||
}
|
||||
}
|
||||
|
||||
+46
-46
@@ -42,7 +42,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CALENDAR_SUPPORTED_PARAMETERS;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CalendarSupportedParameters;
|
||||
import org.apache.fineract.portfolio.calendar.exception.CalendarDateException;
|
||||
import org.apache.fineract.portfolio.calendar.exception.CalendarParameterUpdateNotSupportedException;
|
||||
import org.apache.fineract.portfolio.calendar.service.CalendarUtils;
|
||||
@@ -113,7 +113,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
|
||||
final CalendarType calendarType = CalendarType.fromInt(typeId);
|
||||
if (calendarType.isCollection() && !repeating) {
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue())
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATING.getValue())
|
||||
.failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar");
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||
}
|
||||
@@ -172,20 +172,20 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
// final Integer entityTypeId =
|
||||
// CalendarEntityType.valueOf(command.getSupportedEntityType().toUpperCase()).getValue();
|
||||
Date meetingtime=null;
|
||||
final String title = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue());
|
||||
final String description = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue());
|
||||
final String location = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue());
|
||||
final LocalDate startDate = command.localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue());
|
||||
final LocalDate endDate = command.localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue());
|
||||
final Integer duration = command.integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue());
|
||||
final Integer typeId = command.integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue());
|
||||
final boolean repeating = command.booleanPrimitiveValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue());
|
||||
final Integer remindById = command.integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue());
|
||||
final Integer firstReminder = command.integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER
|
||||
final String title = command.stringValueOfParameterNamed(CalendarSupportedParameters.TITLE.getValue());
|
||||
final String description = command.stringValueOfParameterNamed(CalendarSupportedParameters.DESCRIPTION.getValue());
|
||||
final String location = command.stringValueOfParameterNamed(CalendarSupportedParameters.LOCATION.getValue());
|
||||
final LocalDate startDate = command.localDateValueOfParameterNamed(CalendarSupportedParameters.START_DATE.getValue());
|
||||
final LocalDate endDate = command.localDateValueOfParameterNamed(CalendarSupportedParameters.END_DATE.getValue());
|
||||
final Integer duration = command.integerValueSansLocaleOfParameterNamed(CalendarSupportedParameters.DURATION.getValue());
|
||||
final Integer typeId = command.integerValueSansLocaleOfParameterNamed(CalendarSupportedParameters.TYPE_ID.getValue());
|
||||
final boolean repeating = command.booleanPrimitiveValueOfParameterNamed(CalendarSupportedParameters.REPEATING.getValue());
|
||||
final Integer remindById = command.integerValueSansLocaleOfParameterNamed(CalendarSupportedParameters.REMIND_BY_ID.getValue());
|
||||
final Integer firstReminder = command.integerValueSansLocaleOfParameterNamed(CalendarSupportedParameters.FIRST_REMINDER
|
||||
.getValue());
|
||||
final Integer secondReminder = command.integerValueSansLocaleOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER
|
||||
final Integer secondReminder = command.integerValueSansLocaleOfParameterNamed(CalendarSupportedParameters.SECOND_REMINDER
|
||||
.getValue());
|
||||
final LocalDateTime time= command.localTimeValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue());
|
||||
final LocalDateTime time= command.localTimeValueOfParameterNamed(CalendarSupportedParameters.MEETING_TIME.getValue());
|
||||
if(time!=null){
|
||||
meetingtime=time.toDate();
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
getStartDateLocalDate());
|
||||
} else {
|
||||
|
||||
actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(), newMeetingStartDate.toString());
|
||||
actualChanges.put(CalendarSupportedParameters.START_DATE.getValue(), newMeetingStartDate.toString());
|
||||
this.startDate = newMeetingStartDate.toDate();
|
||||
|
||||
/*
|
||||
@@ -251,27 +251,27 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(9);
|
||||
|
||||
if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), this.title)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue());
|
||||
actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), newValue);
|
||||
if (command.isChangeInStringParameterNamed(CalendarSupportedParameters.TITLE.getValue(), this.title)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CalendarSupportedParameters.TITLE.getValue());
|
||||
actualChanges.put(CalendarSupportedParameters.TITLE.getValue(), newValue);
|
||||
this.title = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(), this.description)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue());
|
||||
actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(), newValue);
|
||||
if (command.isChangeInStringParameterNamed(CalendarSupportedParameters.DESCRIPTION.getValue(), this.description)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CalendarSupportedParameters.DESCRIPTION.getValue());
|
||||
actualChanges.put(CalendarSupportedParameters.DESCRIPTION.getValue(), newValue);
|
||||
this.description = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), this.location)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue());
|
||||
actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), newValue);
|
||||
if (command.isChangeInStringParameterNamed(CalendarSupportedParameters.LOCATION.getValue(), this.location)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CalendarSupportedParameters.LOCATION.getValue());
|
||||
actualChanges.put(CalendarSupportedParameters.LOCATION.getValue(), newValue);
|
||||
this.location = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
final String dateFormatAsInput = command.dateFormat();
|
||||
final String localeAsInput = command.locale();
|
||||
final String startDateParamName = CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue();
|
||||
final String startDateParamName = CalendarSupportedParameters.START_DATE.getValue();
|
||||
if (command.isChangeInLocalDateParameterNamed(startDateParamName, getStartDateLocalDate())) {
|
||||
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(startDateParamName);
|
||||
@@ -295,7 +295,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
}
|
||||
}
|
||||
|
||||
final String endDateParamName = CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue();
|
||||
final String endDateParamName = CalendarSupportedParameters.END_DATE.getValue();
|
||||
if (command.isChangeInLocalDateParameterNamed(endDateParamName, getEndDateLocalDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(endDateParamName);
|
||||
actualChanges.put(endDateParamName, valueAsInput);
|
||||
@@ -306,7 +306,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
this.endDate = newValue.toDate();
|
||||
}
|
||||
|
||||
final String durationParamName = CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue();
|
||||
final String durationParamName = CalendarSupportedParameters.DURATION.getValue();
|
||||
if (command.isChangeInIntegerSansLocaleParameterNamed(durationParamName, this.duration)) {
|
||||
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(durationParamName);
|
||||
actualChanges.put(durationParamName, newValue);
|
||||
@@ -316,7 +316,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
// Do not allow to change calendar type
|
||||
// TODO: AA Instead of throwing an exception, do not allow meeting
|
||||
// calendar type to update.
|
||||
final String typeParamName = CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue();
|
||||
final String typeParamName = CalendarSupportedParameters.TYPE_ID.getValue();
|
||||
if (command.isChangeInIntegerSansLocaleParameterNamed(typeParamName, this.typeId)) {
|
||||
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(typeParamName);
|
||||
final String defaultUserMessage = "Meeting calendar type update is not supported";
|
||||
@@ -332,7 +332,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
*/
|
||||
}
|
||||
|
||||
final String repeatingParamName = CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue();
|
||||
final String repeatingParamName = CalendarSupportedParameters.REPEATING.getValue();
|
||||
if (command.isChangeInBooleanParameterNamed(repeatingParamName, this.repeating)) {
|
||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(repeatingParamName);
|
||||
actualChanges.put(repeatingParamName, newValue);
|
||||
@@ -347,7 +347,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
|
||||
final CalendarType calendarType = CalendarType.fromInt(this.typeId);
|
||||
if (calendarType.isCollection() && !this.repeating) {
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue())
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATING.getValue())
|
||||
.failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar");
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||
}
|
||||
@@ -378,32 +378,32 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
this.recurrence = StringUtils.defaultIfEmpty(newRecurrence, null);
|
||||
}
|
||||
|
||||
final String remindByParamName = CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue();
|
||||
final String remindByParamName = CalendarSupportedParameters.REMIND_BY_ID.getValue();
|
||||
if (command.isChangeInIntegerSansLocaleParameterNamed(remindByParamName, this.remindById)) {
|
||||
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(remindByParamName);
|
||||
actualChanges.put(remindByParamName, newValue);
|
||||
this.remindById = newValue;
|
||||
}
|
||||
|
||||
final String firstRemindarParamName = CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue();
|
||||
final String firstRemindarParamName = CalendarSupportedParameters.FIRST_REMINDER.getValue();
|
||||
if (command.isChangeInIntegerSansLocaleParameterNamed(firstRemindarParamName, this.firstReminder)) {
|
||||
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(firstRemindarParamName);
|
||||
actualChanges.put(firstRemindarParamName, newValue);
|
||||
this.firstReminder = newValue;
|
||||
}
|
||||
|
||||
final String secondRemindarParamName = CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue();
|
||||
final String secondRemindarParamName = CalendarSupportedParameters.SECOND_REMINDER.getValue();
|
||||
if (command.isChangeInIntegerSansLocaleParameterNamed(secondRemindarParamName, this.secondReminder)) {
|
||||
final Integer newValue = command.integerValueSansLocaleOfParameterNamed(secondRemindarParamName);
|
||||
actualChanges.put(secondRemindarParamName, newValue);
|
||||
this.secondReminder = newValue;
|
||||
}
|
||||
|
||||
final String timeFormat = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.Time_Format.getValue());
|
||||
final String time = CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue();
|
||||
if (command.isChangeInTimeParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue(), this.meetingtime,timeFormat)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue());
|
||||
actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue(), newValue);
|
||||
final String timeFormat = command.stringValueOfParameterNamed(CalendarSupportedParameters.Time_Format.getValue());
|
||||
final String time = CalendarSupportedParameters.MEETING_TIME.getValue();
|
||||
if (command.isChangeInTimeParameterNamed(CalendarSupportedParameters.MEETING_TIME.getValue(), this.meetingtime,timeFormat)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(CalendarSupportedParameters.MEETING_TIME.getValue());
|
||||
actualChanges.put(CalendarSupportedParameters.MEETING_TIME.getValue(), newValue);
|
||||
LocalDateTime timeInLocalDateTimeFormat=command.localTimeValueOfParameterNamed(time);
|
||||
if(timeInLocalDateTimeFormat!=null){
|
||||
this.meetingtime= timeInLocalDateTimeFormat.toDate();
|
||||
@@ -546,8 +546,8 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
|
||||
private static String constructRecurrence(final JsonCommand command, final Calendar calendar) {
|
||||
final boolean repeating;
|
||||
if (command.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue())) {
|
||||
repeating = command.booleanPrimitiveValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue());
|
||||
if (command.parameterExists(CalendarSupportedParameters.REPEATING.getValue())) {
|
||||
repeating = command.booleanPrimitiveValueOfParameterNamed(CalendarSupportedParameters.REPEATING.getValue());
|
||||
} else if (calendar != null) {
|
||||
repeating = calendar.isRepeating();
|
||||
} else {
|
||||
@@ -555,22 +555,22 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
if (repeating) {
|
||||
final Integer frequency = command.integerValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.FREQUENCY.getValue());
|
||||
final Integer frequency = command.integerValueOfParameterNamed(CalendarSupportedParameters.FREQUENCY.getValue());
|
||||
final CalendarFrequencyType frequencyType = CalendarFrequencyType.fromInt(frequency);
|
||||
final Integer interval = command.integerValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue());
|
||||
final Integer interval = command.integerValueOfParameterNamed(CalendarSupportedParameters.INTERVAL.getValue());
|
||||
Integer repeatsOnDay = null;
|
||||
if (frequencyType.isWeekly()) {
|
||||
repeatsOnDay = command.integerValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue());
|
||||
repeatsOnDay = command.integerValueOfParameterNamed(CalendarSupportedParameters.REPEATS_ON_DAY.getValue());
|
||||
}
|
||||
Integer repeatsOnNthDayOfMonth = null;
|
||||
if (frequencyType.isMonthly()) {
|
||||
repeatsOnNthDayOfMonth = command.integerValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_NTH_DAY_OF_MONTH
|
||||
repeatsOnNthDayOfMonth = command.integerValueOfParameterNamed(CalendarSupportedParameters.REPEATS_ON_NTH_DAY_OF_MONTH
|
||||
.getValue());
|
||||
final NthDayType nthDay = NthDayType.fromInt(repeatsOnNthDayOfMonth);
|
||||
repeatsOnDay = command.integerValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_LAST_WEEKDAY_OF_MONTH
|
||||
repeatsOnDay = command.integerValueOfParameterNamed(CalendarSupportedParameters.REPEATS_ON_LAST_WEEKDAY_OF_MONTH
|
||||
.getValue());
|
||||
if (nthDay.isOnDay()) {
|
||||
repeatsOnNthDayOfMonth = command.integerValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY_OF_MONTH
|
||||
repeatsOnNthDayOfMonth = command.integerValueOfParameterNamed(CalendarSupportedParameters.REPEATS_ON_DAY_OF_MONTH
|
||||
.getValue());
|
||||
repeatsOnDay = null;
|
||||
}
|
||||
|
||||
+117
-117
@@ -32,7 +32,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CALENDAR_SUPPORTED_PARAMETERS;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CalendarSupportedParameters;
|
||||
import org.apache.fineract.portfolio.calendar.command.CalendarCommand;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarEntityType;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
|
||||
@@ -50,7 +50,7 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD
|
||||
/**
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = CALENDAR_SUPPORTED_PARAMETERS.getAllValues();
|
||||
private final Set<String> supportedParameters = CalendarSupportedParameters.getAllValues();
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@@ -67,25 +67,25 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
|
||||
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
final String title = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), element);
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(), element);
|
||||
final String location = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), element);
|
||||
final LocalDate startDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(),
|
||||
final String title = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.TITLE.getValue(), element);
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.DESCRIPTION.getValue(), element);
|
||||
final String location = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.LOCATION.getValue(), element);
|
||||
final LocalDate startDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.START_DATE.getValue(),
|
||||
element);
|
||||
final LocalDate endDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue(), element);
|
||||
final LocalDate createdDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.CREATED_DATE.getValue(),
|
||||
final LocalDate endDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.END_DATE.getValue(), element);
|
||||
final LocalDate createdDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.CREATED_DATE.getValue(),
|
||||
element);
|
||||
final Integer duration = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue(),
|
||||
final Integer duration = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CalendarSupportedParameters.DURATION.getValue(),
|
||||
element);
|
||||
final Integer typeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue(),
|
||||
final Integer typeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CalendarSupportedParameters.TYPE_ID.getValue(),
|
||||
element);
|
||||
final boolean repeating = this.fromApiJsonHelper.extractBooleanNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue(), element);
|
||||
final boolean repeating = this.fromApiJsonHelper.extractBooleanNamed(CalendarSupportedParameters.REPEATING.getValue(), element);
|
||||
final Integer remindById = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue(), element);
|
||||
CalendarSupportedParameters.REMIND_BY_ID.getValue(), element);
|
||||
final Integer firstReminder = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue(), element);
|
||||
CalendarSupportedParameters.FIRST_REMINDER.getValue(), element);
|
||||
final Integer secondReminder = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue(), element);
|
||||
CalendarSupportedParameters.SECOND_REMINDER.getValue(), element);
|
||||
|
||||
return new CalendarCommand(title, description, location, startDate, endDate, createdDate, duration, typeId, repeating, remindById,
|
||||
firstReminder, secondReminder);
|
||||
@@ -103,107 +103,107 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("calendar");
|
||||
|
||||
final String title = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue()).value(title).notBlank()
|
||||
final String title = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.TITLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.TITLE.getValue()).value(title).notBlank()
|
||||
.notExceedingLengthOf(50);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.DESCRIPTION.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue()).value(description).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.DESCRIPTION.getValue()).value(description).ignoreIfNull()
|
||||
.notExceedingLengthOf(100);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), element)) {
|
||||
final String location = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue()).value(location).ignoreIfNull()
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.LOCATION.getValue(), element)) {
|
||||
final String location = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.LOCATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.LOCATION.getValue()).value(location).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
}
|
||||
|
||||
final String startDateStr = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue()).value(startDateStr).notBlank();
|
||||
final String startDateStr = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.START_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(startDateStr).notBlank();
|
||||
|
||||
if (!StringUtils.isBlank(startDateStr)) {
|
||||
final LocalDate startDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(),
|
||||
final LocalDate startDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.START_DATE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue()).value(startDate).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(startDate).notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue(), element)) {
|
||||
final String endDateStr = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue()).value(endDateStr).notBlank();
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.END_DATE.getValue(), element)) {
|
||||
final String endDateStr = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.END_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.END_DATE.getValue()).value(endDateStr).notBlank();
|
||||
|
||||
final LocalDate endDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue(),
|
||||
final LocalDate endDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.END_DATE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue()).value(endDate).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.END_DATE.getValue()).value(endDate).notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.DURATION.getValue(), element)) {
|
||||
final Integer duration = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue()).value(duration).ignoreIfNull();
|
||||
CalendarSupportedParameters.DURATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.DURATION.getValue()).value(duration).ignoreIfNull();
|
||||
}
|
||||
|
||||
final Integer typeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue(),
|
||||
final Integer typeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CalendarSupportedParameters.TYPE_ID.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue()).value(typeId).notNull()
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.TYPE_ID.getValue()).value(typeId).notNull()
|
||||
.inMinMaxRange(CalendarEntityType.getMinValue(), CalendarEntityType.getMaxValue());
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.REPEATING.getValue(), element)) {
|
||||
// FIXME - Throws NullPointerException when boolean value is null
|
||||
final boolean repeating = this.fromApiJsonHelper.extractBooleanNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue(),
|
||||
final boolean repeating = this.fromApiJsonHelper.extractBooleanNamed(CalendarSupportedParameters.REPEATING.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue()).value(repeating).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATING.getValue()).value(repeating).notNull();
|
||||
|
||||
if (repeating) {
|
||||
final Integer frequency = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.FREQUENCY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.FREQUENCY.getValue()).value(frequency).notBlank()
|
||||
CalendarSupportedParameters.FREQUENCY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.FREQUENCY.getValue()).value(frequency).notBlank()
|
||||
.inMinMaxRange(CalendarFrequencyType.getMinValue(), CalendarFrequencyType.getMaxValue());
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.INTERVAL.getValue(), element)) {
|
||||
final Integer interval = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue()).value(interval).notNull()
|
||||
CalendarSupportedParameters.INTERVAL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.INTERVAL.getValue()).value(interval).notNull()
|
||||
.integerGreaterThanZero();
|
||||
}
|
||||
if (CalendarFrequencyType.fromInt(frequency).isWeekly()) {
|
||||
final Integer repeatsOnDay = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue()).value(repeatsOnDay)
|
||||
CalendarSupportedParameters.REPEATS_ON_DAY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATS_ON_DAY.getValue()).value(repeatsOnDay)
|
||||
.notBlank().inMinMaxRange(CalendarWeekDaysType.getMinValue(), CalendarWeekDaysType.getMaxValue());
|
||||
} else if (CalendarFrequencyType.fromInt(frequency).isMonthly()) {
|
||||
CalendarUtils.validateNthDayOfMonthFrequency(baseDataValidator,
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_NTH_DAY_OF_MONTH.getValue(),
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_LAST_WEEKDAY_OF_MONTH.getValue(), element, this.fromApiJsonHelper);
|
||||
CalendarSupportedParameters.REPEATS_ON_NTH_DAY_OF_MONTH.getValue(),
|
||||
CalendarSupportedParameters.REPEATS_ON_LAST_WEEKDAY_OF_MONTH.getValue(), element, this.fromApiJsonHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.REMIND_BY_ID.getValue(), element)) {
|
||||
final Integer remindById = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue()).value(remindById).ignoreIfNull()
|
||||
CalendarSupportedParameters.REMIND_BY_ID.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REMIND_BY_ID.getValue()).value(remindById).ignoreIfNull()
|
||||
.inMinMaxRange(CalendarRemindBy.getMinValue(), CalendarRemindBy.getMaxValue());
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.FIRST_REMINDER.getValue(), element)) {
|
||||
final Integer firstReminder = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue()).value(firstReminder)
|
||||
CalendarSupportedParameters.FIRST_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.FIRST_REMINDER.getValue()).value(firstReminder)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.SECOND_REMINDER.getValue(), element)) {
|
||||
final Integer secondReminder = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue()).value(secondReminder)
|
||||
CalendarSupportedParameters.SECOND_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.SECOND_REMINDER.getValue()).value(secondReminder)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue(), element)) {
|
||||
final LocalDateTime meetingTime = this.fromApiJsonHelper.extractLocalTimeNamed(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.MEETING_TIME.getValue(), element)) {
|
||||
final LocalDateTime meetingTime = this.fromApiJsonHelper.extractLocalTimeNamed(CalendarSupportedParameters.MEETING_TIME.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue()).value(meetingTime).ignoreIfNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.MEETING_TIME.getValue()).value(meetingTime).ignoreIfNull();
|
||||
}
|
||||
|
||||
|
||||
@@ -223,130 +223,130 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("calendar");
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.RESCHEDULE_BASED_ON_MEETING_DATES.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.RESCHEDULE_BASED_ON_MEETING_DATES.getValue(), element)) {
|
||||
final Boolean rescheduleBasedOnMeetingDates = this.fromApiJsonHelper.extractBooleanNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.RESCHEDULE_BASED_ON_MEETING_DATES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.RESCHEDULE_BASED_ON_MEETING_DATES.getValue())
|
||||
CalendarSupportedParameters.RESCHEDULE_BASED_ON_MEETING_DATES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.RESCHEDULE_BASED_ON_MEETING_DATES.getValue())
|
||||
.value(rescheduleBasedOnMeetingDates).validateForBooleanValue();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.PRESENT_MEETING_DATE.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.PRESENT_MEETING_DATE.getValue(), element)) {
|
||||
final String presentMeetingDate = this.fromApiJsonHelper.extractStringNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.PRESENT_MEETING_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.PRESENT_MEETING_DATE.getValue()).value(presentMeetingDate)
|
||||
CalendarSupportedParameters.PRESENT_MEETING_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.PRESENT_MEETING_DATE.getValue()).value(presentMeetingDate)
|
||||
.notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.NEW_MEETING_DATE.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.NEW_MEETING_DATE.getValue(), element)) {
|
||||
final String newMeetingDate = this.fromApiJsonHelper.extractStringNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.NEW_MEETING_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.NEW_MEETING_DATE.getValue()).value(newMeetingDate).notNull();
|
||||
CalendarSupportedParameters.NEW_MEETING_DATE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.NEW_MEETING_DATE.getValue()).value(newMeetingDate).notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), element)) {
|
||||
final String title = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue()).value(title).notBlank()
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.TITLE.getValue(), element)) {
|
||||
final String title = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.TITLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.TITLE.getValue()).value(title).notBlank()
|
||||
.notExceedingLengthOf(50);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.DESCRIPTION.getValue(), element)) {
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.DESCRIPTION.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue()).value(description).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.DESCRIPTION.getValue()).value(description).ignoreIfNull()
|
||||
.notExceedingLengthOf(100);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), element)) {
|
||||
final String location = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue()).value(location).ignoreIfNull()
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.LOCATION.getValue(), element)) {
|
||||
final String location = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.LOCATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.LOCATION.getValue()).value(location).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(), element)) {
|
||||
final String startDateStr = this.fromApiJsonHelper.extractStringNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.START_DATE.getValue(), element)) {
|
||||
final String startDateStr = this.fromApiJsonHelper.extractStringNamed(CalendarSupportedParameters.START_DATE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue()).value(startDateStr).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(startDateStr).notNull();
|
||||
|
||||
final LocalDate startDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue(),
|
||||
final LocalDate startDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.START_DATE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue()).value(startDate).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(startDate).notNull();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue(), element)) {
|
||||
final LocalDate endDate = this.fromApiJsonHelper.extractLocalDateNamed(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.END_DATE.getValue(), element)) {
|
||||
final LocalDate endDate = this.fromApiJsonHelper.extractLocalDateNamed(CalendarSupportedParameters.END_DATE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue()).value(endDate).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.END_DATE.getValue()).value(endDate).notNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.DURATION.getValue(), element)) {
|
||||
final Integer duration = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue()).value(duration).ignoreIfNull();
|
||||
CalendarSupportedParameters.DURATION.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.DURATION.getValue()).value(duration).ignoreIfNull();
|
||||
}
|
||||
// TODO: AA do not allow to change calendar type.
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue(), element)) {
|
||||
final Integer typeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.TYPE_ID.getValue(), element)) {
|
||||
final Integer typeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(CalendarSupportedParameters.TYPE_ID.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue()).value(typeId).notNull()
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.TYPE_ID.getValue()).value(typeId).notNull()
|
||||
.inMinMaxRange(CalendarEntityType.getMinValue(), CalendarEntityType.getMaxValue());
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.REPEATING.getValue(), element)) {
|
||||
// FIXME - Throws NullPointerException when boolean value is null
|
||||
final boolean repeating = this.fromApiJsonHelper.extractBooleanNamed(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue(),
|
||||
final boolean repeating = this.fromApiJsonHelper.extractBooleanNamed(CalendarSupportedParameters.REPEATING.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue()).value(repeating).notNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATING.getValue()).value(repeating).notNull();
|
||||
|
||||
if (repeating) {
|
||||
final Integer frequency = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.FREQUENCY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.FREQUENCY.getValue()).value(frequency).notBlank()
|
||||
CalendarSupportedParameters.FREQUENCY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.FREQUENCY.getValue()).value(frequency).notBlank()
|
||||
.inMinMaxRange(CalendarFrequencyType.getMinValue(), CalendarFrequencyType.getMaxValue());
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.INTERVAL.getValue(), element)) {
|
||||
final Integer interval = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue()).value(interval).notNull()
|
||||
CalendarSupportedParameters.INTERVAL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.INTERVAL.getValue()).value(interval).notNull()
|
||||
.integerGreaterThanZero();
|
||||
}
|
||||
|
||||
if (CalendarFrequencyType.fromInt(frequency).isWeekly()) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.REPEATS_ON_DAY.getValue(), element)) {
|
||||
final Integer repeatsOnDay = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue()).value(repeatsOnDay)
|
||||
CalendarSupportedParameters.REPEATS_ON_DAY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATS_ON_DAY.getValue()).value(repeatsOnDay)
|
||||
.notBlank().inMinMaxRange(CalendarWeekDaysType.getMinValue(), CalendarWeekDaysType.getMaxValue());
|
||||
}
|
||||
} else if (CalendarFrequencyType.fromInt(frequency).isMonthly()) {
|
||||
CalendarUtils.validateNthDayOfMonthFrequency(baseDataValidator,
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_NTH_DAY_OF_MONTH.getValue(),
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_LAST_WEEKDAY_OF_MONTH.getValue(), element, this.fromApiJsonHelper);
|
||||
CalendarSupportedParameters.REPEATS_ON_NTH_DAY_OF_MONTH.getValue(),
|
||||
CalendarSupportedParameters.REPEATS_ON_LAST_WEEKDAY_OF_MONTH.getValue(), element, this.fromApiJsonHelper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.REMIND_BY_ID.getValue(), element)) {
|
||||
final Integer remindById = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue()).value(remindById).ignoreIfNull()
|
||||
CalendarSupportedParameters.REMIND_BY_ID.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.REMIND_BY_ID.getValue()).value(remindById).ignoreIfNull()
|
||||
.inMinMaxRange(CalendarRemindBy.getMinValue(), CalendarRemindBy.getMaxValue());
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.FIRST_REMINDER.getValue(), element)) {
|
||||
final Integer firstReminder = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue()).value(firstReminder)
|
||||
CalendarSupportedParameters.FIRST_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.FIRST_REMINDER.getValue()).value(firstReminder)
|
||||
.ignoreIfNull();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.SECOND_REMINDER.getValue(), element)) {
|
||||
final Integer secondReminder = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue()).value(secondReminder)
|
||||
CalendarSupportedParameters.SECOND_REMINDER.getValue(), element);
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.SECOND_REMINDER.getValue()).value(secondReminder)
|
||||
.ignoreIfNull();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue(), element)) {
|
||||
final LocalDateTime startDate = this.fromApiJsonHelper.extractLocalTimeNamed(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(CalendarSupportedParameters.MEETING_TIME.getValue(), element)) {
|
||||
final LocalDateTime startDate = this.fromApiJsonHelper.extractLocalTimeNamed(CalendarSupportedParameters.MEETING_TIME.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.MEETING_TIME.getValue()).value(startDate).ignoreIfNull();
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.MEETING_TIME.getValue()).value(startDate).ignoreIfNull();
|
||||
}
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
||||
|
||||
+6
-6
@@ -32,7 +32,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CALENDAR_SUPPORTED_PARAMETERS;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CalendarSupportedParameters;
|
||||
import org.apache.fineract.portfolio.calendar.domain.Calendar;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarEntityType;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarHistory;
|
||||
@@ -125,7 +125,7 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
||||
if (entityActivationDate != null) dateAsString = formatter.print(entityActivationDate);
|
||||
|
||||
final String errorMessage = "cannot.be.before." + entityType.name().toLowerCase() + ".activation.date";
|
||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue()).value(dateAsString)
|
||||
baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(dateAsString)
|
||||
.failWithCodeNoParameterAddedToErrorCode(errorMessage);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
||||
Map<String, Object> changes = null;
|
||||
|
||||
final Boolean reschedulebasedOnMeetingDates = command
|
||||
.booleanObjectValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.RESCHEDULE_BASED_ON_MEETING_DATES.getValue());
|
||||
.booleanObjectValueOfParameterNamed(CalendarSupportedParameters.RESCHEDULE_BASED_ON_MEETING_DATES.getValue());
|
||||
|
||||
/*
|
||||
* System allows to change the meeting date by two means,
|
||||
@@ -269,8 +269,8 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
||||
|
||||
if (reschedulebasedOnMeetingDates != null && reschedulebasedOnMeetingDates) {
|
||||
|
||||
newMeetingDate = command.localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.NEW_MEETING_DATE.getValue());
|
||||
presentMeetingDate = command.localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.PRESENT_MEETING_DATE.getValue());
|
||||
newMeetingDate = command.localDateValueOfParameterNamed(CalendarSupportedParameters.NEW_MEETING_DATE.getValue());
|
||||
presentMeetingDate = command.localDateValueOfParameterNamed(CalendarSupportedParameters.PRESENT_MEETING_DATE.getValue());
|
||||
|
||||
/*
|
||||
* New meeting date proposed will become the new start date for the
|
||||
@@ -287,7 +287,7 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
||||
// update calendar history table only if there is a change in
|
||||
// calendar start date.
|
||||
if (reschedulebasedOnMeetingDates == null){
|
||||
presentMeetingDate = command.localDateValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue());
|
||||
presentMeetingDate = command.localDateValueOfParameterNamed(CalendarSupportedParameters.START_DATE.getValue());
|
||||
}
|
||||
if (null != newMeetingDate) {
|
||||
final Date endDate = presentMeetingDate.minusDays(1).toDate();
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class LoanChargeCannotBeDeletedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_CHARGE_CANNOT_BE_DELETED_REASON {
|
||||
public static enum LoanChargeCannotBeDeletedReason {
|
||||
ALREADY_PAID, ALREADY_WAIVED, LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -45,7 +45,7 @@ public class LoanChargeCannotBeDeletedException extends AbstractPlatformDomainRu
|
||||
}
|
||||
}
|
||||
|
||||
public LoanChargeCannotBeDeletedException(final LOAN_CHARGE_CANNOT_BE_DELETED_REASON reason, final Long loanChargeId) {
|
||||
public LoanChargeCannotBeDeletedException(final LoanChargeCannotBeDeletedReason reason, final Long loanChargeId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanChargeId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class LoanChargeCannotBePayedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_CHARGE_CANNOT_BE_PAYED_REASON {
|
||||
public static enum LoanChargeCannotBePayedReason {
|
||||
ALREADY_PAID, ALREADY_WAIVED, LOAN_INACTIVE, CHARGE_NOT_ACCOUNT_TRANSFER, CHARGE_NOT_PAYABLE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -54,7 +54,7 @@ public class LoanChargeCannotBePayedException extends AbstractPlatformDomainRule
|
||||
}
|
||||
}
|
||||
|
||||
public LoanChargeCannotBePayedException(final LOAN_CHARGE_CANNOT_BE_PAYED_REASON reason, final Long loanChargeId) {
|
||||
public LoanChargeCannotBePayedException(final LoanChargeCannotBePayedReason reason, final Long loanChargeId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanChargeId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class LoanChargeCannotBeUpdatedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_CHARGE_CANNOT_BE_UPDATED_REASON {
|
||||
public static enum LoanChargeCannotBeUpdatedReason {
|
||||
ALREADY_PAID, ALREADY_WAIVED, LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -45,7 +45,7 @@ public class LoanChargeCannotBeUpdatedException extends AbstractPlatformDomainRu
|
||||
}
|
||||
}
|
||||
|
||||
public LoanChargeCannotBeUpdatedException(final LOAN_CHARGE_CANNOT_BE_UPDATED_REASON reason, final Long loanChargeId) {
|
||||
public LoanChargeCannotBeUpdatedException(final LoanChargeCannotBeUpdatedReason reason, final Long loanChargeId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanChargeId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class LoanChargeCannotBeWaivedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_CHARGE_CANNOT_BE_WAIVED_REASON {
|
||||
public static enum LoanChargeCannotBeWaivedReason {
|
||||
ALREADY_PAID, ALREADY_WAIVED, LOAN_INACTIVE, WAIVE_NOT_ALLOWED_FOR_CHARGE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -50,7 +50,7 @@ public class LoanChargeCannotBeWaivedException extends AbstractPlatformDomainRul
|
||||
}
|
||||
}
|
||||
|
||||
public LoanChargeCannotBeWaivedException(final LOAN_CHARGE_CANNOT_BE_WAIVED_REASON reason, final Long loanChargeId) {
|
||||
public LoanChargeCannotBeWaivedException(final LoanChargeCannotBeWaivedReason reason, final Long loanChargeId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanChargeId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class SavingsAccountChargeCannotBeWaivedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Savings Account Charge cannot be waived **/
|
||||
public static enum SAVINGS_ACCOUNT_CHARGE_CANNOT_BE_WAIVED_REASON {
|
||||
public static enum SavingsAccountChargeCannotBeWaivedReason {
|
||||
ALREADY_PAID, ALREADY_WAIVED, SAVINGS_ACCOUNT_NOT_ACTIVE, SAVINGS_ACCOUNT_CLOSED;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -49,7 +49,7 @@ public class SavingsAccountChargeCannotBeWaivedException extends AbstractPlatfor
|
||||
}
|
||||
}
|
||||
|
||||
public SavingsAccountChargeCannotBeWaivedException(final SAVINGS_ACCOUNT_CHARGE_CANNOT_BE_WAIVED_REASON reason,
|
||||
public SavingsAccountChargeCannotBeWaivedException(final SavingsAccountChargeCannotBeWaivedReason reason,
|
||||
final Long savingsAccountChargeId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), savingsAccountChargeId);
|
||||
}
|
||||
|
||||
+12
-12
@@ -65,8 +65,8 @@ import org.apache.fineract.portfolio.client.exception.ClientHasNoStaffException;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientMustBePendingToBeDeletedException;
|
||||
import org.apache.fineract.portfolio.client.exception.InvalidClientSavingProductException;
|
||||
import org.apache.fineract.portfolio.client.exception.InvalidClientStateTransitionException;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
import org.apache.fineract.portfolio.group.domain.GroupRepository;
|
||||
@@ -301,8 +301,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
|
||||
this.clientRepository.save(newClient);
|
||||
if (newClient.isActive()) {
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.CLIENTS_ACTIVATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.CLIENT, newClient));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.CLIENTS_ACTIVATE,
|
||||
constructEntityMap(BusinessEntity.CLIENT, newClient));
|
||||
}
|
||||
if (newClient.isAccountNumberRequiresAutoGeneration()) {
|
||||
AccountNumberFormat accountNumberFormat = this.accountNumberFormatRepository.findByAccountType(EntityAccountType.CLIENT);
|
||||
@@ -338,8 +338,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
command.arrayOfParameterNamed(ClientApiConstants.datatables));
|
||||
}
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.CLIENTS_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.CLIENT, newClient));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.CLIENTS_CREATE,
|
||||
constructEntityMap(BusinessEntity.CLIENT, newClient));
|
||||
|
||||
this.entityDatatableChecksWritePlatformService.runTheCheck(newClient.getId(), EntityTables.CLIENT.getName(),
|
||||
StatusEnum.CREATE.getCode().longValue(), EntityTables.CLIENT.getForeignKeyColumnNameOnDatatable());
|
||||
@@ -583,8 +583,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
client.activate(currentUser, fmt, activationDate);
|
||||
CommandProcessingResult result = openSavingsAccount(client, fmt);
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.CLIENTS_ACTIVATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.CLIENT, client));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.CLIENTS_ACTIVATE,
|
||||
constructEntityMap(BusinessEntity.CLIENT, client));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withOfficeId(client.officeId()) //
|
||||
@@ -837,8 +837,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
}
|
||||
client.reject(currentUser, rejectionReason, rejectionDate.toDate());
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.CLIENTS_REJECT,
|
||||
constructEntityMap(BUSINESS_ENTITY.CLIENT, client));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.CLIENTS_REJECT,
|
||||
constructEntityMap(BusinessEntity.CLIENT, client));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withClientId(entityId) //
|
||||
@@ -956,8 +956,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
.build();
|
||||
}
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+3
-3
@@ -28,18 +28,18 @@ public class CollateralApiConstants {
|
||||
/***
|
||||
* Enum of all parameters passed in while creating/updating a collateral
|
||||
***/
|
||||
public static enum COLLATERAL_JSON_INPUT_PARAMS {
|
||||
public static enum CollateralJSONinputParams {
|
||||
LOAN_ID("loanId"), COLLATERAL_ID("collateralId"), COLLATERAL_TYPE_ID("collateralTypeId"), VALUE("value"), DESCRIPTION("description");
|
||||
|
||||
private final String value;
|
||||
|
||||
private COLLATERAL_JSON_INPUT_PARAMS(final String value) {
|
||||
private CollateralJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final COLLATERAL_JSON_INPUT_PARAMS type : COLLATERAL_JSON_INPUT_PARAMS.values()) {
|
||||
for (final CollateralJSONinputParams type : CollateralJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.COLLATERAL_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.CollateralJSONinputParams;
|
||||
|
||||
/**
|
||||
* Immutable command for creating or updating details of a Collateral.
|
||||
@@ -58,11 +58,11 @@ public class CollateralCommand {
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("collateral");
|
||||
|
||||
baseDataValidator.reset().parameter(COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue()).value(this.collateralTypeId)
|
||||
baseDataValidator.reset().parameter(CollateralJSONinputParams.COLLATERAL_TYPE_ID.getValue()).value(this.collateralTypeId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(COLLATERAL_JSON_INPUT_PARAMS.VALUE.getValue()).value(this.value).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(CollateralJSONinputParams.VALUE.getValue()).value(this.value).ignoreIfNull()
|
||||
.positiveAmount();
|
||||
baseDataValidator.reset().parameter(COLLATERAL_JSON_INPUT_PARAMS.DESCRIPTION.getValue()).value(this.description).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(CollateralJSONinputParams.DESCRIPTION.getValue()).value(this.description).ignoreIfNull()
|
||||
.notExceedingLengthOf(500);
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
||||
@@ -74,11 +74,11 @@ public class CollateralCommand {
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("collateral");
|
||||
|
||||
baseDataValidator.reset().parameter(COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue()).value(this.collateralTypeId)
|
||||
baseDataValidator.reset().parameter(CollateralJSONinputParams.COLLATERAL_TYPE_ID.getValue()).value(this.collateralTypeId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(COLLATERAL_JSON_INPUT_PARAMS.VALUE.getValue()).value(this.value).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(CollateralJSONinputParams.VALUE.getValue()).value(this.value).ignoreIfNull()
|
||||
.positiveAmount();
|
||||
baseDataValidator.reset().parameter(COLLATERAL_JSON_INPUT_PARAMS.DESCRIPTION.getValue()).value(this.description).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(CollateralJSONinputParams.DESCRIPTION.getValue()).value(this.description).ignoreIfNull()
|
||||
.notExceedingLengthOf(500);
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
||||
|
||||
+6
-6
@@ -31,7 +31,7 @@ import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.COLLATERAL_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.CollateralJSONinputParams;
|
||||
import org.apache.fineract.portfolio.collateral.data.CollateralData;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
|
||||
@@ -79,8 +79,8 @@ public class LoanCollateral extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public static LoanCollateral fromJson(final Loan loan, final CodeValue collateralType, final JsonCommand command) {
|
||||
final String description = command.stringValueOfParameterNamed(COLLATERAL_JSON_INPUT_PARAMS.DESCRIPTION.getValue());
|
||||
final BigDecimal value = command.bigDecimalValueOfParameterNamed(COLLATERAL_JSON_INPUT_PARAMS.VALUE.getValue());
|
||||
final String description = command.stringValueOfParameterNamed(CollateralJSONinputParams.DESCRIPTION.getValue());
|
||||
final BigDecimal value = command.bigDecimalValueOfParameterNamed(CollateralJSONinputParams.VALUE.getValue());
|
||||
return new LoanCollateral(loan, collateralType, value, description);
|
||||
}
|
||||
|
||||
@@ -88,20 +88,20 @@ public class LoanCollateral extends AbstractPersistableCustom {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>(7);
|
||||
|
||||
final String collateralTypeIdParamName = COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue();
|
||||
final String collateralTypeIdParamName = CollateralJSONinputParams.COLLATERAL_TYPE_ID.getValue();
|
||||
if (command.isChangeInLongParameterNamed(collateralTypeIdParamName, this.type.getId())) {
|
||||
final Long newValue = command.longValueOfParameterNamed(collateralTypeIdParamName);
|
||||
actualChanges.put(collateralTypeIdParamName, newValue);
|
||||
}
|
||||
|
||||
final String descriptionParamName = COLLATERAL_JSON_INPUT_PARAMS.DESCRIPTION.getValue();
|
||||
final String descriptionParamName = CollateralJSONinputParams.DESCRIPTION.getValue();
|
||||
if (command.isChangeInStringParameterNamed(descriptionParamName, this.description)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(descriptionParamName);
|
||||
actualChanges.put(descriptionParamName, newValue);
|
||||
this.description = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
final String valueParamName = COLLATERAL_JSON_INPUT_PARAMS.VALUE.getValue();
|
||||
final String valueParamName = CollateralJSONinputParams.VALUE.getValue();
|
||||
if (command.isChangeInBigDecimalParameterNamed(valueParamName, this.value)) {
|
||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(valueParamName);
|
||||
actualChanges.put(valueParamName, newValue);
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class CollateralCannotBeCreatedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_COLLATERAL_CANNOT_BE_CREATED_REASON {
|
||||
public static enum LoanCollateralCannotBeCreatedReason {
|
||||
LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -37,7 +37,7 @@ public class CollateralCannotBeCreatedException extends AbstractPlatformDomainRu
|
||||
}
|
||||
}
|
||||
|
||||
public CollateralCannotBeCreatedException(final LOAN_COLLATERAL_CANNOT_BE_CREATED_REASON reason, final Long loanId) {
|
||||
public CollateralCannotBeCreatedException(final LoanCollateralCannotBeCreatedReason reason, final Long loanId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class CollateralCannotBeDeletedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_COLLATERAL_CANNOT_BE_DELETED_REASON {
|
||||
public static enum LoanCollateralCannotBeDeletedReason {
|
||||
LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -37,7 +37,7 @@ public class CollateralCannotBeDeletedException extends AbstractPlatformDomainRu
|
||||
}
|
||||
}
|
||||
|
||||
public CollateralCannotBeDeletedException(final LOAN_COLLATERAL_CANNOT_BE_DELETED_REASON reason, final Long loanId,
|
||||
public CollateralCannotBeDeletedException(final LoanCollateralCannotBeDeletedReason reason, final Long loanId,
|
||||
final Long loanCollateralId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanId, loanCollateralId);
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
public class CollateralCannotBeUpdatedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
/*** enum of reasons of why Loan Charge cannot be waived **/
|
||||
public static enum LOAN_COLLATERAL_CANNOT_BE_UPDATED_REASON {
|
||||
public static enum LoanCollateralCannotBeUpdatedReason {
|
||||
LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE;
|
||||
|
||||
public String errorMessage() {
|
||||
@@ -37,7 +37,7 @@ public class CollateralCannotBeUpdatedException extends AbstractPlatformDomainRu
|
||||
}
|
||||
}
|
||||
|
||||
public CollateralCannotBeUpdatedException(final LOAN_COLLATERAL_CANNOT_BE_UPDATED_REASON reason, final Long loanCollateralId) {
|
||||
public CollateralCannotBeUpdatedException(final LoanCollateralCannotBeUpdatedReason reason, final Long loanCollateralId) {
|
||||
super(reason.errorCode(), reason.errorMessage(), loanCollateralId);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -31,7 +31,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.COLLATERAL_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.CollateralJSONinputParams;
|
||||
import org.apache.fineract.portfolio.collateral.command.CollateralCommand;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -55,7 +55,7 @@ public final class CollateralCommandFromApiJsonDeserializer extends AbstractFrom
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
final Set<String> supportedParameters = COLLATERAL_JSON_INPUT_PARAMS.getAllValues();
|
||||
final Set<String> supportedParameters = CollateralJSONinputParams.getAllValues();
|
||||
supportedParameters.add("locale");
|
||||
supportedParameters.add("dateFormat");
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);
|
||||
@@ -64,10 +64,10 @@ public final class CollateralCommandFromApiJsonDeserializer extends AbstractFrom
|
||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
|
||||
|
||||
final Long collateralTypeId = this.fromApiJsonHelper.extractLongNamed(COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue(),
|
||||
final Long collateralTypeId = this.fromApiJsonHelper.extractLongNamed(CollateralJSONinputParams.COLLATERAL_TYPE_ID.getValue(),
|
||||
element);
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(COLLATERAL_JSON_INPUT_PARAMS.DESCRIPTION.getValue(), element);
|
||||
final BigDecimal value = this.fromApiJsonHelper.extractBigDecimalNamed(COLLATERAL_JSON_INPUT_PARAMS.VALUE.getValue(), element,
|
||||
final String description = this.fromApiJsonHelper.extractStringNamed(CollateralJSONinputParams.DESCRIPTION.getValue(), element);
|
||||
final BigDecimal value = this.fromApiJsonHelper.extractBigDecimalNamed(CollateralJSONinputParams.VALUE.getValue(), element,
|
||||
locale);
|
||||
|
||||
return new CollateralCommand(collateralTypeId, value, description);
|
||||
|
||||
+8
-8
@@ -27,16 +27,16 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.COLLATERAL_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.collateral.api.CollateralApiConstants.CollateralJSONinputParams;
|
||||
import org.apache.fineract.portfolio.collateral.command.CollateralCommand;
|
||||
import org.apache.fineract.portfolio.collateral.domain.LoanCollateral;
|
||||
import org.apache.fineract.portfolio.collateral.domain.LoanCollateralRepository;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeCreatedException;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeCreatedException.LOAN_COLLATERAL_CANNOT_BE_CREATED_REASON;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeCreatedException.LoanCollateralCannotBeCreatedReason;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeDeletedException;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeDeletedException.LOAN_COLLATERAL_CANNOT_BE_DELETED_REASON;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeDeletedException.LoanCollateralCannotBeDeletedReason;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeUpdatedException;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeUpdatedException.LOAN_COLLATERAL_CANNOT_BE_UPDATED_REASON;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralCannotBeUpdatedException.LoanCollateralCannotBeUpdatedReason;
|
||||
import org.apache.fineract.portfolio.collateral.exception.CollateralNotFoundException;
|
||||
import org.apache.fineract.portfolio.collateral.serialization.CollateralCommandFromApiJsonDeserializer;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
@@ -89,7 +89,7 @@ public class CollateralWritePlatformServiceJpaRepositoryImpl implements Collater
|
||||
* are yet to be approved
|
||||
**/
|
||||
if (!loan.status().isSubmittedAndPendingApproval()) { throw new CollateralCannotBeCreatedException(
|
||||
LOAN_COLLATERAL_CANNOT_BE_CREATED_REASON.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loan.getId()); }
|
||||
LoanCollateralCannotBeCreatedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loan.getId()); }
|
||||
|
||||
this.collateralRepository.save(collateral);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class CollateralWritePlatformServiceJpaRepositoryImpl implements Collater
|
||||
|
||||
final Map<String, Object> changes = collateralForUpdate.update(command);
|
||||
|
||||
if (changes.containsKey(COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue())) {
|
||||
if (changes.containsKey(CollateralJSONinputParams.COLLATERAL_TYPE_ID.getValue())) {
|
||||
|
||||
collateralType = this.codeValueRepository.findOneByCodeNameAndIdWithNotFoundDetection(
|
||||
CollateralApiConstants.COLLATERAL_CODE_NAME, collateralTypeId);
|
||||
@@ -134,7 +134,7 @@ public class CollateralWritePlatformServiceJpaRepositoryImpl implements Collater
|
||||
* them are yet to be approved
|
||||
**/
|
||||
if (!loan.status().isSubmittedAndPendingApproval()) { throw new CollateralCannotBeUpdatedException(
|
||||
LOAN_COLLATERAL_CANNOT_BE_UPDATED_REASON.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loan.getId()); }
|
||||
LoanCollateralCannotBeUpdatedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loan.getId()); }
|
||||
|
||||
if (!changes.isEmpty()) {
|
||||
this.collateralRepository.saveAndFlush(collateralForUpdate);
|
||||
@@ -164,7 +164,7 @@ public class CollateralWritePlatformServiceJpaRepositoryImpl implements Collater
|
||||
* are yet to be approved
|
||||
**/
|
||||
if (!loan.status().isSubmittedAndPendingApproval()) { throw new CollateralCannotBeDeletedException(
|
||||
LOAN_COLLATERAL_CANNOT_BE_DELETED_REASON.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanId, collateralId); }
|
||||
LoanCollateralCannotBeDeletedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanId, collateralId); }
|
||||
|
||||
this.collateralRepository.delete(collateral);
|
||||
return new CommandProcessingResultBuilder().withCommandId(commandId).withLoanId(loanId).withEntityId(collateralId).build();
|
||||
|
||||
+5
-5
@@ -23,7 +23,7 @@ import java.util.Set;
|
||||
|
||||
public class BusinessEventNotificationConstants {
|
||||
|
||||
public static enum BUSINESS_EVENTS {
|
||||
public static enum BusinessEvents {
|
||||
LOAN_APPROVED("loan_approved"), LOAN_REJECTED("loan_reject"), LOAN_UNDO_APPROVAL("loan_undo_approval"), LOAN_UNDO_DISBURSAL(
|
||||
"loan_undo_disbursal"), LOAN_UNDO_LASTDISBURSAL("loan_undo_lastdisbursal"), LOAN_UNDO_TRANSACTION("loan_undo_transaction"), LOAN_ADJUST_TRANSACTION(
|
||||
"loan_adjust_transaction"), LOAN_MAKE_REPAYMENT("loan_repayment_transaction"), LOAN_WRITTEN_OFF("loan_writtenoff"), LOAN_UNDO_WRITTEN_OFF(
|
||||
@@ -42,13 +42,13 @@ public class BusinessEventNotificationConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
private BUSINESS_EVENTS(final String value) {
|
||||
private BusinessEvents(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final BUSINESS_EVENTS type : BUSINESS_EVENTS.values()) {
|
||||
for (final BusinessEvents type : BusinessEvents.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
@@ -62,14 +62,14 @@ public class BusinessEventNotificationConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum BUSINESS_ENTITY {
|
||||
public static enum BusinessEntity {
|
||||
LOAN("loan"), LOAN_TRANSACTION("loan_transaction"), LOAN_CHARGE("loan_charge"), LOAN_ADJUSTED_TRANSACTION(
|
||||
"loan_adjusted_transaction"), SAVING("saving"), CLIENT("client"), SAVINGS_TRANSACTION("Savings Transaction"), GROUP("group"),
|
||||
SHARE_ACCOUNT("share_account"), SHARE_PRODUCT("share_product"), DEPOSIT_ACCOUNT("deposit_account"), LOAN_PRODUCT("loan_product");
|
||||
|
||||
private final String value;
|
||||
|
||||
private BUSINESS_ENTITY(final String value) {
|
||||
private BusinessEntity(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.portfolio.common.service;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
|
||||
/**
|
||||
* The interface to be implemented by classes that want to be informed when a
|
||||
@@ -32,11 +32,11 @@ public interface BusinessEventListner {
|
||||
/**
|
||||
* Implement this method for notifications before executing Business Event
|
||||
*/
|
||||
public void businessEventToBeExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity);
|
||||
public void businessEventToBeExecuted(Map<BusinessEntity, Object> businessEventEntity);
|
||||
|
||||
/**
|
||||
* Implement this method for notifications after executing Business Event
|
||||
*/
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity);
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.portfolio.common.service;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
|
||||
/**
|
||||
* Implemented class is responsible for notifying the business event to
|
||||
@@ -33,24 +33,24 @@ public interface BusinessEventNotifierService {
|
||||
* Method should be called to notify listeners before Business event
|
||||
* execution for any pre-processing of event
|
||||
*/
|
||||
public void notifyBusinessEventToBeExecuted(BUSINESS_EVENTS businessEvent, Map<BUSINESS_ENTITY, Object> businessEventEntity);
|
||||
public void notifyBusinessEventToBeExecuted(BusinessEvents businessEvent, Map<BusinessEntity, Object> businessEventEntity);
|
||||
|
||||
/**
|
||||
* Method should be called to notify listeners after Business event
|
||||
* execution for any post-processing of event
|
||||
*/
|
||||
public void notifyBusinessEventWasExecuted(BUSINESS_EVENTS businessEvent, Map<BUSINESS_ENTITY, Object> businessEventEntity);
|
||||
public void notifyBusinessEventWasExecuted(BusinessEvents businessEvent, Map<BusinessEntity, Object> businessEventEntity);
|
||||
|
||||
/**
|
||||
* Method is to register a class as listener for pre-processing of any
|
||||
* Business event
|
||||
*/
|
||||
public void addBusinessEventPreListners(BUSINESS_EVENTS businessEvent, BusinessEventListner businessEventListner);
|
||||
public void addBusinessEventPreListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner);
|
||||
|
||||
/**
|
||||
* Method is to register a class as listener for post-processing of any
|
||||
* Business event
|
||||
*/
|
||||
public void addBusinessEventPostListners(BUSINESS_EVENTS businessEvent, BusinessEventListner businessEventListner);
|
||||
public void addBusinessEventPostListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner);
|
||||
|
||||
}
|
||||
|
||||
+14
-14
@@ -22,15 +22,15 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierService {
|
||||
|
||||
private final Map<BUSINESS_EVENTS, List<BusinessEventListner>> preListners = new HashMap<>(5);
|
||||
private final Map<BUSINESS_EVENTS, List<BusinessEventListner>> postListners = new HashMap<>(5);
|
||||
private final Map<BusinessEvents, List<BusinessEventListner>> preListners = new HashMap<>(5);
|
||||
private final Map<BusinessEvents, List<BusinessEventListner>> postListners = new HashMap<>(5);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -39,11 +39,11 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
|
||||
* org.apache.fineract.portfolio.common.service.BusinessEventNotifierService
|
||||
* #notifyBusinessEventToBeExecuted
|
||||
* (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants
|
||||
* .BUSINESS_EVENTS,
|
||||
* .BusinessEvents,
|
||||
* org.springframework.data.jpa.domain.AbstractPersistable)
|
||||
*/
|
||||
@Override
|
||||
public void notifyBusinessEventToBeExecuted(BUSINESS_EVENTS businessEvent, Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void notifyBusinessEventToBeExecuted(BusinessEvents businessEvent, Map<BusinessEntity, Object> businessEventEntity) {
|
||||
List<BusinessEventListner> businessEventListners = this.preListners.get(businessEvent);
|
||||
if (businessEventListners != null) {
|
||||
for (BusinessEventListner eventListner : businessEventListners) {
|
||||
@@ -59,11 +59,11 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
|
||||
* org.apache.fineract.portfolio.common.service.BusinessEventNotifierService
|
||||
* #notifyBusinessEventWasExecuted
|
||||
* (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants
|
||||
* .BUSINESS_EVENTS,
|
||||
* .BusinessEvents,
|
||||
* org.springframework.data.jpa.domain.AbstractPersistable)
|
||||
*/
|
||||
@Override
|
||||
public void notifyBusinessEventWasExecuted(BUSINESS_EVENTS businessEvent, Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void notifyBusinessEventWasExecuted(BusinessEvents businessEvent, Map<BusinessEntity, Object> businessEventEntity) {
|
||||
List<BusinessEventListner> businessEventListners = this.postListners.get(businessEvent);
|
||||
if (businessEventListners != null) {
|
||||
for (BusinessEventListner eventListner : businessEventListners) {
|
||||
@@ -79,11 +79,11 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
|
||||
* org.apache.fineract.portfolio.common.service.BusinessEventNotifierService
|
||||
* #addBusinessEventPreListners
|
||||
* (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants
|
||||
* .BUSINESS_EVENTS,
|
||||
* .BusinessEvents,
|
||||
* org.apache.fineract.portfolio.common.service.BusinessEventListner)
|
||||
*/
|
||||
@Override
|
||||
public void addBusinessEventPreListners(BUSINESS_EVENTS businessEvent, BusinessEventListner businessEventListner) {
|
||||
public void addBusinessEventPreListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner) {
|
||||
addBusinessEventListners(businessEvent, businessEventListner, preListners);
|
||||
}
|
||||
|
||||
@@ -94,16 +94,16 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe
|
||||
* org.apache.fineract.portfolio.common.service.BusinessEventNotifierService
|
||||
* #addBusinessEventPostListners
|
||||
* (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants
|
||||
* .BUSINESS_EVENTS,
|
||||
* .BusinessEvents,
|
||||
* org.apache.fineract.portfolio.common.service.BusinessEventListner)
|
||||
*/
|
||||
@Override
|
||||
public void addBusinessEventPostListners(BUSINESS_EVENTS businessEvent, BusinessEventListner businessEventListner) {
|
||||
public void addBusinessEventPostListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner) {
|
||||
addBusinessEventListners(businessEvent, businessEventListner, postListners);
|
||||
}
|
||||
|
||||
private void addBusinessEventListners(BUSINESS_EVENTS businessEvent, BusinessEventListner businessEventListner,
|
||||
final Map<BUSINESS_EVENTS, List<BusinessEventListner>> businessEventListnerMap) {
|
||||
private void addBusinessEventListners(BusinessEvents businessEvent, BusinessEventListner businessEventListner,
|
||||
final Map<BusinessEvents, List<BusinessEventListner>> businessEventListnerMap) {
|
||||
List<BusinessEventListner> businessEventListners = businessEventListnerMap.get(businessEvent);
|
||||
if (businessEventListners == null) {
|
||||
businessEventListners = new ArrayList<>();
|
||||
|
||||
+8
-8
@@ -60,8 +60,8 @@ import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.client.service.LoanStatusMapper;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.api.GroupingTypesApiConstants;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
@@ -289,8 +289,8 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
||||
|
||||
CommandProcessingResult commandProcessingResult = createGroupingType(command, GroupTypes.CENTER, centerId);
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.CENTERS_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.GROUP, commandProcessingResult));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.CENTERS_CREATE,
|
||||
constructEntityMap(BusinessEntity.GROUP, commandProcessingResult));
|
||||
|
||||
return commandProcessingResult;
|
||||
}
|
||||
@@ -307,8 +307,8 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
||||
|
||||
CommandProcessingResult commandProcessingResult = createGroupingType(command, GroupTypes.GROUP, centerId);
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEventNotificationConstants.BUSINESS_EVENTS.GROUPS_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.GROUP, commandProcessingResult));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEventNotificationConstants.BusinessEvents.GROUPS_CREATE,
|
||||
constructEntityMap(BusinessEntity.GROUP, commandProcessingResult));
|
||||
|
||||
return commandProcessingResult;
|
||||
}
|
||||
@@ -996,8 +996,8 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
||||
}
|
||||
}
|
||||
|
||||
private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEventNotificationConstants.BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+24
-24
@@ -56,8 +56,8 @@ import org.apache.fineract.portfolio.account.domain.StandingInstructionRepositor
|
||||
import org.apache.fineract.portfolio.account.domain.StandingInstructionStatus;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
@@ -151,8 +151,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
Boolean isHolidayValidationDone, final boolean isLoanToLoanTransfer) {
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_MAKE_REPAYMENT,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_MAKE_REPAYMENT,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
// TODO: Is it required to validate transaction date with meeting dates
|
||||
// if repayments is synced with meeting?
|
||||
@@ -222,8 +222,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
recalculateAccruals(loan);
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_MAKE_REPAYMENT,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, newRepaymentTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_MAKE_REPAYMENT,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, newRepaymentTransaction));
|
||||
|
||||
// disable all active standing orders linked to this loan if status changes to closed
|
||||
disableStandingInstructionsLinkedToClosedLoan(loan);
|
||||
@@ -303,8 +303,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
boolean isAccountTransfer = true;
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_CHARGE_PAYMENT,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_CHARGE_PAYMENT,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
|
||||
@@ -339,8 +339,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_CHARGE_PAYMENT,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, newPaymentTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_CHARGE_PAYMENT,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, newPaymentTransaction));
|
||||
return newPaymentTransaction;
|
||||
}
|
||||
|
||||
@@ -385,8 +385,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
boolean isAccountTransfer = true;
|
||||
final Loan loan = this.loanAccountAssembler.assembleFrom(accountId);
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_REFUND,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REFUND,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
|
||||
@@ -411,8 +411,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
}
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REFUND,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, newRefundTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REFUND,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, newRefundTransaction));
|
||||
builderResult.withEntityId(newRefundTransaction.getId())
|
||||
.withOfficeId(loan.getOfficeId())
|
||||
.withClientId(loan.getClientId())
|
||||
@@ -575,8 +575,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
BigDecimal transactionAmount, PaymentDetail paymentDetail, String noteText, String txnExternalId) {
|
||||
final Loan loan = this.loanAccountAssembler.assembleFrom(accountId);
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_REFUND,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REFUND,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
@@ -603,8 +603,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false);
|
||||
recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REFUND,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, newRefundTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REFUND,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, newRefundTransaction));
|
||||
|
||||
builderResult.withEntityId(newRefundTransaction.getId())
|
||||
.withOfficeId(loan.getOfficeId())
|
||||
@@ -616,8 +616,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> foreCloseLoan(final Loan loan, final LocalDate foreClosureDate, final String noteText) {
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_FORECLOSURE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_FORECLOSURE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
MonetaryCurrency currency = loan.getCurrency();
|
||||
LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant();
|
||||
final Map<String, Object> changes = new LinkedHashMap<>();
|
||||
@@ -721,14 +721,14 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
}
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_FORECLOSURE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, payment));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_FORECLOSURE,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, payment));
|
||||
return changes;
|
||||
|
||||
}
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+3
-3
@@ -28,7 +28,7 @@ public class GuarantorConstants {
|
||||
/***
|
||||
* Enum of all parameters passed in while creating/updating a loan product
|
||||
***/
|
||||
public enum GUARANTOR_JSON_INPUT_PARAMS {
|
||||
public enum GuarantorJSONinputParams {
|
||||
LOAN_ID("loanId"), CLIENT_RELATIONSHIP_TYPE_ID("clientRelationshipTypeId"), GUARANTOR_TYPE_ID("guarantorTypeId"), ENTITY_ID(
|
||||
"entityId"), FIRSTNAME("firstname"), LASTNAME("lastname"), ADDRESS_LINE_1("addressLine1"), ADDRESS_LINE_2("addressLine2"), CITY(
|
||||
"city"), STATE("state"), ZIP("zip"), COUNTRY("country"), MOBILE_NUMBER("mobileNumber"), PHONE_NUMBER("housePhoneNumber"), COMMENT(
|
||||
@@ -36,13 +36,13 @@ public class GuarantorConstants {
|
||||
|
||||
private final String value;
|
||||
|
||||
GUARANTOR_JSON_INPUT_PARAMS(final String value) {
|
||||
GuarantorJSONinputParams(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final GUARANTOR_JSON_INPUT_PARAMS type : GUARANTOR_JSON_INPUT_PARAMS.values()) {
|
||||
for (final GuarantorJSONinputParams type : GuarantorJSONinputParams.values()) {
|
||||
values.add(type.value);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GUARANTOR_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GuarantorJSONinputParams;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorType;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
@@ -99,27 +99,27 @@ public class GuarantorCommand {
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors);
|
||||
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.CLIENT_RELATIONSHIP_TYPE_ID.getValue())
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.CLIENT_RELATIONSHIP_TYPE_ID.getValue())
|
||||
.value(this.clientRelationshipTypeId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID.getValue()).value(this.guarantorTypeId).notNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.GUARANTOR_TYPE_ID.getValue()).value(this.guarantorTypeId).notNull()
|
||||
.inMinMaxRange(GuarantorType.getMinValue(), GuarantorType.getMaxValue());
|
||||
|
||||
// validate for existing Client or Staff serving as gurantor
|
||||
if (!isExternalGuarantor()) {
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.ENTITY_ID.getValue()).value(this.entityId).notNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.ENTITY_ID.getValue()).value(this.entityId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.SAVINGS_ID.getValue()).value(this.savingsId)
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.SAVINGS_ID.getValue()).value(this.savingsId)
|
||||
.longGreaterThanZero();
|
||||
if (this.savingsId != null) {
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.AMOUNT.getValue()).value(this.amount).notNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.AMOUNT.getValue()).value(this.amount).notNull()
|
||||
.positiveAmount();
|
||||
}
|
||||
} else {
|
||||
// validate for an external guarantor
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.FIRSTNAME.getValue()).value(this.firstname).notBlank()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.FIRSTNAME.getValue()).value(this.firstname).notBlank()
|
||||
.notExceedingLengthOf(50);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.LASTNAME.getValue()).value(this.lastname).notBlank()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.LASTNAME.getValue()).value(this.lastname).notBlank()
|
||||
.notExceedingLengthOf(50);
|
||||
validateNonMandatoryFieldsForMaxLength(baseDataValidator);
|
||||
}
|
||||
@@ -133,20 +133,20 @@ public class GuarantorCommand {
|
||||
|
||||
final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors);
|
||||
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.CLIENT_RELATIONSHIP_TYPE_ID.getValue())
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.CLIENT_RELATIONSHIP_TYPE_ID.getValue())
|
||||
.value(this.clientRelationshipTypeId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID.getValue()).value(this.guarantorTypeId)
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.GUARANTOR_TYPE_ID.getValue()).value(this.guarantorTypeId)
|
||||
.ignoreIfNull().inMinMaxRange(GuarantorType.getMinValue(), GuarantorType.getMaxValue());
|
||||
|
||||
// validate for existing Client or Staff serving as gurantor
|
||||
if (!isExternalGuarantor()) {
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.ENTITY_ID.getValue()).value(this.entityId).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.ENTITY_ID.getValue()).value(this.entityId).ignoreIfNull()
|
||||
.integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.SAVINGS_ID.getValue()).value(this.savingsId)
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.SAVINGS_ID.getValue()).value(this.savingsId)
|
||||
.longGreaterThanZero();
|
||||
if (this.savingsId != null) {
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.AMOUNT.getValue()).value(this.amount).notNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.AMOUNT.getValue()).value(this.amount).notNull()
|
||||
.positiveAmount();
|
||||
}
|
||||
} else {
|
||||
@@ -155,9 +155,9 @@ public class GuarantorCommand {
|
||||
// firstname and last name when a guarantor type is changed), to be
|
||||
// corrected while
|
||||
// refactoring for maker checker
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.FIRSTNAME.getValue()).value(this.firstname).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.FIRSTNAME.getValue()).value(this.firstname).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.LASTNAME.getValue()).value(this.lastname).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.LASTNAME.getValue()).value(this.lastname).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
|
||||
validateNonMandatoryFieldsForMaxLength(baseDataValidator);
|
||||
@@ -174,23 +174,23 @@ public class GuarantorCommand {
|
||||
*/
|
||||
private void validateNonMandatoryFieldsForMaxLength(final DataValidatorBuilder baseDataValidator) {
|
||||
// validate non mandatory fields for length
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_1.getValue()).value(this.addressLine1).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.ADDRESS_LINE_1.getValue()).value(this.addressLine1).ignoreIfNull()
|
||||
.notExceedingLengthOf(500);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_2.getValue()).value(this.addressLine2).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.ADDRESS_LINE_2.getValue()).value(this.addressLine2).ignoreIfNull()
|
||||
.notExceedingLengthOf(500);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.CITY.getValue()).value(this.city).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.CITY.getValue()).value(this.city).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.STATE.getValue()).value(this.state).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.STATE.getValue()).value(this.state).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.ZIP.getValue()).value(this.zip).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.ZIP.getValue()).value(this.zip).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.COUNTRY.getValue()).value(this.country).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.COUNTRY.getValue()).value(this.country).ignoreIfNull()
|
||||
.notExceedingLengthOf(50);
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.MOBILE_NUMBER.getValue()).value(this.mobileNumber).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.MOBILE_NUMBER.getValue()).value(this.mobileNumber).ignoreIfNull()
|
||||
.notExceedingLengthOf(20).validatePhoneNumber();
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.PHONE_NUMBER.getValue()).value(this.housePhoneNumber)
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.PHONE_NUMBER.getValue()).value(this.housePhoneNumber)
|
||||
.ignoreIfNull().notExceedingLengthOf(20).validatePhoneNumber();
|
||||
baseDataValidator.reset().parameter(GUARANTOR_JSON_INPUT_PARAMS.COMMENT.getValue()).value(this.comment).ignoreIfNull()
|
||||
baseDataValidator.reset().parameter(GuarantorJSONinputParams.COMMENT.getValue()).value(this.comment).ignoreIfNull()
|
||||
.notExceedingLengthOf(500);
|
||||
}
|
||||
|
||||
|
||||
+41
-41
@@ -38,7 +38,7 @@ import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GUARANTOR_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GuarantorJSONinputParams;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_guarantor")
|
||||
@@ -132,23 +132,23 @@ public class Guarantor extends AbstractPersistableCustom {
|
||||
|
||||
public static Guarantor fromJson(final Loan loan, final CodeValue clientRelationshipType, final JsonCommand command,
|
||||
final List<GuarantorFundingDetails> fundingDetails) {
|
||||
final Integer gurantorType = command.integerValueSansLocaleOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID
|
||||
final Integer gurantorType = command.integerValueSansLocaleOfParameterNamed(GuarantorJSONinputParams.GUARANTOR_TYPE_ID
|
||||
.getValue());
|
||||
final Long entityId = command.longValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.ENTITY_ID.getValue());
|
||||
final Long entityId = command.longValueOfParameterNamed(GuarantorJSONinputParams.ENTITY_ID.getValue());
|
||||
final boolean active = true;
|
||||
if (GuarantorType.EXTERNAL.getValue().equals(gurantorType)) {
|
||||
final String firstname = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.FIRSTNAME.getValue());
|
||||
final String lastname = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.LASTNAME.getValue());
|
||||
final Date dateOfBirth = command.DateValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.DATE_OF_BIRTH.getValue());
|
||||
final String addressLine1 = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_1.getValue());
|
||||
final String addressLine2 = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_2.getValue());
|
||||
final String city = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.CITY.getValue());
|
||||
final String state = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.STATE.getValue());
|
||||
final String country = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.COUNTRY.getValue());
|
||||
final String zip = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.ZIP.getValue());
|
||||
final String housePhoneNumber = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.PHONE_NUMBER.getValue());
|
||||
final String mobilePhoneNumber = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.MOBILE_NUMBER.getValue());
|
||||
final String comment = command.stringValueOfParameterNamed(GUARANTOR_JSON_INPUT_PARAMS.COMMENT.getValue());
|
||||
final String firstname = command.stringValueOfParameterNamed(GuarantorJSONinputParams.FIRSTNAME.getValue());
|
||||
final String lastname = command.stringValueOfParameterNamed(GuarantorJSONinputParams.LASTNAME.getValue());
|
||||
final Date dateOfBirth = command.DateValueOfParameterNamed(GuarantorJSONinputParams.DATE_OF_BIRTH.getValue());
|
||||
final String addressLine1 = command.stringValueOfParameterNamed(GuarantorJSONinputParams.ADDRESS_LINE_1.getValue());
|
||||
final String addressLine2 = command.stringValueOfParameterNamed(GuarantorJSONinputParams.ADDRESS_LINE_2.getValue());
|
||||
final String city = command.stringValueOfParameterNamed(GuarantorJSONinputParams.CITY.getValue());
|
||||
final String state = command.stringValueOfParameterNamed(GuarantorJSONinputParams.STATE.getValue());
|
||||
final String country = command.stringValueOfParameterNamed(GuarantorJSONinputParams.COUNTRY.getValue());
|
||||
final String zip = command.stringValueOfParameterNamed(GuarantorJSONinputParams.ZIP.getValue());
|
||||
final String housePhoneNumber = command.stringValueOfParameterNamed(GuarantorJSONinputParams.PHONE_NUMBER.getValue());
|
||||
final String mobilePhoneNumber = command.stringValueOfParameterNamed(GuarantorJSONinputParams.MOBILE_NUMBER.getValue());
|
||||
final String comment = command.stringValueOfParameterNamed(GuarantorJSONinputParams.COMMENT.getValue());
|
||||
|
||||
return new Guarantor(loan, clientRelationshipType, gurantorType, entityId, firstname, lastname, dateOfBirth, addressLine1,
|
||||
addressLine2, city, state, country, zip, housePhoneNumber, mobilePhoneNumber, comment, active, fundingDetails);
|
||||
@@ -163,21 +163,21 @@ public class Guarantor extends AbstractPersistableCustom {
|
||||
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>();
|
||||
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.CLIENT_RELATIONSHIP_TYPE_ID.getValue(), 0, true);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.CLIENT_RELATIONSHIP_TYPE_ID.getValue(), 0, true);
|
||||
|
||||
if (isExternalGuarantor()) {
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.FIRSTNAME.getValue(), this.firstname);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.LASTNAME.getValue(), this.lastname);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.DATE_OF_BIRTH.getValue(), this.dateOfBirth);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_1.getValue(), this.addressLine1);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_2.getValue(), this.addressLine2);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.CITY.getValue(), this.city);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.STATE.getValue(), this.state);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.COUNTRY.getValue(), this.country);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.ZIP.getValue(), this.zip);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.PHONE_NUMBER.getValue(), this.housePhoneNumber);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.MOBILE_NUMBER.getValue(), this.mobilePhoneNumber);
|
||||
handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.COMMENT.getValue(), this.comment);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.FIRSTNAME.getValue(), this.firstname);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.LASTNAME.getValue(), this.lastname);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.DATE_OF_BIRTH.getValue(), this.dateOfBirth);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.ADDRESS_LINE_1.getValue(), this.addressLine1);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.ADDRESS_LINE_2.getValue(), this.addressLine2);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.CITY.getValue(), this.city);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.STATE.getValue(), this.state);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.COUNTRY.getValue(), this.country);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.ZIP.getValue(), this.zip);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.PHONE_NUMBER.getValue(), this.housePhoneNumber);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.MOBILE_NUMBER.getValue(), this.mobilePhoneNumber);
|
||||
handlePropertyUpdate(command, actualChanges, GuarantorJSONinputParams.COMMENT.getValue(), this.comment);
|
||||
updateExistingEntityToNull();
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public class Guarantor extends AbstractPersistableCustom {
|
||||
//propertyToBeUpdated = newValue;
|
||||
|
||||
// now update actual property
|
||||
if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID.getValue())) {
|
||||
if (paramName.equals(GuarantorJSONinputParams.GUARANTOR_TYPE_ID.getValue())) {
|
||||
this.gurantorType = newValue;
|
||||
}
|
||||
}
|
||||
@@ -223,27 +223,27 @@ public class Guarantor extends AbstractPersistableCustom {
|
||||
//propertyToBeUpdated = newValue;
|
||||
|
||||
// now update actual property
|
||||
if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.FIRSTNAME.getValue())) {
|
||||
if (paramName.equals(GuarantorJSONinputParams.FIRSTNAME.getValue())) {
|
||||
this.firstname = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.LASTNAME.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.LASTNAME.getValue())) {
|
||||
this.lastname = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_1.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.ADDRESS_LINE_1.getValue())) {
|
||||
this.addressLine1 = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_2.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.ADDRESS_LINE_2.getValue())) {
|
||||
this.addressLine2 = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.CITY.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.CITY.getValue())) {
|
||||
this.city = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.STATE.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.STATE.getValue())) {
|
||||
this.state = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.COUNTRY.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.COUNTRY.getValue())) {
|
||||
this.country = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.ZIP.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.ZIP.getValue())) {
|
||||
this.zip = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.PHONE_NUMBER.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.PHONE_NUMBER.getValue())) {
|
||||
this.housePhoneNumber = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.MOBILE_NUMBER.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.MOBILE_NUMBER.getValue())) {
|
||||
this.mobilePhoneNumber = newValue;
|
||||
} else if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.COMMENT.getValue())) {
|
||||
} else if (paramName.equals(GuarantorJSONinputParams.COMMENT.getValue())) {
|
||||
this.comment = newValue;
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class Guarantor extends AbstractPersistableCustom {
|
||||
//propertyToBeUpdated = newValue;
|
||||
|
||||
// now update actual property
|
||||
if (paramName.equals(GUARANTOR_JSON_INPUT_PARAMS.DATE_OF_BIRTH.getValue())) {
|
||||
if (paramName.equals(GuarantorJSONinputParams.DATE_OF_BIRTH.getValue())) {
|
||||
this.dateOfBirth = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-19
@@ -30,7 +30,7 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GUARANTOR_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GuarantorJSONinputParams;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -55,7 +55,7 @@ public final class GuarantorCommandFromApiJsonDeserializer extends AbstractFromA
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
final Set<String> supportedParameters = GUARANTOR_JSON_INPUT_PARAMS.getAllValues();
|
||||
final Set<String> supportedParameters = GuarantorJSONinputParams.getAllValues();
|
||||
supportedParameters.add("locale");
|
||||
supportedParameters.add("dateFormat");
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters);
|
||||
@@ -69,29 +69,29 @@ public final class GuarantorCommandFromApiJsonDeserializer extends AbstractFromA
|
||||
|
||||
private GuarantorCommand extractGuarantorCommand(final JsonElement element, final Locale locale, final String dateFormat) {
|
||||
final Long clientRelationshipTypeId = this.fromApiJsonHelper.extractLongNamed(
|
||||
GUARANTOR_JSON_INPUT_PARAMS.CLIENT_RELATIONSHIP_TYPE_ID.getValue(), element);
|
||||
GuarantorJSONinputParams.CLIENT_RELATIONSHIP_TYPE_ID.getValue(), element);
|
||||
final Integer guarantorTypeId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||
GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID.getValue(), element);
|
||||
final Long entityId = this.fromApiJsonHelper.extractLongNamed(GUARANTOR_JSON_INPUT_PARAMS.ENTITY_ID.getValue(), element);
|
||||
final String firstname = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.FIRSTNAME.getValue(), element);
|
||||
final String lastname = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.LASTNAME.getValue(), element);
|
||||
final String addressLine1 = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_1.getValue(),
|
||||
GuarantorJSONinputParams.GUARANTOR_TYPE_ID.getValue(), element);
|
||||
final Long entityId = this.fromApiJsonHelper.extractLongNamed(GuarantorJSONinputParams.ENTITY_ID.getValue(), element);
|
||||
final String firstname = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.FIRSTNAME.getValue(), element);
|
||||
final String lastname = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.LASTNAME.getValue(), element);
|
||||
final String addressLine1 = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.ADDRESS_LINE_1.getValue(),
|
||||
element);
|
||||
final String addressLine2 = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.ADDRESS_LINE_2.getValue(),
|
||||
final String addressLine2 = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.ADDRESS_LINE_2.getValue(),
|
||||
element);
|
||||
final String city = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.CITY.getValue(), element);
|
||||
final String state = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.STATE.getValue(), element);
|
||||
final String zip = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.ZIP.getValue(), element);
|
||||
final String country = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.COUNTRY.getValue(), element);
|
||||
final String city = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.CITY.getValue(), element);
|
||||
final String state = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.STATE.getValue(), element);
|
||||
final String zip = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.ZIP.getValue(), element);
|
||||
final String country = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.COUNTRY.getValue(), element);
|
||||
final String mobileNumber = this.fromApiJsonHelper
|
||||
.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.MOBILE_NUMBER.getValue(), element);
|
||||
final String housePhoneNumber = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.PHONE_NUMBER.getValue(),
|
||||
.extractStringNamed(GuarantorJSONinputParams.MOBILE_NUMBER.getValue(), element);
|
||||
final String housePhoneNumber = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.PHONE_NUMBER.getValue(),
|
||||
element);
|
||||
final String comment = this.fromApiJsonHelper.extractStringNamed(GUARANTOR_JSON_INPUT_PARAMS.COMMENT.getValue(), element);
|
||||
final LocalDate dob = this.fromApiJsonHelper.extractLocalDateNamed(GUARANTOR_JSON_INPUT_PARAMS.DATE_OF_BIRTH.getValue(), element,
|
||||
final String comment = this.fromApiJsonHelper.extractStringNamed(GuarantorJSONinputParams.COMMENT.getValue(), element);
|
||||
final LocalDate dob = this.fromApiJsonHelper.extractLocalDateNamed(GuarantorJSONinputParams.DATE_OF_BIRTH.getValue(), element,
|
||||
dateFormat, locale);
|
||||
final Long savingsId = this.fromApiJsonHelper.extractLongNamed(GUARANTOR_JSON_INPUT_PARAMS.SAVINGS_ID.getValue(), element);
|
||||
final BigDecimal amount = this.fromApiJsonHelper.extractBigDecimalNamed(GUARANTOR_JSON_INPUT_PARAMS.AMOUNT.getValue(), element,
|
||||
final Long savingsId = this.fromApiJsonHelper.extractLongNamed(GuarantorJSONinputParams.SAVINGS_ID.getValue(), element);
|
||||
final BigDecimal amount = this.fromApiJsonHelper.extractBigDecimalNamed(GuarantorJSONinputParams.AMOUNT.getValue(), element,
|
||||
locale);
|
||||
|
||||
return new GuarantorCommand(clientRelationshipTypeId, guarantorTypeId, entityId, firstname, lastname, addressLine1, addressLine2,
|
||||
|
||||
+35
-35
@@ -35,8 +35,8 @@ import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
||||
import org.apache.fineract.portfolio.account.domain.AccountTransferDetails;
|
||||
import org.apache.fineract.portfolio.account.domain.AccountTransferType;
|
||||
import org.apache.fineract.portfolio.account.service.AccountTransfersWritePlatformService;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
@@ -94,17 +94,17 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
|
||||
@PostConstruct
|
||||
public void addListners() {
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_APPROVED, new ValidateOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_APPROVED, new HoldFundsOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_UNDO_APPROVAL, new UndoAllFundTransactions());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_UNDO_DISBURSAL,
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new ValidateOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPROVED, new HoldFundsOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_APPROVAL, new UndoAllFundTransactions());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_DISBURSAL,
|
||||
new ReverseAllFundsOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_ADJUST_TRANSACTION,
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_ADJUST_TRANSACTION,
|
||||
new AdjustFundsOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_MAKE_REPAYMENT,
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT,
|
||||
new ReleaseFundsOnBusinessEvent());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_WRITTEN_OFF, new ReleaseAllFunds());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_UNDO_WRITTEN_OFF,
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_WRITTEN_OFF, new ReleaseAllFunds());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_WRITTEN_OFF,
|
||||
new ReverseFundsOnBusinessEvent());
|
||||
}
|
||||
|
||||
@@ -531,11 +531,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class ValidateOnBusinessEvent implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity instanceof Loan) {
|
||||
Loan loan = (Loan) entity;
|
||||
validateGuarantorBusinessRules(loan);
|
||||
@@ -546,11 +546,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class HoldFundsOnBusinessEvent implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity instanceof Loan) {
|
||||
Loan loan = (Loan) entity;
|
||||
holdGuarantorFunds(loan);
|
||||
@@ -561,11 +561,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class ReleaseFundsOnBusinessEvent implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_TRANSACTION);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN_TRANSACTION);
|
||||
if (entity instanceof LoanTransaction) {
|
||||
LoanTransaction loanTransaction = (LoanTransaction) entity;
|
||||
if (releaseLoanIds.containsKey(loanTransaction.getLoan().getId())) {
|
||||
@@ -580,11 +580,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class ReverseFundsOnBusinessEvent implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_TRANSACTION);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN_TRANSACTION);
|
||||
if (entity instanceof LoanTransaction) {
|
||||
LoanTransaction loanTransaction = (LoanTransaction) entity;
|
||||
List<Long> reersedTransactions = new ArrayList<>(1);
|
||||
@@ -597,18 +597,18 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class AdjustFundsOnBusinessEvent implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_ADJUSTED_TRANSACTION);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN_ADJUSTED_TRANSACTION);
|
||||
if (entity instanceof LoanTransaction) {
|
||||
LoanTransaction loanTransaction = (LoanTransaction) entity;
|
||||
List<Long> reersedTransactions = new ArrayList<>(1);
|
||||
reersedTransactions.add(loanTransaction.getId());
|
||||
reverseTransaction(reersedTransactions);
|
||||
}
|
||||
Object transactionentity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_TRANSACTION);
|
||||
Object transactionentity = businessEventEntity.get(BusinessEntity.LOAN_TRANSACTION);
|
||||
if (transactionentity != null && transactionentity instanceof LoanTransaction) {
|
||||
LoanTransaction loanTransaction = (LoanTransaction) transactionentity;
|
||||
releaseGuarantorFunds(loanTransaction);
|
||||
@@ -619,11 +619,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class ReverseAllFundsOnBusinessEvent implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity instanceof Loan) {
|
||||
Loan loan = (Loan) entity;
|
||||
List<Long> reersedTransactions = new ArrayList<>(1);
|
||||
@@ -636,11 +636,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class UndoAllFundTransactions implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (entity instanceof Loan) {
|
||||
Loan loan = (Loan) entity;
|
||||
reverseAllFundTransaction(loan);
|
||||
@@ -651,11 +651,11 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
private class ReleaseAllFunds implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BUSINESS_ENTITY, Object> businessEventEntity) {}
|
||||
public void businessEventToBeExecuted(@SuppressWarnings("unused") Map<BusinessEntity, Object> businessEventEntity) {}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_TRANSACTION);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEntity.LOAN_TRANSACTION);
|
||||
if (entity instanceof LoanTransaction) {
|
||||
LoanTransaction loanTransaction = (LoanTransaction) entity;
|
||||
releaseAllGuarantors(loanTransaction);
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GUARANTOR_JSON_INPUT_PARAMS;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GuarantorJSONinputParams;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.domain.Guarantor;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorFundStatusType;
|
||||
@@ -202,7 +202,7 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
|
||||
|
||||
final Map<String, Object> changesOnly = guarantorForUpdate.update(command);
|
||||
|
||||
if (changesOnly.containsKey(GUARANTOR_JSON_INPUT_PARAMS.CLIENT_RELATIONSHIP_TYPE_ID.getValue())) {
|
||||
if (changesOnly.containsKey(GuarantorJSONinputParams.CLIENT_RELATIONSHIP_TYPE_ID.getValue())) {
|
||||
final Long clientRelationshipId = guarantorCommand.getClientRelationshipTypeId();
|
||||
CodeValue clientRelationshipType = null;
|
||||
if (clientRelationshipId != null) {
|
||||
@@ -228,8 +228,8 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
|
||||
}
|
||||
}
|
||||
|
||||
if (changesOnly.containsKey(GUARANTOR_JSON_INPUT_PARAMS.ENTITY_ID.getValue())
|
||||
|| changesOnly.containsKey(GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID.getValue())) {
|
||||
if (changesOnly.containsKey(GuarantorJSONinputParams.ENTITY_ID.getValue())
|
||||
|| changesOnly.containsKey(GuarantorJSONinputParams.GUARANTOR_TYPE_ID.getValue())) {
|
||||
validateGuarantorBusinessRules(guarantorForUpdate);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -81,8 +81,8 @@ import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
|
||||
import org.apache.fineract.portfolio.collateral.domain.LoanCollateral;
|
||||
import org.apache.fineract.portfolio.collateral.service.CollateralAssembler;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.fund.domain.Fund;
|
||||
@@ -585,8 +585,8 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
EntityTables.LOAN.getName(), StatusEnum.CREATE.getCode().longValue(),
|
||||
EntityTables.LOAN.getForeignKeyColumnNameOnDatatable(), newLoanApplication.productId());
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, newLoanApplication));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_CREATE,
|
||||
constructEntityMap(BusinessEntity.LOAN, newLoanApplication));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -1434,8 +1434,8 @@ public void checkForProductMixRestrictions(final Loan loan) {
|
||||
this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_APPROVED,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_APPROVED,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
@@ -1516,8 +1516,8 @@ public void checkForProductMixRestrictions(final Loan loan) {
|
||||
final Note note = Note.loanNote(loan, noteText);
|
||||
this.noteRepository.save(note);
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_UNDO_APPROVAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_UNDO_APPROVAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
@@ -1591,7 +1591,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
|
||||
this.noteRepository.save(note);
|
||||
}
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REJECTED, constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REJECTED, constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(loan.getId()) //
|
||||
@@ -1712,8 +1712,8 @@ public void checkForProductMixRestrictions(final Loan loan) {
|
||||
return user;
|
||||
}
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+22
-22
@@ -31,8 +31,8 @@ import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
|
||||
import org.apache.fineract.infrastructure.jobs.service.JobName;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventListner;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
@@ -69,17 +69,17 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
|
||||
@PostConstruct
|
||||
public void registerForNotification() {
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_REFUND, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_ADJUST_TRANSACTION, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_MAKE_REPAYMENT, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_UNDO_WRITTEN_OFF, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_WAIVE_INTEREST, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_ADD_CHARGE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_WAIVE_CHARGE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_CHARGE_PAYMENT, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_APPLY_OVERDUE_CHARGE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_DISBURSAL, new DisbursementEventListner());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.LOAN_FORECLOSURE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_REFUND, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_ADJUST_TRANSACTION, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_MAKE_REPAYMENT, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_UNDO_WRITTEN_OFF, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_WAIVE_INTEREST, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_ADD_CHARGE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_WAIVE_CHARGE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_CHARGE_PAYMENT, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_APPLY_OVERDUE_CHARGE, this);
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_DISBURSAL, new DisbursementEventListner());
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BusinessEvents.LOAN_FORECLOSURE, this);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -461,18 +461,18 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
public void businessEventToBeExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventToBeExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Loan loan = null;
|
||||
Object loanEntity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
Object loanTransactionEntity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_TRANSACTION);
|
||||
Object loanAdjustTransactionEntity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_ADJUSTED_TRANSACTION);
|
||||
Object loanChargeEntity = businessEventEntity.get(BUSINESS_ENTITY.LOAN_CHARGE);
|
||||
Object loanEntity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
Object loanTransactionEntity = businessEventEntity.get(BusinessEntity.LOAN_TRANSACTION);
|
||||
Object loanAdjustTransactionEntity = businessEventEntity.get(BusinessEntity.LOAN_ADJUSTED_TRANSACTION);
|
||||
Object loanChargeEntity = businessEventEntity.get(BusinessEntity.LOAN_CHARGE);
|
||||
if (loanEntity != null) {
|
||||
loan = (Loan) loanEntity;
|
||||
} else if (loanTransactionEntity != null) {
|
||||
@@ -497,14 +497,14 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
public void businessEventToBeExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
public void businessEventToBeExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object loanEntity = businessEventEntity.get(BUSINESS_ENTITY.LOAN);
|
||||
public void businessEventWasExecuted(Map<BusinessEntity, Object> businessEventEntity) {
|
||||
Object loanEntity = businessEventEntity.get(BusinessEntity.LOAN);
|
||||
if (loanEntity != null) {
|
||||
Loan loan = (Loan) loanEntity;
|
||||
updateLoanArrearsAgeingDetails(loan);
|
||||
|
||||
+1
-1
@@ -332,7 +332,7 @@ public class LoanAssembler {
|
||||
if (loanOfficerId != null) {
|
||||
staff = this.staffRepository.findById(loanOfficerId)
|
||||
.orElseThrow(() -> new StaffNotFoundException(loanOfficerId));
|
||||
if (staff.isNotLoanOfficer()) { throw new StaffRoleException(loanOfficerId, StaffRoleException.STAFF_ROLE.LOAN_OFFICER); }
|
||||
if (staff.isNotLoanOfficer()) { throw new StaffRoleException(loanOfficerId, StaffRoleException.StaffRole.LOAN_OFFICER); }
|
||||
}
|
||||
return staff;
|
||||
}
|
||||
|
||||
+122
-122
@@ -99,13 +99,13 @@ import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.charge.exception.ChargeCannotBeUpdatedException;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeAddedException;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeDeletedException;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeDeletedException.LOAN_CHARGE_CANNOT_BE_DELETED_REASON;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeDeletedException.LoanChargeCannotBeDeletedReason;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBePayedException;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBePayedException.LOAN_CHARGE_CANNOT_BE_PAYED_REASON;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBePayedException.LoanChargeCannotBePayedReason;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeUpdatedException;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeUpdatedException.LOAN_CHARGE_CANNOT_BE_UPDATED_REASON;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeUpdatedException.LoanChargeCannotBeUpdatedReason;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeWaivedException;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeWaivedException.LOAN_CHARGE_CANNOT_BE_WAIVED_REASON;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeCannotBeWaivedException.LoanChargeCannotBeWaivedReason;
|
||||
import org.apache.fineract.portfolio.charge.exception.LoanChargeNotFoundException;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
|
||||
@@ -113,8 +113,8 @@ import org.apache.fineract.portfolio.collectionsheet.command.CollectionSheetBulk
|
||||
import org.apache.fineract.portfolio.collectionsheet.command.CollectionSheetBulkRepaymentCommand;
|
||||
import org.apache.fineract.portfolio.collectionsheet.command.SingleDisbursalCommand;
|
||||
import org.apache.fineract.portfolio.collectionsheet.command.SingleRepaymentCommand;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
@@ -387,8 +387,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
scheduleGeneratorDTO.isSkipRepaymentOnFirstDayofMonth(), scheduleGeneratorDTO.getNumberOfdays());
|
||||
}
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_DISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_DISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
@@ -518,8 +518,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
updateRecurringCalendarDatesForInterestRecalculation(loan);
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_DISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_DISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(loan.getId()) //
|
||||
@@ -668,8 +668,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
syncExpectedDateWithActualDisbursementDate(loan, actualDisbursementDate);
|
||||
}
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_DISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_DISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
@@ -759,8 +759,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
}
|
||||
updateRecurringCalendarDatesForInterestRecalculation(loan);
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_DISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_DISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
return changes;
|
||||
@@ -801,8 +801,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final AppUser currentUser = getAppUserIfPresent();
|
||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_UNDO_DISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_UNDO_DISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
removeLoanCycle(loan);
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
@@ -832,8 +832,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(applicationCurrency.toData(),
|
||||
existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
this.journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_UNDO_DISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_UNDO_DISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
@@ -983,8 +983,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
checkClientOrGroupActive(loan);
|
||||
final LoanTransaction transactionToAdjust = this.loanTransactionRepository.findById(transactionId)
|
||||
.orElseThrow(() -> new LoanTransactionNotFoundException(transactionId));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_ADJUST_TRANSACTION,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_ADJUSTED_TRANSACTION, transactionToAdjust));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_ADJUST_TRANSACTION,
|
||||
constructEntityMap(BusinessEntity.LOAN_ADJUSTED_TRANSACTION, transactionToAdjust));
|
||||
if (this.accountTransfersReadPlatformService.isAccountTransfer(transactionId, PortfolioAccountType.LOAN)) { throw new PlatformServiceUnavailableException(
|
||||
"error.msg.loan.transfer.transaction.update.not.allowed", "Loan transaction:" + transactionId
|
||||
+ " update not allowed as it involves in account transfer", transactionId); }
|
||||
@@ -1093,11 +1093,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
Map<BUSINESS_ENTITY, Object> entityMap = constructEntityMap(BUSINESS_ENTITY.LOAN_ADJUSTED_TRANSACTION, transactionToAdjust);
|
||||
Map<BusinessEntity, Object> entityMap = constructEntityMap(BusinessEntity.LOAN_ADJUSTED_TRANSACTION, transactionToAdjust);
|
||||
if (newTransactionDetail.isRepayment() && newTransactionDetail.isGreaterThanZero(loan.getPrincpal().getCurrency())) {
|
||||
entityMap.put(BUSINESS_ENTITY.LOAN_TRANSACTION, newTransactionDetail);
|
||||
entityMap.put(BusinessEntity.LOAN_TRANSACTION, newTransactionDetail);
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_ADJUST_TRANSACTION, entityMap);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_ADJUST_TRANSACTION, entityMap);
|
||||
|
||||
return new CommandProcessingResultBuilder()
|
||||
.withCommandId(command.commandId())
|
||||
@@ -1144,8 +1144,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
}
|
||||
final LoanTransaction waiveInterestTransaction = LoanTransaction.waiver(loan.getOffice(), loan, transactionAmountAsMoney,
|
||||
transactionDate, interestComponent, unrecognizedIncome, DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_WAIVE_INTEREST,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, waiveInterestTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_WAIVE_INTEREST,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, waiveInterestTransaction));
|
||||
LocalDate recalculateFrom = null;
|
||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||
recalculateFrom = transactionDate;
|
||||
@@ -1184,8 +1184,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_WAIVE_INTEREST,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, waiveInterestTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_WAIVE_INTEREST,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, waiveInterestTransaction));
|
||||
return new CommandProcessingResultBuilder()
|
||||
.withCommandId(command.commandId())
|
||||
.withEntityId(waiveInterestTransaction.getId())
|
||||
@@ -1217,8 +1217,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
}
|
||||
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_WRITTEN_OFF,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_WRITTEN_OFF,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
entityDatatableChecksWritePlatformService.runTheCheckForProduct(loanId, EntityTables.LOAN.getName(),
|
||||
StatusEnum.WRITE_OFF.getCode().longValue(), EntityTables.LOAN.getForeignKeyColumnNameOnDatatable(), loan.productId());
|
||||
|
||||
@@ -1254,8 +1254,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_WRITTEN_OFF,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, writeoff));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_WRITTEN_OFF,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, writeoff));
|
||||
return new CommandProcessingResultBuilder()
|
||||
.withCommandId(command.commandId())
|
||||
.withEntityId(writeoff.getId())
|
||||
@@ -1277,8 +1277,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_CLOSE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_CLOSE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final Map<String, Object> changes = new LinkedHashMap<>();
|
||||
changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
@@ -1319,8 +1319,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
}
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_CLOSE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_CLOSE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
// disable all active standing instructions linked to the loan
|
||||
this.loanAccountDomainService.disableStandingInstructionsLinkedToClosedLoan(loan);
|
||||
@@ -1361,8 +1361,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
checkClientOrGroupActive(loan);
|
||||
removeLoanCycle(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_CLOSE_AS_RESCHEDULE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_CLOSE_AS_RESCHEDULE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final Map<String, Object> changes = new LinkedHashMap<>();
|
||||
changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
@@ -1379,8 +1379,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final Note note = Note.loanNote(loan, noteText);
|
||||
this.noteRepository.save(note);
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_CLOSE_AS_RESCHEDULE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_CLOSE_AS_RESCHEDULE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
// disable all active standing instructions linked to the loan
|
||||
this.loanAccountDomainService.disableStandingInstructionsLinkedToClosedLoan(loan);
|
||||
@@ -1440,8 +1440,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
disbursementDetail.expectedDisbursementDateAsLocalDate(), null, null);
|
||||
loanTrancheDisbursementCharge = new LoanTrancheDisbursementCharge(loanCharge, disbursementDetail);
|
||||
loanCharge.updateLoanTrancheDisbursementCharge(loanTrancheDisbursementCharge);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_ADD_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_ADD_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
validateAddLoanCharge(loan, chargeDefinition, loanCharge);
|
||||
addCharge(loan, chargeDefinition, loanCharge);
|
||||
isAppliedOnBackDate = true;
|
||||
@@ -1453,8 +1453,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
loan.addTrancheLoanCharge(chargeDefinition);
|
||||
} else {
|
||||
loanCharge = LoanCharge.createNewFromJson(loan, chargeDefinition, command);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_ADD_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_ADD_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
|
||||
validateAddLoanCharge(loan, chargeDefinition, loanCharge);
|
||||
isAppliedOnBackDate = addCharge(loan, chargeDefinition, loanCharge);
|
||||
@@ -1493,8 +1493,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
&& loan.isFeeCompoundingEnabledForInterestRecalculation()) {
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_ADD_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_ADD_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
return new CommandProcessingResultBuilder()
|
||||
.withCommandId(command.commandId())
|
||||
.withEntityId(loanCharge.getId())
|
||||
@@ -1609,16 +1609,16 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
// Charges may be edited only when the loan associated with them are
|
||||
// yet to be approved (are in submitted and pending status)
|
||||
if (!loan.status().isSubmittedAndPendingApproval()) { throw new LoanChargeCannotBeUpdatedException(
|
||||
LOAN_CHARGE_CANNOT_BE_UPDATED_REASON.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanCharge.getId()); }
|
||||
LoanChargeCannotBeUpdatedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanCharge.getId()); }
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_UPDATE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_UPDATE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
|
||||
final Map<String, Object> changes = loan.updateLoanCharge(loanCharge, command);
|
||||
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_UPDATE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_UPDATE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(loanChargeId) //
|
||||
@@ -1643,16 +1643,16 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
// Charges may be waived only when the loan associated with them are
|
||||
// active
|
||||
if (!loan.status().isActive()) { throw new LoanChargeCannotBeWaivedException(LOAN_CHARGE_CANNOT_BE_WAIVED_REASON.LOAN_INACTIVE,
|
||||
if (!loan.status().isActive()) { throw new LoanChargeCannotBeWaivedException(LoanChargeCannotBeWaivedReason.LOAN_INACTIVE,
|
||||
loanCharge.getId()); }
|
||||
|
||||
// validate loan charge is not already paid or waived
|
||||
if (loanCharge.isWaived()) {
|
||||
throw new LoanChargeCannotBeWaivedException(LOAN_CHARGE_CANNOT_BE_WAIVED_REASON.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (loanCharge.isPaid()) { throw new LoanChargeCannotBeWaivedException(LOAN_CHARGE_CANNOT_BE_WAIVED_REASON.ALREADY_PAID,
|
||||
throw new LoanChargeCannotBeWaivedException(LoanChargeCannotBeWaivedReason.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (loanCharge.isPaid()) { throw new LoanChargeCannotBeWaivedException(LoanChargeCannotBeWaivedReason.ALREADY_PAID,
|
||||
loanCharge.getId()); }
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_WAIVE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_WAIVE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
Integer loanInstallmentNumber = null;
|
||||
if (loanCharge.isInstalmentFee()) {
|
||||
LoanInstallmentCharge chargePerInstallment = null;
|
||||
@@ -1669,9 +1669,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
chargePerInstallment = loanCharge.getUnpaidInstallmentLoanCharge();
|
||||
}
|
||||
if (chargePerInstallment.isWaived()) {
|
||||
throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_WAIVED, loanCharge.getId());
|
||||
throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (chargePerInstallment.isPaid()) { throw new LoanChargeCannotBePayedException(
|
||||
LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_PAID, loanCharge.getId()); }
|
||||
LoanChargeCannotBePayedReason.ALREADY_PAID, loanCharge.getId()); }
|
||||
loanInstallmentNumber = chargePerInstallment.getRepaymentInstallment().getInstallmentNumber();
|
||||
}
|
||||
|
||||
@@ -1700,8 +1700,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_WAIVE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_WAIVE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -1725,14 +1725,14 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
// Charges may be deleted only when the loan associated with them are
|
||||
// yet to be approved (are in submitted and pending status)
|
||||
if (!loan.status().isSubmittedAndPendingApproval()) { throw new LoanChargeCannotBeDeletedException(
|
||||
LOAN_CHARGE_CANNOT_BE_DELETED_REASON.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanCharge.getId()); }
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_DELETE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
LoanChargeCannotBeDeletedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanCharge.getId()); }
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_DELETE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
|
||||
loan.removeLoanCharge(loanCharge);
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_DELETE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_CHARGE, loanCharge));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_DELETE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN_CHARGE, loanCharge));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(loanChargeId) //
|
||||
@@ -1758,17 +1758,17 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
// Charges may be waived only when the loan associated with them are
|
||||
// active
|
||||
if (!loan.status().isActive()) { throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.LOAN_INACTIVE,
|
||||
if (!loan.status().isActive()) { throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.LOAN_INACTIVE,
|
||||
loanCharge.getId()); }
|
||||
|
||||
// validate loan charge is not already paid or waived
|
||||
if (loanCharge.isWaived()) {
|
||||
throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (loanCharge.isPaid()) { throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_PAID,
|
||||
throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (loanCharge.isPaid()) { throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_PAID,
|
||||
loanCharge.getId()); }
|
||||
|
||||
if (!loanCharge.getChargePaymentMode().isPaymentModeAccountTransfer()) { throw new LoanChargeCannotBePayedException(
|
||||
LOAN_CHARGE_CANNOT_BE_PAYED_REASON.CHARGE_NOT_ACCOUNT_TRANSFER, loanCharge.getId()); }
|
||||
LoanChargeCannotBePayedReason.CHARGE_NOT_ACCOUNT_TRANSFER, loanCharge.getId()); }
|
||||
|
||||
final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate");
|
||||
|
||||
@@ -1789,9 +1789,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
chargePerInstallment = loanCharge.getUnpaidInstallmentLoanCharge();
|
||||
}
|
||||
if (chargePerInstallment.isWaived()) {
|
||||
throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_WAIVED, loanCharge.getId());
|
||||
throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (chargePerInstallment.isPaid()) { throw new LoanChargeCannotBePayedException(
|
||||
LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_PAID, loanCharge.getId()); }
|
||||
LoanChargeCannotBePayedReason.ALREADY_PAID, loanCharge.getId()); }
|
||||
loanInstallmentNumber = chargePerInstallment.getRepaymentInstallment().getInstallmentNumber();
|
||||
amount = chargePerInstallment.getAmountOutstanding();
|
||||
}
|
||||
@@ -1935,8 +1935,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
checkClientOrGroupActive(loan);
|
||||
validateTransactionsForTransfer(loan, transferDate);
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_INITIATE_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_INITIATE_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final List<Long> existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds());
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
||||
@@ -1950,8 +1950,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_INITIATE_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_INITIATE_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
return newTransferTransaction;
|
||||
}
|
||||
|
||||
@@ -1961,8 +1961,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final Staff loanOfficer) {
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
this.loanAssembler.setHelpers(loan) ;
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_ACCEPT_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_ACCEPT_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
final List<Long> existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds());
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
||||
|
||||
@@ -1982,8 +1982,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_ACCEPT_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_ACCEPT_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
return newTransferAcceptanceTransaction;
|
||||
}
|
||||
@@ -1993,8 +1993,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
public LoanTransaction withdrawLoanTransfer(final Loan loan, final LocalDate transferDate) {
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
this.loanAssembler.setHelpers(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_WITHDRAW_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_WITHDRAW_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final List<Long> existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds());
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
||||
@@ -2008,8 +2008,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_WITHDRAW_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_WITHDRAW_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
return newTransferAcceptanceTransaction;
|
||||
}
|
||||
@@ -2018,12 +2018,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
@Override
|
||||
public void rejectLoanTransfer(final Loan loan) {
|
||||
this.loanAssembler.setHelpers(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_REJECT_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REJECT_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
loan.setLoanStatus(LoanStatus.TRANSFER_ON_HOLD.getValue());
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REJECT_TRANSFER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REJECT_TRANSFER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -2041,15 +2041,15 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
if (!loan.hasLoanOfficer(fromLoanOfficer)) { throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); }
|
||||
|
||||
loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment);
|
||||
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -2079,16 +2079,16 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
for (final String loanIdString : loanIds) {
|
||||
final Long loanId = Long.valueOf(loanIdString);
|
||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
checkClientOrGroupActive(loan);
|
||||
|
||||
if (!loan.hasLoanOfficer(fromLoanOfficer)) { throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); }
|
||||
|
||||
loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment);
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REASSIGN_OFFICER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
this.loanRepositoryWrapper.flush();
|
||||
|
||||
@@ -2111,14 +2111,14 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
checkClientOrGroupActive(loan);
|
||||
|
||||
if (loan.getLoanOfficer() == null) { throw new LoanOfficerUnassignmentException(loanId); }
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_REMOVE_OFFICER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REMOVE_OFFICER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
loan.removeLoanOfficer(dateOfLoanOfficerunAssigned);
|
||||
|
||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_REMOVE_OFFICER,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_REMOVE_OFFICER,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -2477,8 +2477,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
&& loan.isFeeCompoundingEnabledForInterestRecalculation()) {
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_APPLY_OVERDUE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_APPLY_OVERDUE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2557,8 +2557,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
LocalDate recalculateFrom = DateUtils.getLocalDateOfTenant();
|
||||
|
||||
if (loan != null) {
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_APPLY_OVERDUE_CHARGE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_APPLY_OVERDUE_CHARGE,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
for (Map.Entry<Integer, LocalDate> entry : scheduleDates.entrySet()) {
|
||||
|
||||
final LoanCharge loanCharge = LoanCharge.createNewFromJson(loan, chargeDefinition, command, entry.getValue());
|
||||
@@ -2597,8 +2597,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
+ " update not allowed as loan status is not written off", loanId); }
|
||||
LocalDate recalculateFrom = null;
|
||||
LoanTransaction writeOffTransaction = loan.findWriteOffTransaction();
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_UNDO_WRITTEN_OFF,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, writeOffTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_UNDO_WRITTEN_OFF,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, writeOffTransaction));
|
||||
|
||||
ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
||||
|
||||
@@ -2615,8 +2615,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
if (writeOffTransaction != null) {
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_UNDO_WRITTEN_OFF,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_TRANSACTION, writeOffTransaction));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_UNDO_WRITTEN_OFF,
|
||||
constructEntityMap(BusinessEntity.LOAN_TRANSACTION, writeOffTransaction));
|
||||
}
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withOfficeId(loan.getOfficeId()) //
|
||||
@@ -2783,17 +2783,17 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
// Charges may be waived only when the loan associated with them are
|
||||
// active
|
||||
if (!loan.status().isActive()) { throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.LOAN_INACTIVE,
|
||||
if (!loan.status().isActive()) { throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.LOAN_INACTIVE,
|
||||
loanCharge.getId()); }
|
||||
|
||||
// validate loan charge is not already paid or waived
|
||||
if (loanCharge.isWaived()) {
|
||||
throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (loanCharge.isPaid()) { throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_PAID,
|
||||
throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (loanCharge.isPaid()) { throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_PAID,
|
||||
loanCharge.getId()); }
|
||||
|
||||
if (!loanCharge.getChargePaymentMode().isPaymentModeAccountTransfer()) { throw new LoanChargeCannotBePayedException(
|
||||
LOAN_CHARGE_CANNOT_BE_PAYED_REASON.CHARGE_NOT_ACCOUNT_TRANSFER, loanCharge.getId()); }
|
||||
LoanChargeCannotBePayedReason.CHARGE_NOT_ACCOUNT_TRANSFER, loanCharge.getId()); }
|
||||
|
||||
final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate");
|
||||
|
||||
@@ -2814,9 +2814,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
chargePerInstallment = loanCharge.getUnpaidInstallmentLoanCharge();
|
||||
}
|
||||
if (chargePerInstallment.isWaived()) {
|
||||
throw new LoanChargeCannotBePayedException(LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_WAIVED, loanCharge.getId());
|
||||
throw new LoanChargeCannotBePayedException(LoanChargeCannotBePayedReason.ALREADY_WAIVED, loanCharge.getId());
|
||||
} else if (chargePerInstallment.isPaid()) { throw new LoanChargeCannotBePayedException(
|
||||
LOAN_CHARGE_CANNOT_BE_PAYED_REASON.ALREADY_PAID, loanCharge.getId()); }
|
||||
LoanChargeCannotBePayedReason.ALREADY_PAID, loanCharge.getId()); }
|
||||
loanInstallmentNumber = chargePerInstallment.getRepaymentInstallment().getInstallmentNumber();
|
||||
amount = chargePerInstallment.getAmountOutstanding();
|
||||
}
|
||||
@@ -2845,8 +2845,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
LocalDate recalculateFrom = loan.fetchInterestRecalculateFromDate();
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_INTEREST_RECALCULATION,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_INTEREST_RECALCULATION,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<>();
|
||||
|
||||
@@ -2868,8 +2868,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
}
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.loanAccountDomainService.recalculateAccruals(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_INTEREST_RECALCULATION,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_INTEREST_RECALCULATION,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2975,8 +2975,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
return user;
|
||||
}
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
@@ -2990,8 +2990,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final LocalDate recalculateFromDate = loan.getLastRepaymentDate();
|
||||
validateIsMultiDisbursalLoanAndDisbursedMoreThanOneTranche(loan);
|
||||
checkClientOrGroupActive(loan);
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BUSINESS_EVENTS.LOAN_UNDO_LASTDISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_UNDO_LASTDISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
|
||||
final MonetaryCurrency currency = loan.getCurrency();
|
||||
final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency);
|
||||
@@ -3016,8 +3016,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(applicationCurrency.toData(),
|
||||
existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
this.journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_UNDO_LASTDISBURSAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN, loan));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_UNDO_LASTDISBURSAL,
|
||||
constructEntityMap(BusinessEntity.LOAN, loan));
|
||||
}
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
|
||||
+73
-73
@@ -33,7 +33,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -69,16 +69,16 @@ public final class LoanProductDataValidator {
|
||||
"accountingRule", "includeInBorrowerCycle", "startDate", "closeDate", "externalId", "isLinkedToFloatingInterestRates",
|
||||
"floatingRatesId", "interestRateDifferential", "minDifferentialLendingRate", "defaultDifferentialLendingRate",
|
||||
"maxDifferentialLendingRate", "isFloatingInterestRateCalculationAllowed", "syncExpectedWithDisbursementDate",
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(),
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), LoanProductConstants.useBorrowerCycleParameterName,
|
||||
LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), LoanProductAccountingParams.FUND_SOURCE.getValue(),
|
||||
LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(),
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(),
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), LoanProductAccountingParams.OVERPAYMENT.getValue(),
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(),
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(),
|
||||
LoanProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), LoanProductConstants.useBorrowerCycleParameterName,
|
||||
LoanProductConstants.principalVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.interestRateVariationsForBorrowerCycleParameterName,
|
||||
LoanProductConstants.numberOfRepaymentVariationsForBorrowerCycleParameterName, LoanProductConstants.shortName,
|
||||
@@ -553,49 +553,49 @@ public final class LoanProductDataValidator {
|
||||
|
||||
if (isCashBasedAccounting(accountingRuleType) || isAccrualBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(),
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.FUND_SOURCE.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).value(fundAccountId).notNull()
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.FUND_SOURCE.getValue()).value(fundAccountId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
|
||||
final Long loanPortfolioAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue()).value(loanPortfolioAccountId)
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.LOAN_PORTFOLIO.getValue()).value(loanPortfolioAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromInterestId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue()).value(incomeFromInterestId)
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INTEREST_ON_LOANS.getValue()).value(incomeFromInterestId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
LoanProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromRecoveryAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue())
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue())
|
||||
.value(incomeFromRecoveryAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long writeOffAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue()).value(writeOffAccountId)
|
||||
LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writeOffAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long overpaymentAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue()).value(overpaymentAccountId)
|
||||
LoanProductAccountingParams.OVERPAYMENT.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.OVERPAYMENT.getValue()).value(overpaymentAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
validatePaymentChannelFundSourceMappings(baseDataValidator, element);
|
||||
@@ -606,18 +606,18 @@ public final class LoanProductDataValidator {
|
||||
if (isAccrualBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long receivableInterestAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue())
|
||||
LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue())
|
||||
.value(receivableInterestAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivableFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue()).value(receivableFeeAccountId)
|
||||
LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.FEES_RECEIVABLE.getValue()).value(receivableFeeAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivablePenaltyAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue())
|
||||
LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue())
|
||||
.value(receivablePenaltyAccountId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
@@ -1408,63 +1408,63 @@ public final class LoanProductDataValidator {
|
||||
final Integer accountingRuleType = this.fromApiJsonHelper.extractIntegerNamed("accountingRule", element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter("accountingRule").value(accountingRuleType).ignoreIfNull().inMinMaxRange(1, 4);
|
||||
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).value(fundAccountId).ignoreIfNull()
|
||||
final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.FUND_SOURCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.FUND_SOURCE.getValue()).value(fundAccountId).ignoreIfNull()
|
||||
.integerGreaterThanZero();
|
||||
|
||||
final Long loanPortfolioAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue()).value(loanPortfolioAccountId)
|
||||
LoanProductAccountingParams.LOAN_PORTFOLIO.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.LOAN_PORTFOLIO.getValue()).value(loanPortfolioAccountId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromInterestId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue()).value(incomeFromInterestId)
|
||||
LoanProductAccountingParams.INTEREST_ON_LOANS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INTEREST_ON_LOANS.getValue()).value(incomeFromInterestId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromRecoveryAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_RECOVERY.getValue())
|
||||
LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INCOME_FROM_RECOVERY.getValue())
|
||||
.value(incomeFromRecoveryAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long writeOffAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue()).value(writeOffAccountId)
|
||||
LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writeOffAccountId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long overpaymentAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(),
|
||||
final Long overpaymentAccountId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.OVERPAYMENT.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue()).value(overpaymentAccountId)
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.OVERPAYMENT.getValue()).value(overpaymentAccountId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivableInterestAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue())
|
||||
LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.INTEREST_RECEIVABLE.getValue())
|
||||
.value(receivableInterestAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivableFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue()).value(receivableFeeAccountId)
|
||||
LoanProductAccountingParams.FEES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.FEES_RECEIVABLE.getValue()).value(receivableFeeAccountId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long receivablePenaltyAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue())
|
||||
LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(LoanProductAccountingParams.PENALTIES_RECEIVABLE.getValue())
|
||||
.value(receivablePenaltyAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
validatePaymentChannelFundSourceMappings(baseDataValidator, element);
|
||||
@@ -1503,29 +1503,29 @@ public final class LoanProductDataValidator {
|
||||
* Validation for advanced accounting options
|
||||
*/
|
||||
private void validatePaymentChannelFundSourceMappings(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element)) {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element)) {
|
||||
final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
if (paymentChannelMappingArray != null && paymentChannelMappingArray.size() > 0) {
|
||||
int i = 0;
|
||||
do {
|
||||
final JsonObject jsonObject = paymentChannelMappingArray.get(i).getAsJsonObject();
|
||||
final Long paymentTypeId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.getValue(), jsonObject);
|
||||
LoanProductAccountingParams.PAYMENT_TYPE.getValue(), jsonObject);
|
||||
final Long paymentSpecificFundAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), jsonObject);
|
||||
LoanProductAccountingParams.FUND_SOURCE.getValue(), jsonObject);
|
||||
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.getValue()).value(paymentTypeId).notNull()
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ LoanProductAccountingParams.PAYMENT_TYPE.getValue()).value(paymentTypeId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).value(paymentSpecificFundAccountId)
|
||||
LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ LoanProductAccountingParams.FUND_SOURCE.getValue()).value(paymentSpecificFundAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
i++;
|
||||
} while (i < paymentChannelMappingArray.size());
|
||||
@@ -1543,9 +1543,9 @@ public final class LoanProductDataValidator {
|
||||
final boolean isPenalty) {
|
||||
String parameterName;
|
||||
if (isPenalty) {
|
||||
parameterName = LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
parameterName = LoanProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
} else {
|
||||
parameterName = LOAN_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
parameterName = LoanProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(parameterName, element)) {
|
||||
@@ -1554,15 +1554,15 @@ public final class LoanProductDataValidator {
|
||||
int i = 0;
|
||||
do {
|
||||
final JsonObject jsonObject = chargeToIncomeAccountMappingArray.get(i).getAsJsonObject();
|
||||
final Long chargeId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue(),
|
||||
final Long chargeId = this.fromApiJsonHelper.extractLongNamed(LoanProductAccountingParams.CHARGE_ID.getValue(),
|
||||
jsonObject);
|
||||
final Long incomeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(), jsonObject);
|
||||
LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue(), jsonObject);
|
||||
baseDataValidator.reset()
|
||||
.parameter(parameterName + "[" + i + "]." + LOAN_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue())
|
||||
.parameter(parameterName + "[" + i + "]." + LoanProductAccountingParams.CHARGE_ID.getValue())
|
||||
.value(chargeId).notNull().integerGreaterThanZero();
|
||||
baseDataValidator.reset()
|
||||
.parameter(parameterName + "[" + i + "]." + LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue())
|
||||
.parameter(parameterName + "[" + i + "]." + LoanProductAccountingParams.INCOME_ACCOUNT_ID.getValue())
|
||||
.value(incomeAccountId).notNull().integerGreaterThanZero();
|
||||
i++;
|
||||
} while (i < chargeToIncomeAccountMappingArray.size());
|
||||
|
||||
+8
-8
@@ -37,8 +37,8 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
|
||||
import org.apache.fineract.portfolio.charge.domain.Charge;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.floatingrates.domain.FloatingRate;
|
||||
import org.apache.fineract.portfolio.floatingrates.domain.FloatingRateRepositoryWrapper;
|
||||
@@ -151,11 +151,11 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
|
||||
FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS,
|
||||
loanproduct.getId());
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_PRODUCT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_PRODUCT, loanproduct));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_PRODUCT_CREATE,
|
||||
constructEntityMap(BusinessEntity.LOAN_PRODUCT, loanproduct));
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.LOAN_PRODUCT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.LOAN_PRODUCT, loanproduct));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.LOAN_PRODUCT_CREATE,
|
||||
constructEntityMap(BusinessEntity.LOAN_PRODUCT, loanproduct));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -380,8 +380,8 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
|
||||
logger.error("Error occured.", dve);
|
||||
}
|
||||
|
||||
private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BusinessEventNotificationConstants.BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEventNotificationConstants.BusinessEntity, Object> constructEntityMap(final BusinessEventNotificationConstants.BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+9
-9
@@ -21,7 +21,7 @@ package org.apache.fineract.portfolio.savings;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
|
||||
public class DepositsApiConstants {
|
||||
|
||||
@@ -207,14 +207,14 @@ public class DepositsApiConstants {
|
||||
digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
|
||||
interestCalculationDaysInYearTypeParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
|
||||
accountingRuleParamName, chargesParamName, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), chartsParamName,
|
||||
accountingRuleParamName, chargesParamName, SavingProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(),
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(),
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(),
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(),
|
||||
SavingProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), chartsParamName,
|
||||
SavingsApiConstants.withHoldTaxParamName, SavingsApiConstants.taxGroupIdParamName));
|
||||
|
||||
private static final Set<String> PRECLOSURE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(preClosurePenalApplicableParamName,
|
||||
|
||||
+39
-39
@@ -71,7 +71,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -301,33 +301,33 @@ public class DepositProductDataValidator {
|
||||
if (isCashBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long savingsControlAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_CONTROL.getValue())
|
||||
.value(savingsControlAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long savingsReferenceAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue())
|
||||
.value(savingsReferenceAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long interestOnSavingsAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue())
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue())
|
||||
.value(interestOnSavingsAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
final Long incomeFromFeeId = fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue())
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue())
|
||||
.value(incomeFromPenaltyId).notNull().integerGreaterThanZero();
|
||||
|
||||
validatePaymentChannelFundSourceMappings(fromApiJsonHelper, baseDataValidator, element);
|
||||
@@ -510,33 +510,33 @@ public class DepositProductDataValidator {
|
||||
}
|
||||
|
||||
final Long savingsControlAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue()).value(savingsControlAccountId)
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_CONTROL.getValue()).value(savingsControlAccountId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long savingsReferenceAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue())
|
||||
.value(savingsReferenceAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long interestOnSavingsAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue())
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue())
|
||||
.value(interestOnSavingsAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
final Long incomeFromFeeId = fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
validatePaymentChannelFundSourceMappings(fromApiJsonHelper, baseDataValidator, element);
|
||||
@@ -615,27 +615,27 @@ public class DepositProductDataValidator {
|
||||
*/
|
||||
private void validatePaymentChannelFundSourceMappings(final FromJsonHelper fromApiJsonHelper,
|
||||
final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||
if (fromApiJsonHelper.parameterExists(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element)) {
|
||||
if (fromApiJsonHelper.parameterExists(SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element)) {
|
||||
final JsonArray paymentChannelMappingArray = fromApiJsonHelper.extractJsonArrayNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
if (paymentChannelMappingArray != null && paymentChannelMappingArray.size() > 0) {
|
||||
int i = 0;
|
||||
do {
|
||||
final JsonObject jsonObject = paymentChannelMappingArray.get(i).getAsJsonObject();
|
||||
final Long paymentTypeId = jsonObject.get(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue())
|
||||
final Long paymentTypeId = jsonObject.get(SavingProductAccountingParams.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(SavingProductAccountingParams.FUND_SOURCE.getValue())
|
||||
.getAsLong();
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.toString()).value(paymentTypeId).notNull()
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SavingProductAccountingParams.PAYMENT_TYPE.toString()).value(paymentTypeId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).value(paymentSpecificFundAccountId)
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SavingProductAccountingParams.FUND_SOURCE.getValue()).value(paymentSpecificFundAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
i++;
|
||||
} while (i < paymentChannelMappingArray.size());
|
||||
@@ -654,9 +654,9 @@ public class DepositProductDataValidator {
|
||||
final DataValidatorBuilder baseDataValidator, final JsonElement element, final boolean isPenalty) {
|
||||
String parameterName;
|
||||
if (isPenalty) {
|
||||
parameterName = SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
parameterName = SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
} else {
|
||||
parameterName = SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
parameterName = SavingProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
}
|
||||
|
||||
if (fromApiJsonHelper.parameterExists(parameterName, element)) {
|
||||
@@ -665,15 +665,15 @@ public class DepositProductDataValidator {
|
||||
int i = 0;
|
||||
do {
|
||||
final JsonObject jsonObject = chargeToIncomeAccountMappingArray.get(i).getAsJsonObject();
|
||||
final Long chargeId = fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue(),
|
||||
final Long chargeId = fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.CHARGE_ID.getValue(),
|
||||
jsonObject);
|
||||
final Long incomeAccountId = fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(), jsonObject);
|
||||
SavingProductAccountingParams.INCOME_ACCOUNT_ID.getValue(), jsonObject);
|
||||
baseDataValidator.reset()
|
||||
.parameter(parameterName + "[" + i + "]." + SAVINGS_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue())
|
||||
.parameter(parameterName + "[" + i + "]." + SavingProductAccountingParams.CHARGE_ID.getValue())
|
||||
.value(chargeId).notNull().integerGreaterThanZero();
|
||||
baseDataValidator.reset()
|
||||
.parameter(parameterName + "[" + i + "]." + SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue())
|
||||
.parameter(parameterName + "[" + i + "]." + SavingProductAccountingParams.INCOME_ACCOUNT_ID.getValue())
|
||||
.value(incomeAccountId).notNull().integerGreaterThanZero();
|
||||
i++;
|
||||
} while (i < chargeToIncomeAccountMappingArray.size());
|
||||
|
||||
+69
-69
@@ -62,7 +62,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -93,19 +93,19 @@ public class SavingsProductDataValidator {
|
||||
lockinPeriodFrequencyTypeParamName, SavingsApiConstants.withdrawalFeeAmountParamName,
|
||||
SavingsApiConstants.withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName,
|
||||
feeAmountParamName, feeOnMonthDayParamName, SavingsApiConstants.accountingRuleParamName,
|
||||
SavingsApiConstants.chargesParamName, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), isDormancyTrackingActiveParamName,
|
||||
SavingsApiConstants.chargesParamName, SavingProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(),
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(),
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(),
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(),
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(),
|
||||
SavingProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||
SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(),
|
||||
SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), isDormancyTrackingActiveParamName,
|
||||
daysToDormancyParamName, daysToInactiveParamName, daysToEscheatParamName, allowOverdraftParamName,
|
||||
overdraftLimitParamName, nominalAnnualInterestRateOverdraftParamName,
|
||||
minOverdraftForInterestCalculationParamName, SavingsApiConstants.minRequiredBalanceParamName,
|
||||
@@ -297,54 +297,54 @@ public class SavingsProductDataValidator {
|
||||
if (isCashBasedAccounting(accountingRuleType)) {
|
||||
|
||||
final Long savingsControlAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_CONTROL.getValue())
|
||||
.value(savingsControlAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long savingsReferenceAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue())
|
||||
.value(savingsReferenceAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long interestOnSavingsAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue())
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue())
|
||||
.value(interestOnSavingsAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
SavingProductAccountingParams.INCOME_FROM_FEES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue())
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue())
|
||||
.value(incomeFromPenaltyId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long overdraftControlAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||
SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||
.value(overdraftControlAccountId).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromInterest = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue())
|
||||
SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue())
|
||||
.value(incomeFromInterest).notNull().integerGreaterThanZero();
|
||||
|
||||
final Long writtenoff = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue()).value(writtenoff)
|
||||
SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writtenoff)
|
||||
.notNull().integerGreaterThanZero();
|
||||
|
||||
if(null != isDormancyActive && isDormancyActive){
|
||||
final Long escheatLiabilityAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue())
|
||||
SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue())
|
||||
.value(escheatLiabilityAccountId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
@@ -473,48 +473,48 @@ public class SavingsProductDataValidator {
|
||||
}
|
||||
|
||||
final Long savingsControlAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue()).value(savingsControlAccountId)
|
||||
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_CONTROL.getValue()).value(savingsControlAccountId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long savingsReferenceAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue())
|
||||
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue())
|
||||
.value(savingsReferenceAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue())
|
||||
SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||
.value(transfersInSuspenseAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long interestOnSavingsAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue())
|
||||
SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue())
|
||||
.value(interestOnSavingsAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
final Long incomeFromFeeId = this.fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_FEES.getValue()).value(incomeFromFeeId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromPenaltyId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue()).value(incomeFromPenaltyId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long overdraftAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||
SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||
.value(overdraftAccountId).ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long incomeFromInterest = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue()).value(incomeFromInterest)
|
||||
SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue()).value(incomeFromInterest)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
final Long writtenoff = this.fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(),
|
||||
final Long writtenoff = this.fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||
element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue()).value(writtenoff)
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writtenoff)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
|
||||
//dormancy
|
||||
@@ -545,10 +545,10 @@ public class SavingsProductDataValidator {
|
||||
baseDataValidator.reset().parameter(daysToEscheatParamName).value(daysToEsc).longGreaterThanNumber(daysToDor);
|
||||
}
|
||||
|
||||
if(this.fromApiJsonHelper.parameterExists(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), element)){
|
||||
if(this.fromApiJsonHelper.parameterExists(SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), element)){
|
||||
final Long escheatLiabilityAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.ESCHEAT_LIABILITY.getValue())
|
||||
SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), element);
|
||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue())
|
||||
.value(escheatLiabilityAccountId).notNull().integerGreaterThanZero();
|
||||
}
|
||||
}
|
||||
@@ -581,28 +581,28 @@ public class SavingsProductDataValidator {
|
||||
* Validation for advanced accounting options
|
||||
*/
|
||||
private void validatePaymentChannelFundSourceMappings(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||
if (this.fromApiJsonHelper.parameterExists(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
if (this.fromApiJsonHelper.parameterExists(SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
element)) {
|
||||
final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
|
||||
if (paymentChannelMappingArray != null && paymentChannelMappingArray.size() > 0) {
|
||||
int i = 0;
|
||||
do {
|
||||
final JsonObject jsonObject = paymentChannelMappingArray.get(i).getAsJsonObject();
|
||||
final Long paymentTypeId = jsonObject.get(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue())
|
||||
final Long paymentTypeId = jsonObject.get(SavingProductAccountingParams.PAYMENT_TYPE.getValue()).getAsLong();
|
||||
final Long paymentSpecificFundAccountId = jsonObject.get(SavingProductAccountingParams.FUND_SOURCE.getValue())
|
||||
.getAsLong();
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_TYPE.toString()).value(paymentTypeId).notNull()
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SavingProductAccountingParams.PAYMENT_TYPE.toString()).value(paymentTypeId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
baseDataValidator
|
||||
.reset()
|
||||
.parameter(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue()).value(paymentSpecificFundAccountId)
|
||||
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue() + "[" + i + "]."
|
||||
+ SavingProductAccountingParams.FUND_SOURCE.getValue()).value(paymentSpecificFundAccountId)
|
||||
.notNull().integerGreaterThanZero();
|
||||
i++;
|
||||
} while (i < paymentChannelMappingArray.size());
|
||||
@@ -620,9 +620,9 @@ public class SavingsProductDataValidator {
|
||||
final boolean isPenalty) {
|
||||
String parameterName;
|
||||
if (isPenalty) {
|
||||
parameterName = SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
parameterName = SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
} else {
|
||||
parameterName = SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
parameterName = SavingProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(parameterName, element)) {
|
||||
@@ -631,15 +631,15 @@ public class SavingsProductDataValidator {
|
||||
int i = 0;
|
||||
do {
|
||||
final JsonObject jsonObject = chargeToIncomeAccountMappingArray.get(i).getAsJsonObject();
|
||||
final Long chargeId = this.fromApiJsonHelper.extractLongNamed(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue(),
|
||||
final Long chargeId = this.fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.CHARGE_ID.getValue(),
|
||||
jsonObject);
|
||||
final Long incomeAccountId = this.fromApiJsonHelper.extractLongNamed(
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue(), jsonObject);
|
||||
SavingProductAccountingParams.INCOME_ACCOUNT_ID.getValue(), jsonObject);
|
||||
baseDataValidator.reset()
|
||||
.parameter(parameterName + "[" + i + "]." + SAVINGS_PRODUCT_ACCOUNTING_PARAMS.CHARGE_ID.getValue())
|
||||
.parameter(parameterName + "[" + i + "]." + SavingProductAccountingParams.CHARGE_ID.getValue())
|
||||
.value(chargeId).notNull().integerGreaterThanZero();
|
||||
baseDataValidator.reset()
|
||||
.parameter(parameterName + "[" + i + "]." + SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_ACCOUNT_ID.getValue())
|
||||
.parameter(parameterName + "[" + i + "]." + SavingProductAccountingParams.INCOME_ACCOUNT_ID.getValue())
|
||||
.value(incomeAccountId).notNull().integerGreaterThanZero();
|
||||
i++;
|
||||
} while (i < chargeToIncomeAccountMappingArray.size());
|
||||
|
||||
+8
-8
@@ -33,8 +33,8 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrencyRepositoryWrapper;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
|
||||
@@ -121,8 +121,8 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
||||
this.savingsAccountRepository.save(account);
|
||||
|
||||
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds, transactionBooleanValues.isAccountTransfer());
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_WITHDRAWAL,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVINGS_TRANSACTION, withdrawal));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_WITHDRAWAL,
|
||||
constructEntityMap(BusinessEntity.SAVINGS_TRANSACTION, withdrawal));
|
||||
return withdrawal;
|
||||
}
|
||||
|
||||
@@ -182,8 +182,8 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
||||
this.savingsAccountRepository.saveAndFlush(account);
|
||||
|
||||
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_DEPOSIT,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVINGS_TRANSACTION, deposit));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_DEPOSIT,
|
||||
constructEntityMap(BusinessEntity.SAVINGS_TRANSACTION, deposit));
|
||||
return deposit;
|
||||
}
|
||||
|
||||
@@ -230,8 +230,8 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
||||
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
}
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
|
||||
|
||||
public class PostInterestAsOnDateException extends AbstractPlatformDomainRuleException{
|
||||
public static enum PostInterestAsOnException_TYPE {
|
||||
public static enum PostInterestAsOnExceptionType {
|
||||
FUTURE_DATE, VALID_DATE, ACTIVATION_DATE, LAST_TRANSACTION_DATE;
|
||||
public String errorMessage() {
|
||||
if (name().toString().equalsIgnoreCase("FUTURE_DATE")) {
|
||||
@@ -53,7 +53,7 @@ public class PostInterestAsOnDateException extends AbstractPlatformDomainRuleExc
|
||||
}
|
||||
|
||||
|
||||
public PostInterestAsOnDateException(final PostInterestAsOnException_TYPE reason) {
|
||||
public PostInterestAsOnDateException(final PostInterestAsOnExceptionType reason) {
|
||||
super(reason.errorCode(), reason.errorMessage());
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -65,8 +65,8 @@ import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
@@ -232,11 +232,11 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
}
|
||||
|
||||
final Long savingsId = account.getId();
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BUSINESS_EVENTS.FIXED_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.DEPOSIT_ACCOUNT, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BusinessEvents.FIXED_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BusinessEntity.DEPOSIT_ACCOUNT, account));
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BUSINESS_EVENTS.FIXED_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.DEPOSIT_ACCOUNT, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BusinessEvents.FIXED_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BusinessEntity.DEPOSIT_ACCOUNT, account));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -295,11 +295,11 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
financialYearBeginningMonth);
|
||||
account.validateApplicableInterestRate();
|
||||
this.savingAccountRepository.save(account);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BUSINESS_EVENTS.RECURRING_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.DEPOSIT_ACCOUNT, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BusinessEvents.RECURRING_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BusinessEntity.DEPOSIT_ACCOUNT, account));
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BUSINESS_EVENTS.RECURRING_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.DEPOSIT_ACCOUNT, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted( BusinessEvents.RECURRING_DEPOSIT_ACCOUNT_CREATE,
|
||||
constructEntityMap(BusinessEntity.DEPOSIT_ACCOUNT, account));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -786,8 +786,8 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
}
|
||||
}
|
||||
|
||||
private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEventNotificationConstants.BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+15
-15
@@ -76,8 +76,8 @@ import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
import org.apache.fineract.portfolio.group.exception.GroupNotActiveException;
|
||||
@@ -106,7 +106,7 @@ import org.apache.fineract.portfolio.savings.domain.SavingsAccountStatusType;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionRepository;
|
||||
import org.apache.fineract.portfolio.savings.exception.PostInterestAsOnDateException;
|
||||
import org.apache.fineract.portfolio.savings.exception.PostInterestAsOnDateException.PostInterestAsOnException_TYPE;
|
||||
import org.apache.fineract.portfolio.savings.exception.PostInterestAsOnDateException.PostInterestAsOnExceptionType;
|
||||
import org.apache.fineract.portfolio.savings.exception.PostInterestClosingDateException;
|
||||
import org.apache.fineract.portfolio.savings.exception.SavingsAccountClosingNotAllowedException;
|
||||
import org.apache.fineract.portfolio.savings.exception.SavingsAccountTransactionNotFoundException;
|
||||
@@ -256,8 +256,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
}
|
||||
|
||||
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_ACTIVATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVING, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_ACTIVATE,
|
||||
constructEntityMap(BusinessEntity.SAVING, account));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withEntityId(savingsId) //
|
||||
@@ -508,23 +508,23 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
|
||||
if (transactionDate == null) {
|
||||
|
||||
throw new PostInterestAsOnDateException(PostInterestAsOnException_TYPE.VALID_DATE); }
|
||||
throw new PostInterestAsOnDateException(PostInterestAsOnExceptionType.VALID_DATE); }
|
||||
if (transactionDate.isBefore(account.accountSubmittedOrActivationDate())) { throw new PostInterestAsOnDateException(
|
||||
PostInterestAsOnException_TYPE.ACTIVATION_DATE); }
|
||||
PostInterestAsOnExceptionType.ACTIVATION_DATE); }
|
||||
List<SavingsAccountTransaction> savingTransactions = account.getTransactions();
|
||||
for (SavingsAccountTransaction savingTransaction : savingTransactions) {
|
||||
if (transactionDate.toDate().before(savingTransaction
|
||||
.getDateOf())) { throw new PostInterestAsOnDateException(PostInterestAsOnException_TYPE.LAST_TRANSACTION_DATE); }
|
||||
.getDateOf())) { throw new PostInterestAsOnDateException(PostInterestAsOnExceptionType.LAST_TRANSACTION_DATE); }
|
||||
}
|
||||
|
||||
LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||
if (transactionDate.isAfter(today)) { throw new PostInterestAsOnDateException(PostInterestAsOnException_TYPE.FUTURE_DATE); }
|
||||
if (transactionDate.isAfter(today)) { throw new PostInterestAsOnDateException(PostInterestAsOnExceptionType.FUTURE_DATE); }
|
||||
|
||||
}
|
||||
postInterest(account, postInterestAs, transactionDate);
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_POST_INTEREST,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVING, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_POST_INTEREST,
|
||||
constructEntityMap(BusinessEntity.SAVING, account));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withEntityId(savingsId) //
|
||||
.withOfficeId(account.officeId()) //
|
||||
@@ -851,8 +851,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
|
||||
}
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_CLOSE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVING, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_CLOSE,
|
||||
constructEntityMap(BusinessEntity.SAVING, account));
|
||||
// disable all standing orders linked to the savings account
|
||||
this.disableStandingInstructionsLinkedToClosedSavings(account);
|
||||
return new CommandProcessingResultBuilder() //
|
||||
@@ -1510,8 +1510,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
}
|
||||
}
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+10
-10
@@ -58,8 +58,8 @@ import org.apache.fineract.portfolio.client.domain.AccountNumberGenerator;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
import org.apache.fineract.portfolio.group.domain.GroupRepository;
|
||||
@@ -307,8 +307,8 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
EntityTables.SAVING.getName(), StatusEnum.CREATE.getCode().longValue(),
|
||||
EntityTables.SAVING.getForeignKeyColumnNameOnDatatable(), account.productId());
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVING, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_CREATE,
|
||||
constructEntityMap(BusinessEntity.SAVING, account));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -533,8 +533,8 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
}
|
||||
}
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_APPROVE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVING, savingsAccount));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_APPROVE,
|
||||
constructEntityMap(BusinessEntity.SAVING, savingsAccount));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -656,8 +656,8 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
this.noteRepository.save(note);
|
||||
}
|
||||
}
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SAVINGS_REJECT,
|
||||
constructEntityMap(BUSINESS_ENTITY.SAVING, savingsAccount));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SAVINGS_REJECT,
|
||||
constructEntityMap(BusinessEntity.SAVING, savingsAccount));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(savingsId) //
|
||||
@@ -754,8 +754,8 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
|
||||
}
|
||||
|
||||
|
||||
private Map<BUSINESS_ENTITY, Object> constructEntityMap(final BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEntity, Object> constructEntityMap(final BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+12
-12
@@ -23,19 +23,19 @@ import java.util.Set;
|
||||
|
||||
public class SearchConstants {
|
||||
|
||||
public static enum SEARCH_RESPONSE_PARAMETERS {
|
||||
public static enum SearchResponseParameters {
|
||||
ENTITY_ID("entityId"), ENTITY_ACCOUNT_NO("entityAccountNo"), ENTITY_EXTERNAL_ID("entityExternalId"), ENTITY_NAME("entityName"), ENTITY_TYPE(
|
||||
"entityType"), PARENT_ID("parentId"), PARENT_NAME("parentName"),ENTITY_MOBILE_NO("entityMobileNo"), ENTITY_STATUS("entityStatus");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SEARCH_RESPONSE_PARAMETERS(final String value) {
|
||||
private SearchResponseParameters(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final SEARCH_RESPONSE_PARAMETERS param : SEARCH_RESPONSE_PARAMETERS.values()) {
|
||||
for (final SearchResponseParameters param : SearchResponseParameters.values()) {
|
||||
values.add(param.value);
|
||||
}
|
||||
}
|
||||
@@ -54,18 +54,18 @@ public class SearchConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SEARCH_SUPPORTED_PARAMETERS {
|
||||
public static enum SearchSupportedParameters {
|
||||
QUERY("query"), RESOURCE("resource"),EXACTMATCH("exactMatch");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SEARCH_SUPPORTED_PARAMETERS(final String value) {
|
||||
private SearchSupportedParameters(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final SEARCH_SUPPORTED_PARAMETERS param : SEARCH_SUPPORTED_PARAMETERS.values()) {
|
||||
for (final SearchSupportedParameters param : SearchSupportedParameters.values()) {
|
||||
values.add(param.value);
|
||||
}
|
||||
}
|
||||
@@ -84,18 +84,18 @@ public class SearchConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SEARCH_SUPPORTED_RESOURCES {
|
||||
public static enum SearchSupportedResources {
|
||||
CLIENTS("clients"), GROUPS("groups"), LOANS("loans"), SAVINGS("savings"), SHARES("shares"), CLIENTIDENTIFIERS("clientIdentifiers");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SEARCH_SUPPORTED_RESOURCES(final String value) {
|
||||
private SearchSupportedResources(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final SEARCH_SUPPORTED_RESOURCES param : SEARCH_SUPPORTED_RESOURCES.values()) {
|
||||
for (final SearchSupportedResources param : SearchSupportedResources.values()) {
|
||||
values.add(param.value);
|
||||
}
|
||||
}
|
||||
@@ -114,18 +114,18 @@ public class SearchConstants {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SEARCH_LOAN_DATE {
|
||||
public static enum SearchLoanDate {
|
||||
APPROVAL_DATE("approvalDate"), CREATED_DATE("createdDate"), DISBURSAL_DATE("disbursalDate");
|
||||
|
||||
private final String value;
|
||||
|
||||
private SEARCH_LOAN_DATE(final String value) {
|
||||
private SearchLoanDate(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private static final Set<String> values = new HashSet<>();
|
||||
static {
|
||||
for (final SEARCH_LOAN_DATE param : SEARCH_LOAN_DATE.values()) {
|
||||
for (final SearchLoanDate param : SearchLoanDate.values()) {
|
||||
values.add(param.value);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ import javax.ws.rs.core.UriInfo;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.portfolio.search.SearchConstants.SEARCH_RESPONSE_PARAMETERS;
|
||||
import org.apache.fineract.portfolio.search.SearchConstants.SearchResponseParameters;
|
||||
import org.apache.fineract.portfolio.search.data.AdHocQueryDataValidator;
|
||||
import org.apache.fineract.portfolio.search.data.AdHocQuerySearchConditions;
|
||||
import org.apache.fineract.portfolio.search.data.AdHocSearchQueryData;
|
||||
@@ -62,7 +62,7 @@ import org.springframework.stereotype.Component;
|
||||
})
|
||||
public class SearchApiResource {
|
||||
|
||||
private final Set<String> searchResponseParameters = SEARCH_RESPONSE_PARAMETERS.getAllValues();
|
||||
private final Set<String> searchResponseParameters = SearchResponseParameters.getAllValues();
|
||||
|
||||
private final SearchReadPlatformService searchReadPlatformService;
|
||||
private final ToApiJsonSerializer<Object> toApiJsonSerializer;
|
||||
|
||||
+7
-7
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.search.data;
|
||||
|
||||
import org.apache.fineract.portfolio.search.SearchConstants.SEARCH_SUPPORTED_RESOURCES;
|
||||
import org.apache.fineract.portfolio.search.SearchConstants.SearchSupportedResources;
|
||||
|
||||
public class SearchConditions {
|
||||
|
||||
@@ -37,17 +37,17 @@ public class SearchConditions {
|
||||
this.searchResource = searchResource;
|
||||
this.exactMatch=exactMatch;
|
||||
this.clientSearch = (null == searchResource || searchResource.toLowerCase().contains(
|
||||
SEARCH_SUPPORTED_RESOURCES.CLIENTS.name().toLowerCase())) ? true : false;
|
||||
SearchSupportedResources.CLIENTS.name().toLowerCase())) ? true : false;
|
||||
this.groupSearch = (null == searchResource || searchResource.toLowerCase().contains(
|
||||
SEARCH_SUPPORTED_RESOURCES.GROUPS.name().toLowerCase())) ? true : false;
|
||||
SearchSupportedResources.GROUPS.name().toLowerCase())) ? true : false;
|
||||
this.loanSeach = (null == searchResource || searchResource.toLowerCase().contains(
|
||||
SEARCH_SUPPORTED_RESOURCES.LOANS.name().toLowerCase())) ? true : false;
|
||||
SearchSupportedResources.LOANS.name().toLowerCase())) ? true : false;
|
||||
this.savingSeach = (null == searchResource || searchResource.toLowerCase().contains(
|
||||
SEARCH_SUPPORTED_RESOURCES.SAVINGS.name().toLowerCase())) ? true : false;
|
||||
SearchSupportedResources.SAVINGS.name().toLowerCase())) ? true : false;
|
||||
this.shareSeach = (null == searchResource || searchResource.toLowerCase().contains(
|
||||
SEARCH_SUPPORTED_RESOURCES.SHARES.name().toLowerCase())) ? true : false;
|
||||
SearchSupportedResources.SHARES.name().toLowerCase())) ? true : false;
|
||||
this.clientIdentifierSearch = (null == searchResource || searchResource.toLowerCase().contains(
|
||||
SEARCH_SUPPORTED_RESOURCES.CLIENTIDENTIFIERS.name().toLowerCase())) ? true : false;
|
||||
SearchSupportedResources.CLIENTIDENTIFIERS.name().toLowerCase())) ? true : false;
|
||||
}
|
||||
|
||||
public SearchConditions(final String searchQueryParam, final String searchResource, final Boolean clientSearch,
|
||||
|
||||
+3
-3
@@ -243,17 +243,17 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(searchConditions.getLoanDateOption())) {
|
||||
if (searchConditions.getLoanDateOption().equals(SearchConstants.SEARCH_LOAN_DATE.APPROVAL_DATE.getValue())) {
|
||||
if (searchConditions.getLoanDateOption().equals(SearchConstants.SearchLoanDate.APPROVAL_DATE.getValue())) {
|
||||
checkAndUpdateWhereClause(sql);
|
||||
params.addValue("loanFromDate", searchConditions.getLoanFromDate().toDate());
|
||||
params.addValue("loanToDate", searchConditions.getLoanToDate().toDate());
|
||||
sql.append(" ( ml.approvedon_date between :loanFromDate and :loanToDate ) ");
|
||||
} else if (searchConditions.getLoanDateOption().equals(SearchConstants.SEARCH_LOAN_DATE.CREATED_DATE.getValue())) {
|
||||
} else if (searchConditions.getLoanDateOption().equals(SearchConstants.SearchLoanDate.CREATED_DATE.getValue())) {
|
||||
checkAndUpdateWhereClause(sql);
|
||||
params.addValue("loanFromDate", searchConditions.getLoanFromDate().toDate());
|
||||
params.addValue("loanToDate", searchConditions.getLoanToDate().toDate());
|
||||
sql.append(" ( ml.submittedon_date between :loanFromDate and :loanToDate ) ");
|
||||
} else if (searchConditions.getLoanDateOption().equals(SearchConstants.SEARCH_LOAN_DATE.DISBURSAL_DATE.getValue())) {
|
||||
} else if (searchConditions.getLoanDateOption().equals(SearchConstants.SearchLoanDate.DISBURSAL_DATE.getValue())) {
|
||||
checkAndUpdateWhereClause(sql);
|
||||
params.addValue("loanFromDate", searchConditions.getLoanFromDate().toDate());
|
||||
params.addValue("loanToDate", searchConditions.getLoanToDate().toDate());
|
||||
|
||||
+8
-8
@@ -43,8 +43,8 @@ import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.portfolio.accounts.constants.ShareAccountApiConstants;
|
||||
import org.apache.fineract.portfolio.client.domain.AccountNumberGenerator;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.note.domain.Note;
|
||||
import org.apache.fineract.portfolio.note.domain.NoteRepository;
|
||||
@@ -108,8 +108,8 @@ public class ShareAccountWritePlatformServiceJpaRepositoryImpl implements ShareA
|
||||
journalEntryWritePlatformService.createJournalEntriesForShares(populateJournalEntries(account,
|
||||
account.getPendingForApprovalSharePurchaseTransactions()));
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SHARE_ACCOUNT_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SHARE_ACCOUNT, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SHARE_ACCOUNT_CREATE,
|
||||
constructEntityMap(BusinessEntity.SHARE_ACCOUNT, account));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(jsonCommand.commandId()) //
|
||||
@@ -284,8 +284,8 @@ public class ShareAccountWritePlatformServiceJpaRepositoryImpl implements ShareA
|
||||
|
||||
this.journalEntryWritePlatformService.createJournalEntriesForShares(populateJournalEntries(account, journalTransactions));
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SHARE_ACCOUNT_APPROVE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SHARE_ACCOUNT, account));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SHARE_ACCOUNT_APPROVE,
|
||||
constructEntityMap(BusinessEntity.SHARE_ACCOUNT, account));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(jsonCommand.commandId()) //
|
||||
@@ -531,8 +531,8 @@ public class ShareAccountWritePlatformServiceJpaRepositoryImpl implements ShareA
|
||||
"Unknown data integrity issue with resource.");
|
||||
}
|
||||
|
||||
private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BusinessEventNotificationConstants.BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEventNotificationConstants.BusinessEntity, Object> constructEntityMap(final BusinessEventNotificationConstants.BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
+4
-4
@@ -82,10 +82,10 @@ public class ShareProductDataSerializer {
|
||||
ShareProductApiConstants.minimumactiveperiodfordividends_paramname,
|
||||
ShareProductApiConstants.minimumactiveperiodfrequencytype_paramname,
|
||||
ShareProductApiConstants.sharecapital_paramname, ShareProductApiConstants.accountingRuleParamName,
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(),
|
||||
AccountingConstants.SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue()));
|
||||
AccountingConstants.SharesProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||
AccountingConstants.SharesProductAccountingParams.SHARES_EQUITY.getValue(),
|
||||
AccountingConstants.SharesProductAccountingParams.SHARES_REFERENCE.getValue(),
|
||||
AccountingConstants.SharesProductAccountingParams.SHARES_SUSPENSE.getValue()));
|
||||
|
||||
private static final Set<String> supportedParametersForDivident = new HashSet<>(Arrays.asList(
|
||||
ShareProductApiConstants.locale_paramname, ShareProductApiConstants.dateFormatParamName,
|
||||
|
||||
+6
-6
@@ -31,8 +31,8 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_ENTITY;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BUSINESS_EVENTS;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEntity;
|
||||
import org.apache.fineract.portfolio.common.BusinessEventNotificationConstants.BusinessEvents;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.shareproducts.constants.ShareProductApiConstants;
|
||||
import org.apache.fineract.portfolio.shareproducts.domain.ShareProduct;
|
||||
@@ -146,8 +146,8 @@ public class ShareProductWritePlatformServiceJpaRepositoryImpl implements ShareP
|
||||
this.shareProductDividentPayOutDetailsRepository.save(dividendPayOutDetails);
|
||||
|
||||
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BUSINESS_EVENTS.SHARE_PRODUCT_DIVIDENDS_CREATE,
|
||||
constructEntityMap(BUSINESS_ENTITY.SHARE_PRODUCT, productId));
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.SHARE_PRODUCT_DIVIDENDS_CREATE,
|
||||
constructEntityMap(BusinessEntity.SHARE_PRODUCT, productId));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(jsonCommand.commandId()) //
|
||||
@@ -213,8 +213,8 @@ public class ShareProductWritePlatformServiceJpaRepositoryImpl implements ShareP
|
||||
"Unknown data integrity issue with resource.");
|
||||
}
|
||||
|
||||
private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BusinessEventNotificationConstants.BUSINESS_ENTITY entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> map = new HashMap<>(1);
|
||||
private Map<BusinessEventNotificationConstants.BusinessEntity, Object> constructEntityMap(final BusinessEventNotificationConstants.BusinessEntity entityEvent, Object entity) {
|
||||
Map<BusinessEventNotificationConstants.BusinessEntity, Object> map = new HashMap<>(1);
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user