applying format across the project and fixing all warnings
Conflicts: mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAssembler.java mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsApplicationProcessWritePlatformService.java mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java
This commit is contained in:
+10
-15
@@ -109,9 +109,8 @@ public class AccountingConstants {
|
|||||||
public static enum LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS {
|
public static enum LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS {
|
||||||
FUND_SOURCE("fundSourceAccount"), LOAN_PORTFOLIO("loanPortfolioAccount"), INTEREST_ON_LOANS("interestOnLoanAccount"), INCOME_FROM_FEES(
|
FUND_SOURCE("fundSourceAccount"), LOAN_PORTFOLIO("loanPortfolioAccount"), INTEREST_ON_LOANS("interestOnLoanAccount"), INCOME_FROM_FEES(
|
||||||
"incomeFromFeeAccount"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccount"), LOSSES_WRITTEN_OFF("writeOffAccount"), OVERPAYMENT(
|
"incomeFromFeeAccount"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccount"), LOSSES_WRITTEN_OFF("writeOffAccount"), OVERPAYMENT(
|
||||||
"overpaymentLiabilityAccount"), INTEREST_RECEIVABLE("receivableInterestAccount"), FEES_RECEIVABLE(
|
"overpaymentLiabilityAccount"), INTEREST_RECEIVABLE("receivableInterestAccount"), FEES_RECEIVABLE("receivableFeeAccount"), PENALTIES_RECEIVABLE(
|
||||||
"receivableFeeAccount"), PENALTIES_RECEIVABLE("receivablePenaltyAccount"), TRANSFERS_SUSPENSE(
|
"receivablePenaltyAccount"), TRANSFERS_SUSPENSE("transfersInSuspenseAccount"), INCOME_ACCOUNT_ID("incomeAccount");
|
||||||
"transfersInSuspenseAccount"), INCOME_ACCOUNT_ID("incomeAccount");
|
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
@@ -129,12 +128,10 @@ public class AccountingConstants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*** Accounting placeholders for cash based accounting for savings products ***/
|
/*** Accounting placeholders for cash based accounting for savings products ***/
|
||||||
public static enum CASH_ACCOUNTS_FOR_SAVINGS {
|
public static enum CASH_ACCOUNTS_FOR_SAVINGS {
|
||||||
SAVINGS_REFERENCE(1), SAVINGS_CONTROL(2), INTEREST_ON_SAVINGS(3), INCOME_FROM_FEES(4), INCOME_FROM_PENALTIES(5), TRANSFERS_SUSPENSE(
|
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),
|
10), OVERDRAFT_PORTFOLIO_CONTROL(11), INCOME_FROM_INTEREST(12), LOSSES_WRITTEN_OFF(13);
|
||||||
LOSSES_WRITTEN_OFF(13);
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
|
|
||||||
@@ -174,8 +171,8 @@ public class AccountingConstants {
|
|||||||
"interestOnSavingsAccountId"), PAYMENT_CHANNEL_FUND_SOURCE_MAPPING("paymentChannelToFundSourceMappings"), PAYMENT_TYPE(
|
"interestOnSavingsAccountId"), PAYMENT_CHANNEL_FUND_SOURCE_MAPPING("paymentChannelToFundSourceMappings"), PAYMENT_TYPE(
|
||||||
"paymentTypeId"), FUND_SOURCE("fundSourceAccountId"), TRANSFERS_SUSPENSE("transfersInSuspenseAccountId"), FEE_INCOME_ACCOUNT_MAPPING(
|
"paymentTypeId"), FUND_SOURCE("fundSourceAccountId"), TRANSFERS_SUSPENSE("transfersInSuspenseAccountId"), FEE_INCOME_ACCOUNT_MAPPING(
|
||||||
"feeToIncomeAccountMappings"), PENALTY_INCOME_ACCOUNT_MAPPING("penaltyToIncomeAccountMappings"), CHARGE_ID("chargeId"), INCOME_ACCOUNT_ID(
|
"feeToIncomeAccountMappings"), PENALTY_INCOME_ACCOUNT_MAPPING("penaltyToIncomeAccountMappings"), CHARGE_ID("chargeId"), INCOME_ACCOUNT_ID(
|
||||||
"incomeAccountId"),OVERDRAFT_PORTFOLIO_CONTROL("overdraftPortfolioControlId"),INCOME_FROM_INTEREST("incomeFromInterestId"),
|
"incomeAccountId"), OVERDRAFT_PORTFOLIO_CONTROL("overdraftPortfolioControlId"), INCOME_FROM_INTEREST("incomeFromInterestId"), LOSSES_WRITTEN_OFF(
|
||||||
LOSSES_WRITTEN_OFF("writeOffAccountId");
|
"writeOffAccountId");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
@@ -194,12 +191,11 @@ public class AccountingConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static enum SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS {
|
public static enum SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS {
|
||||||
SAVINGS_REFERENCE("savingsReferenceAccount"), SAVINGS_CONTROL("savingsControlAccount"), INCOME_FROM_FEES(
|
SAVINGS_REFERENCE("savingsReferenceAccount"), SAVINGS_CONTROL("savingsControlAccount"), INCOME_FROM_FEES("incomeFromFeeAccount"), INCOME_FROM_PENALTIES(
|
||||||
"incomeFromFeeAccount"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccount"), INTEREST_ON_SAVINGS(
|
"incomeFromPenaltyAccount"), INTEREST_ON_SAVINGS("interestOnSavingsAccount"), PAYMENT_TYPE("paymentType"), FUND_SOURCE(
|
||||||
"interestOnSavingsAccount"), PAYMENT_TYPE("paymentType"), FUND_SOURCE("fundSourceAccount"),
|
"fundSourceAccount"), TRANSFERS_SUSPENSE("transfersInSuspenseAccount"), PENALTY_INCOME_ACCOUNT_MAPPING(
|
||||||
TRANSFERS_SUSPENSE("transfersInSuspenseAccount"), PENALTY_INCOME_ACCOUNT_MAPPING("penaltyToIncomeAccountMappings"), CHARGE_ID("charge"), INCOME_ACCOUNT_ID(
|
"penaltyToIncomeAccountMappings"), CHARGE_ID("charge"), INCOME_ACCOUNT_ID("incomeAccount"), OVERDRAFT_PORTFOLIO_CONTROL(
|
||||||
"incomeAccount"),OVERDRAFT_PORTFOLIO_CONTROL("overdraftPortfolioControl"),INCOME_FROM_INTEREST("incomeFromInterest"),
|
"overdraftPortfolioControl"), INCOME_FROM_INTEREST("incomeFromInterest"), LOSSES_WRITTEN_OFF("writeOffAccount");
|
||||||
LOSSES_WRITTEN_OFF("writeOffAccount");
|
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
@@ -217,7 +213,6 @@ public class AccountingConstants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final String ASSESTS_TAG_OPTION_CODE_NAME = "AssetAccountTags";
|
public static final String ASSESTS_TAG_OPTION_CODE_NAME = "AssetAccountTags";
|
||||||
public static final String LIABILITIES_TAG_OPTION_CODE_NAME = "LiabilityAccountTags";
|
public static final String LIABILITIES_TAG_OPTION_CODE_NAME = "LiabilityAccountTags";
|
||||||
public static final String EQUITY_TAG_OPTION_CODE_NAME = "EquityAccountTags";
|
public static final String EQUITY_TAG_OPTION_CODE_NAME = "EquityAccountTags";
|
||||||
|
|||||||
+2
-2
@@ -35,7 +35,6 @@ public class GLAccountData {
|
|||||||
private final CodeValueData tagId;
|
private final CodeValueData tagId;
|
||||||
private final Long organizationRunningBalance;
|
private final Long organizationRunningBalance;
|
||||||
|
|
||||||
|
|
||||||
// templates
|
// templates
|
||||||
final List<EnumOptionData> accountTypeOptions;
|
final List<EnumOptionData> accountTypeOptions;
|
||||||
final List<EnumOptionData> usageOptions;
|
final List<EnumOptionData> usageOptions;
|
||||||
@@ -131,7 +130,8 @@ public class GLAccountData {
|
|||||||
final CodeValueData tagId = null;
|
final CodeValueData tagId = null;
|
||||||
final Long organizationRunningBalance = null;
|
final Long organizationRunningBalance = null;
|
||||||
|
|
||||||
return new GLAccountData(id, name, parentId, glCode, disabled, manualEntriesAllowed, type, usage, description, nameDecorated, tagId,organizationRunningBalance);
|
return new GLAccountData(id, name, parentId, glCode, disabled, manualEntriesAllowed, type, usage, description, nameDecorated,
|
||||||
|
tagId, organizationRunningBalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GLAccountData(final Long id, final String name, final String glCode) {
|
public GLAccountData(final Long id, final String name, final String glCode) {
|
||||||
|
|||||||
+6
-4
@@ -44,7 +44,6 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
|||||||
|
|
||||||
private final JournalEntryAssociationParametersData associationParametersData;
|
private final JournalEntryAssociationParametersData associationParametersData;
|
||||||
|
|
||||||
|
|
||||||
public GLAccountMapper(final JournalEntryAssociationParametersData associationParametersData) {
|
public GLAccountMapper(final JournalEntryAssociationParametersData associationParametersData) {
|
||||||
if (associationParametersData == null) {
|
if (associationParametersData == null) {
|
||||||
this.associationParametersData = new JournalEntryAssociationParametersData();
|
this.associationParametersData = new JournalEntryAssociationParametersData();
|
||||||
@@ -55,7 +54,8 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
|||||||
|
|
||||||
public String schema() {
|
public String schema() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(" gl.id as id, name as name, parent_id as parentId, gl_code as glCode, disabled as disabled, manual_journal_entries_allowed as manualEntriesAllowed, ")
|
sb.append(
|
||||||
|
" gl.id as id, name as name, parent_id as parentId, gl_code as glCode, disabled as disabled, manual_journal_entries_allowed as manualEntriesAllowed, ")
|
||||||
.append("classification_enum as classification, account_usage as accountUsage, gl.description as description, ")
|
.append("classification_enum as classification, account_usage as accountUsage, gl.description as description, ")
|
||||||
.append(nameDecoratedBaseOnHierarchy).append(" as nameDecorated, ")
|
.append(nameDecoratedBaseOnHierarchy).append(" as nameDecorated, ")
|
||||||
.append("cv.id as codeId, cv.code_value as codeValue ");
|
.append("cv.id as codeId, cv.code_value as codeValue ");
|
||||||
@@ -207,7 +207,8 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GLAccountData> retrieveAllEnabledDetailGLAccounts(final GLAccountType accountType) {
|
public List<GLAccountData> retrieveAllEnabledDetailGLAccounts(final GLAccountType accountType) {
|
||||||
return retrieveAllGLAccounts(accountType.getValue(), null, GLAccountUsage.DETAIL.getValue(), null, false, new JournalEntryAssociationParametersData());
|
return retrieveAllGLAccounts(accountType.getValue(), null, GLAccountUsage.DETAIL.getValue(), null, false,
|
||||||
|
new JournalEntryAssociationParametersData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -236,7 +237,8 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GLAccountData> retrieveAllEnabledHeaderGLAccounts(final GLAccountType accountType) {
|
public List<GLAccountData> retrieveAllEnabledHeaderGLAccounts(final GLAccountType accountType) {
|
||||||
return retrieveAllGLAccounts(accountType.getValue(), null, GLAccountUsage.HEADER.getValue(), null, false, new JournalEntryAssociationParametersData());
|
return retrieveAllGLAccounts(accountType.getValue(), null, GLAccountUsage.HEADER.getValue(), null, false,
|
||||||
|
new JournalEntryAssociationParametersData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+11
-8
@@ -77,11 +77,11 @@ public class JournalEntriesApiResource {
|
|||||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
|
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
|
||||||
@QueryParam("glAccountId") final Long glAccountId, @QueryParam("manualEntriesOnly") final Boolean onlyManualEntries,
|
@QueryParam("glAccountId") final Long glAccountId, @QueryParam("manualEntriesOnly") final Boolean onlyManualEntries,
|
||||||
@QueryParam("fromDate") final DateParam fromDateParam, @QueryParam("toDate") final DateParam toDateParam,
|
@QueryParam("fromDate") final DateParam fromDateParam, @QueryParam("toDate") final DateParam toDateParam,
|
||||||
@QueryParam("transactionId") final String transactionId, @QueryParam("entityType") final Integer entityType, @QueryParam("offset") final Integer offset,
|
@QueryParam("transactionId") final String transactionId, @QueryParam("entityType") final Integer entityType,
|
||||||
@QueryParam("limit") final Integer limit, @QueryParam("orderBy") final String orderBy,
|
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||||
@QueryParam("sortOrder") final String sortOrder, @QueryParam("locale") final String locale,
|
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder,
|
||||||
@QueryParam("dateFormat") final String dateFormat,@QueryParam("runningBalance") final boolean runningBalance,
|
@QueryParam("locale") final String locale, @QueryParam("dateFormat") final String dateFormat,
|
||||||
@QueryParam("transactionDetails") final boolean transactionDetails) {
|
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||||
|
|
||||||
@@ -95,7 +95,8 @@ public class JournalEntriesApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forJournalEntries(officeId, offset, limit, orderBy, sortOrder);
|
final SearchParameters searchParameters = SearchParameters.forJournalEntries(officeId, offset, limit, orderBy, sortOrder);
|
||||||
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails, runningBalance);
|
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
||||||
|
runningBalance);
|
||||||
|
|
||||||
final Page<JournalEntryData> glJournalEntries = this.journalEntryReadPlatformService.retrieveAll(searchParameters, glAccountId,
|
final Page<JournalEntryData> glJournalEntries = this.journalEntryReadPlatformService.retrieveAll(searchParameters, glAccountId,
|
||||||
onlyManualEntries, fromDate, toDate, transactionId, entityType, associationParametersData);
|
onlyManualEntries, fromDate, toDate, transactionId, entityType, associationParametersData);
|
||||||
@@ -111,8 +112,10 @@ public class JournalEntriesApiResource {
|
|||||||
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||||
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails, runningBalance);
|
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
||||||
final JournalEntryData glJournalEntryData = this.journalEntryReadPlatformService.retrieveGLJournalEntryById(journalEntryId, associationParametersData);
|
runningBalance);
|
||||||
|
final JournalEntryData glJournalEntryData = this.journalEntryReadPlatformService.retrieveGLJournalEntryById(journalEntryId,
|
||||||
|
associationParametersData);
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.apiJsonSerializerService.serialize(settings, glJournalEntryData, RESPONSE_DATA_PARAMETERS);
|
return this.apiJsonSerializerService.serialize(settings, glJournalEntryData, RESPONSE_DATA_PARAMETERS);
|
||||||
|
|||||||
-4
@@ -1,12 +1,10 @@
|
|||||||
package org.mifosplatform.accounting.journalentry.data;
|
package org.mifosplatform.accounting.journalentry.data;
|
||||||
|
|
||||||
|
|
||||||
public class JournalEntryAssociationParametersData {
|
public class JournalEntryAssociationParametersData {
|
||||||
|
|
||||||
private final boolean transactionDetailsRequired;
|
private final boolean transactionDetailsRequired;
|
||||||
private final boolean runningBalanceRequired;
|
private final boolean runningBalanceRequired;
|
||||||
|
|
||||||
|
|
||||||
public JournalEntryAssociationParametersData() {
|
public JournalEntryAssociationParametersData() {
|
||||||
this.transactionDetailsRequired = false;
|
this.transactionDetailsRequired = false;
|
||||||
this.runningBalanceRequired = false;
|
this.runningBalanceRequired = false;
|
||||||
@@ -17,12 +15,10 @@ public class JournalEntryAssociationParametersData {
|
|||||||
this.runningBalanceRequired = runningBalanceRequired;
|
this.runningBalanceRequired = runningBalanceRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isTransactionDetailsRequired() {
|
public boolean isTransactionDetailsRequired() {
|
||||||
return this.transactionDetailsRequired;
|
return this.transactionDetailsRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isRunningBalanceRequired() {
|
public boolean isRunningBalanceRequired() {
|
||||||
return this.runningBalanceRequired;
|
return this.runningBalanceRequired;
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -80,7 +80,6 @@ public class SavingsTransactionDTO {
|
|||||||
return this.feePayments;
|
return this.feePayments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getOverdraftAmount() {
|
public BigDecimal getOverdraftAmount() {
|
||||||
return this.overdraftAmount;
|
return this.overdraftAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -88,22 +88,24 @@ public class JournalEntry extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
@Column(name = "ref_num")
|
@Column(name = "ref_num")
|
||||||
private String referenceNumber;
|
private String referenceNumber;
|
||||||
|
|
||||||
public static JournalEntry createNew(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount, final String currencyCode,
|
public static JournalEntry createNew(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount,
|
||||||
final String transactionId, final boolean manualEntry, final Date transactionDate, final JournalEntryType journalEntryType,
|
final String currencyCode, final String transactionId, final boolean manualEntry, final Date transactionDate,
|
||||||
final BigDecimal amount, final String description, final Integer entityType, final Long entityId, final String referenceNumber,
|
final JournalEntryType journalEntryType, final BigDecimal amount, final String description, final Integer entityType,
|
||||||
final LoanTransaction loanTransaction, final SavingsAccountTransaction savingsTransaction) {
|
final Long entityId, final String referenceNumber, final LoanTransaction loanTransaction,
|
||||||
return new JournalEntry(office, paymentDetail, glAccount, currencyCode, transactionId, manualEntry, transactionDate, journalEntryType.getValue(),
|
final SavingsAccountTransaction savingsTransaction) {
|
||||||
amount, description, entityType, entityId, referenceNumber, loanTransaction, savingsTransaction);
|
return new JournalEntry(office, paymentDetail, glAccount, currencyCode, transactionId, manualEntry, transactionDate,
|
||||||
|
journalEntryType.getValue(), amount, description, entityType, entityId, referenceNumber, loanTransaction,
|
||||||
|
savingsTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JournalEntry() {
|
protected JournalEntry() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public JournalEntry(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount, final String currencyCode, final String transactionId,
|
public JournalEntry(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount, final String currencyCode,
|
||||||
final boolean manualEntry, final Date transactionDate, final Integer type, final BigDecimal amount, final String description,
|
final String transactionId, final boolean manualEntry, final Date transactionDate, final Integer type, final BigDecimal amount,
|
||||||
final Integer entityType, final Long entityId, final String referenceNumber, final LoanTransaction loanTransaction,
|
final String description, final Integer entityType, final Long entityId, final String referenceNumber,
|
||||||
final SavingsAccountTransaction savingsTransaction) {
|
final LoanTransaction loanTransaction, final SavingsAccountTransaction savingsTransaction) {
|
||||||
this.office = office;
|
this.office = office;
|
||||||
this.glAccount = glAccount;
|
this.glAccount = glAccount;
|
||||||
this.reversalJournalEntry = null;
|
this.reversalJournalEntry = null;
|
||||||
@@ -163,12 +165,10 @@ public class JournalEntry extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
return this.currencyCode;
|
return this.currencyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LoanTransaction getLoanTransaction() {
|
public LoanTransaction getLoanTransaction() {
|
||||||
return this.loanTransaction;
|
return this.loanTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SavingsAccountTransaction getSavingsTransaction() {
|
public SavingsAccountTransaction getSavingsTransaction() {
|
||||||
return this.savingsTransaction;
|
return this.savingsTransaction;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-12
@@ -49,18 +49,17 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
|||||||
|
|
||||||
if (savingsTransactionDTO.getTransactionType().isWithdrawal() && savingsTransactionDTO.isOverdraftTransaction()) {
|
if (savingsTransactionDTO.getTransactionType().isWithdrawal() && savingsTransactionDTO.isOverdraftTransaction()) {
|
||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE,
|
||||||
paymentTypeId, savingsId, transactionId, transactionDate, overdraftAmount, isReversal);
|
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, overdraftAmount, isReversal);
|
||||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, savingsProductId,
|
||||||
paymentTypeId, savingsId, transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal);
|
paymentTypeId, savingsId, transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal);
|
||||||
}
|
}
|
||||||
}
|
} else if (savingsTransactionDTO.getTransactionType().isDeposit() && savingsTransactionDTO.isOverdraftTransaction()) {
|
||||||
else if (savingsTransactionDTO.getTransactionType().isDeposit() && savingsTransactionDTO.isOverdraftTransaction()) {
|
|
||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL,
|
||||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL, savingsProductId,
|
||||||
@@ -126,13 +125,11 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
|||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST, savingsProductId,
|
||||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||||
}
|
} else if (savingsTransactionDTO.getTransactionType().isWrittenoff()) {
|
||||||
else if (savingsTransactionDTO.getTransactionType().isWrittenoff()) {
|
|
||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF, CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF, CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL,
|
||||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||||
}
|
} else if (savingsTransactionDTO.getTransactionType().isOverdraftFee()) {
|
||||||
else if (savingsTransactionDTO.getTransactionType().isOverdraftFee()) {
|
|
||||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES, savingsProductId,
|
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE, CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES, savingsProductId,
|
||||||
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal, feePayments);
|
paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal, feePayments);
|
||||||
|
|||||||
+2
-1
@@ -86,7 +86,8 @@ public class AuditsApiResource {
|
|||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
if (parameters.isPaged()) {
|
if (parameters.isPaged()) {
|
||||||
final Page<AuditData> auditEntries = this.auditReadPlatformService.retrievePaginatedAuditEntries(extraCriteria, settings.isIncludeJson(), parameters);
|
final Page<AuditData> auditEntries = this.auditReadPlatformService.retrievePaginatedAuditEntries(extraCriteria,
|
||||||
|
settings.isIncludeJson(), parameters);
|
||||||
return this.toApiJsonSerializer.serialize(settings, auditEntries, this.RESPONSE_DATA_PARAMETERS);
|
return this.toApiJsonSerializer.serialize(settings, auditEntries, this.RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ public class CommandWrapper {
|
|||||||
public boolean isLoanChargeResource() {
|
public boolean isLoanChargeResource() {
|
||||||
return this.entityName.equalsIgnoreCase("LOANCHARGE");
|
return this.entityName.equalsIgnoreCase("LOANCHARGE");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoanDisburseDetailResource() {
|
public boolean isLoanDisburseDetailResource() {
|
||||||
return this.entityName.equalsIgnoreCase("DISBURSEMENTDETAIL");
|
return this.entityName.equalsIgnoreCase("DISBURSEMENTDETAIL");
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -165,7 +165,8 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditData> retrievePaginatedAuditEntries(final String extraCriteria, final boolean includeJson, final PaginationParameters parameters) {
|
public Page<AuditData> retrievePaginatedAuditEntries(final String extraCriteria, final boolean includeJson,
|
||||||
|
final PaginationParameters parameters) {
|
||||||
|
|
||||||
this.paginationParametersDataValidator.validateParameterValues(parameters, supportedOrderByValues, "audits");
|
this.paginationParametersDataValidator.validateParameterValues(parameters, supportedOrderByValues, "audits");
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = this.context.authenticatedUser();
|
||||||
|
|||||||
-3
@@ -584,7 +584,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CommandWrapperBuilder closeLoanAsRescheduledTransaction(final Long loanId) {
|
public CommandWrapperBuilder closeLoanAsRescheduledTransaction(final Long loanId) {
|
||||||
this.actionName = "CLOSEASRESCHEDULED";
|
this.actionName = "CLOSEASRESCHEDULED";
|
||||||
this.entityName = "LOAN";
|
this.entityName = "LOAN";
|
||||||
@@ -639,7 +638,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CommandWrapperBuilder deleteLoanApplication(final Long loanId) {
|
public CommandWrapperBuilder deleteLoanApplication(final Long loanId) {
|
||||||
this.actionName = "DELETE";
|
this.actionName = "DELETE";
|
||||||
this.entityName = "LOAN";
|
this.entityName = "LOAN";
|
||||||
@@ -827,7 +825,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CommandWrapperBuilder createSavingProduct() {
|
public CommandWrapperBuilder createSavingProduct() {
|
||||||
this.actionName = "CREATE";
|
this.actionName = "CREATE";
|
||||||
this.entityName = "SAVINGSPRODUCT";
|
this.entityName = "SAVINGSPRODUCT";
|
||||||
|
|||||||
-1
@@ -72,7 +72,6 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
|||||||
result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
|
result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
|
||||||
} catch (final RollbackTransactionAsCommandIsNotApprovedByCheckerException e) {
|
} catch (final RollbackTransactionAsCommandIsNotApprovedByCheckerException e) {
|
||||||
|
|
||||||
|
|
||||||
result = this.processAndLogCommandService.logCommand(e.getCommandSourceResult());
|
result = this.processAndLogCommandService.logCommand(e.getCommandSourceResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -435,9 +435,12 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
|
|||||||
handler = this.applicationContext.getBean("calculateInterestSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
handler = this.applicationContext.getBean("calculateInterestSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
||||||
} else if (wrapper.isSavingsAccountInterestPosting()) {
|
} else if (wrapper.isSavingsAccountInterestPosting()) {
|
||||||
handler = this.applicationContext.getBean("postInterestSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
handler = this.applicationContext.getBean("postInterestSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
||||||
} /*else if (wrapper.isSavingsAccountApplyAnnualFee()) {
|
} /*
|
||||||
handler = this.applicationContext.getBean("applyAnnualFeeSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
* else if (wrapper.isSavingsAccountApplyAnnualFee()) { handler =
|
||||||
} */else if (wrapper.isSavingsAccountUndoTransaction()) {
|
* this.applicationContext.getBean(
|
||||||
|
* "applyAnnualFeeSavingsAccountCommandHandler",
|
||||||
|
* NewCommandSourceHandler.class); }
|
||||||
|
*/else if (wrapper.isSavingsAccountUndoTransaction()) {
|
||||||
handler = this.applicationContext.getBean("undoTransactionSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
handler = this.applicationContext.getBean("undoTransactionSavingsAccountCommandHandler", NewCommandSourceHandler.class);
|
||||||
} else if (wrapper.isAdjustSavingsAccountTransaction()) {
|
} else if (wrapper.isAdjustSavingsAccountTransaction()) {
|
||||||
handler = this.applicationContext.getBean("savingsTransactionAdjustmentCommandHandler", NewCommandSourceHandler.class);
|
handler = this.applicationContext.getBean("savingsTransactionAdjustmentCommandHandler", NewCommandSourceHandler.class);
|
||||||
|
|||||||
-1
@@ -58,5 +58,4 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
-5
@@ -373,8 +373,8 @@ public class DataValidatorBuilder {
|
|||||||
if (intValue < number + 1) {
|
if (intValue < number + 1) {
|
||||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||||
.append(this.parameter).append(".not.greater.than.specified.number");
|
.append(this.parameter).append(".not.greater.than.specified.number");
|
||||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter).append(
|
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter)
|
||||||
" must be greater than ").append(number);
|
.append(" must be greater than ").append(number);
|
||||||
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
|
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
|
||||||
defaultEnglishMessage.toString(), this.parameter, intValue, number);
|
defaultEnglishMessage.toString(), this.parameter, intValue, number);
|
||||||
this.dataValidationErrors.add(error);
|
this.dataValidationErrors.add(error);
|
||||||
@@ -391,8 +391,8 @@ public class DataValidatorBuilder {
|
|||||||
if (intValue != number) {
|
if (intValue != number) {
|
||||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||||
.append(this.parameter).append(".not.equal.to.specified.number");
|
.append(this.parameter).append(".not.equal.to.specified.number");
|
||||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter).append(
|
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter)
|
||||||
" must be same as").append(number);
|
.append(" must be same as").append(number);
|
||||||
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
|
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
|
||||||
defaultEnglishMessage.toString(), this.parameter, intValue, number);
|
defaultEnglishMessage.toString(), this.parameter, intValue, number);
|
||||||
this.dataValidationErrors.add(error);
|
this.dataValidationErrors.add(error);
|
||||||
@@ -401,7 +401,6 @@ public class DataValidatorBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* should be used with .notNull() before it
|
* should be used with .notNull() before it
|
||||||
*/
|
*/
|
||||||
|
|||||||
+12
-6
@@ -16,22 +16,28 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class PaginationParametersDataValidator {
|
public class PaginationParametersDataValidator {
|
||||||
|
|
||||||
public static Set<String> sortOrderValues = new HashSet<String>(Arrays.asList("ASC", "DESC"));
|
public static Set<String> sortOrderValues = new HashSet<String>(Arrays.asList("ASC", "DESC"));
|
||||||
|
|
||||||
public void validateParameterValues(PaginationParameters parameters, final Set<String> supportedOrdeByValues, final String resourceName) {
|
public void validateParameterValues(PaginationParameters parameters, final Set<String> supportedOrdeByValues, final String resourceName) {
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
|
|
||||||
if (parameters.isOrderByRequested() && !supportedOrdeByValues.contains(parameters.getOrderBy())) {
|
if (parameters.isOrderByRequested() && !supportedOrdeByValues.contains(parameters.getOrderBy())) {
|
||||||
final String defaultUserMessage = "The orderBy value '" + parameters.getOrderBy() + "' is not supported. The supported orderBy values are " + supportedOrdeByValues.toString();
|
final String defaultUserMessage = "The orderBy value '" + parameters.getOrderBy()
|
||||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg."+resourceName+".orderBy.value.is.not.supported",
|
+ "' is not supported. The supported orderBy values are " + supportedOrdeByValues.toString();
|
||||||
defaultUserMessage, "orderBy", parameters.getOrderBy(), supportedOrdeByValues.toString());
|
final ApiParameterError error = ApiParameterError.parameterError("validation.msg." + resourceName
|
||||||
|
+ ".orderBy.value.is.not.supported", defaultUserMessage, "orderBy", parameters.getOrderBy(),
|
||||||
|
supportedOrdeByValues.toString());
|
||||||
dataValidationErrors.add(error);
|
dataValidationErrors.add(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.isSortOrderProvided() && !sortOrderValues.contains(parameters.getSortOrder().toUpperCase())) {
|
if (parameters.isSortOrderProvided() && !sortOrderValues.contains(parameters.getSortOrder().toUpperCase())) {
|
||||||
final String defaultUserMessage = "The sortOrder value '" + parameters.getSortOrder() + "' is not supported. The supported sortOrder values are " + sortOrderValues.toString();
|
final String defaultUserMessage = "The sortOrder value '" + parameters.getSortOrder()
|
||||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg."+resourceName+".sortOrder.value.is.not.supported",
|
+ "' is not supported. The supported sortOrder values are " + sortOrderValues.toString();
|
||||||
defaultUserMessage, "sortOrder", parameters.getSortOrder(), sortOrderValues.toString());
|
final ApiParameterError error = ApiParameterError.parameterError("validation.msg." + resourceName
|
||||||
|
+ ".sortOrder.value.is.not.supported", defaultUserMessage, "sortOrder", parameters.getSortOrder(),
|
||||||
|
sortOrderValues.toString());
|
||||||
dataValidationErrors.add(error);
|
dataValidationErrors.add(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -73,9 +73,7 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService {
|
|||||||
final ContentRepository contentRepository = this.contentRepositoryFactory.getRepository(imageData.storageType());
|
final ContentRepository contentRepository = this.contentRepositoryFactory.getRepository(imageData.storageType());
|
||||||
final ImageData result = contentRepository.fetchImage(imageData);
|
final ImageData result = contentRepository.fetchImage(imageData);
|
||||||
|
|
||||||
if (result.getContent() == null) {
|
if (result.getContent() == null) { throw new ImageNotFoundException("clients", clientId); }
|
||||||
throw new ImageNotFoundException("clients", clientId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} catch (final EmptyResultDataAccessException e) {
|
} catch (final EmptyResultDataAccessException e) {
|
||||||
|
|||||||
+2
-4
@@ -30,10 +30,8 @@ public class SmsMessageAssembler {
|
|||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public SmsMessageAssembler(final SmsMessageRepository smsMessageRepository,
|
public SmsMessageAssembler(final SmsMessageRepository smsMessageRepository, final GroupRepositoryWrapper groupRepositoryWrapper,
|
||||||
final GroupRepositoryWrapper groupRepositoryWrapper,
|
final ClientRepositoryWrapper clientRepository, final StaffRepositoryWrapper staffRepository,
|
||||||
final ClientRepositoryWrapper clientRepository,
|
|
||||||
final StaffRepositoryWrapper staffRepository,
|
|
||||||
final FromJsonHelper fromApiJsonHelper) {
|
final FromJsonHelper fromApiJsonHelper) {
|
||||||
this.smsMessageRepository = smsMessageRepository;
|
this.smsMessageRepository = smsMessageRepository;
|
||||||
this.groupRepository = groupRepositoryWrapper;
|
this.groupRepository = groupRepositoryWrapper;
|
||||||
|
|||||||
+12
-7
@@ -14,23 +14,28 @@ public class SmsMessageEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData status(final SmsMessageStatusType status) {
|
public static EnumOptionData status(final SmsMessageStatusType status) {
|
||||||
EnumOptionData optionData = new EnumOptionData(SmsMessageStatusType.INVALID.getValue().longValue(), SmsMessageStatusType.INVALID.getCode(),
|
EnumOptionData optionData = new EnumOptionData(SmsMessageStatusType.INVALID.getValue().longValue(),
|
||||||
"Invalid");
|
SmsMessageStatusType.INVALID.getCode(), "Invalid");
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case INVALID:
|
case INVALID:
|
||||||
optionData = new EnumOptionData(SmsMessageStatusType.INVALID.getValue().longValue(), SmsMessageStatusType.INVALID.getCode(), "Invalid");
|
optionData = new EnumOptionData(SmsMessageStatusType.INVALID.getValue().longValue(),
|
||||||
|
SmsMessageStatusType.INVALID.getCode(), "Invalid");
|
||||||
break;
|
break;
|
||||||
case PENDING:
|
case PENDING:
|
||||||
optionData = new EnumOptionData(SmsMessageStatusType.PENDING.getValue().longValue(), SmsMessageStatusType.PENDING.getCode(), "Pending");
|
optionData = new EnumOptionData(SmsMessageStatusType.PENDING.getValue().longValue(),
|
||||||
|
SmsMessageStatusType.PENDING.getCode(), "Pending");
|
||||||
break;
|
break;
|
||||||
case SENT:
|
case SENT:
|
||||||
optionData = new EnumOptionData(SmsMessageStatusType.SENT.getValue().longValue(), SmsMessageStatusType.SENT.getCode(), "Sent");
|
optionData = new EnumOptionData(SmsMessageStatusType.SENT.getValue().longValue(), SmsMessageStatusType.SENT.getCode(),
|
||||||
|
"Sent");
|
||||||
break;
|
break;
|
||||||
case DELIVERED:
|
case DELIVERED:
|
||||||
optionData = new EnumOptionData(SmsMessageStatusType.DELIVERED.getValue().longValue(), SmsMessageStatusType.DELIVERED.getCode(), "Delivered");
|
optionData = new EnumOptionData(SmsMessageStatusType.DELIVERED.getValue().longValue(),
|
||||||
|
SmsMessageStatusType.DELIVERED.getCode(), "Delivered");
|
||||||
break;
|
break;
|
||||||
case FAILED:
|
case FAILED:
|
||||||
optionData = new EnumOptionData(SmsMessageStatusType.FAILED.getValue().longValue(), SmsMessageStatusType.FAILED.getCode(), "Failed");
|
optionData = new EnumOptionData(SmsMessageStatusType.FAILED.getValue().longValue(), SmsMessageStatusType.FAILED.getCode(),
|
||||||
|
"Failed");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-5
@@ -48,8 +48,11 @@ public class SmsWritePlatformServiceJpaRepositoryImpl implements SmsWritePlatfor
|
|||||||
|
|
||||||
final SmsMessage message = this.assembler.assembleFromJson(command);
|
final SmsMessage message = this.assembler.assembleFromJson(command);
|
||||||
|
|
||||||
// TODO: at this point we also want to fire off request using third party service to send SMS.
|
// TODO: at this point we also want to fire off request using third
|
||||||
// TODO: decision to be made on wheter we 'wait' for response or use 'future/promise' to capture response and update the SmsMessage table
|
// party service to send SMS.
|
||||||
|
// TODO: decision to be made on wheter we 'wait' for response or use
|
||||||
|
// 'future/promise' to capture response and update the SmsMessage
|
||||||
|
// table
|
||||||
this.repository.save(message);
|
this.repository.save(message);
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
return new CommandProcessingResultBuilder() //
|
||||||
@@ -108,9 +111,8 @@ public class SmsWritePlatformServiceJpaRepositoryImpl implements SmsWritePlatfor
|
|||||||
private void handleDataIntegrityIssues(@SuppressWarnings("unused") final JsonCommand command, final DataIntegrityViolationException dve) {
|
private void handleDataIntegrityIssues(@SuppressWarnings("unused") final JsonCommand command, final DataIntegrityViolationException dve) {
|
||||||
final Throwable realCause = dve.getMostSpecificCause();
|
final Throwable realCause = dve.getMostSpecificCause();
|
||||||
|
|
||||||
if (realCause.getMessage().contains("mobile_no")) {
|
if (realCause.getMessage().contains("mobile_no")) { throw new PlatformDataIntegrityException("error.msg.sms.no.mobile.no.exists",
|
||||||
throw new PlatformDataIntegrityException("error.msg.sms.no.mobile.no.exists", "The group, client or staff provided has no mobile no.", "id");
|
"The group, client or staff provided has no mobile no.", "id"); }
|
||||||
}
|
|
||||||
|
|
||||||
logger.error(dve.getMessage(), dve);
|
logger.error(dve.getMessage(), dve);
|
||||||
throw new PlatformDataIntegrityException("error.msg.sms.unknown.data.integrity.issue",
|
throw new PlatformDataIntegrityException("error.msg.sms.unknown.data.integrity.issue",
|
||||||
|
|||||||
+4
-2
@@ -25,8 +25,10 @@ public class HolidayApiConstants {
|
|||||||
public static final String status = "status";
|
public static final String status = "status";
|
||||||
|
|
||||||
public static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
|
public static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
|
||||||
dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName, repaymentsRescheduledToParamName));
|
dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName,
|
||||||
|
repaymentsRescheduledToParamName));
|
||||||
|
|
||||||
public static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName, nameParamName,
|
public static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName, nameParamName,
|
||||||
fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName, dateFormatParamName, status));
|
fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName,
|
||||||
|
dateFormatParamName, status));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -108,7 +108,6 @@ public class HolidaysApiResource {
|
|||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, holidayData, HOLIDAY_RESPONSE_DATA_PARAMETERS);
|
return this.toApiJsonSerializer.serialize(settings, holidayData, HOLIDAY_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +117,7 @@ public class HolidaysApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String update(@PathParam("holidayId") final Long holidayId, final String jsonRequestBody) {
|
public String update(@PathParam("holidayId") final Long holidayId, final String jsonRequestBody) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateHoliday(holidayId)
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateHoliday(holidayId).withJson(jsonRequestBody).build();
|
||||||
.withJson(jsonRequestBody).build();
|
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
|
|||||||
+10
-6
@@ -38,7 +38,8 @@ public class HolidayDataValidator {
|
|||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||||
|
HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
@@ -55,14 +56,15 @@ public class HolidayDataValidator {
|
|||||||
final LocalDate toDate = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.toDateParamName, element);
|
final LocalDate toDate = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.toDateParamName, element);
|
||||||
baseDataValidator.reset().parameter(HolidayApiConstants.toDateParamName).value(toDate).notNull();
|
baseDataValidator.reset().parameter(HolidayApiConstants.toDateParamName).value(toDate).notNull();
|
||||||
|
|
||||||
final LocalDate repaymentsRescheduledTo = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.repaymentsRescheduledToParamName,
|
final LocalDate repaymentsRescheduledTo = this.fromApiJsonHelper.extractLocalDateNamed(
|
||||||
element);
|
HolidayApiConstants.repaymentsRescheduledToParamName, element);
|
||||||
baseDataValidator.reset().parameter(HolidayApiConstants.repaymentsRescheduledToParamName).value(repaymentsRescheduledTo).notNull();
|
baseDataValidator.reset().parameter(HolidayApiConstants.repaymentsRescheduledToParamName).value(repaymentsRescheduledTo).notNull();
|
||||||
|
|
||||||
Set<Long> offices = null;
|
Set<Long> offices = null;
|
||||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||||
|
|
||||||
if (topLevelJsonElement.has(HolidayApiConstants.officesParamName) && topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) {
|
if (topLevelJsonElement.has(HolidayApiConstants.officesParamName)
|
||||||
|
&& topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) {
|
||||||
|
|
||||||
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray();
|
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray();
|
||||||
if (array.size() > 0) {
|
if (array.size() > 0) {
|
||||||
@@ -111,13 +113,15 @@ public class HolidayDataValidator {
|
|||||||
if (this.fromApiJsonHelper.parameterExists(HolidayApiConstants.repaymentsRescheduledToParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(HolidayApiConstants.repaymentsRescheduledToParamName, element)) {
|
||||||
final LocalDate repaymentsRescheduledTo = this.fromApiJsonHelper.extractLocalDateNamed(
|
final LocalDate repaymentsRescheduledTo = this.fromApiJsonHelper.extractLocalDateNamed(
|
||||||
HolidayApiConstants.repaymentsRescheduledToParamName, element);
|
HolidayApiConstants.repaymentsRescheduledToParamName, element);
|
||||||
baseDataValidator.reset().parameter(HolidayApiConstants.repaymentsRescheduledToParamName).value(repaymentsRescheduledTo).notNull();
|
baseDataValidator.reset().parameter(HolidayApiConstants.repaymentsRescheduledToParamName).value(repaymentsRescheduledTo)
|
||||||
|
.notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Long> offices = null;
|
Set<Long> offices = null;
|
||||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||||
if (this.fromApiJsonHelper.parameterExists(HolidayApiConstants.officesParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(HolidayApiConstants.officesParamName, element)) {
|
||||||
if (topLevelJsonElement.has(HolidayApiConstants.officesParamName) && topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) {
|
if (topLevelJsonElement.has(HolidayApiConstants.officesParamName)
|
||||||
|
&& topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) {
|
||||||
|
|
||||||
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray();
|
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray();
|
||||||
if (array.size() > 0) {
|
if (array.size() > 0) {
|
||||||
|
|||||||
+4
-5
@@ -81,7 +81,8 @@ public class Holiday extends AbstractPersistable<Long> {
|
|||||||
final String name = command.stringValueOfParameterNamed(HolidayApiConstants.nameParamName);
|
final String name = command.stringValueOfParameterNamed(HolidayApiConstants.nameParamName);
|
||||||
final LocalDate fromDate = command.localDateValueOfParameterNamed(HolidayApiConstants.fromDateParamName);
|
final LocalDate fromDate = command.localDateValueOfParameterNamed(HolidayApiConstants.fromDateParamName);
|
||||||
final LocalDate toDate = command.localDateValueOfParameterNamed(HolidayApiConstants.toDateParamName);
|
final LocalDate toDate = command.localDateValueOfParameterNamed(HolidayApiConstants.toDateParamName);
|
||||||
final LocalDate repaymentsRescheduledTo = command.localDateValueOfParameterNamed(HolidayApiConstants.repaymentsRescheduledToParamName);
|
final LocalDate repaymentsRescheduledTo = command
|
||||||
|
.localDateValueOfParameterNamed(HolidayApiConstants.repaymentsRescheduledToParamName);
|
||||||
final Integer status = HolidayStatusType.PENDING_FOR_ACTIVATION.getValue();
|
final Integer status = HolidayStatusType.PENDING_FOR_ACTIVATION.getValue();
|
||||||
final boolean processed = false;// default it to false. Only batch job
|
final boolean processed = false;// default it to false. Only batch job
|
||||||
// should update this field.
|
// should update this field.
|
||||||
@@ -93,8 +94,7 @@ public class Holiday extends AbstractPersistable<Long> {
|
|||||||
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(7);
|
final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(7);
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("holiday" + ".update");
|
||||||
.resource("holiday" + ".update");
|
|
||||||
|
|
||||||
final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status);
|
final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status);
|
||||||
|
|
||||||
@@ -263,8 +263,7 @@ public class Holiday extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
public void activate() {
|
public void activate() {
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("holiday" + ".activate");
|
||||||
.resource("holiday" + ".activate");
|
|
||||||
|
|
||||||
final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status);
|
final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status);
|
||||||
if (!currentStatus.isPendingActivation()) {
|
if (!currentStatus.isPendingActivation()) {
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,8 @@ import org.springframework.data.repository.query.Param;
|
|||||||
public interface HolidayRepository extends JpaRepository<Holiday, Long>, JpaSpecificationExecutor<Holiday> {
|
public interface HolidayRepository extends JpaRepository<Holiday, Long>, JpaSpecificationExecutor<Holiday> {
|
||||||
|
|
||||||
@Query("select holiday from Holiday holiday, IN(holiday.offices) office where (holiday.fromDate >= :date OR :date <= holiday.toDate) and holiday.status = :status and office.id = :officeId")
|
@Query("select holiday from Holiday holiday, IN(holiday.offices) office where (holiday.fromDate >= :date OR :date <= holiday.toDate) and holiday.status = :status and office.id = :officeId")
|
||||||
List<Holiday> findByOfficeIdAndGreaterThanDate(@Param("officeId") Long officeId, @Param("date") Date date, @Param("status") Integer status);
|
List<Holiday> findByOfficeIdAndGreaterThanDate(@Param("officeId") Long officeId, @Param("date") Date date,
|
||||||
|
@Param("status") Integer status);
|
||||||
|
|
||||||
@Query("from Holiday holiday where holiday.processed = false and holiday.status = :status")
|
@Query("from Holiday holiday where holiday.processed = false and holiday.status = :status")
|
||||||
List<Holiday> findUnprocessed(@Param("status") Integer status);
|
List<Holiday> findUnprocessed(@Param("status") Integer status);
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.organisation.holiday.domain;
|
package org.mifosplatform.organisation.holiday.domain;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum representation of {@link Holiday} status states.
|
* Enum representation of {@link Holiday} status states.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+4
-2
@@ -26,10 +26,12 @@ public class HolidayEnumerations {
|
|||||||
HolidayStatusType.PENDING_FOR_ACTIVATION.getCode(), "Pending for activation");
|
HolidayStatusType.PENDING_FOR_ACTIVATION.getCode(), "Pending for activation");
|
||||||
break;
|
break;
|
||||||
case ACTIVE:
|
case ACTIVE:
|
||||||
optionData = new EnumOptionData(HolidayStatusType.ACTIVE.getValue().longValue(), HolidayStatusType.ACTIVE.getCode(), "Active");
|
optionData = new EnumOptionData(HolidayStatusType.ACTIVE.getValue().longValue(), HolidayStatusType.ACTIVE.getCode(),
|
||||||
|
"Active");
|
||||||
break;
|
break;
|
||||||
case DELETED:
|
case DELETED:
|
||||||
optionData = new EnumOptionData(HolidayStatusType.DELETED.getValue().longValue(), HolidayStatusType.DELETED.getCode(), "Deleted");
|
optionData = new EnumOptionData(HolidayStatusType.DELETED.getValue().longValue(), HolidayStatusType.DELETED.getCode(),
|
||||||
|
"Deleted");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return optionData;
|
return optionData;
|
||||||
|
|||||||
+10
-8
@@ -51,8 +51,9 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public HolidayWritePlatformServiceJpaRepositoryImpl(final HolidayDataValidator fromApiJsonDeserializer,
|
public HolidayWritePlatformServiceJpaRepositoryImpl(final HolidayDataValidator fromApiJsonDeserializer,
|
||||||
final HolidayRepositoryWrapper holidayRepository, final PlatformSecurityContext context, final OfficeRepository officeRepository,
|
final HolidayRepositoryWrapper holidayRepository, final PlatformSecurityContext context,
|
||||||
final FromJsonHelper fromApiJsonHelper, final WorkingDaysRepositoryWrapper daysRepositoryWrapper, final ConfigurationDomainService configurationDomainService) {
|
final OfficeRepository officeRepository, final FromJsonHelper fromApiJsonHelper,
|
||||||
|
final WorkingDaysRepositoryWrapper daysRepositoryWrapper, final ConfigurationDomainService configurationDomainService) {
|
||||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||||
this.holidayRepository = holidayRepository;
|
this.holidayRepository = holidayRepository;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -123,8 +124,7 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit
|
|||||||
|
|
||||||
holiday.activate();
|
holiday.activate();
|
||||||
this.holidayRepository.saveAndFlush(holiday);
|
this.holidayRepository.saveAndFlush(holiday);
|
||||||
return new CommandProcessingResultBuilder()
|
return new CommandProcessingResultBuilder().withEntityId(holiday.getId()).build();
|
||||||
.withEntityId(holiday.getId()).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -134,14 +134,14 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit
|
|||||||
final Holiday holiday = this.holidayRepository.findOneWithNotFoundDetection(holidayId);
|
final Holiday holiday = this.holidayRepository.findOneWithNotFoundDetection(holidayId);
|
||||||
holiday.delete();
|
holiday.delete();
|
||||||
this.holidayRepository.saveAndFlush(holiday);
|
this.holidayRepository.saveAndFlush(holiday);
|
||||||
return new CommandProcessingResultBuilder()
|
return new CommandProcessingResultBuilder().withEntityId(holidayId).build();
|
||||||
.withEntityId(holidayId).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Office> getSelectedOffices(final JsonCommand command) {
|
private Set<Office> getSelectedOffices(final JsonCommand command) {
|
||||||
Set<Office> offices = null;
|
Set<Office> offices = null;
|
||||||
final JsonObject topLevelJsonElement = this.fromApiJsonHelper.parse(command.json()).getAsJsonObject();
|
final JsonObject topLevelJsonElement = this.fromApiJsonHelper.parse(command.json()).getAsJsonObject();
|
||||||
if (topLevelJsonElement.has(HolidayApiConstants.officesParamName) && topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) {
|
if (topLevelJsonElement.has(HolidayApiConstants.officesParamName)
|
||||||
|
&& topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) {
|
||||||
|
|
||||||
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray();
|
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray();
|
||||||
offices = new HashSet<Office>(array.size());
|
offices = new HashSet<Office>(array.size());
|
||||||
@@ -172,9 +172,11 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit
|
|||||||
private void validateInputDates(final JsonCommand command) {
|
private void validateInputDates(final JsonCommand command) {
|
||||||
final LocalDate fromDate = command.localDateValueOfParameterNamed(HolidayApiConstants.fromDateParamName);
|
final LocalDate fromDate = command.localDateValueOfParameterNamed(HolidayApiConstants.fromDateParamName);
|
||||||
final LocalDate toDate = command.localDateValueOfParameterNamed(HolidayApiConstants.toDateParamName);
|
final LocalDate toDate = command.localDateValueOfParameterNamed(HolidayApiConstants.toDateParamName);
|
||||||
final LocalDate repaymentsRescheduledTo = command.localDateValueOfParameterNamed(HolidayApiConstants.repaymentsRescheduledToParamName);
|
final LocalDate repaymentsRescheduledTo = command
|
||||||
|
.localDateValueOfParameterNamed(HolidayApiConstants.repaymentsRescheduledToParamName);
|
||||||
this.validateInputDates(fromDate, toDate, repaymentsRescheduledTo);
|
this.validateInputDates(fromDate, toDate, repaymentsRescheduledTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateInputDates(final LocalDate fromDate, final LocalDate toDate, final LocalDate repaymentsRescheduledTo) {
|
private void validateInputDates(final LocalDate fromDate, final LocalDate toDate, final LocalDate repaymentsRescheduledTo) {
|
||||||
|
|
||||||
String defaultUserMessage = "";
|
String defaultUserMessage = "";
|
||||||
|
|||||||
+4
-2
@@ -38,8 +38,10 @@ public class StaffData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static StaffData instance(final Long id, final String firstname, final String lastname, final String displayName,
|
public static StaffData instance(final Long id, final String firstname, final String lastname, final String displayName,
|
||||||
final Long officeId, final String officeName, final Boolean isLoanOfficer, final String externalId, final String mobileNo, final boolean isActive) {
|
final Long officeId, final String officeName, final Boolean isLoanOfficer, final String externalId, final String mobileNo,
|
||||||
return new StaffData(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo, null, isActive);
|
final boolean isActive) {
|
||||||
|
return new StaffData(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo, null,
|
||||||
|
isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private StaffData(final Long id, final String firstname, final String lastname, final String displayName, final Long officeId,
|
private StaffData(final Long id, final String firstname, final String lastname, final String displayName, final Long officeId,
|
||||||
|
|||||||
+9
-6
@@ -57,7 +57,8 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
|||||||
final String mobileNo = rs.getString("mobileNo");
|
final String mobileNo = rs.getString("mobileNo");
|
||||||
final boolean isActive = rs.getBoolean("isActive");
|
final boolean isActive = rs.getBoolean("isActive");
|
||||||
|
|
||||||
return StaffData.instance(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo, isActive);
|
return StaffData.instance(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo,
|
||||||
|
isActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +99,8 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
|||||||
final String mobileNo = rs.getString("mobileNo");
|
final String mobileNo = rs.getString("mobileNo");
|
||||||
final boolean isActive = rs.getBoolean("isActive");
|
final boolean isActive = rs.getBoolean("isActive");
|
||||||
|
|
||||||
return StaffData.instance(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo, isActive);
|
return StaffData.instance(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo,
|
||||||
|
isActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +167,8 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<StaffData> retrieveAllStaff(final String sqlSearch, final Long officeId, final boolean loanOfficersOnly, final String status) {
|
public Collection<StaffData> retrieveAllStaff(final String sqlSearch, final Long officeId, final boolean loanOfficersOnly,
|
||||||
|
final String status) {
|
||||||
final String extraCriteria = getStaffCriteria(sqlSearch, officeId, loanOfficersOnly, status);
|
final String extraCriteria = getStaffCriteria(sqlSearch, officeId, loanOfficersOnly, status);
|
||||||
return retrieveAllStaff(extraCriteria);
|
return retrieveAllStaff(extraCriteria);
|
||||||
}
|
}
|
||||||
@@ -194,13 +197,13 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
|||||||
if (loanOfficersOnly) {
|
if (loanOfficersOnly) {
|
||||||
extraCriteria.append(" and s.is_loan_officer is true ");
|
extraCriteria.append(" and s.is_loan_officer is true ");
|
||||||
}
|
}
|
||||||
// Passing status parameter to get ACTIVE (By Default), INACTIVE or ALL (Both active and Inactive) employees
|
// Passing status parameter to get ACTIVE (By Default), INACTIVE or ALL
|
||||||
|
// (Both active and Inactive) employees
|
||||||
if (status.equalsIgnoreCase("active")) {
|
if (status.equalsIgnoreCase("active")) {
|
||||||
extraCriteria.append(" and is_active = 1 ");
|
extraCriteria.append(" and is_active = 1 ");
|
||||||
} else if (status.equalsIgnoreCase("inActive")) {
|
} else if (status.equalsIgnoreCase("inActive")) {
|
||||||
extraCriteria.append(" and is_active = 0 ");
|
extraCriteria.append(" and is_active = 0 ");
|
||||||
} else if (status.equalsIgnoreCase("all")) {}
|
} else if (status.equalsIgnoreCase("all")) {} else {
|
||||||
else {
|
|
||||||
throw new UnrecognizedQueryParamException("status", status, new Object[] { "all", "active", "inactive" });
|
throw new UnrecognizedQueryParamException("status", status, new Object[] { "all", "active", "inactive" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -100,6 +100,7 @@ public class StaffWritePlatformServiceJpaRepositoryImpl implements StaffWritePla
|
|||||||
return CommandProcessingResult.empty();
|
return CommandProcessingResult.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Guaranteed to throw an exception no matter what the data integrity issue
|
* Guaranteed to throw an exception no matter what the data integrity issue
|
||||||
* is.
|
* is.
|
||||||
|
|||||||
+2
-1
@@ -98,7 +98,8 @@ public class AccountTransfersApiResource {
|
|||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);
|
this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forAccountTransfer(sqlSearch, externalId, offset, limit, orderBy, sortOrder);
|
final SearchParameters searchParameters = SearchParameters.forAccountTransfer(sqlSearch, externalId, offset, limit, orderBy,
|
||||||
|
sortOrder);
|
||||||
|
|
||||||
final Page<AccountTransferData> transfers = this.accountTransfersReadPlatformService.retrieveAll(searchParameters);
|
final Page<AccountTransferData> transfers = this.accountTransfersReadPlatformService.retrieveAll(searchParameters);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,8 @@ public class AccountTransferDTO {
|
|||||||
public AccountTransferDTO(final LocalDate transactionDate, final BigDecimal transactionAmount,
|
public AccountTransferDTO(final LocalDate transactionDate, final BigDecimal transactionAmount,
|
||||||
final PortfolioAccountType fromAccountType, final PortfolioAccountType toAccountType, final Long fromAccountId,
|
final PortfolioAccountType fromAccountType, final PortfolioAccountType toAccountType, final Long fromAccountId,
|
||||||
final Long toAccountId, final String description, final Locale locale, final DateTimeFormatter fmt,
|
final Long toAccountId, final String description, final Locale locale, final DateTimeFormatter fmt,
|
||||||
final PaymentDetail paymentDetail, final Integer fromTransferType, final Integer toTransferType, final Long chargeId, Integer loanInstallmentNumber) {
|
final PaymentDetail paymentDetail, final Integer fromTransferType, final Integer toTransferType, final Long chargeId,
|
||||||
|
Integer loanInstallmentNumber) {
|
||||||
this.transactionDate = transactionDate;
|
this.transactionDate = transactionDate;
|
||||||
this.transactionAmount = transactionAmount;
|
this.transactionAmount = transactionAmount;
|
||||||
this.fromAccountType = fromAccountType;
|
this.fromAccountType = fromAccountType;
|
||||||
@@ -97,7 +98,6 @@ public class AccountTransferDTO {
|
|||||||
return this.chargeId;
|
return this.chargeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Integer getLoanInstallmentNumber() {
|
public Integer getLoanInstallmentNumber() {
|
||||||
return this.loanInstallmentNumber;
|
return this.loanInstallmentNumber;
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -176,7 +176,6 @@ public class AccountTransfer extends AbstractPersistable<Long> {
|
|||||||
return this.fromAccount;
|
return this.fromAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateToLoanTransaction(LoanTransaction toLoanTransaction) {
|
public void updateToLoanTransaction(LoanTransaction toLoanTransaction) {
|
||||||
this.toLoanTransaction = toLoanTransaction;
|
this.toLoanTransaction = toLoanTransaction;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -229,7 +229,8 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
|
|
||||||
final LoanTransaction loanRepaymentTransaction = this.loanAccountDomainService.makeChargePayment(toLoanAccount,
|
final LoanTransaction loanRepaymentTransaction = this.loanAccountDomainService.makeChargePayment(toLoanAccount,
|
||||||
accountTransferDTO.getChargeId(), accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
accountTransferDTO.getChargeId(), accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||||
accountTransferDTO.getPaymentDetail(), null, null, accountTransferDTO.getToTransferType(), accountTransferDTO.getLoanInstallmentNumber());
|
accountTransferDTO.getPaymentDetail(), null, null, accountTransferDTO.getToTransferType(),
|
||||||
|
accountTransferDTO.getLoanInstallmentNumber());
|
||||||
|
|
||||||
final AccountTransfer transferTransaction = this.accountTransferAssembler.assembleSavingsToLoanTransfer(accountTransferDTO,
|
final AccountTransfer transferTransaction = this.accountTransferAssembler.assembleSavingsToLoanTransfer(accountTransferDTO,
|
||||||
fromSavingsAccount, toLoanAccount, withdrawal, loanRepaymentTransaction);
|
fromSavingsAccount, toLoanAccount, withdrawal, loanRepaymentTransaction);
|
||||||
|
|||||||
+1
@@ -11,6 +11,7 @@ import java.util.Set;
|
|||||||
public class CalendarConstants {
|
public class CalendarConstants {
|
||||||
|
|
||||||
public static final String CALENDAR_RESOURCE_NAME = "calendar";
|
public static final String CALENDAR_RESOURCE_NAME = "calendar";
|
||||||
|
|
||||||
public static enum CALENDAR_SUPPORTED_PARAMETERS {
|
public static enum CALENDAR_SUPPORTED_PARAMETERS {
|
||||||
CALENDAR_ID("id"), ENTITY_TYPE("entityType"), ENTITY_ID("entityId"), TITLE("title"), DESCRIPTION("description"), LOCATION(
|
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(
|
"location"), START_DATE("startDate"), END_DATE("endDate"), CREATED_DATE("createdDate"), DURATION("duration"), TYPE_ID(
|
||||||
|
|||||||
+6
-6
@@ -55,12 +55,12 @@ public class CalendarsApiResource {
|
|||||||
/**
|
/**
|
||||||
* The set of parameters that are supported in response for {@link Calendar}
|
* The set of parameters that are supported in response for {@link Calendar}
|
||||||
*/
|
*/
|
||||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(
|
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "entityId", "entityType", "title",
|
||||||
Arrays.asList("id", "entityId", "entityType", "title", "description", "location", "startDate", "endDate", "duration", "type",
|
"description", "location", "startDate", "endDate", "duration", "type", "repeating", "recurrence", "frequency", "interval",
|
||||||
"repeating", "recurrence", "frequency", "interval", "repeatsOnDay", "remindBy", "firstReminder", "secondReminder",
|
"repeatsOnDay", "remindBy", "firstReminder", "secondReminder", "humanReadable", "createdDate", "lastUpdatedDate",
|
||||||
"humanReadable", "createdDate", "lastUpdatedDate", "createdByUserId", "createdByUsername", "lastUpdatedByUserId",
|
"createdByUserId", "createdByUsername", "lastUpdatedByUserId", "lastUpdatedByUsername", "recurringDates",
|
||||||
"lastUpdatedByUsername", "recurringDates", "nextTenRecurringDates", "entityTypeOptions", "calendarTypeOptions",
|
"nextTenRecurringDates", "entityTypeOptions", "calendarTypeOptions", "remindByOptions", "frequencyOptions",
|
||||||
"remindByOptions", "frequencyOptions", "repeatsOnDayOptions"));
|
"repeatsOnDayOptions"));
|
||||||
private final String resourceNameForPermissions = "CALENDAR";
|
private final String resourceNameForPermissions = "CALENDAR";
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
|
|||||||
+45
-46
@@ -60,12 +60,13 @@ public class CalendarData {
|
|||||||
final List<EnumOptionData> frequencyOptions;
|
final List<EnumOptionData> frequencyOptions;
|
||||||
final List<EnumOptionData> repeatsOnDayOptions;
|
final List<EnumOptionData> repeatsOnDayOptions;
|
||||||
|
|
||||||
public static CalendarData instance(final Long id, final Long calendarInstanceId, final Long entityId, final EnumOptionData entityType, final String title,
|
public static CalendarData instance(final Long id, final Long calendarInstanceId, final Long entityId, final EnumOptionData entityType,
|
||||||
final String description, final String location, final LocalDate startDate, final LocalDate endDate, final Integer duration,
|
final String title, final String description, final String location, final LocalDate startDate, final LocalDate endDate,
|
||||||
final EnumOptionData type, final boolean repeating, final String recurrence, final EnumOptionData frequency,
|
final Integer duration, final EnumOptionData type, final boolean repeating, final String recurrence,
|
||||||
final Integer interval, final EnumOptionData repeatsOnDay, final EnumOptionData remindBy, final Integer firstReminder,
|
final EnumOptionData frequency, final Integer interval, final EnumOptionData repeatsOnDay, final EnumOptionData remindBy,
|
||||||
final Integer secondReminder, final String humanReadable, final LocalDate createdDate, final LocalDate lastUpdatedDate,
|
final Integer firstReminder, final Integer secondReminder, final String humanReadable, final LocalDate createdDate,
|
||||||
final Long createdByUserId, final String createdByUsername, final Long lastUpdatedByUserId, final String lastUpdatedByUsername) {
|
final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername, final Long lastUpdatedByUserId,
|
||||||
|
final String lastUpdatedByUsername) {
|
||||||
|
|
||||||
final Collection<LocalDate> recurringDates = null;
|
final Collection<LocalDate> recurringDates = null;
|
||||||
final Collection<LocalDate> nextTenRecurringDates = null;
|
final Collection<LocalDate> nextTenRecurringDates = null;
|
||||||
@@ -77,8 +78,8 @@ public class CalendarData {
|
|||||||
final List<EnumOptionData> frequencyOptions = null;
|
final List<EnumOptionData> frequencyOptions = null;
|
||||||
final List<EnumOptionData> repeatsOnDayOptions = null;
|
final List<EnumOptionData> repeatsOnDayOptions = null;
|
||||||
|
|
||||||
return new CalendarData(id, calendarInstanceId, entityId, entityType, title, description, location, startDate, endDate, duration, type, repeating,
|
return new CalendarData(id, calendarInstanceId, entityId, entityType, title, description, location, startDate, endDate, duration,
|
||||||
recurrence, frequency, interval, repeatsOnDay, remindBy, firstReminder, secondReminder, recurringDates,
|
type, repeating, recurrence, frequency, interval, repeatsOnDay, remindBy, firstReminder, secondReminder, recurringDates,
|
||||||
nextTenRecurringDates, humanReadable, recentEligibleMeetingDate, createdDate, lastUpdatedDate, createdByUserId,
|
nextTenRecurringDates, humanReadable, recentEligibleMeetingDate, createdDate, lastUpdatedDate, createdByUserId,
|
||||||
createdByUsername, lastUpdatedByUserId, lastUpdatedByUsername, entityTypeOptions, calendarTypeOptions, remindByOptions,
|
createdByUsername, lastUpdatedByUserId, lastUpdatedByUsername, entityTypeOptions, calendarTypeOptions, remindByOptions,
|
||||||
frequencyOptions, repeatsOnDayOptions);
|
frequencyOptions, repeatsOnDayOptions);
|
||||||
@@ -86,27 +87,27 @@ public class CalendarData {
|
|||||||
|
|
||||||
public static CalendarData withRecurringDates(final CalendarData calendarData, final Collection<LocalDate> recurringDates,
|
public static CalendarData withRecurringDates(final CalendarData calendarData, final Collection<LocalDate> recurringDates,
|
||||||
final Collection<LocalDate> nextTenRecurringDates, final LocalDate recentEligibleMeetingDate) {
|
final Collection<LocalDate> nextTenRecurringDates, final LocalDate recentEligibleMeetingDate) {
|
||||||
return new CalendarData(calendarData.id, calendarData.calendarInstanceId, calendarData.entityId, calendarData.entityType, calendarData.title,
|
return new CalendarData(calendarData.id, calendarData.calendarInstanceId, calendarData.entityId, calendarData.entityType,
|
||||||
calendarData.description, calendarData.location, calendarData.startDate, calendarData.endDate, calendarData.duration,
|
calendarData.title, calendarData.description, calendarData.location, calendarData.startDate, calendarData.endDate,
|
||||||
calendarData.type, calendarData.repeating, calendarData.recurrence, calendarData.frequency, calendarData.interval,
|
calendarData.duration, calendarData.type, calendarData.repeating, calendarData.recurrence, calendarData.frequency,
|
||||||
calendarData.repeatsOnDay, calendarData.remindBy, calendarData.firstReminder, calendarData.secondReminder, recurringDates,
|
calendarData.interval, calendarData.repeatsOnDay, calendarData.remindBy, calendarData.firstReminder,
|
||||||
nextTenRecurringDates, calendarData.humanReadable, recentEligibleMeetingDate, calendarData.createdDate,
|
calendarData.secondReminder, recurringDates, nextTenRecurringDates, calendarData.humanReadable, recentEligibleMeetingDate,
|
||||||
calendarData.lastUpdatedDate, calendarData.createdByUserId, calendarData.createdByUsername,
|
calendarData.createdDate, calendarData.lastUpdatedDate, calendarData.createdByUserId, calendarData.createdByUsername,
|
||||||
calendarData.lastUpdatedByUserId, calendarData.lastUpdatedByUsername, calendarData.entityTypeOptions,
|
calendarData.lastUpdatedByUserId, calendarData.lastUpdatedByUsername, calendarData.entityTypeOptions,
|
||||||
calendarData.calendarTypeOptions, calendarData.remindByOptions, calendarData.frequencyOptions,
|
calendarData.calendarTypeOptions, calendarData.remindByOptions, calendarData.frequencyOptions,
|
||||||
calendarData.repeatsOnDayOptions);
|
calendarData.repeatsOnDayOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarData withRecentEligibleMeetingDate(final CalendarData calendarData, final LocalDate recentEligibleMeetingDate) {
|
public static CalendarData withRecentEligibleMeetingDate(final CalendarData calendarData, final LocalDate recentEligibleMeetingDate) {
|
||||||
return new CalendarData(calendarData.id, calendarData.calendarInstanceId, calendarData.entityId, calendarData.entityType, calendarData.title,
|
return new CalendarData(calendarData.id, calendarData.calendarInstanceId, calendarData.entityId, calendarData.entityType,
|
||||||
calendarData.description, calendarData.location, calendarData.startDate, calendarData.endDate, calendarData.duration,
|
calendarData.title, calendarData.description, calendarData.location, calendarData.startDate, calendarData.endDate,
|
||||||
calendarData.type, calendarData.repeating, calendarData.recurrence, calendarData.frequency, calendarData.interval,
|
calendarData.duration, calendarData.type, calendarData.repeating, calendarData.recurrence, calendarData.frequency,
|
||||||
calendarData.repeatsOnDay, calendarData.remindBy, calendarData.firstReminder, calendarData.secondReminder, calendarData.recurringDates,
|
calendarData.interval, calendarData.repeatsOnDay, calendarData.remindBy, calendarData.firstReminder,
|
||||||
calendarData.nextTenRecurringDates, calendarData.humanReadable, recentEligibleMeetingDate, calendarData.createdDate,
|
calendarData.secondReminder, calendarData.recurringDates, calendarData.nextTenRecurringDates, calendarData.humanReadable,
|
||||||
calendarData.lastUpdatedDate, calendarData.createdByUserId, calendarData.createdByUsername,
|
recentEligibleMeetingDate, calendarData.createdDate, calendarData.lastUpdatedDate, calendarData.createdByUserId,
|
||||||
calendarData.lastUpdatedByUserId, calendarData.lastUpdatedByUsername, calendarData.entityTypeOptions,
|
calendarData.createdByUsername, calendarData.lastUpdatedByUserId, calendarData.lastUpdatedByUsername,
|
||||||
calendarData.calendarTypeOptions, calendarData.remindByOptions, calendarData.frequencyOptions,
|
calendarData.entityTypeOptions, calendarData.calendarTypeOptions, calendarData.remindByOptions,
|
||||||
calendarData.repeatsOnDayOptions);
|
calendarData.frequencyOptions, calendarData.repeatsOnDayOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CalendarData sensibleDefaultsForNewCalendarCreation() {
|
public static CalendarData sensibleDefaultsForNewCalendarCreation() {
|
||||||
@@ -147,8 +148,8 @@ public class CalendarData {
|
|||||||
final Long lastUpdatedByUserId = null;
|
final Long lastUpdatedByUserId = null;
|
||||||
final String lastUpdatedByUsername = null;
|
final String lastUpdatedByUsername = null;
|
||||||
|
|
||||||
return new CalendarData(id, calendarInstanceId, entityId, entityType, title, description, location, startDate, endDate, duration, type, repeating,
|
return new CalendarData(id, calendarInstanceId, entityId, entityType, title, description, location, startDate, endDate, duration,
|
||||||
recurrence, frequency, interval, repeatsOnDay, remindBy, firstReminder, secondReminder, recurringDates,
|
type, repeating, recurrence, frequency, interval, repeatsOnDay, remindBy, firstReminder, secondReminder, recurringDates,
|
||||||
nextTenRecurringDates, humanReadable, recentEligibleMeetingDate, createdDate, lastUpdatedDate, createdByUserId,
|
nextTenRecurringDates, humanReadable, recentEligibleMeetingDate, createdDate, lastUpdatedDate, createdByUserId,
|
||||||
createdByUsername, lastUpdatedByUserId, lastUpdatedByUsername, entityTypeOptions, calendarTypeOptions, remindByOptions,
|
createdByUsername, lastUpdatedByUserId, lastUpdatedByUsername, entityTypeOptions, calendarTypeOptions, remindByOptions,
|
||||||
frequencyOptions, repeatsOnDayOptions);
|
frequencyOptions, repeatsOnDayOptions);
|
||||||
@@ -158,26 +159,27 @@ public class CalendarData {
|
|||||||
final List<EnumOptionData> calendarTypeOptions, final List<EnumOptionData> remindByOptions,
|
final List<EnumOptionData> calendarTypeOptions, final List<EnumOptionData> remindByOptions,
|
||||||
final List<EnumOptionData> repeatsOptions, final List<EnumOptionData> repeatsOnDayOptions) {
|
final List<EnumOptionData> repeatsOptions, final List<EnumOptionData> repeatsOnDayOptions) {
|
||||||
|
|
||||||
return new CalendarData(calendarData.id, calendarData.calendarInstanceId, calendarData.entityId, calendarData.entityType, calendarData.title,
|
return new CalendarData(calendarData.id, calendarData.calendarInstanceId, calendarData.entityId, calendarData.entityType,
|
||||||
calendarData.description, calendarData.location, calendarData.startDate, calendarData.endDate, calendarData.duration,
|
calendarData.title, calendarData.description, calendarData.location, calendarData.startDate, calendarData.endDate,
|
||||||
calendarData.type, calendarData.repeating, calendarData.recurrence, calendarData.frequency, calendarData.interval,
|
calendarData.duration, calendarData.type, calendarData.repeating, calendarData.recurrence, calendarData.frequency,
|
||||||
calendarData.repeatsOnDay, calendarData.remindBy, calendarData.firstReminder, calendarData.secondReminder,
|
calendarData.interval, calendarData.repeatsOnDay, calendarData.remindBy, calendarData.firstReminder,
|
||||||
calendarData.recurringDates, calendarData.nextTenRecurringDates, calendarData.humanReadable,
|
calendarData.secondReminder, calendarData.recurringDates, calendarData.nextTenRecurringDates, calendarData.humanReadable,
|
||||||
calendarData.recentEligibleMeetingDate, calendarData.createdDate, calendarData.lastUpdatedDate,
|
calendarData.recentEligibleMeetingDate, calendarData.createdDate, calendarData.lastUpdatedDate,
|
||||||
calendarData.createdByUserId, calendarData.createdByUsername, calendarData.lastUpdatedByUserId, calendarData.lastUpdatedByUsername,
|
calendarData.createdByUserId, calendarData.createdByUsername, calendarData.lastUpdatedByUserId,
|
||||||
entityTypeOptions, calendarTypeOptions, remindByOptions, repeatsOptions, repeatsOnDayOptions);
|
calendarData.lastUpdatedByUsername, entityTypeOptions, calendarTypeOptions, remindByOptions, repeatsOptions,
|
||||||
|
repeatsOnDayOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CalendarData(final Long id, final Long calendarInstanceId, final Long entityId, final EnumOptionData entityType, final String title, final String description,
|
private CalendarData(final Long id, final Long calendarInstanceId, final Long entityId, final EnumOptionData entityType,
|
||||||
final String location, final LocalDate startDate, final LocalDate endDate, final Integer duration, final EnumOptionData type,
|
final String title, final String description, final String location, final LocalDate startDate, final LocalDate endDate,
|
||||||
final boolean repeating, final String recurrence, final EnumOptionData frequency, final Integer interval,
|
final Integer duration, final EnumOptionData type, final boolean repeating, final String recurrence,
|
||||||
final EnumOptionData repeatsOnDay, final EnumOptionData remindBy, final Integer firstReminder, final Integer secondReminder,
|
final EnumOptionData frequency, final Integer interval, final EnumOptionData repeatsOnDay, final EnumOptionData remindBy,
|
||||||
final Collection<LocalDate> recurringDates, final Collection<LocalDate> nextTenRecurringDates, final String humanReadable,
|
final Integer firstReminder, final Integer secondReminder, final Collection<LocalDate> recurringDates,
|
||||||
final LocalDate recentEligibleMeetingDate, final LocalDate createdDate, final LocalDate lastUpdatedDate,
|
final Collection<LocalDate> nextTenRecurringDates, final String humanReadable, final LocalDate recentEligibleMeetingDate,
|
||||||
final Long createdByUserId, final String createdByUsername, final Long lastUpdatedByUserId, final String lastUpdatedByUsername,
|
final LocalDate createdDate, final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername,
|
||||||
final List<EnumOptionData> entityTypeOptions, final List<EnumOptionData> calendarTypeOptions,
|
final Long lastUpdatedByUserId, final String lastUpdatedByUsername, final List<EnumOptionData> entityTypeOptions,
|
||||||
final List<EnumOptionData> remindByOptions, final List<EnumOptionData> repeatsOptions,
|
final List<EnumOptionData> calendarTypeOptions, final List<EnumOptionData> remindByOptions,
|
||||||
final List<EnumOptionData> repeatsOnDayOptions) {
|
final List<EnumOptionData> repeatsOptions, final List<EnumOptionData> repeatsOnDayOptions) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.calendarInstanceId = calendarInstanceId;
|
this.calendarInstanceId = calendarInstanceId;
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
@@ -294,7 +296,6 @@ public class CalendarData {
|
|||||||
return this.humanReadable;
|
return this.humanReadable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Long getCalendarInstanceId() {
|
public Long getCalendarInstanceId() {
|
||||||
return this.calendarInstanceId;
|
return this.calendarInstanceId;
|
||||||
}
|
}
|
||||||
@@ -315,9 +316,7 @@ public class CalendarData {
|
|||||||
|
|
||||||
public boolean isBetweenStartAndEndDate(final LocalDate compareDate) {
|
public boolean isBetweenStartAndEndDate(final LocalDate compareDate) {
|
||||||
if (isStartDateBeforeOrEqual(compareDate)) {
|
if (isStartDateBeforeOrEqual(compareDate)) {
|
||||||
if (this.endDate == null || isEndDateAfterOrEqual(compareDate)){
|
if (this.endDate == null || isEndDateAfterOrEqual(compareDate)) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-6
@@ -185,10 +185,10 @@ public class Calendar extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
if (newValue.isBefore(currentDate)) {
|
if (newValue.isBefore(currentDate)) {
|
||||||
final String defaultUserMessage = "New meeting effective from date cannot be in past";
|
final String defaultUserMessage = "New meeting effective from date cannot be in past";
|
||||||
throw new CalendarDateException("new.start.date.cannot.be.in.past", defaultUserMessage, newValue,
|
throw new CalendarDateException("new.start.date.cannot.be.in.past", defaultUserMessage, newValue, getStartDateLocalDate());
|
||||||
getStartDateLocalDate());
|
|
||||||
} else if (isStartDateAfter(newValue) && isStartDateBeforeOrEqual(currentDate)) {
|
} else if (isStartDateAfter(newValue) && isStartDateBeforeOrEqual(currentDate)) {
|
||||||
//new meeting date should be on or after start date or current date
|
// new meeting date should be on or after start date or current
|
||||||
|
// date
|
||||||
final String defaultUserMessage = "New meeting effective from date cannot be a date before existing meeting start date";
|
final String defaultUserMessage = "New meeting effective from date cannot be a date before existing meeting start date";
|
||||||
throw new CalendarDateException("new.start.date.before.existing.date", defaultUserMessage, newValue,
|
throw new CalendarDateException("new.start.date.before.existing.date", defaultUserMessage, newValue,
|
||||||
getStartDateLocalDate());
|
getStartDateLocalDate());
|
||||||
@@ -403,9 +403,7 @@ public class Calendar extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
|
|
||||||
public boolean isBetweenStartAndEndDate(final LocalDate compareDate) {
|
public boolean isBetweenStartAndEndDate(final LocalDate compareDate) {
|
||||||
if (isStartDateBeforeOrEqual(compareDate)) {
|
if (isStartDateBeforeOrEqual(compareDate)) {
|
||||||
if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)){
|
if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -75,7 +75,8 @@ public class CalendarHistory extends AbstractPersistable<Long>{
|
|||||||
this.description = calendar.getDescription();
|
this.description = calendar.getDescription();
|
||||||
this.location = calendar.getLocation();
|
this.location = calendar.getLocation();
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
this.endDate = calendar.getStartDate();//Calendar start date become end date for history data.
|
this.endDate = calendar.getStartDate();// Calendar start date become end
|
||||||
|
// date for history data.
|
||||||
this.duration = calendar.getDuration();
|
this.duration = calendar.getDuration();
|
||||||
this.typeId = calendar.getTypeId();
|
this.typeId = calendar.getTypeId();
|
||||||
this.repeating = calendar.isRepeating();
|
this.repeating = calendar.isRepeating();
|
||||||
@@ -121,9 +122,7 @@ public class CalendarHistory extends AbstractPersistable<Long>{
|
|||||||
|
|
||||||
public boolean isBetweenStartAndEndDate(final LocalDate compareDate) {
|
public boolean isBetweenStartAndEndDate(final LocalDate compareDate) {
|
||||||
if (isStartDateBeforeOrEqual(compareDate)) {
|
if (isStartDateBeforeOrEqual(compareDate)) {
|
||||||
if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)){
|
if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -42,7 +42,6 @@ public enum CalendarWeekDaysType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static CalendarWeekDaysType fromInt(final int i) {
|
public static CalendarWeekDaysType fromInt(final int i) {
|
||||||
final CalendarWeekDaysType type = intToEnumMap.get(Integer.valueOf(i));
|
final CalendarWeekDaysType type = intToEnumMap.get(Integer.valueOf(i));
|
||||||
return type;
|
return type;
|
||||||
|
|||||||
+4
-4
@@ -151,8 +151,8 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD
|
|||||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element)) {
|
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element)) {
|
||||||
final Integer interval = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
final Integer interval = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||||
CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element);
|
CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element);
|
||||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue()).value(interval)
|
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue()).value(interval).notNull()
|
||||||
.notNull().integerGreaterThanZero();
|
.integerGreaterThanZero();
|
||||||
}
|
}
|
||||||
if (CalendarFrequencyType.fromInt(frequency).isWeekly()) {
|
if (CalendarFrequencyType.fromInt(frequency).isWeekly()) {
|
||||||
final Integer repeatsOnDay = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
final Integer repeatsOnDay = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||||
@@ -261,8 +261,8 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD
|
|||||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element)) {
|
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element)) {
|
||||||
final Integer interval = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
final Integer interval = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(
|
||||||
CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element);
|
CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue(), element);
|
||||||
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue()).value(interval)
|
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.INTERVAL.getValue()).value(interval).notNull()
|
||||||
.notNull().integerGreaterThanZero();
|
.integerGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue(), element)) {
|
if (this.fromApiJsonHelper.parameterExists(CALENDAR_SUPPORTED_PARAMETERS.REPEATS_ON_DAY.getValue(), element)) {
|
||||||
|
|||||||
+4
-2
@@ -73,7 +73,8 @@ public class CalendarEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData calendarFrequencyType(final CalendarFrequencyType calendarFrequencyType) {
|
public static EnumOptionData calendarFrequencyType(final CalendarFrequencyType calendarFrequencyType) {
|
||||||
final EnumOptionData optionData = new EnumOptionData(calendarFrequencyType.getValue().longValue(), calendarFrequencyType.getCode(), calendarFrequencyType.toString());
|
final EnumOptionData optionData = new EnumOptionData(calendarFrequencyType.getValue().longValue(), calendarFrequencyType.getCode(),
|
||||||
|
calendarFrequencyType.toString());
|
||||||
return optionData;
|
return optionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +93,8 @@ public class CalendarEnumerations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumOptionData calendarWeekDaysType(final CalendarWeekDaysType calendarWeekDaysType) {
|
public static EnumOptionData calendarWeekDaysType(final CalendarWeekDaysType calendarWeekDaysType) {
|
||||||
final EnumOptionData optionData = new EnumOptionData(calendarWeekDaysType.getValue().longValue(), calendarWeekDaysType.getCode(), calendarWeekDaysType.toString());
|
final EnumOptionData optionData = new EnumOptionData(calendarWeekDaysType.getValue().longValue(), calendarWeekDaysType.getCode(),
|
||||||
|
calendarWeekDaysType.toString());
|
||||||
return optionData;
|
return optionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -207,7 +207,8 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
return generateRecurringDate(calendarData, DateUtils.getLocalDateOfTenant(), tillDate, 10);
|
return generateRecurringDate(calendarData, DateUtils.getLocalDateOfTenant(), tillDate, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<LocalDate> generateRecurringDate(final CalendarData calendarData, final LocalDate fromDate, final LocalDate tillDate, final int maxCount) {
|
private Collection<LocalDate> generateRecurringDate(final CalendarData calendarData, final LocalDate fromDate,
|
||||||
|
final LocalDate tillDate, final int maxCount) {
|
||||||
|
|
||||||
if (!calendarData.isRepeating()) { return null; }
|
if (!calendarData.isRepeating()) { return null; }
|
||||||
final String rrule = calendarData.getRecurrence();
|
final String rrule = calendarData.getRecurrence();
|
||||||
|
|||||||
+4
-2
@@ -159,7 +159,8 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
|||||||
final Map<String, Object> changes = calendarForUpdate.update(command);
|
final Map<String, Object> changes = calendarForUpdate.update(command);
|
||||||
|
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
//update calendar history table only if there is a change in calendar start date.
|
// update calendar history table only if there is a change in
|
||||||
|
// calendar start date.
|
||||||
if (currentDate.isAfter(new LocalDate(oldStartDate))) {
|
if (currentDate.isAfter(new LocalDate(oldStartDate))) {
|
||||||
final Date endDate = calendarForUpdate.getStartDateLocalDate().minusDays(1).toDate();
|
final Date endDate = calendarForUpdate.getStartDateLocalDate().minusDays(1).toDate();
|
||||||
calendarHistory.updateEndDate(endDate);
|
calendarHistory.updateEndDate(endDate);
|
||||||
@@ -169,7 +170,8 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
|||||||
this.calendarRepository.saveAndFlush(calendarForUpdate);
|
this.calendarRepository.saveAndFlush(calendarForUpdate);
|
||||||
|
|
||||||
if (this.configurationDomainService.isRescheduleFutureRepaymentsEnabled() && calendarForUpdate.isRepeating()) {
|
if (this.configurationDomainService.isRescheduleFutureRepaymentsEnabled() && calendarForUpdate.isRepeating()) {
|
||||||
//fetch all loan calendar instances associated with modifying calendar.
|
// fetch all loan calendar instances associated with modifying
|
||||||
|
// calendar.
|
||||||
final Collection<CalendarInstance> loanCalendarInstances = this.calendarInstanceRepository.findByCalendarIdAndEntityTypeId(
|
final Collection<CalendarInstance> loanCalendarInstances = this.calendarInstanceRepository.findByCalendarIdAndEntityTypeId(
|
||||||
calendarId, CalendarEntityType.LOANS.getValue());
|
calendarId, CalendarEntityType.LOANS.getValue());
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -64,13 +64,14 @@ public class ChargeData implements Comparable<ChargeData>, Serializable {
|
|||||||
charge.chargeCalculationType, charge.chargePaymentMode, charge.penalty, charge.active, template.currencyOptions,
|
charge.chargeCalculationType, charge.chargePaymentMode, charge.penalty, charge.active, template.currencyOptions,
|
||||||
template.chargeCalculationTypeOptions, template.chargeAppliesToOptions, template.chargeTimeTypeOptions,
|
template.chargeCalculationTypeOptions, template.chargeAppliesToOptions, template.chargeTimeTypeOptions,
|
||||||
template.chargePaymetModeOptions, template.loanChargeCalculationTypeOptions, template.loanChargeTimeTypeOptions,
|
template.chargePaymetModeOptions, template.loanChargeCalculationTypeOptions, template.loanChargeTimeTypeOptions,
|
||||||
template.savingsChargeCalculationTypeOptions, template.savingsChargeTimeTypeOptions, charge.feeOnMonthDay, charge.feeInterval,charge.minCap,charge.maxCap);
|
template.savingsChargeCalculationTypeOptions, template.savingsChargeTimeTypeOptions, charge.feeOnMonthDay,
|
||||||
|
charge.feeInterval, charge.minCap, charge.maxCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChargeData instance(final Long id, final String name, final BigDecimal amount, final CurrencyData currency,
|
public static ChargeData instance(final Long id, final String name, final BigDecimal amount, final CurrencyData currency,
|
||||||
final EnumOptionData chargeTimeType, final EnumOptionData chargeAppliesTo, final EnumOptionData chargeCalculationType,
|
final EnumOptionData chargeTimeType, final EnumOptionData chargeAppliesTo, final EnumOptionData chargeCalculationType,
|
||||||
final EnumOptionData chargePaymentMode, final MonthDay feeOnMonthDay, final Integer feeInterval, final boolean penalty, final boolean active,
|
final EnumOptionData chargePaymentMode, final MonthDay feeOnMonthDay, final Integer feeInterval, final boolean penalty,
|
||||||
final BigDecimal minCap, final BigDecimal maxCap) {
|
final boolean active, final BigDecimal minCap, final BigDecimal maxCap) {
|
||||||
|
|
||||||
final Collection<CurrencyData> currencyOptions = null;
|
final Collection<CurrencyData> currencyOptions = null;
|
||||||
final List<EnumOptionData> chargeCalculationTypeOptions = null;
|
final List<EnumOptionData> chargeCalculationTypeOptions = null;
|
||||||
@@ -193,8 +194,9 @@ public class ChargeData implements Comparable<ChargeData>, Serializable {
|
|||||||
final Collection<ChargeData> chargeOptions = null;
|
final Collection<ChargeData> chargeOptions = null;
|
||||||
final LocalDate dueAsOfDate = null;
|
final LocalDate dueAsOfDate = null;
|
||||||
|
|
||||||
return SavingsAccountChargeData.instance(savingsChargeId, this.id, savingsAccountId, this.name, this.currency, this.amount, amountPaid, amountWaived,
|
return SavingsAccountChargeData.instance(savingsChargeId, this.id, savingsAccountId, this.name, this.currency, this.amount,
|
||||||
amountWrittenOff, amountOutstanding, this.chargeTimeType, dueAsOfDate, this.chargeCalculationType, percentage,
|
amountPaid, amountWaived, amountWrittenOff, amountOutstanding, this.chargeTimeType, dueAsOfDate,
|
||||||
amountPercentageAppliedTo, chargeOptions, this.penalty, this.feeOnMonthDay, this.feeInterval);
|
this.chargeCalculationType, percentage, amountPercentageAppliedTo, chargeOptions, this.penalty, this.feeOnMonthDay,
|
||||||
|
this.feeInterval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,6 @@ public class Charge extends AbstractPersistable<Long> {
|
|||||||
this.active = active;
|
this.active = active;
|
||||||
this.chargePaymentMode = paymentMode == null ? null : paymentMode.getValue();
|
this.chargePaymentMode = paymentMode == null ? null : paymentMode.getValue();
|
||||||
|
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges");
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges");
|
||||||
|
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.portfolio.charge.domain;
|
package org.mifosplatform.portfolio.charge.domain;
|
||||||
|
|
||||||
|
|
||||||
public enum ChargeAppliesTo {
|
public enum ChargeAppliesTo {
|
||||||
|
|
||||||
INVALID(0, "chargeAppliesTo.invalid"), //
|
INVALID(0, "chargeAppliesTo.invalid"), //
|
||||||
|
|||||||
+2
-2
@@ -18,7 +18,8 @@ public enum ChargeTimeType {
|
|||||||
ANNUAL_FEE(6, "chargeTimeType.annualFee"), // only for savings
|
ANNUAL_FEE(6, "chargeTimeType.annualFee"), // only for savings
|
||||||
MONTHLY_FEE(7, "chargeTimeType.monthlyFee"), // only for savings
|
MONTHLY_FEE(7, "chargeTimeType.monthlyFee"), // only for savings
|
||||||
INSTALMENT_FEE(8, "chargeTimeType.instalmentFee"), // only for loan charges
|
INSTALMENT_FEE(8, "chargeTimeType.instalmentFee"), // only for loan charges
|
||||||
OVERDUE_INSTALLMENT(9, "chargeTimeType.overdueInstallment"), // only for loan charges
|
OVERDUE_INSTALLMENT(9, "chargeTimeType.overdueInstallment"), // only for
|
||||||
|
// loan charges
|
||||||
OVERDRAFT_FEE(10, "chargeTimeType.overdraftFee");// only for savings
|
OVERDRAFT_FEE(10, "chargeTimeType.overdraftFee");// only for savings
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
@@ -139,5 +140,4 @@ public enum ChargeTimeType {
|
|||||||
return this.value.equals(ChargeTimeType.OVERDRAFT_FEE.getValue());
|
return this.value.equals(ChargeTimeType.OVERDRAFT_FEE.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-6
@@ -22,9 +22,7 @@ public class LoanChargeCannotBePayedException extends AbstractPlatformDomainRule
|
|||||||
return "This loan charge can be payed as the loan associated with it is currently inactive";
|
return "This loan charge can be payed as the loan associated with it is currently inactive";
|
||||||
} else if (name().toString().equalsIgnoreCase("CHARGE_NOT_ACCOUNT_TRANSFER")) {
|
} else if (name().toString().equalsIgnoreCase("CHARGE_NOT_ACCOUNT_TRANSFER")) {
|
||||||
return "This loan charge can be payed as the charge payment mode is not account transfer";
|
return "This loan charge can be payed as the charge payment mode is not account transfer";
|
||||||
}else if (name().toString().equalsIgnoreCase("CHARGE_NOT_PAYABLE")) {
|
} else if (name().toString().equalsIgnoreCase("CHARGE_NOT_PAYABLE")) { return "This loan charge is not Payable through account transfer"; }
|
||||||
return "This loan charge is not Payable through account transfer";
|
|
||||||
}
|
|
||||||
|
|
||||||
return name().toString();
|
return name().toString();
|
||||||
}
|
}
|
||||||
@@ -38,9 +36,7 @@ public class LoanChargeCannotBePayedException extends AbstractPlatformDomainRule
|
|||||||
return "error.msg.loan.charge.associated.loan.inactive";
|
return "error.msg.loan.charge.associated.loan.inactive";
|
||||||
} else if (name().toString().equalsIgnoreCase("CHARGE_NOT_ACCOUNT_TRANSFER")) {
|
} else if (name().toString().equalsIgnoreCase("CHARGE_NOT_ACCOUNT_TRANSFER")) {
|
||||||
return "error.msg.loan.charge.payment.mode.not.account.transfer";
|
return "error.msg.loan.charge.payment.mode.not.account.transfer";
|
||||||
}else if (name().toString().equalsIgnoreCase("CHARGE_NOT_PAYABLE")) {
|
} else if (name().toString().equalsIgnoreCase("CHARGE_NOT_PAYABLE")) { return "error.msg.loan.charge.payment.not.allowed.account.transfer"; }
|
||||||
return "error.msg.loan.charge.payment.not.allowed.account.transfer";
|
|
||||||
}
|
|
||||||
return name().toString();
|
return name().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -18,9 +18,7 @@ public class LoanChargeCannotBeUpdatedException extends AbstractPlatformDomainRu
|
|||||||
return "This loan charge has been partially/completely paid";
|
return "This loan charge has been partially/completely paid";
|
||||||
} else if (name().toString().equalsIgnoreCase("ALREADY_WAIVED")) {
|
} else if (name().toString().equalsIgnoreCase("ALREADY_WAIVED")) {
|
||||||
return "This loan charge has already been waived";
|
return "This loan charge has already been waived";
|
||||||
} else if (name().toString().equalsIgnoreCase("LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE")) {
|
} else if (name().toString().equalsIgnoreCase("LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE")) { return "This charge cannot be updated as the loan it is associated with is not in submitted and pending approval stage"; }
|
||||||
return "This charge cannot be updated as the loan it is associated with is not in submitted and pending approval stage";
|
|
||||||
}
|
|
||||||
return name().toString();
|
return name().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,9 +27,7 @@ public class LoanChargeCannotBeUpdatedException extends AbstractPlatformDomainRu
|
|||||||
return "error.msg.loan.charge.already.paid";
|
return "error.msg.loan.charge.already.paid";
|
||||||
} else if (name().toString().equalsIgnoreCase("ALREADY_WAIVED")) {
|
} else if (name().toString().equalsIgnoreCase("ALREADY_WAIVED")) {
|
||||||
return "error.msg.loan.charge.already.waived";
|
return "error.msg.loan.charge.already.waived";
|
||||||
} else if (name().toString().equalsIgnoreCase("LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE")) {
|
} else if (name().toString().equalsIgnoreCase("LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE")) { return "error.msg.loan.charge.associated.loan.not.in.submitted.and.pending.approval.stage"; }
|
||||||
return "error.msg.loan.charge.associated.loan.not.in.submitted.and.pending.approval.stage";
|
|
||||||
}
|
|
||||||
return name().toString();
|
return name().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -20,9 +20,7 @@ public class LoanChargeCannotBeWaivedException extends AbstractPlatformDomainRul
|
|||||||
return "This loan charge has already been waived";
|
return "This loan charge has already been waived";
|
||||||
} else if (name().toString().equalsIgnoreCase("LOAN_INACTIVE")) {
|
} else if (name().toString().equalsIgnoreCase("LOAN_INACTIVE")) {
|
||||||
return "This loan charge can be waived as the loan associated with it is currently inactive";
|
return "This loan charge can be waived as the loan associated with it is currently inactive";
|
||||||
} else if(name().toString().equalsIgnoreCase("WAIVE_NOT_ALLOWED_FOR_CHARGE")){
|
} else if (name().toString().equalsIgnoreCase("WAIVE_NOT_ALLOWED_FOR_CHARGE")) { return "This loan charge can be waived"; }
|
||||||
return "This loan charge can be waived";
|
|
||||||
}
|
|
||||||
|
|
||||||
return name().toString();
|
return name().toString();
|
||||||
}
|
}
|
||||||
@@ -34,9 +32,7 @@ public class LoanChargeCannotBeWaivedException extends AbstractPlatformDomainRul
|
|||||||
return "error.msg.loan.charge.already.waived";
|
return "error.msg.loan.charge.already.waived";
|
||||||
} else if (name().toString().equalsIgnoreCase("LOAN_INACTIVE")) {
|
} else if (name().toString().equalsIgnoreCase("LOAN_INACTIVE")) {
|
||||||
return "error.msg.loan.charge.associated.loan.inactive";
|
return "error.msg.loan.charge.associated.loan.inactive";
|
||||||
} else if(name().toString().equalsIgnoreCase("WAIVE_NOT_ALLOWED_FOR_CHARGE")) {
|
} else if (name().toString().equalsIgnoreCase("WAIVE_NOT_ALLOWED_FOR_CHARGE")) { return "error.msg.loan.charge.waive.not.allowed"; }
|
||||||
return "error.msg.loan.charge.waive.not.allowed";
|
|
||||||
}
|
|
||||||
return name().toString();
|
return name().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -76,17 +76,21 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer {
|
|||||||
final Integer chargeTimeType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("chargeTimeType", element);
|
final Integer chargeTimeType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("chargeTimeType", element);
|
||||||
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).notNull();
|
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).notNull();
|
||||||
if (chargeTimeType != null) {
|
if (chargeTimeType != null) {
|
||||||
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).isOneOfTheseValues(ChargeTimeType.validLoanValues());
|
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType)
|
||||||
|
.isOneOfTheseValues(ChargeTimeType.validLoanValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer chargePaymentMode = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("chargePaymentMode", element);
|
final Integer chargePaymentMode = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("chargePaymentMode", element);
|
||||||
baseDataValidator.reset().parameter("chargePaymentMode").value(chargePaymentMode).notNull().isOneOfTheseValues(ChargePaymentMode.validValues());
|
baseDataValidator.reset().parameter("chargePaymentMode").value(chargePaymentMode).notNull()
|
||||||
|
.isOneOfTheseValues(ChargePaymentMode.validValues());
|
||||||
if (chargePaymentMode != null) {
|
if (chargePaymentMode != null) {
|
||||||
baseDataValidator.reset().parameter("chargePaymentMode").value(chargePaymentMode).isOneOfTheseValues(ChargePaymentMode.validValues());
|
baseDataValidator.reset().parameter("chargePaymentMode").value(chargePaymentMode)
|
||||||
|
.isOneOfTheseValues(ChargePaymentMode.validValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chargeCalculationType != null) {
|
if (chargeCalculationType != null) {
|
||||||
baseDataValidator.reset().parameter("chargeCalculationType").value(chargeCalculationType).isOneOfTheseValues(ChargeCalculationType.validValuesForLoan());
|
baseDataValidator.reset().parameter("chargeCalculationType").value(chargeCalculationType)
|
||||||
|
.isOneOfTheseValues(ChargeCalculationType.validValuesForLoan());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (appliesTo.isSavingsCharge()) {
|
} else if (appliesTo.isSavingsCharge()) {
|
||||||
@@ -94,7 +98,8 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer {
|
|||||||
final Integer chargeTimeType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("chargeTimeType", element);
|
final Integer chargeTimeType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("chargeTimeType", element);
|
||||||
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).notNull();
|
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).notNull();
|
||||||
if (chargeTimeType != null) {
|
if (chargeTimeType != null) {
|
||||||
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).isOneOfTheseValues(ChargeTimeType.validSavingsValues());
|
baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType)
|
||||||
|
.isOneOfTheseValues(ChargeTimeType.validSavingsValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
final ChargeTimeType ctt = ChargeTimeType.fromInt(chargeTimeType);
|
final ChargeTimeType ctt = ChargeTimeType.fromInt(chargeTimeType);
|
||||||
@@ -112,7 +117,8 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chargeCalculationType != null) {
|
if (chargeCalculationType != null) {
|
||||||
baseDataValidator.reset().parameter("chargeCalculationType").value(chargeCalculationType).isOneOfTheseValues(ChargeCalculationType.validValuesForSavings());
|
baseDataValidator.reset().parameter("chargeCalculationType").value(chargeCalculationType)
|
||||||
|
.isOneOfTheseValues(ChargeCalculationType.validValuesForSavings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-7
@@ -27,8 +27,7 @@ public class ChargeDropdownReadPlatformServiceImpl implements ChargeDropdownRead
|
|||||||
return Arrays.asList(chargeCalculationType(ChargeCalculationType.FLAT),
|
return Arrays.asList(chargeCalculationType(ChargeCalculationType.FLAT),
|
||||||
chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT),
|
chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT),
|
||||||
chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT_AND_INTEREST),
|
chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT_AND_INTEREST),
|
||||||
chargeCalculationType(ChargeCalculationType.PERCENT_OF_INTEREST)
|
chargeCalculationType(ChargeCalculationType.PERCENT_OF_INTEREST));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,12 +61,16 @@ public class ChargeDropdownReadPlatformServiceImpl implements ChargeDropdownRead
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EnumOptionData> retrieveLoanCalculationTypes() {
|
public List<EnumOptionData> retrieveLoanCalculationTypes() {
|
||||||
return Arrays.asList(chargeCalculationType(ChargeCalculationType.FLAT), chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT), chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT_AND_INTEREST), chargeCalculationType(ChargeCalculationType.PERCENT_OF_INTEREST));
|
return Arrays.asList(chargeCalculationType(ChargeCalculationType.FLAT),
|
||||||
|
chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT),
|
||||||
|
chargeCalculationType(ChargeCalculationType.PERCENT_OF_AMOUNT_AND_INTEREST),
|
||||||
|
chargeCalculationType(ChargeCalculationType.PERCENT_OF_INTEREST));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EnumOptionData> retrieveLoanCollectionTimeTypes() {
|
public List<EnumOptionData> retrieveLoanCollectionTimeTypes() {
|
||||||
return Arrays.asList(chargeTimeType(ChargeTimeType.DISBURSEMENT), chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE),chargeTimeType(ChargeTimeType.INSTALMENT_FEE),chargeTimeType(ChargeTimeType.OVERDUE_INSTALLMENT));
|
return Arrays.asList(chargeTimeType(ChargeTimeType.DISBURSEMENT), chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE),
|
||||||
|
chargeTimeType(ChargeTimeType.INSTALMENT_FEE), chargeTimeType(ChargeTimeType.OVERDUE_INSTALLMENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -80,8 +83,7 @@ public class ChargeDropdownReadPlatformServiceImpl implements ChargeDropdownRead
|
|||||||
public List<EnumOptionData> retrieveSavingsCollectionTimeTypes() {
|
public List<EnumOptionData> retrieveSavingsCollectionTimeTypes() {
|
||||||
return Arrays.asList(chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE), chargeTimeType(ChargeTimeType.SAVINGS_ACTIVATION),
|
return Arrays.asList(chargeTimeType(ChargeTimeType.SPECIFIED_DUE_DATE), chargeTimeType(ChargeTimeType.SAVINGS_ACTIVATION),
|
||||||
// chargeTimeType(ChargeTimeType.SAVINGS_CLOSURE),
|
// chargeTimeType(ChargeTimeType.SAVINGS_CLOSURE),
|
||||||
chargeTimeType(ChargeTimeType.WITHDRAWAL_FEE),
|
chargeTimeType(ChargeTimeType.WITHDRAWAL_FEE), chargeTimeType(ChargeTimeType.ANNUAL_FEE),
|
||||||
chargeTimeType(ChargeTimeType.ANNUAL_FEE), chargeTimeType(ChargeTimeType.MONTHLY_FEE),
|
chargeTimeType(ChargeTimeType.MONTHLY_FEE), chargeTimeType(ChargeTimeType.OVERDRAFT_FEE));
|
||||||
chargeTimeType(ChargeTimeType.OVERDRAFT_FEE));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+16
-8
@@ -29,28 +29,36 @@ public class ChargeEnumerations {
|
|||||||
ChargeTimeType.SPECIFIED_DUE_DATE.getCode(), "Specified due date");
|
ChargeTimeType.SPECIFIED_DUE_DATE.getCode(), "Specified due date");
|
||||||
break;
|
break;
|
||||||
case SAVINGS_ACTIVATION:
|
case SAVINGS_ACTIVATION:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.SAVINGS_ACTIVATION.getValue().longValue(), ChargeTimeType.SAVINGS_ACTIVATION.getCode(), "Savings Activation");
|
optionData = new EnumOptionData(ChargeTimeType.SAVINGS_ACTIVATION.getValue().longValue(),
|
||||||
|
ChargeTimeType.SAVINGS_ACTIVATION.getCode(), "Savings Activation");
|
||||||
break;
|
break;
|
||||||
case SAVINGS_CLOSURE:
|
case SAVINGS_CLOSURE:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.SAVINGS_CLOSURE.getValue().longValue(), ChargeTimeType.SAVINGS_CLOSURE.getCode(), "Savings Closure");
|
optionData = new EnumOptionData(ChargeTimeType.SAVINGS_CLOSURE.getValue().longValue(),
|
||||||
|
ChargeTimeType.SAVINGS_CLOSURE.getCode(), "Savings Closure");
|
||||||
break;
|
break;
|
||||||
case WITHDRAWAL_FEE:
|
case WITHDRAWAL_FEE:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.WITHDRAWAL_FEE.getValue().longValue(), ChargeTimeType.WITHDRAWAL_FEE.getCode(), "Withdrawal Fee");
|
optionData = new EnumOptionData(ChargeTimeType.WITHDRAWAL_FEE.getValue().longValue(),
|
||||||
|
ChargeTimeType.WITHDRAWAL_FEE.getCode(), "Withdrawal Fee");
|
||||||
break;
|
break;
|
||||||
case ANNUAL_FEE:
|
case ANNUAL_FEE:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.ANNUAL_FEE.getValue().longValue(), ChargeTimeType.ANNUAL_FEE.getCode(), "Annual Fee");
|
optionData = new EnumOptionData(ChargeTimeType.ANNUAL_FEE.getValue().longValue(), ChargeTimeType.ANNUAL_FEE.getCode(),
|
||||||
|
"Annual Fee");
|
||||||
break;
|
break;
|
||||||
case MONTHLY_FEE:
|
case MONTHLY_FEE:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.MONTHLY_FEE.getValue().longValue(), ChargeTimeType.MONTHLY_FEE.getCode(), "Monthly Fee");
|
optionData = new EnumOptionData(ChargeTimeType.MONTHLY_FEE.getValue().longValue(), ChargeTimeType.MONTHLY_FEE.getCode(),
|
||||||
|
"Monthly Fee");
|
||||||
break;
|
break;
|
||||||
case INSTALMENT_FEE:
|
case INSTALMENT_FEE:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.INSTALMENT_FEE.getValue().longValue(), ChargeTimeType.INSTALMENT_FEE.getCode(), "Instalment Fee");
|
optionData = new EnumOptionData(ChargeTimeType.INSTALMENT_FEE.getValue().longValue(),
|
||||||
|
ChargeTimeType.INSTALMENT_FEE.getCode(), "Instalment Fee");
|
||||||
break;
|
break;
|
||||||
case OVERDUE_INSTALLMENT:
|
case OVERDUE_INSTALLMENT:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.OVERDUE_INSTALLMENT.getValue().longValue(),ChargeTimeType.OVERDUE_INSTALLMENT.getCode(),"overdue fees") ;
|
optionData = new EnumOptionData(ChargeTimeType.OVERDUE_INSTALLMENT.getValue().longValue(),
|
||||||
|
ChargeTimeType.OVERDUE_INSTALLMENT.getCode(), "overdue fees");
|
||||||
break;
|
break;
|
||||||
case OVERDRAFT_FEE:
|
case OVERDRAFT_FEE:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.OVERDRAFT_FEE.getValue().longValue(), ChargeTimeType.OVERDRAFT_FEE.getCode(), "Overdraft Fee");
|
optionData = new EnumOptionData(ChargeTimeType.OVERDRAFT_FEE.getValue().longValue(),
|
||||||
|
ChargeTimeType.OVERDRAFT_FEE.getCode(), "Overdraft Fee");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
optionData = new EnumOptionData(ChargeTimeType.INVALID.getValue().longValue(), ChargeTimeType.INVALID.getCode(), "Invalid");
|
optionData = new EnumOptionData(ChargeTimeType.INVALID.getValue().longValue(), ChargeTimeType.INVALID.getCode(), "Invalid");
|
||||||
|
|||||||
+1
-2
@@ -145,8 +145,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
|||||||
+ "c.is_active as active, oc.name as currencyName, oc.decimal_places as currencyDecimalPlaces, "
|
+ "c.is_active as active, oc.name as currencyName, oc.decimal_places as currencyDecimalPlaces, "
|
||||||
+ "oc.currency_multiplesof as inMultiplesOf, oc.display_symbol as currencyDisplaySymbol, "
|
+ "oc.currency_multiplesof as inMultiplesOf, oc.display_symbol as currencyDisplaySymbol, "
|
||||||
+ "oc.internationalized_name_code as currencyNameCode, c.fee_on_day as feeOnDay, c.fee_on_month as feeOnMonth, "
|
+ "oc.internationalized_name_code as currencyNameCode, c.fee_on_day as feeOnDay, c.fee_on_month as feeOnMonth, "
|
||||||
+ "c.fee_interval as feeInterval,c.min_cap as minCap,c.max_cap as maxCap "
|
+ "c.fee_interval as feeInterval,c.min_cap as minCap,c.max_cap as maxCap " + "from m_charge c "
|
||||||
+ "from m_charge c "
|
|
||||||
+ "join m_organisation_currency oc on c.currency_code = oc.code";
|
+ "join m_organisation_currency oc on c.currency_code = oc.code";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-11
@@ -83,21 +83,18 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
|
|||||||
|
|
||||||
final Map<String, Object> changes = chargeForUpdate.update(command);
|
final Map<String, Object> changes = chargeForUpdate.update(command);
|
||||||
|
|
||||||
// MIFOSX-900: Check if the Charge has been active before and now is deactivated:
|
// MIFOSX-900: Check if the Charge has been active before and now is
|
||||||
|
// deactivated:
|
||||||
if (changes.containsKey("active")) {
|
if (changes.containsKey("active")) {
|
||||||
// IF the key exists then it has changed (otherwise it would have been filtered), so check current state:
|
// IF the key exists then it has changed (otherwise it would
|
||||||
if(!chargeForUpdate.isActive())
|
// have been filtered), so check current state:
|
||||||
{
|
if (!chargeForUpdate.isActive()) {
|
||||||
// TODO: Change this function to only check the mappings!!!
|
// TODO: Change this function to only check the mappings!!!
|
||||||
final Boolean isChargeExistWithLoans = isAnyLoanProductsAssociateWithThisCharge(chargeId);
|
final Boolean isChargeExistWithLoans = isAnyLoanProductsAssociateWithThisCharge(chargeId);
|
||||||
final Boolean isChargeExistWithSavings = isAnySavingsProductsAssociateWithThisCharge(chargeId);
|
final Boolean isChargeExistWithSavings = isAnySavingsProductsAssociateWithThisCharge(chargeId);
|
||||||
|
|
||||||
if(isChargeExistWithLoans || isChargeExistWithSavings)
|
if (isChargeExistWithLoans || isChargeExistWithSavings) { throw new ChargeCannotBeUpdatedException(
|
||||||
{
|
"error.msg.charge.cannot.be.updated.it.is.used.in.loan", "This charge cannot be updated, it is used in loan"); }
|
||||||
throw new ChargeCannotBeUpdatedException(
|
|
||||||
"error.msg.charge.cannot.be.updated.it.is.used.in.loan",
|
|
||||||
"This charge cannot be updated, it is used in loan");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +166,6 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
|
|||||||
return new Boolean(isSavingsUsingCharge);
|
return new Boolean(isSavingsUsingCharge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isAnyLoanProductsAssociateWithThisCharge(final Long chargeId) {
|
private boolean isAnyLoanProductsAssociateWithThisCharge(final Long chargeId) {
|
||||||
|
|
||||||
final String sql = "select if((exists (select 1 from m_product_loan_charge lc where lc.charge_id = ?)) = 1, 'true', 'false')";
|
final String sql = "select if((exists (select 1 from m_product_loan_charge lc where lc.charge_id = ?)) = 1, 'true', 'false')";
|
||||||
|
|||||||
-1
@@ -135,7 +135,6 @@ public class ClientsApiResource {
|
|||||||
clientData = ClientData.templateOnTop(clientData, templateData);
|
clientData = ClientData.templateOnTop(clientData, templateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
return this.toApiJsonSerializer.serialize(settings, clientData, ClientApiConstants.CLIENT_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -78,8 +78,8 @@ final public class ClientData implements Comparable<ClientData> {
|
|||||||
clientData.transferToOfficeId, clientData.transferToOfficeName, clientData.id, clientData.firstname, clientData.middlename,
|
clientData.transferToOfficeId, clientData.transferToOfficeName, clientData.id, clientData.firstname, clientData.middlename,
|
||||||
clientData.lastname, clientData.fullname, clientData.displayName, clientData.externalId, clientData.mobileNo,
|
clientData.lastname, clientData.fullname, clientData.displayName, clientData.externalId, clientData.mobileNo,
|
||||||
clientData.activationDate, clientData.imageId, clientData.staffId, clientData.staffName, templateData.officeOptions,
|
clientData.activationDate, clientData.imageId, clientData.staffId, clientData.staffName, templateData.officeOptions,
|
||||||
clientData.groups, templateData.staffOptions, null,null, templateData.savingProductOptions,
|
clientData.groups, templateData.staffOptions, null, null, templateData.savingProductOptions, clientData.savingsProductId,
|
||||||
clientData.savingsProductId, clientData.savingsProductName);
|
clientData.savingsProductName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -71,7 +71,8 @@ public final class ClientDataValidator {
|
|||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.savingsProductIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.savingsProductIdParamName, element)) {
|
||||||
final Long savingsProductId = this.fromApiJsonHelper.extractLongNamed(ClientApiConstants.savingsProductIdParamName, element);
|
final Long savingsProductId = this.fromApiJsonHelper.extractLongNamed(ClientApiConstants.savingsProductIdParamName, element);
|
||||||
baseDataValidator.reset().parameter(ClientApiConstants.savingsProductIdParamName).value(savingsProductId).ignoreIfNull().longGreaterThanZero();
|
baseDataValidator.reset().parameter(ClientApiConstants.savingsProductIdParamName).value(savingsProductId).ignoreIfNull()
|
||||||
|
.longGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFullnameProvided(element) || isIndividualNameProvided(element)) {
|
if (isFullnameProvided(element) || isIndividualNameProvided(element)) {
|
||||||
@@ -137,9 +138,9 @@ public final class ClientDataValidator {
|
|||||||
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.submittedOnDateParamName, element))
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.submittedOnDateParamName, element)) {
|
||||||
{
|
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.submittedOnDateParamName,
|
||||||
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.submittedOnDateParamName, element);
|
element);
|
||||||
baseDataValidator.reset().parameter(ClientApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
baseDataValidator.reset().parameter(ClientApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +314,8 @@ public final class ClientDataValidator {
|
|||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.savingsProductIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.savingsProductIdParamName, element)) {
|
||||||
final Long savingsProductId = this.fromApiJsonHelper.extractLongNamed(ClientApiConstants.savingsProductIdParamName, element);
|
final Long savingsProductId = this.fromApiJsonHelper.extractLongNamed(ClientApiConstants.savingsProductIdParamName, element);
|
||||||
baseDataValidator.reset().parameter(ClientApiConstants.savingsProductIdParamName).value(savingsProductId).ignoreIfNull().longGreaterThanZero();
|
baseDataValidator.reset().parameter(ClientApiConstants.savingsProductIdParamName).value(savingsProductId).ignoreIfNull()
|
||||||
|
.longGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!atLeastOneParameterPassedForUpdate) {
|
if (!atLeastOneParameterPassedForUpdate) {
|
||||||
|
|||||||
+4
-7
@@ -33,12 +33,10 @@ public class ClientTimelineData {
|
|||||||
private final String closedByFirstname;
|
private final String closedByFirstname;
|
||||||
private final String closedByLastname;
|
private final String closedByLastname;
|
||||||
|
|
||||||
|
public ClientTimelineData(final LocalDate submittedOnDate, final String submittedByUsername, final String submittedByFirstname,
|
||||||
public ClientTimelineData(final LocalDate submittedOnDate, final String submittedByUsername,
|
final String submittedByLastname, final LocalDate activatedOnDate, final String activatedByUsername,
|
||||||
final String submittedByFirstname, final String submittedByLastname, final LocalDate activatedOnDate,
|
final String activatedByFirstname, final String activatedByLastname, final LocalDate closedOnDate,
|
||||||
final String activatedByUsername, final String activatedByFirstname, final String activatedByLastname,
|
final String closedByUsername, final String closedByFirstname, final String closedByLastname) {
|
||||||
final LocalDate closedOnDate, final String closedByUsername, final String closedByFirstname,
|
|
||||||
final String closedByLastname) {
|
|
||||||
this.submittedOnDate = submittedOnDate;
|
this.submittedOnDate = submittedOnDate;
|
||||||
this.submittedByUsername = submittedByUsername;
|
this.submittedByUsername = submittedByUsername;
|
||||||
this.submittedByFirstname = submittedByFirstname;
|
this.submittedByFirstname = submittedByFirstname;
|
||||||
@@ -56,5 +54,4 @@ public class ClientTimelineData {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -640,7 +640,6 @@ public final class Client extends AbstractPersistable<Long> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Long savingsProductId() {
|
private Long savingsProductId() {
|
||||||
Long savingsProductId = null;
|
Long savingsProductId = null;
|
||||||
if (this.savingsProduct != null) {
|
if (this.savingsProduct != null) {
|
||||||
@@ -649,17 +648,14 @@ public final class Client extends AbstractPersistable<Long> {
|
|||||||
return savingsProductId;
|
return savingsProductId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SavingsProduct SavingsProduct() {
|
public SavingsProduct SavingsProduct() {
|
||||||
return this.savingsProduct;
|
return this.savingsProduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateSavingsProduct(SavingsProduct savingsProduct) {
|
public void updateSavingsProduct(SavingsProduct savingsProduct) {
|
||||||
this.savingsProduct = savingsProduct;
|
this.savingsProduct = savingsProduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AppUser activatedBy() {
|
public AppUser activatedBy() {
|
||||||
return this.activatedBy;
|
return this.activatedBy;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,8 @@ import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRul
|
|||||||
public class ClientActiveForUpdateException extends AbstractPlatformDomainRuleException {
|
public class ClientActiveForUpdateException extends AbstractPlatformDomainRuleException {
|
||||||
|
|
||||||
public ClientActiveForUpdateException(final Long clientId, final String parameterName) {
|
public ClientActiveForUpdateException(final Long clientId, final String parameterName) {
|
||||||
super("error.msg.client.active.for.update.parameter."+parameterName, "The Client with id `" + clientId + "` is active,can't update parameter "+parameterName, clientId,parameterName);
|
super("error.msg.client.active.for.update.parameter." + parameterName, "The Client with id `" + clientId
|
||||||
|
+ "` is active,can't update parameter " + parameterName, clientId, parameterName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-16
@@ -82,7 +82,6 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
|
|
||||||
final Collection<SavingsProductData> savingsProductDatas = this.savingsProductReadPlatformService.retrieveAllForLookupByType(true);
|
final Collection<SavingsProductData> savingsProductDatas = this.savingsProductReadPlatformService.retrieveAllForLookupByType(true);
|
||||||
|
|
||||||
|
|
||||||
Collection<StaffData> staffOptions = null;
|
Collection<StaffData> staffOptions = null;
|
||||||
|
|
||||||
final boolean loanOfficersOnly = false;
|
final boolean loanOfficersOnly = false;
|
||||||
@@ -338,7 +337,6 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
final Long savingsProductId = JdbcSupport.getLong(rs, "savingsProductId");
|
final Long savingsProductId = JdbcSupport.getLong(rs, "savingsProductId");
|
||||||
final String savingsProductName = rs.getString("savingsProductName");
|
final String savingsProductName = rs.getString("savingsProductName");
|
||||||
|
|
||||||
|
|
||||||
final LocalDate closedOnDate = JdbcSupport.getLocalDate(rs, "closedOnDate");
|
final LocalDate closedOnDate = JdbcSupport.getLocalDate(rs, "closedOnDate");
|
||||||
final String closedByUsername = rs.getString("closedByUsername");
|
final String closedByUsername = rs.getString("closedByUsername");
|
||||||
final String closedByFirstname = rs.getString("closedByFirstname");
|
final String closedByFirstname = rs.getString("closedByFirstname");
|
||||||
@@ -349,18 +347,17 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
||||||
final String submittedByLastname = rs.getString("submittedByLastname");
|
final String submittedByLastname = rs.getString("submittedByLastname");
|
||||||
|
|
||||||
|
|
||||||
final String activatedByUsername = rs.getString("activatedByUsername");
|
final String activatedByUsername = rs.getString("activatedByUsername");
|
||||||
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
||||||
final String activatedByLastname = rs.getString("activatedByLastname");
|
final String activatedByLastname = rs.getString("activatedByLastname");
|
||||||
|
|
||||||
final ClientTimelineData timeline = new ClientTimelineData (submittedOnDate, submittedByUsername, submittedByFirstname, submittedByLastname,
|
final ClientTimelineData timeline = new ClientTimelineData(submittedOnDate, submittedByUsername, submittedByFirstname,
|
||||||
activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate, closedByUsername,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return ClientData.instance(accountNo, status, officeId, officeName, transferToOfficeId, transferToOfficeName, id, firstname,
|
return ClientData.instance(accountNo, status, officeId, officeName, transferToOfficeId, transferToOfficeName, id, firstname,
|
||||||
middlename, lastname, fullname, displayName, externalId, mobileNo, activationDate, imageId, staffId, staffName,timeline,
|
middlename, lastname, fullname, displayName, externalId, mobileNo, activationDate, imageId, staffId, staffName,
|
||||||
savingsProductId, savingsProductName);
|
timeline, savingsProductId, savingsProductName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +391,6 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
builder.append("c.fullname as fullname, c.display_name as displayName, ");
|
builder.append("c.fullname as fullname, c.display_name as displayName, ");
|
||||||
builder.append("c.mobile_no as mobileNo, ");
|
builder.append("c.mobile_no as mobileNo, ");
|
||||||
|
|
||||||
|
|
||||||
builder.append("c.submittedon_date as submittedOnDate, ");
|
builder.append("c.submittedon_date as submittedOnDate, ");
|
||||||
builder.append("sbu.username as submittedByUsername, ");
|
builder.append("sbu.username as submittedByUsername, ");
|
||||||
builder.append("sbu.firstname as submittedByFirstname, ");
|
builder.append("sbu.firstname as submittedByFirstname, ");
|
||||||
@@ -410,7 +406,6 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
builder.append("acu.firstname as activatedByFirstname, ");
|
builder.append("acu.firstname as activatedByFirstname, ");
|
||||||
builder.append("acu.lastname as activatedByLastname, ");
|
builder.append("acu.lastname as activatedByLastname, ");
|
||||||
|
|
||||||
|
|
||||||
builder.append("c.activation_date as activationDate, c.image_id as imageId, ");
|
builder.append("c.activation_date as activationDate, c.image_id as imageId, ");
|
||||||
builder.append("c.staff_id as staffId, s.display_name as staffName, ");
|
builder.append("c.staff_id as staffId, s.display_name as staffName, ");
|
||||||
builder.append("c.default_savings_product as savingsProductId, sp.name as savingsProductName ");
|
builder.append("c.default_savings_product as savingsProductId, sp.name as savingsProductName ");
|
||||||
@@ -460,7 +455,6 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
final Long savingsProductId = JdbcSupport.getLong(rs, "savingsProductId");
|
final Long savingsProductId = JdbcSupport.getLong(rs, "savingsProductId");
|
||||||
final String savingsProductName = rs.getString("savingsProductName");
|
final String savingsProductName = rs.getString("savingsProductName");
|
||||||
|
|
||||||
|
|
||||||
final LocalDate closedOnDate = JdbcSupport.getLocalDate(rs, "closedOnDate");
|
final LocalDate closedOnDate = JdbcSupport.getLocalDate(rs, "closedOnDate");
|
||||||
final String closedByUsername = rs.getString("closedByUsername");
|
final String closedByUsername = rs.getString("closedByUsername");
|
||||||
final String closedByFirstname = rs.getString("closedByFirstname");
|
final String closedByFirstname = rs.getString("closedByFirstname");
|
||||||
@@ -475,13 +469,13 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
||||||
final String activatedByLastname = rs.getString("activatedByLastname");
|
final String activatedByLastname = rs.getString("activatedByLastname");
|
||||||
|
|
||||||
final ClientTimelineData timeline = new ClientTimelineData (submittedOnDate, submittedByUsername, submittedByFirstname, submittedByLastname,
|
final ClientTimelineData timeline = new ClientTimelineData(submittedOnDate, submittedByUsername, submittedByFirstname,
|
||||||
activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate, closedByUsername,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return ClientData.instance(accountNo, status, officeId, officeName, transferToOfficeId, transferToOfficeName, id, firstname,
|
return ClientData.instance(accountNo, status, officeId, officeName, transferToOfficeId, transferToOfficeName, id, firstname,
|
||||||
middlename, lastname, fullname, displayName, externalId, mobileNo, activationDate, imageId, staffId, staffName,timeline,
|
middlename, lastname, fullname, displayName, externalId, mobileNo, activationDate, imageId, staffId, staffName,
|
||||||
savingsProductId, savingsProductName);
|
timeline, savingsProductId, savingsProductName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-7
@@ -142,8 +142,10 @@ public class CentersApiResource {
|
|||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
if (meetingDateParam != null && officeId != null) {
|
if (meetingDateParam != null && officeId != null) {
|
||||||
Date meetingDate = meetingDateParam.getDate("meetingDate", dateFormat, locale);
|
Date meetingDate = meetingDateParam.getDate("meetingDate", dateFormat, locale);
|
||||||
Collection<StaffCenterData> staffCenterDataArray = this.centerReadPlatformService.retriveAllCentersByMeetingDate(officeId, meetingDate, staffId);
|
Collection<StaffCenterData> staffCenterDataArray = this.centerReadPlatformService.retriveAllCentersByMeetingDate(officeId,
|
||||||
return this.toApiJsonSerializer.serialize(settings, staffCenterDataArray, GroupingTypesApiConstants.STAFF_CENTER_RESPONSE_DATA_PARAMETERS);
|
meetingDate, staffId);
|
||||||
|
return this.toApiJsonSerializer.serialize(settings, staffCenterDataArray,
|
||||||
|
GroupingTypesApiConstants.STAFF_CENTER_RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
|
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
|
||||||
final SearchParameters searchParameters = SearchParameters.forGroups(sqlSearch, officeId, staffId, externalId, name, hierarchy,
|
final SearchParameters searchParameters = SearchParameters.forGroups(sqlSearch, officeId, staffId, externalId, name, hierarchy,
|
||||||
@@ -187,11 +189,16 @@ public class CentersApiResource {
|
|||||||
if (collectionMeetingCalendar != null) {
|
if (collectionMeetingCalendar != null) {
|
||||||
final boolean withHistory = true;
|
final boolean withHistory = true;
|
||||||
final LocalDate tillDate = null;
|
final LocalDate tillDate = null;
|
||||||
final Collection<LocalDate> recurringDates = this.calendarReadPlatformService.generateRecurringDates(collectionMeetingCalendar, withHistory, tillDate);
|
final Collection<LocalDate> recurringDates = this.calendarReadPlatformService.generateRecurringDates(
|
||||||
final Collection<LocalDate> nextTenRecurringDates = this.calendarReadPlatformService.generateNextTenRecurringDates(collectionMeetingCalendar);
|
collectionMeetingCalendar, withHistory, tillDate);
|
||||||
final MeetingData lastMeeting = this.meetingReadPlatformService.retrieveLastMeeting(collectionMeetingCalendar.getCalendarInstanceId());
|
final Collection<LocalDate> nextTenRecurringDates = this.calendarReadPlatformService
|
||||||
final LocalDate recentEligibleMeetingDate = this.calendarReadPlatformService.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
|
.generateNextTenRecurringDates(collectionMeetingCalendar);
|
||||||
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates, nextTenRecurringDates, recentEligibleMeetingDate);
|
final MeetingData lastMeeting = this.meetingReadPlatformService.retrieveLastMeeting(collectionMeetingCalendar
|
||||||
|
.getCalendarInstanceId());
|
||||||
|
final LocalDate recentEligibleMeetingDate = this.calendarReadPlatformService
|
||||||
|
.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
|
||||||
|
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates,
|
||||||
|
nextTenRecurringDates, recentEligibleMeetingDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -106,6 +106,6 @@ public class GroupingTypesApiConstants {
|
|||||||
public static final Set<String> GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
|
public static final Set<String> GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
|
||||||
dateFormatParamName, closureDateParamName, closureReasonIdParamName));
|
dateFormatParamName, closureDateParamName, closureReasonIdParamName));
|
||||||
|
|
||||||
public static final Set<String> STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<String>(
|
public static final Set<String> STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(staffIdParamName,
|
||||||
Arrays.asList(staffIdParamName, staffNameParamName, meetingFallCenters));
|
staffNameParamName, meetingFallCenters));
|
||||||
}
|
}
|
||||||
+10
-5
@@ -230,11 +230,16 @@ public class GroupsApiResource {
|
|||||||
if (collectionMeetingCalendar != null) {
|
if (collectionMeetingCalendar != null) {
|
||||||
final boolean withHistory = true;
|
final boolean withHistory = true;
|
||||||
final LocalDate tillDate = null;
|
final LocalDate tillDate = null;
|
||||||
final Collection<LocalDate> recurringDates = this.calendarReadPlatformService.generateRecurringDates(collectionMeetingCalendar, withHistory, tillDate);
|
final Collection<LocalDate> recurringDates = this.calendarReadPlatformService.generateRecurringDates(
|
||||||
final Collection<LocalDate> nextTenRecurringDates = this.calendarReadPlatformService.generateNextTenRecurringDates(collectionMeetingCalendar);
|
collectionMeetingCalendar, withHistory, tillDate);
|
||||||
final MeetingData lastMeeting = this.meetingReadPlatformService.retrieveLastMeeting(collectionMeetingCalendar.getCalendarInstanceId());
|
final Collection<LocalDate> nextTenRecurringDates = this.calendarReadPlatformService
|
||||||
final LocalDate recentEligibleMeetingDate = this.calendarReadPlatformService.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
|
.generateNextTenRecurringDates(collectionMeetingCalendar);
|
||||||
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates, nextTenRecurringDates, recentEligibleMeetingDate);
|
final MeetingData lastMeeting = this.meetingReadPlatformService.retrieveLastMeeting(collectionMeetingCalendar
|
||||||
|
.getCalendarInstanceId());
|
||||||
|
final LocalDate recentEligibleMeetingDate = this.calendarReadPlatformService
|
||||||
|
.generateNextEligibleMeetingDateForCollection(collectionMeetingCalendar, lastMeeting);
|
||||||
|
collectionMeetingCalendar = CalendarData.withRecurringDates(collectionMeetingCalendar, recurringDates,
|
||||||
|
nextTenRecurringDates, recentEligibleMeetingDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -81,7 +81,8 @@ public class GroupGeneralData {
|
|||||||
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
||||||
grouping.hierarchy, grouping.clientMembers, templatedGrouping.centerOptions, templatedGrouping.officeOptions,
|
grouping.hierarchy, grouping.clientMembers, templatedGrouping.centerOptions, templatedGrouping.officeOptions,
|
||||||
templatedGrouping.staffOptions, templatedGrouping.clientOptions, grouping.groupRoles, templatedGrouping.availableRoles,
|
templatedGrouping.staffOptions, templatedGrouping.clientOptions, grouping.groupRoles, templatedGrouping.availableRoles,
|
||||||
grouping.selectedRole, grouping.calendarsData, grouping.collectionMeetingCalendar, grouping.closureReasons,templatedGrouping.timeline);
|
grouping.selectedRole, grouping.calendarsData, grouping.collectionMeetingCalendar, grouping.closureReasons,
|
||||||
|
templatedGrouping.timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GroupGeneralData withAssocations(final GroupGeneralData grouping, final Collection<ClientData> membersOfGroup,
|
public static GroupGeneralData withAssocations(final GroupGeneralData grouping, final Collection<ClientData> membersOfGroup,
|
||||||
@@ -224,7 +225,6 @@ public class GroupGeneralData {
|
|||||||
role, calendarsData, collectionMeetingCalendar, closureReasons, null);
|
role, calendarsData, collectionMeetingCalendar, closureReasons, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Collection<ClientData> clientMembers() {
|
public Collection<ClientData> clientMembers() {
|
||||||
return this.clientMembers;
|
return this.clientMembers;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-8
@@ -8,7 +8,8 @@ package org.mifosplatform.portfolio.group.data;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immutable data object represent the important time-line events of a group/center.
|
* Immutable data object represent the important time-line events of a
|
||||||
|
* group/center.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -29,12 +30,10 @@ public class GroupTimelineData {
|
|||||||
private final String closedByFirstname;
|
private final String closedByFirstname;
|
||||||
private final String closedByLastname;
|
private final String closedByLastname;
|
||||||
|
|
||||||
|
public GroupTimelineData(final LocalDate submittedOnDate, final String submittedByUsername, final String submittedByFirstname,
|
||||||
public GroupTimelineData(final LocalDate submittedOnDate, final String submittedByUsername,
|
final String submittedByLastname, final LocalDate activatedOnDate, final String activatedByUsername,
|
||||||
final String submittedByFirstname, final String submittedByLastname, final LocalDate activatedOnDate,
|
final String activatedByFirstname, final String activatedByLastname, final LocalDate closedOnDate,
|
||||||
final String activatedByUsername, final String activatedByFirstname, final String activatedByLastname,
|
final String closedByUsername, final String closedByFirstname, final String closedByLastname) {
|
||||||
final LocalDate closedOnDate, final String closedByUsername, final String closedByFirstname,
|
|
||||||
final String closedByLastname) {
|
|
||||||
this.submittedOnDate = submittedOnDate;
|
this.submittedOnDate = submittedOnDate;
|
||||||
this.submittedByUsername = submittedByUsername;
|
this.submittedByUsername = submittedByUsername;
|
||||||
this.submittedByFirstname = submittedByFirstname;
|
this.submittedByFirstname = submittedByFirstname;
|
||||||
@@ -52,5 +51,4 @@ public class GroupTimelineData {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -18,6 +18,7 @@ public class StaffCenterData {
|
|||||||
public static StaffCenterData instance(final Long staffId, final String staffName, final Collection<CenterData> meetingFallCenters) {
|
public static StaffCenterData instance(final Long staffId, final String staffName, final Collection<CenterData> meetingFallCenters) {
|
||||||
return new StaffCenterData(staffId, staffName, meetingFallCenters);
|
return new StaffCenterData(staffId, staffName, meetingFallCenters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getStaffId() {
|
public Long getStaffId() {
|
||||||
return staffId;
|
return staffId;
|
||||||
}
|
}
|
||||||
@@ -26,4 +27,3 @@ public class StaffCenterData {
|
|||||||
return meetingFallCenters;
|
return meetingFallCenters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+9
-9
@@ -97,9 +97,9 @@ public final class GroupingTypesDataValidator {
|
|||||||
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element))
|
if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element)) {
|
||||||
{
|
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(
|
||||||
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(GroupingTypesApiConstants.submittedOnDateParamName, element);
|
GroupingTypesApiConstants.submittedOnDateParamName, element);
|
||||||
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,9 +161,9 @@ public final class GroupingTypesDataValidator {
|
|||||||
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element))
|
if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element)) {
|
||||||
{
|
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(
|
||||||
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(GroupingTypesApiConstants.submittedOnDateParamName, element);
|
GroupingTypesApiConstants.submittedOnDateParamName, element);
|
||||||
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,9 +221,9 @@ public final class GroupingTypesDataValidator {
|
|||||||
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element))
|
if (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.submittedOnDateParamName, element)) {
|
||||||
{
|
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(
|
||||||
final LocalDate submittedOnDate = this.fromApiJsonHelper.extractLocalDateNamed(GroupingTypesApiConstants.submittedOnDateParamName, element);
|
GroupingTypesApiConstants.submittedOnDateParamName, element);
|
||||||
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
baseDataValidator.reset().parameter(GroupingTypesApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -37,7 +37,6 @@ public final class AllGroupTypesDataMapper implements RowMapper<GroupGeneralData
|
|||||||
sqlBuilder.append("sbu.firstname as submittedByFirstname, ");
|
sqlBuilder.append("sbu.firstname as submittedByFirstname, ");
|
||||||
sqlBuilder.append("sbu.lastname as submittedByLastname, ");
|
sqlBuilder.append("sbu.lastname as submittedByLastname, ");
|
||||||
|
|
||||||
|
|
||||||
sqlBuilder.append("clu.username as closedByUsername, ");
|
sqlBuilder.append("clu.username as closedByUsername, ");
|
||||||
sqlBuilder.append("clu.firstname as closedByFirstname, ");
|
sqlBuilder.append("clu.firstname as closedByFirstname, ");
|
||||||
sqlBuilder.append("clu.lastname as closedByLastname, ");
|
sqlBuilder.append("clu.lastname as closedByLastname, ");
|
||||||
@@ -91,14 +90,13 @@ public final class AllGroupTypesDataMapper implements RowMapper<GroupGeneralData
|
|||||||
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
||||||
final String submittedByLastname = rs.getString("submittedByLastname");
|
final String submittedByLastname = rs.getString("submittedByLastname");
|
||||||
|
|
||||||
|
|
||||||
final String activatedByUsername = rs.getString("activatedByUsername");
|
final String activatedByUsername = rs.getString("activatedByUsername");
|
||||||
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
||||||
final String activatedByLastname = rs.getString("activatedByLastname");
|
final String activatedByLastname = rs.getString("activatedByLastname");
|
||||||
|
|
||||||
final GroupTimelineData timeline = new GroupTimelineData (submittedOnDate, submittedByUsername, submittedByFirstname, submittedByLastname,
|
final GroupTimelineData timeline = new GroupTimelineData(submittedOnDate, submittedByUsername, submittedByFirstname,
|
||||||
activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate, closedByUsername,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return GroupGeneralData.instance(id, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
return GroupGeneralData.instance(id, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
||||||
staffName, hierarchy, timeline);
|
staffName, hierarchy, timeline);
|
||||||
|
|||||||
+21
-28
@@ -135,24 +135,15 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
+ "g.staff_id as staffId, s.display_name as staffName, " //
|
+ "g.staff_id as staffId, s.display_name as staffName, " //
|
||||||
+ "g.status_enum as statusEnum, g.activation_date as activationDate, " //
|
+ "g.status_enum as statusEnum, g.activation_date as activationDate, " //
|
||||||
+ "g.hierarchy as hierarchy, " //
|
+ "g.hierarchy as hierarchy, " //
|
||||||
+ "g.closedon_date as closedOnDate, "
|
+ "g.closedon_date as closedOnDate, " + "g.submittedon_date as submittedOnDate, " + "sbu.username as submittedByUsername, "
|
||||||
+ "g.submittedon_date as submittedOnDate, "
|
+ "sbu.firstname as submittedByFirstname, " + "sbu.lastname as submittedByLastname, " + "clu.username as closedByUsername, "
|
||||||
+ "sbu.username as submittedByUsername, "
|
+ "clu.firstname as closedByFirstname, " + "clu.lastname as closedByLastname, " + "acu.username as activatedByUsername, "
|
||||||
+ "sbu.firstname as submittedByFirstname, "
|
|
||||||
+ "sbu.lastname as submittedByLastname, "
|
|
||||||
+ "clu.username as closedByUsername, "
|
|
||||||
+ "clu.firstname as closedByFirstname, "
|
|
||||||
+ "clu.lastname as closedByLastname, "
|
|
||||||
+ "acu.username as activatedByUsername, "
|
|
||||||
+ "acu.firstname as activatedByFirstname, "
|
+ "acu.firstname as activatedByFirstname, "
|
||||||
+ "acu.lastname as activatedByLastname "
|
+ "acu.lastname as activatedByLastname "
|
||||||
+ "from m_group g " //
|
+ "from m_group g " //
|
||||||
+ "join m_office o on o.id = g.office_id "
|
+ "join m_office o on o.id = g.office_id " + "left join m_staff s on s.id = g.staff_id "
|
||||||
+ "left join m_staff s on s.id = g.staff_id "
|
+ "left join m_group pg on pg.id = g.parent_id " + "left join m_appuser sbu on sbu.id = g.submittedon_userid "
|
||||||
+ "left join m_group pg on pg.id = g.parent_id "
|
+ "left join m_appuser acu on acu.id = g.activatedon_userid " + "left join m_appuser clu on clu.id = g.closedon_userid ";
|
||||||
+ "left join m_appuser sbu on sbu.id = g.submittedon_userid "
|
|
||||||
+ "left join m_appuser acu on acu.id = g.activatedon_userid "
|
|
||||||
+ "left join m_appuser clu on clu.id = g.closedon_userid ";
|
|
||||||
|
|
||||||
private static final class CenterDataMapper implements RowMapper<CenterData> {
|
private static final class CenterDataMapper implements RowMapper<CenterData> {
|
||||||
|
|
||||||
@@ -192,16 +183,16 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
||||||
final String submittedByLastname = rs.getString("submittedByLastname");
|
final String submittedByLastname = rs.getString("submittedByLastname");
|
||||||
|
|
||||||
|
|
||||||
final String activatedByUsername = rs.getString("activatedByUsername");
|
final String activatedByUsername = rs.getString("activatedByUsername");
|
||||||
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
||||||
final String activatedByLastname = rs.getString("activatedByLastname");
|
final String activatedByLastname = rs.getString("activatedByLastname");
|
||||||
|
|
||||||
final GroupTimelineData timeline = new GroupTimelineData (submittedOnDate, submittedByUsername, submittedByFirstname, submittedByLastname,
|
final GroupTimelineData timeline = new GroupTimelineData(submittedOnDate, submittedByUsername, submittedByFirstname,
|
||||||
activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate, closedByUsername,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return CenterData.instance(id, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy, timeline, null);
|
return CenterData.instance(id, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
||||||
|
timeline, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,9 +241,11 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
final LocalDate endDate = JdbcSupport.getLocalDate(rs, "endDate");
|
final LocalDate endDate = JdbcSupport.getLocalDate(rs, "endDate");
|
||||||
final String recurrence = rs.getString("recurrence");
|
final String recurrence = rs.getString("recurrence");
|
||||||
|
|
||||||
CalendarData calendarData = CalendarData.instance(calendarId, calendarInstanceId, entityId, entityType, title, description, location, startDate,
|
CalendarData calendarData = CalendarData.instance(calendarId, calendarInstanceId, entityId, entityType, title, description,
|
||||||
endDate, null, null, false, recurrence, null, null, null, null, null, null, null, null, null, null, null, null, null);
|
location, startDate, endDate, null, null, false, recurrence, null, null, null, null, null, null, null, null, null,
|
||||||
return CenterData.instance(id, name, externalId, status, activationDate, officeId, null, staffId, staffName, hierarchy, null, calendarData);
|
null, null, null, null);
|
||||||
|
return CenterData.instance(id, name, externalId, status, activationDate, officeId, null, staffId, staffName, hierarchy, null,
|
||||||
|
calendarData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,14 +289,13 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
final String submittedByFirstname = rs.getString("submittedByFirstname");
|
||||||
final String submittedByLastname = rs.getString("submittedByLastname");
|
final String submittedByLastname = rs.getString("submittedByLastname");
|
||||||
|
|
||||||
|
|
||||||
final String activatedByUsername = rs.getString("activatedByUsername");
|
final String activatedByUsername = rs.getString("activatedByUsername");
|
||||||
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
final String activatedByFirstname = rs.getString("activatedByFirstname");
|
||||||
final String activatedByLastname = rs.getString("activatedByLastname");
|
final String activatedByLastname = rs.getString("activatedByLastname");
|
||||||
|
|
||||||
final GroupTimelineData timeline = new GroupTimelineData (submittedOnDate, submittedByUsername, submittedByFirstname, submittedByLastname,
|
final GroupTimelineData timeline = new GroupTimelineData(submittedOnDate, submittedByUsername, submittedByFirstname,
|
||||||
activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate, closedByUsername,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return GroupGeneralData.instance(id, name, externalId, status, activationDate, officeId, officeName, null, null, staffId,
|
return GroupGeneralData.instance(id, name, externalId, status, activationDate, officeId, officeName, null, null, staffId,
|
||||||
staffName, hierarchy, timeline);
|
staffName, hierarchy, timeline);
|
||||||
@@ -540,7 +532,8 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
if (!flag) {
|
if (!flag) {
|
||||||
Collection<CenterData> meetingFallCenter = new ArrayList<CenterData>();
|
Collection<CenterData> meetingFallCenter = new ArrayList<CenterData>();
|
||||||
meetingFallCenter.add(centerData);
|
meetingFallCenter.add(centerData);
|
||||||
staffCenterDataArray.add(StaffCenterData.instance(centerData.staffId(), centerData.getStaffName(), meetingFallCenter));
|
staffCenterDataArray.add(StaffCenterData.instance(centerData.staffId(), centerData.getStaffName(),
|
||||||
|
meetingFallCenter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -65,7 +65,8 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
|
|||||||
public GroupReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource,
|
public GroupReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource,
|
||||||
final CenterReadPlatformService centerReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
|
final CenterReadPlatformService centerReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
|
||||||
final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService,
|
final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService,
|
||||||
final CodeValueReadPlatformService codeValueReadPlatformService, final PaginationParametersDataValidator paginationParametersDataValidator) {
|
final CodeValueReadPlatformService codeValueReadPlatformService,
|
||||||
|
final PaginationParametersDataValidator paginationParametersDataValidator) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
this.centerReadPlatformService = centerReadPlatformService;
|
this.centerReadPlatformService = centerReadPlatformService;
|
||||||
@@ -161,7 +162,6 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
|
|||||||
new Object[] { hierarchySearchString }, this.allGroupTypesDataMapper);
|
new Object[] { hierarchySearchString }, this.allGroupTypesDataMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<GroupGeneralData> retrieveAll(SearchParameters searchParameters, final PaginationParameters parameters) {
|
public Collection<GroupGeneralData> retrieveAll(SearchParameters searchParameters, final PaginationParameters parameters) {
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = this.context.authenticatedUser();
|
||||||
|
|||||||
+15
-10
@@ -22,14 +22,14 @@ public final class SearchParameters {
|
|||||||
private final String sortOrder;
|
private final String sortOrder;
|
||||||
private final String accountNo;
|
private final String accountNo;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private final Long staffId;
|
private final Long staffId;
|
||||||
|
|
||||||
public static SearchParameters from(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
public static SearchParameters from(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
||||||
final String hierarchy) {
|
final String hierarchy) {
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
return new SearchParameters(sqlSearch, officeId, externalId, name, hierarchy, null, null, null, null, null, null, staffId, accountNo);
|
return new SearchParameters(sqlSearch, officeId, externalId, name, hierarchy, null, null, null, null, null, null, staffId,
|
||||||
|
accountNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forClients(final String sqlSearch, final Long officeId, final String externalId,
|
public static SearchParameters forClients(final String sqlSearch, final Long officeId, final String externalId,
|
||||||
@@ -44,8 +44,9 @@ public final class SearchParameters {
|
|||||||
orderBy, sortOrder, staffId, accountNo);
|
orderBy, sortOrder, staffId, accountNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forGroups(final String sqlSearch, final Long officeId, final Long staffId, final String externalId, final String name,
|
public static SearchParameters forGroups(final String sqlSearch, final Long officeId, final Long staffId, final String externalId,
|
||||||
final String hierarchy, final Integer offset, final Integer limit, final String orderBy, final String sortOrder) {
|
final String name, final String hierarchy, final Integer offset, final Integer limit, final String orderBy,
|
||||||
|
final String sortOrder) {
|
||||||
|
|
||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
@@ -60,7 +61,8 @@ public final class SearchParameters {
|
|||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId, accountNo);
|
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||||
|
staffId, accountNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forJournalEntries(final Long officeId, final Integer offset, final Integer limit, final String orderBy,
|
public static SearchParameters forJournalEntries(final Long officeId, final Integer offset, final Integer limit, final String orderBy,
|
||||||
@@ -69,7 +71,8 @@ public final class SearchParameters {
|
|||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
|
|
||||||
return new SearchParameters(null, officeId, null, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId, null);
|
return new SearchParameters(null, officeId, null, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId,
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forPagination(final Integer offset, final Integer limit, final String orderBy, final String sortOrder) {
|
public static SearchParameters forPagination(final Integer offset, final Integer limit, final String orderBy, final String sortOrder) {
|
||||||
@@ -87,17 +90,19 @@ public final class SearchParameters {
|
|||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId, accountNo);
|
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||||
|
staffId, accountNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forAccountTransfer(final String sqlSearch, final String externalId, final Integer offset, final Integer limit,
|
public static SearchParameters forAccountTransfer(final String sqlSearch, final String externalId, final Integer offset,
|
||||||
final String orderBy, final String sortOrder) {
|
final Integer limit, final String orderBy, final String sortOrder) {
|
||||||
|
|
||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId, accountNo);
|
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||||
|
staffId, accountNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchParameters(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
private SearchParameters(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
||||||
|
|||||||
+4
-2
@@ -49,7 +49,8 @@ public class LoanChargesApiResource {
|
|||||||
|
|
||||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "chargeId", "name", "penalty",
|
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "chargeId", "name", "penalty",
|
||||||
"chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage", "amountPercentageAppliedTo", "currency",
|
"chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage", "amountPercentageAppliedTo", "currency",
|
||||||
"amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage", "amount", "amountPaid", "chargeOptions","installmentChargeData"));
|
"amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage", "amount", "amountPaid", "chargeOptions",
|
||||||
|
"installmentChargeData"));
|
||||||
|
|
||||||
private final String resourceNameForPermissions = "LOAN";
|
private final String resourceNameForPermissions = "LOAN";
|
||||||
|
|
||||||
@@ -118,7 +119,8 @@ public class LoanChargesApiResource {
|
|||||||
|
|
||||||
final LoanChargeData loanCharge = this.loanChargeReadPlatformService.retrieveLoanChargeDetails(loanChargeId, loanId);
|
final LoanChargeData loanCharge = this.loanChargeReadPlatformService.retrieveLoanChargeDetails(loanChargeId, loanId);
|
||||||
|
|
||||||
final Collection<LoanInstallmentChargeData> installmentChargeData = this.loanChargeReadPlatformService.retrieveInstallmentLoanCharges(loanChargeId, true);
|
final Collection<LoanInstallmentChargeData> installmentChargeData = this.loanChargeReadPlatformService
|
||||||
|
.retrieveInstallmentLoanCharges(loanChargeId, true);
|
||||||
|
|
||||||
final LoanChargeData loanChargeData = new LoanChargeData(loanCharge, installmentChargeData);
|
final LoanChargeData loanChargeData = new LoanChargeData(loanCharge, installmentChargeData);
|
||||||
|
|
||||||
|
|||||||
+4
-6
@@ -38,8 +38,8 @@ import org.springframework.stereotype.Component;
|
|||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public class LoanDisbursementDetailApiResource {
|
public class LoanDisbursementDetailApiResource {
|
||||||
|
|
||||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "expectedDisbursementDate","actualDisbursementDate",
|
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "expectedDisbursementDate",
|
||||||
"principal","approvedPrincipal"));
|
"actualDisbursementDate", "principal", "approvedPrincipal"));
|
||||||
|
|
||||||
private final String resourceNameForPermissions = "LOAN";
|
private final String resourceNameForPermissions = "LOAN";
|
||||||
|
|
||||||
@@ -67,14 +67,14 @@ public class LoanDisbursementDetailApiResource {
|
|||||||
public String updateDisbursementDate(@PathParam("loanId") final Long loanId, @PathParam("disbursementId") final Long disbursementId,
|
public String updateDisbursementDate(@PathParam("loanId") final Long loanId, @PathParam("disbursementId") final Long disbursementId,
|
||||||
final String apiRequestBodyAsJson) {
|
final String apiRequestBodyAsJson) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateDisbusementDate(loanId,disbursementId).withJson(apiRequestBodyAsJson).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateDisbusementDate(loanId, disbursementId)
|
||||||
|
.withJson(apiRequestBodyAsJson).build();
|
||||||
|
|
||||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
|
|
||||||
return this.toApiJsonSerializer.serialize(result);
|
return this.toApiJsonSerializer.serialize(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{disbursementId}")
|
@Path("{disbursementId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -90,6 +90,4 @@ public class LoanDisbursementDetailApiResource {
|
|||||||
return this.toApiJsonSerializer.serialize(settings, disbursementData, this.RESPONSE_DATA_PARAMETERS);
|
return this.toApiJsonSerializer.serialize(settings, disbursementData, this.RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+12
-8
@@ -213,8 +213,8 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
officeId = loanAccountClientDetails.officeId();
|
officeId = loanAccountClientDetails.officeId();
|
||||||
|
|
||||||
newLoanAccount = newLoanAccount == null ? loanAccountClientDetails : LoanAccountData.populateClientDefaults(
|
newLoanAccount = newLoanAccount == null ? loanAccountClientDetails : LoanAccountData.populateClientDefaults(newLoanAccount,
|
||||||
newLoanAccount, loanAccountClientDetails);
|
loanAccountClientDetails);
|
||||||
|
|
||||||
// if it's JLG loan add group details
|
// if it's JLG loan add group details
|
||||||
if (templateType.equals("jlg")) {
|
if (templateType.equals("jlg")) {
|
||||||
@@ -330,17 +330,18 @@ public class LoansApiResource {
|
|||||||
disbursementData = this.loanReadPlatformService.retrieveLoanDisbursementDetails(loanId);
|
disbursementData = this.loanReadPlatformService.retrieveLoanDisbursementDetails(loanId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (associationParameters.contains("emiAmountVariations") || associationParameters.contains("repaymentSchedule")) {
|
if (associationParameters.contains("emiAmountVariations") || associationParameters.contains("repaymentSchedule")) {
|
||||||
mandatoryResponseParameters.add("emiAmountVariations");
|
mandatoryResponseParameters.add("emiAmountVariations");
|
||||||
emiAmountVariations = this.loanReadPlatformService.retrieveLoanTermVariations(loanId, LoanTermVariationType.EMI_AMOUNT.getValue());
|
emiAmountVariations = this.loanReadPlatformService.retrieveLoanTermVariations(loanId,
|
||||||
|
LoanTermVariationType.EMI_AMOUNT.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (associationParameters.contains("repaymentSchedule")) {
|
if (associationParameters.contains("repaymentSchedule")) {
|
||||||
mandatoryResponseParameters.add("repaymentSchedule");
|
mandatoryResponseParameters.add("repaymentSchedule");
|
||||||
|
|
||||||
final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData = loanBasicDetails.repaymentScheduleRelatedData();
|
final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData = loanBasicDetails.repaymentScheduleRelatedData();
|
||||||
repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId, repaymentScheduleRelatedData, disbursementData);
|
repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId, repaymentScheduleRelatedData,
|
||||||
|
disbursementData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (associationParameters.contains("charges")) {
|
if (associationParameters.contains("charges")) {
|
||||||
@@ -451,15 +452,18 @@ public class LoansApiResource {
|
|||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") final String sqlSearch,
|
public String retrieveAll(@Context final UriInfo uriInfo,
|
||||||
|
@QueryParam("sqlSearch") final String sqlSearch,
|
||||||
@QueryParam("externalId") final String externalId,
|
@QueryParam("externalId") final String externalId,
|
||||||
// @QueryParam("underHierarchy") final String hierarchy,
|
// @QueryParam("underHierarchy") final String hierarchy,
|
||||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder, @QueryParam("accountNo") final String accountNo) {
|
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder,
|
||||||
|
@QueryParam("accountNo") final String accountNo) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forLoans(sqlSearch, externalId, offset, limit, orderBy, sortOrder, accountNo);
|
final SearchParameters searchParameters = SearchParameters.forLoans(sqlSearch, externalId, offset, limit, orderBy, sortOrder,
|
||||||
|
accountNo);
|
||||||
|
|
||||||
final Page<LoanAccountData> loanBasicDetails = this.loanReadPlatformService.retrieveAll(searchParameters);
|
final Page<LoanAccountData> loanBasicDetails = this.loanReadPlatformService.retrieveAll(searchParameters);
|
||||||
|
|
||||||
|
|||||||
+2
-6
@@ -22,10 +22,8 @@ public class DisbursementData implements Comparable<DisbursementData>{
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final BigDecimal approvedPrincipal;
|
private final BigDecimal approvedPrincipal;
|
||||||
|
|
||||||
|
public DisbursementData(Long id, final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate,
|
||||||
public DisbursementData(Long id, final LocalDate expectedDisbursementDate,
|
final BigDecimal principalDisbursed, final BigDecimal approvedPrincipal) {
|
||||||
final LocalDate actualDisbursementDate, final BigDecimal principalDisbursed,
|
|
||||||
final BigDecimal approvedPrincipal) {
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||||
this.actualDisbursementDate = actualDisbursementDate;
|
this.actualDisbursementDate = actualDisbursementDate;
|
||||||
@@ -66,6 +64,4 @@ public class DisbursementData implements Comparable<DisbursementData>{
|
|||||||
return target != null && target.isAfter(fromNotInclusive) && !target.isAfter(upToAndInclusive);
|
return target != null && target.isAfter(fromNotInclusive) && !target.isAfter(upToAndInclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+110
-108
@@ -154,6 +154,7 @@ public class LoanAccountData {
|
|||||||
private final LoanProductData product;
|
private final LoanProductData product;
|
||||||
|
|
||||||
private final Map<Long, LoanBorrowerCycleData> memberVariations;
|
private final Map<Long, LoanBorrowerCycleData> memberVariations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to produce a {@link LoanAccountData} with only collateral options
|
* Used to produce a {@link LoanAccountData} with only collateral options
|
||||||
* for now.
|
* for now.
|
||||||
@@ -238,17 +239,18 @@ public class LoanAccountData {
|
|||||||
final LoanProductData product = null;
|
final LoanProductData product = null;
|
||||||
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
||||||
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
||||||
currencyData, principal,principal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType, numberOfRepayments,
|
currencyData, principal, principal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType,
|
||||||
repaymentEvery, repaymentFrequencyType, transactionProcessingStrategyId, transactionProcessingStrategyName,
|
numberOfRepayments, repaymentEvery, repaymentFrequencyType, transactionProcessingStrategyId,
|
||||||
amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate, interestType,
|
transactionProcessingStrategyName, amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate,
|
||||||
interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
interestType, interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
||||||
graceOnInterestCharged, interestChargedFromDate, timeline, summary, feeChargesDueAtDisbursementCharged, repaymentSchedule,
|
graceOnInterestCharged, interestChargedFromDate, timeline, summary, feeChargesDueAtDisbursementCharged, repaymentSchedule,
|
||||||
transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
||||||
repaymentFrequencyTypeOptions, transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
|
repaymentFrequencyTypeOptions, transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
|
||||||
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions,
|
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions,
|
||||||
chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions,
|
chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions,
|
||||||
syncDisbursementWithMeeting, loancounter, loanProductCounter, notes, accountLinkingOptions, linkedAccount, disbursementData,
|
syncDisbursementWithMeeting, loancounter, loanProductCounter, notes, accountLinkingOptions, linkedAccount,
|
||||||
multiDisburseLoan, fixedEmiAmount,maxOutstandingLoanBalance,emiAmountVariations,memberVariations, product);
|
disbursementData, multiDisburseLoan, fixedEmiAmount, maxOutstandingLoanBalance, emiAmountVariations, memberVariations,
|
||||||
|
product);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,17 +338,17 @@ public class LoanAccountData {
|
|||||||
|
|
||||||
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
||||||
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
||||||
currencyData, principal,principal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType, numberOfRepayments,
|
currencyData, principal, principal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType,
|
||||||
repaymentEvery, repaymentFrequencyType, transactionProcessingStrategyId, transactionProcessingStrategyName,
|
numberOfRepayments, repaymentEvery, repaymentFrequencyType, transactionProcessingStrategyId,
|
||||||
amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate, interestType,
|
transactionProcessingStrategyName, amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate,
|
||||||
interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
interestType, interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
||||||
graceOnInterestCharged, interestChargedFromDate, timeline, summary, feeChargesDueAtDisbursementCharged, repaymentSchedule,
|
graceOnInterestCharged, interestChargedFromDate, timeline, summary, feeChargesDueAtDisbursementCharged, repaymentSchedule,
|
||||||
transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
||||||
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
||||||
interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions,
|
interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions,
|
||||||
loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter,
|
loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter,
|
||||||
notes, accountLinkingOptions, linkedAccount, disbursementData, multiDisburseLoan, fixedEmiAmount, maxOutstandingLoanBalance,
|
notes, accountLinkingOptions, linkedAccount, disbursementData, multiDisburseLoan, fixedEmiAmount,
|
||||||
emiAmountVariations,memberVariations, product);
|
maxOutstandingLoanBalance, emiAmountVariations, memberVariations, product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanAccountData populateClientDefaults(final LoanAccountData acc, final LoanAccountData clientAcc) {
|
public static LoanAccountData populateClientDefaults(final LoanAccountData acc, final LoanAccountData clientAcc) {
|
||||||
@@ -354,16 +356,17 @@ public class LoanAccountData {
|
|||||||
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, clientAcc.clientId, clientAcc.clientName,
|
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, clientAcc.clientId, clientAcc.clientName,
|
||||||
clientAcc.clientOfficeId, acc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription,
|
clientAcc.clientOfficeId, acc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription,
|
||||||
acc.fundId, acc.fundName, acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency,
|
acc.fundId, acc.fundName, acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency,
|
||||||
acc.principal,acc.approvedPrincipal, acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType,
|
acc.principal, acc.approvedPrincipal, acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency,
|
||||||
acc.numberOfRepayments, acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId,
|
acc.termPeriodFrequencyType, acc.numberOfRepayments, acc.repaymentEvery, acc.repaymentFrequencyType,
|
||||||
acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType,
|
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType,
|
||||||
acc.annualInterestRate, acc.interestType, acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate,
|
acc.interestRatePerPeriod, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType,
|
||||||
acc.graceOnPrincipalPayment, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate,
|
acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment,
|
||||||
clientAcc.timeline, acc.summary, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges,
|
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, clientAcc.timeline, acc.summary,
|
||||||
acc.collateral, acc.guarantors, acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions,
|
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
|
||||||
acc.repaymentFrequencyTypeOptions, acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions,
|
acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions, acc.repaymentFrequencyTypeOptions,
|
||||||
acc.amortizationTypeOptions, acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions,
|
acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions, acc.amortizationTypeOptions,
|
||||||
acc.chargeOptions, null, acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions, acc.chargeOptions, null,
|
||||||
|
acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
||||||
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
||||||
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
||||||
acc.emiAmountVariations, acc.memberVariations, acc.product);
|
acc.emiAmountVariations, acc.memberVariations, acc.product);
|
||||||
@@ -455,10 +458,10 @@ public class LoanAccountData {
|
|||||||
|
|
||||||
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
||||||
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
||||||
currencyData, principal,principal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType, numberOfRepayments,
|
currencyData, principal, principal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType,
|
||||||
repaymentEvery, repaymentFrequencyType, transactionProcessingStrategyId, transactionProcessingStrategyName,
|
numberOfRepayments, repaymentEvery, repaymentFrequencyType, transactionProcessingStrategyId,
|
||||||
amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate, interestType,
|
transactionProcessingStrategyName, amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate,
|
||||||
interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
interestType, interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
||||||
graceOnInterestCharged, interestChargedFromDate, timeline, summary, feeChargesDueAtDisbursementCharged, repaymentSchedule,
|
graceOnInterestCharged, interestChargedFromDate, timeline, summary, feeChargesDueAtDisbursementCharged, repaymentSchedule,
|
||||||
transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
||||||
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
||||||
@@ -472,17 +475,17 @@ public class LoanAccountData {
|
|||||||
|
|
||||||
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
||||||
groupAcc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
groupAcc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
||||||
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,acc.approvedPrincipal,
|
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,
|
||||||
acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType, acc.numberOfRepayments,
|
acc.approvedPrincipal, acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType,
|
||||||
acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName,
|
acc.numberOfRepayments, acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId,
|
||||||
acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType,
|
acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType,
|
||||||
acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment,
|
acc.annualInterestRate, acc.interestType, acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate,
|
||||||
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, groupAcc.timeline, acc.summary,
|
acc.graceOnPrincipalPayment, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate,
|
||||||
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
|
groupAcc.timeline, acc.summary, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges,
|
||||||
acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions, acc.repaymentFrequencyTypeOptions,
|
acc.collateral, acc.guarantors, acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions,
|
||||||
acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions, acc.amortizationTypeOptions,
|
acc.repaymentFrequencyTypeOptions, acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions,
|
||||||
acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions, acc.chargeOptions, null,
|
acc.amortizationTypeOptions, acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions,
|
||||||
acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
acc.chargeOptions, null, acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
||||||
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
||||||
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
||||||
acc.emiAmountVariations, acc.memberVariations, acc.product);
|
acc.emiAmountVariations, acc.memberVariations, acc.product);
|
||||||
@@ -603,8 +606,8 @@ public class LoanAccountData {
|
|||||||
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
||||||
interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions,
|
interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions,
|
||||||
loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter,
|
loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter,
|
||||||
notes, accountLinkingOptions, linkedAccount, disbursementData, product.getMultiDisburseLoan(), fixedEmi, product.getOutstandingLoanBalance(),
|
notes, accountLinkingOptions, linkedAccount, disbursementData, product.getMultiDisburseLoan(), fixedEmi,
|
||||||
emiAmountVariations,memberVariations, product);
|
product.getOutstandingLoanBalance(), emiAmountVariations, memberVariations, product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanAccountData populateLoanProductDefaults(final LoanAccountData acc, final LoanProductData product) {
|
public static LoanAccountData populateLoanProductDefaults(final LoanAccountData acc, final LoanProductData product) {
|
||||||
@@ -642,20 +645,20 @@ public class LoanAccountData {
|
|||||||
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
||||||
acc.group, acc.loanType, product.getId(), product.getName(), product.getDescription(), product.getFundId(),
|
acc.group, acc.loanType, product.getId(), product.getName(), product.getDescription(), product.getFundId(),
|
||||||
product.getFundName(), acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName,
|
product.getFundName(), acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName,
|
||||||
product.getCurrency(), product.getPrincipal(),product.getPrincipal(), acc.totalOverpaid, product.getInArrearsTolerance(), termFrequency,
|
product.getCurrency(), product.getPrincipal(), product.getPrincipal(), acc.totalOverpaid, product.getInArrearsTolerance(),
|
||||||
termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(), product.getRepaymentFrequencyType(),
|
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(),
|
||||||
product.getTransactionProcessingStrategyId(), product.getTransactionProcessingStrategyName(),
|
product.getRepaymentFrequencyType(), product.getTransactionProcessingStrategyId(),
|
||||||
product.getAmortizationType(), product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(),
|
product.getTransactionProcessingStrategyName(), product.getAmortizationType(), product.getInterestRatePerPeriod(),
|
||||||
product.getAnnualInterestRate(), product.getInterestType(), product.getInterestCalculationPeriodType(),
|
product.getInterestRateFrequencyType(), product.getAnnualInterestRate(), product.getInterestType(),
|
||||||
acc.expectedFirstRepaymentOnDate, product.getGraceOnPrincipalPayment(), product.getGraceOnInterestPayment(),
|
product.getInterestCalculationPeriodType(), acc.expectedFirstRepaymentOnDate, product.getGraceOnPrincipalPayment(),
|
||||||
product.getGraceOnInterestCharged(), acc.interestChargedFromDate, acc.timeline, acc.summary,
|
product.getGraceOnInterestPayment(), product.getGraceOnInterestCharged(), acc.interestChargedFromDate, acc.timeline,
|
||||||
acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, calendarData,
|
acc.summary, acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors,
|
||||||
productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions, repaymentStrategyOptions,
|
calendarData, productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions, repaymentStrategyOptions,
|
||||||
interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions,
|
interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions,
|
||||||
fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions,
|
fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions,
|
||||||
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, notes, acc.accountLinkingOptions,
|
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, notes, acc.accountLinkingOptions,
|
||||||
acc.linkedAccount, acc.disbursementDetails, product.getMultiDisburseLoan(), acc.fixedEmiAmount,product.getOutstandingLoanBalance(),
|
acc.linkedAccount, acc.disbursementDetails, product.getMultiDisburseLoan(), acc.fixedEmiAmount,
|
||||||
acc.emiAmountVariations,acc.memberVariations, product);
|
product.getOutstandingLoanBalance(), acc.emiAmountVariations, acc.memberVariations, product);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -667,12 +670,11 @@ public class LoanAccountData {
|
|||||||
final EnumOptionData loanType, final Long loanProductId, final String loanProductName, final String loanProductDescription,
|
final EnumOptionData loanType, final Long loanProductId, final String loanProductName, final String loanProductDescription,
|
||||||
final Long fundId, final String fundName, final Long loanPurposeId, final String loanPurposeName, final Long loanOfficerId,
|
final Long fundId, final String fundName, final Long loanPurposeId, final String loanPurposeName, final Long loanOfficerId,
|
||||||
final String loanOfficerName, final CurrencyData currencyData, final BigDecimal principal, final BigDecimal approvedPrincipal,
|
final String loanOfficerName, final CurrencyData currencyData, final BigDecimal principal, final BigDecimal approvedPrincipal,
|
||||||
final BigDecimal totalOverpaid, final BigDecimal inArrearsTolerance,
|
final BigDecimal totalOverpaid, final BigDecimal inArrearsTolerance, final Integer termFrequency,
|
||||||
final Integer termFrequency, final EnumOptionData termPeriodFrequencyType,
|
final EnumOptionData termPeriodFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery,
|
||||||
final Integer numberOfRepayments, final Integer repaymentEvery, final EnumOptionData repaymentFrequencyType,
|
final EnumOptionData repaymentFrequencyType, final Long transactionStrategyId, final String transactionStrategyName,
|
||||||
final Long transactionStrategyId, final String transactionStrategyName, final EnumOptionData amortizationType,
|
final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType,
|
||||||
final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType, final BigDecimal annualInterestRate,
|
final BigDecimal annualInterestRate, final EnumOptionData interestType, final EnumOptionData interestCalculationPeriodType,
|
||||||
final EnumOptionData interestType, final EnumOptionData interestCalculationPeriodType,
|
|
||||||
final LocalDate expectedFirstRepaymentOnDate, final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment,
|
final LocalDate expectedFirstRepaymentOnDate, final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment,
|
||||||
final Integer graceOnInterestCharged, final LocalDate interestChargedFromDate, final LoanApplicationTimelineData timeline,
|
final Integer graceOnInterestCharged, final LocalDate interestChargedFromDate, final LoanApplicationTimelineData timeline,
|
||||||
final LoanSummaryData loanSummary, final BigDecimal feeChargesDueAtDisbursementCharged,
|
final LoanSummaryData loanSummary, final BigDecimal feeChargesDueAtDisbursementCharged,
|
||||||
@@ -710,17 +712,17 @@ public class LoanAccountData {
|
|||||||
|
|
||||||
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
return new LoanAccountData(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, group, loanType, loanProductId,
|
||||||
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName, loanOfficerId, loanOfficerName,
|
||||||
currencyData, principal,approvedPrincipal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType, numberOfRepayments,
|
currencyData, principal, approvedPrincipal, totalOverpaid, inArrearsTolerance, termFrequency, termPeriodFrequencyType,
|
||||||
repaymentEvery, repaymentFrequencyType, transactionStrategyId, transactionStrategyName, amortizationType,
|
numberOfRepayments, repaymentEvery, repaymentFrequencyType, transactionStrategyId, transactionStrategyName,
|
||||||
interestRatePerPeriod, interestRateFrequencyType, annualInterestRate, interestType, interestCalculationPeriodType,
|
amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate, interestType,
|
||||||
expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged,
|
interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
||||||
interestChargedFromDate, timeline, loanSummary, feeChargesDueAtDisbursementCharged, repaymentSchedule, transactions,
|
graceOnInterestCharged, interestChargedFromDate, timeline, loanSummary, feeChargesDueAtDisbursementCharged,
|
||||||
charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
repaymentSchedule, transactions, charges, collateral, guarantors, calendarData, productOptions, termFrequencyTypeOptions,
|
||||||
repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions,
|
repaymentFrequencyTypeOptions, repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions,
|
||||||
interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions,
|
interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions,
|
||||||
loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter, notes,
|
loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter,
|
||||||
accountLinkingOptions, linkedAccount, disbursementData, multiDisburseLoan, fixedEmiAmont, outstandingLoanBalance,emiAmountVariations,
|
notes, accountLinkingOptions, linkedAccount, disbursementData, multiDisburseLoan, fixedEmiAmont, outstandingLoanBalance,
|
||||||
memberVariations, product);
|
emiAmountVariations, memberVariations, product);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -743,18 +745,19 @@ public class LoanAccountData {
|
|||||||
final Collection<LoanTermVariationsData> emiAmountVariations) {
|
final Collection<LoanTermVariationsData> emiAmountVariations) {
|
||||||
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
||||||
acc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
acc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
||||||
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,acc.approvedPrincipal,
|
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,
|
||||||
acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType, acc.numberOfRepayments,
|
acc.approvedPrincipal, acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType,
|
||||||
acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName,
|
acc.numberOfRepayments, acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId,
|
||||||
acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType,
|
acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType,
|
||||||
acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment,
|
acc.annualInterestRate, acc.interestType, acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate,
|
||||||
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
|
acc.graceOnPrincipalPayment, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate,
|
||||||
acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, calendarData,
|
acc.timeline, acc.summary, acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral,
|
||||||
productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions, transactionProcessingStrategyOptions,
|
guarantors, calendarData, productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
||||||
interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions,
|
transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions,
|
||||||
fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions,
|
interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions,
|
||||||
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, notes, accountLinkingOptions, linkedAccount, disbursementDetails,
|
loanCollateralOptions, calendarOptions, acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, notes,
|
||||||
acc.multiDisburseLoan, acc.fixedEmiAmount,acc.maxOutstandingLoanBalance,emiAmountVariations,acc.memberVariations, acc.product);
|
accountLinkingOptions, linkedAccount, disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount,
|
||||||
|
acc.maxOutstandingLoanBalance, emiAmountVariations, acc.memberVariations, acc.product);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanAccountData associationsAndTemplate(final LoanAccountData acc, final Collection<LoanProductData> productOptions,
|
public static LoanAccountData associationsAndTemplate(final LoanAccountData acc, final Collection<LoanProductData> productOptions,
|
||||||
@@ -771,17 +774,17 @@ public class LoanAccountData {
|
|||||||
public static LoanAccountData associateGroup(final LoanAccountData acc, final GroupGeneralData group) {
|
public static LoanAccountData associateGroup(final LoanAccountData acc, final GroupGeneralData group) {
|
||||||
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
||||||
group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
||||||
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,acc.approvedPrincipal,
|
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,
|
||||||
acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType, acc.numberOfRepayments,
|
acc.approvedPrincipal, acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType,
|
||||||
acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName,
|
acc.numberOfRepayments, acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId,
|
||||||
acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType,
|
acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType,
|
||||||
acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment,
|
acc.annualInterestRate, acc.interestType, acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate,
|
||||||
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
|
acc.graceOnPrincipalPayment, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate,
|
||||||
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
|
acc.timeline, acc.summary, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges,
|
||||||
acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions, acc.repaymentFrequencyTypeOptions,
|
acc.collateral, acc.guarantors, acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions,
|
||||||
acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions, acc.amortizationTypeOptions,
|
acc.repaymentFrequencyTypeOptions, acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions,
|
||||||
acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions, acc.chargeOptions, null,
|
acc.amortizationTypeOptions, acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions,
|
||||||
acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
acc.chargeOptions, null, acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
||||||
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
||||||
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
||||||
acc.emiAmountVariations, acc.memberVariations, acc.product);
|
acc.emiAmountVariations, acc.memberVariations, acc.product);
|
||||||
@@ -820,24 +823,24 @@ public class LoanAccountData {
|
|||||||
numberOfRepayments = acc.product.getNumberOfRepayments();
|
numberOfRepayments = acc.product.getNumberOfRepayments();
|
||||||
}
|
}
|
||||||
final Integer termFrequency = numberOfRepayments * acc.product.getRepaymentEvery();
|
final Integer termFrequency = numberOfRepayments * acc.product.getRepaymentEvery();
|
||||||
LoanBorrowerCycleData borrowerCycleData = new LoanBorrowerCycleData(principal, interestRatePerPeriod, numberOfRepayments,termFrequency);
|
LoanBorrowerCycleData borrowerCycleData = new LoanBorrowerCycleData(principal, interestRatePerPeriod, numberOfRepayments,
|
||||||
|
termFrequency);
|
||||||
memberVariations.put(clientId, borrowerCycleData);
|
memberVariations.put(clientId, borrowerCycleData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientName, acc.clientOfficeId,
|
||||||
acc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
acc.group, acc.loanType, acc.loanProductId, acc.loanProductName, acc.loanProductDescription, acc.fundId, acc.fundName,
|
||||||
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,acc.approvedPrincipal,
|
acc.loanPurposeId, acc.loanPurposeName, acc.loanOfficerId, acc.loanOfficerName, acc.currency, acc.principal,
|
||||||
acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType, acc.numberOfRepayments,
|
acc.approvedPrincipal, acc.totalOverpaid, acc.inArrearsTolerance, acc.termFrequency, acc.termPeriodFrequencyType,
|
||||||
acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName,
|
acc.numberOfRepayments, acc.repaymentEvery, acc.repaymentFrequencyType, acc.transactionProcessingStrategyId,
|
||||||
acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType,
|
acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType,
|
||||||
acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment,
|
acc.annualInterestRate, acc.interestType, acc.interestCalculationPeriodType, acc.expectedFirstRepaymentOnDate,
|
||||||
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
|
acc.graceOnPrincipalPayment, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate,
|
||||||
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
|
acc.timeline, acc.summary, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges,
|
||||||
acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions, acc.repaymentFrequencyTypeOptions,
|
acc.collateral, acc.guarantors, acc.meeting, acc.productOptions, acc.termFrequencyTypeOptions,
|
||||||
acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions, acc.amortizationTypeOptions,
|
acc.repaymentFrequencyTypeOptions, acc.transactionProcessingStrategyOptions, acc.interestRateFrequencyTypeOptions,
|
||||||
acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions, acc.chargeOptions, null,
|
acc.amortizationTypeOptions, acc.interestTypeOptions, acc.interestCalculationPeriodTypeOptions, acc.fundOptions,
|
||||||
acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
acc.chargeOptions, null, acc.loanOfficerOptions, acc.loanPurposeOptions, acc.loanCollateralOptions, acc.calendarOptions,
|
||||||
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, acc.notes, acc.accountLinkingOptions,
|
||||||
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
acc.linkedAccount, acc.disbursementDetails, acc.multiDisburseLoan, acc.fixedEmiAmount, acc.maxOutstandingLoanBalance,
|
||||||
acc.emiAmountVariations, memberVariations, acc.product);
|
acc.emiAmountVariations, memberVariations, acc.product);
|
||||||
@@ -890,9 +893,10 @@ public class LoanAccountData {
|
|||||||
final Collection<CodeValueData> loanCollateralOptions, final Collection<CalendarData> calendarOptions,
|
final Collection<CodeValueData> loanCollateralOptions, final Collection<CalendarData> calendarOptions,
|
||||||
final Boolean syncDisbursementWithMeeting, final Integer loanCounter, final Integer loanProductCounter,
|
final Boolean syncDisbursementWithMeeting, final Integer loanCounter, final Integer loanProductCounter,
|
||||||
final Collection<NoteData> notes, final Collection<PortfolioAccountData> accountLinkingOptions,
|
final Collection<NoteData> notes, final Collection<PortfolioAccountData> accountLinkingOptions,
|
||||||
final PortfolioAccountData linkedAccount,final Collection<DisbursementData> disbursementDetails,final Boolean multiDisburseLoan, BigDecimal fixedEmiAmount,
|
final PortfolioAccountData linkedAccount, final Collection<DisbursementData> disbursementDetails,
|
||||||
final BigDecimal maxOutstandingLoanBalance,final Collection<LoanTermVariationsData> emiAmountVariations,
|
final Boolean multiDisburseLoan, BigDecimal fixedEmiAmount, final BigDecimal maxOutstandingLoanBalance,
|
||||||
final Map<Long, LoanBorrowerCycleData> memberVariations, final LoanProductData product) {
|
final Collection<LoanTermVariationsData> emiAmountVariations, final Map<Long, LoanBorrowerCycleData> memberVariations,
|
||||||
|
final LoanProductData product) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.accountNo = accountNo;
|
this.accountNo = accountNo;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@@ -1092,12 +1096,10 @@ public class LoanAccountData {
|
|||||||
return data.getBorrowerCycleNumber() == loanCycleNumber && data.getValueConditionType().equals(LoanProductValueConditionType.EQUAL);
|
return data.getBorrowerCycleNumber() == loanCycleNumber && data.getValueConditionType().equals(LoanProductValueConditionType.EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LoanProductData product() {
|
public LoanProductData product() {
|
||||||
return this.product;
|
return this.product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public GroupGeneralData groupData() {
|
public GroupGeneralData groupData() {
|
||||||
return this.group;
|
return this.group;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -130,9 +130,9 @@ public class LoanApplicationTimelineData {
|
|||||||
this.writeOffByLastname = writeOffByLastname;
|
this.writeOffByLastname = writeOffByLastname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData(final CurrencyData currency, final BigDecimal principal,final BigDecimal approvedPrincipal,
|
public RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData(final CurrencyData currency, final BigDecimal principal,
|
||||||
final BigDecimal inArrearsTolerance, final BigDecimal totalFeeChargesAtDisbursement) {
|
final BigDecimal approvedPrincipal, final BigDecimal inArrearsTolerance, final BigDecimal totalFeeChargesAtDisbursement) {
|
||||||
return new RepaymentScheduleRelatedLoanData(this.expectedDisbursementDate, this.actualDisbursementDate, currency, principal,approvedPrincipal,
|
return new RepaymentScheduleRelatedLoanData(this.expectedDisbursementDate, this.actualDisbursementDate, currency, principal,
|
||||||
inArrearsTolerance, totalFeeChargesAtDisbursement);
|
approvedPrincipal, inArrearsTolerance, totalFeeChargesAtDisbursement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-3
@@ -2,16 +2,19 @@ package org.mifosplatform.portfolio.loanaccount.data;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
public class LoanBorrowerCycleData {
|
public class LoanBorrowerCycleData {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final BigDecimal principal;
|
private final BigDecimal principal;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final BigDecimal interestRatePerPeriod;
|
private final BigDecimal interestRatePerPeriod;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final Integer numberOfRepayments;
|
private final Integer numberOfRepayments;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final Integer termFrequency;
|
private final Integer termFrequency;
|
||||||
|
|
||||||
|
public LoanBorrowerCycleData(final BigDecimal principal, final BigDecimal interestRatePerPeriod, final Integer numberOfRepayments,
|
||||||
public LoanBorrowerCycleData(final BigDecimal principal, final BigDecimal interestRatePerPeriod,final Integer numberOfRepayments,final Integer termFrequency) {
|
final Integer termFrequency) {
|
||||||
|
|
||||||
this.principal = principal;
|
this.principal = principal;
|
||||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||||
|
|||||||
+6
-6
@@ -88,7 +88,8 @@ public class LoanChargeData {
|
|||||||
final BigDecimal amountOutstanding, final EnumOptionData chargeTimeType, final LocalDate dueDate,
|
final BigDecimal amountOutstanding, final EnumOptionData chargeTimeType, final LocalDate dueDate,
|
||||||
final EnumOptionData chargeCalculationType, final BigDecimal percentage, final BigDecimal amountPercentageAppliedTo,
|
final EnumOptionData chargeCalculationType, final BigDecimal percentage, final BigDecimal amountPercentageAppliedTo,
|
||||||
final boolean penalty, final EnumOptionData chargePaymentMode, final boolean paid, final boolean waived, final Long loanId,
|
final boolean penalty, final EnumOptionData chargePaymentMode, final boolean paid, final boolean waived, final Long loanId,
|
||||||
final BigDecimal minCap, final BigDecimal maxCap,final BigDecimal amountOrPercentage, Collection<LoanInstallmentChargeData> installmentChargeData) {
|
final BigDecimal minCap, final BigDecimal maxCap, final BigDecimal amountOrPercentage,
|
||||||
|
Collection<LoanInstallmentChargeData> installmentChargeData) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.chargeId = chargeId;
|
this.chargeId = chargeId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -128,7 +129,8 @@ public class LoanChargeData {
|
|||||||
private LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
private LoanChargeData(final Long id, final Long chargeId, final String name, final CurrencyData currency, final BigDecimal amount,
|
||||||
final BigDecimal percentage, final EnumOptionData chargeTimeType, final EnumOptionData chargeCalculationType,
|
final BigDecimal percentage, final EnumOptionData chargeTimeType, final EnumOptionData chargeCalculationType,
|
||||||
final Collection<ChargeData> chargeOptions, final boolean penalty, final EnumOptionData chargePaymentMode, final boolean paid,
|
final Collection<ChargeData> chargeOptions, final boolean penalty, final EnumOptionData chargePaymentMode, final boolean paid,
|
||||||
final boolean waived, final Long loanId, final BigDecimal minCap, final BigDecimal maxCap,final BigDecimal amountOrPercentage, Collection<LoanInstallmentChargeData> installmentChargeData) {
|
final boolean waived, final Long loanId, final BigDecimal minCap, final BigDecimal maxCap, final BigDecimal amountOrPercentage,
|
||||||
|
Collection<LoanInstallmentChargeData> installmentChargeData) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.chargeId = chargeId;
|
this.chargeId = chargeId;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -166,7 +168,8 @@ public class LoanChargeData {
|
|||||||
this.installmentChargeData = installmentChargeData;
|
this.installmentChargeData = installmentChargeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanChargeData(final Long id, final LocalDate dueAsOfDate, final BigDecimal amountOutstanding, EnumOptionData chargeTimeType, final Long loanId, Collection<LoanInstallmentChargeData> installmentChargeData) {
|
public LoanChargeData(final Long id, final LocalDate dueAsOfDate, final BigDecimal amountOutstanding, EnumOptionData chargeTimeType,
|
||||||
|
final Long loanId, Collection<LoanInstallmentChargeData> installmentChargeData) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.chargeId = null;
|
this.chargeId = null;
|
||||||
this.name = null;
|
this.name = null;
|
||||||
@@ -250,8 +253,6 @@ public class LoanChargeData {
|
|||||||
this.installmentChargeData = null;
|
this.installmentChargeData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isChargePayable() {
|
public boolean isChargePayable() {
|
||||||
boolean isAccountTransfer = false;
|
boolean isAccountTransfer = false;
|
||||||
if (this.chargePaymentMode != null) {
|
if (this.chargePaymentMode != null) {
|
||||||
@@ -284,7 +285,6 @@ public class LoanChargeData {
|
|||||||
return isInstalmentFee;
|
return isInstalmentFee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal amountOrPercentage() {
|
public BigDecimal amountOrPercentage() {
|
||||||
return this.amountOrPercentage;
|
return this.amountOrPercentage;
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -36,10 +36,8 @@ public class LoanInstallmentChargeData {
|
|||||||
return !(this.paid || this.waived);
|
return !(this.paid || this.waived);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getAmountOutstanding() {
|
public BigDecimal getAmountOutstanding() {
|
||||||
return this.amountOutstanding;
|
return this.amountOutstanding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-5
@@ -13,25 +13,22 @@ public class LoanTermVariationsData {
|
|||||||
private final LocalDate termVariationApplicableFrom;
|
private final LocalDate termVariationApplicableFrom;
|
||||||
private final BigDecimal termValue;
|
private final BigDecimal termValue;
|
||||||
|
|
||||||
public LoanTermVariationsData(final Long id, final EnumOptionData termType,
|
public LoanTermVariationsData(final Long id, final EnumOptionData termType, final LocalDate termVariationApplicableFrom,
|
||||||
final LocalDate termVariationApplicableFrom, final BigDecimal termValue) {
|
final BigDecimal termValue) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.termType = termType;
|
this.termType = termType;
|
||||||
this.termVariationApplicableFrom = termVariationApplicableFrom;
|
this.termVariationApplicableFrom = termVariationApplicableFrom;
|
||||||
this.termValue = termValue;
|
this.termValue = termValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EnumOptionData getTermType() {
|
public EnumOptionData getTermType() {
|
||||||
return this.termType;
|
return this.termType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LocalDate getTermApplicableFrom() {
|
public LocalDate getTermApplicableFrom() {
|
||||||
return this.termVariationApplicableFrom;
|
return this.termVariationApplicableFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getTermValue() {
|
public BigDecimal getTermValue() {
|
||||||
return this.termValue;
|
return this.termValue;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -24,8 +24,8 @@ public class RepaymentScheduleRelatedLoanData {
|
|||||||
private final BigDecimal totalFeeChargesAtDisbursement;
|
private final BigDecimal totalFeeChargesAtDisbursement;
|
||||||
|
|
||||||
public RepaymentScheduleRelatedLoanData(final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate,
|
public RepaymentScheduleRelatedLoanData(final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate,
|
||||||
final CurrencyData currency, final BigDecimal principal,final BigDecimal approvedPrincipal, final BigDecimal inArrearsTolerance,
|
final CurrencyData currency, final BigDecimal principal, final BigDecimal approvedPrincipal,
|
||||||
final BigDecimal totalFeeChargesAtDisbursement) {
|
final BigDecimal inArrearsTolerance, final BigDecimal totalFeeChargesAtDisbursement) {
|
||||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||||
this.actualDisbursementDate = actualDisbursementDate;
|
this.actualDisbursementDate = actualDisbursementDate;
|
||||||
this.currency = currency;
|
this.currency = currency;
|
||||||
@@ -64,6 +64,7 @@ public class RepaymentScheduleRelatedLoanData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DisbursementData disbursementData() {
|
public DisbursementData disbursementData() {
|
||||||
return new DisbursementData(null, this.expectedDisbursementDate, this.actualDisbursementDate, this.principal,this.approvedPrincipal);
|
return new DisbursementData(null, this.expectedDisbursementDate, this.actualDisbursementDate, this.principal,
|
||||||
|
this.approvedPrincipal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-2
@@ -122,7 +122,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction");
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction");
|
||||||
if (realCause.getMessage().toLowerCase().contains("external_id_unique")) {
|
if (realCause.getMessage().toLowerCase().contains("external_id_unique")) {
|
||||||
baseDataValidator.reset().parameter("externalId").value(newRepaymentTransaction.getExternalId()).failWithCode("value.must.be.unique");
|
baseDataValidator.reset().parameter("externalId").value(newRepaymentTransaction.getExternalId())
|
||||||
|
.failWithCode("value.must.be.unique");
|
||||||
}
|
}
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
|
||||||
"Validation errors exist.", dataValidationErrors); }
|
"Validation errors exist.", dataValidationErrors); }
|
||||||
@@ -187,7 +188,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
loan.handlePayDisbursementTransaction(chargeId, newPaymentTransaction, existingTransactionIds, existingReversedTransactionIds);
|
loan.handlePayDisbursementTransaction(chargeId, newPaymentTransaction, existingTransactionIds, existingReversedTransactionIds);
|
||||||
} else {
|
} else {
|
||||||
loan.makeChargePayment(chargeId, defaultLoanLifecycleStateMachine(), existingTransactionIds, existingReversedTransactionIds,
|
loan.makeChargePayment(chargeId, defaultLoanLifecycleStateMachine(), existingTransactionIds, existingReversedTransactionIds,
|
||||||
allowTransactionsOnHoliday, holidays, workingDays, allowTransactionsOnNonWorkingDay, newPaymentTransaction, installmentNumber);
|
allowTransactionsOnHoliday, holidays, workingDays, allowTransactionsOnNonWorkingDay, newPaymentTransaction,
|
||||||
|
installmentNumber);
|
||||||
}
|
}
|
||||||
this.loanTransactionRepository.save(newPaymentTransaction);
|
this.loanTransactionRepository.save(newPaymentTransaction);
|
||||||
this.loanRepository.saveAndFlush(loan);
|
this.loanRepository.saveAndFlush(loan);
|
||||||
|
|||||||
+24
-27
@@ -112,7 +112,6 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
|
|
||||||
|
|
||||||
public static LoanCharge createNewFromJson(final Loan loan, final Charge chargeDefinition, final JsonCommand command) {
|
public static LoanCharge createNewFromJson(final Loan loan, final Charge chargeDefinition, final JsonCommand command) {
|
||||||
|
|
||||||
final BigDecimal amount = command.bigDecimalValueOfParameterNamed("amount");
|
final BigDecimal amount = command.bigDecimalValueOfParameterNamed("amount");
|
||||||
@@ -142,7 +141,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
if (percentage == null) {
|
if (percentage == null) {
|
||||||
percentage = chargeDefinition.getAmount();
|
percentage = chargeDefinition.getAmount();
|
||||||
}
|
}
|
||||||
loanCharge = loan.calculatePerInstallmentChargeAmount(ChargeCalculationType.fromInt(chargeDefinition.getChargeCalculation()),percentage);
|
loanCharge = loan.calculatePerInstallmentChargeAmount(ChargeCalculationType.fromInt(chargeDefinition.getChargeCalculation()),
|
||||||
|
percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LoanCharge(loan, chargeDefinition, amountPercentageAppliedTo, amount, chargeTime, chargeCalculation, dueDate,
|
return new LoanCharge(loan, chargeDefinition, amountPercentageAppliedTo, amount, chargeTime, chargeCalculation, dueDate,
|
||||||
@@ -155,7 +155,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
public static LoanCharge createNewWithoutLoan(final Charge chargeDefinition, final BigDecimal loanPrincipal, final BigDecimal amount,
|
public static LoanCharge createNewWithoutLoan(final Charge chargeDefinition, final BigDecimal loanPrincipal, final BigDecimal amount,
|
||||||
final ChargeTimeType chargeTime, final ChargeCalculationType chargeCalculation, final LocalDate dueDate,
|
final ChargeTimeType chargeTime, final ChargeCalculationType chargeCalculation, final LocalDate dueDate,
|
||||||
final ChargePaymentMode chargePaymentMode, final Integer numberOfRepayments) {
|
final ChargePaymentMode chargePaymentMode, final Integer numberOfRepayments) {
|
||||||
return new LoanCharge(null, chargeDefinition, loanPrincipal, amount, chargeTime, chargeCalculation, dueDate, chargePaymentMode, numberOfRepayments, BigDecimal.ZERO);
|
return new LoanCharge(null, chargeDefinition, loanPrincipal, amount, chargeTime, chargeCalculation, dueDate, chargePaymentMode,
|
||||||
|
numberOfRepayments, BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LoanCharge() {
|
protected LoanCharge() {
|
||||||
@@ -176,7 +177,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
this.chargeTime = chargeTime.getValue();
|
this.chargeTime = chargeTime.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChargeTimeType.fromInt(this.chargeTime).equals(ChargeTimeType.SPECIFIED_DUE_DATE) || ChargeTimeType.fromInt(this.chargeTime).equals(ChargeTimeType.OVERDUE_INSTALLMENT) ) {
|
if (ChargeTimeType.fromInt(this.chargeTime).equals(ChargeTimeType.SPECIFIED_DUE_DATE)
|
||||||
|
|| ChargeTimeType.fromInt(this.chargeTime).equals(ChargeTimeType.OVERDUE_INSTALLMENT)) {
|
||||||
|
|
||||||
if (dueDate == null) {
|
if (dueDate == null) {
|
||||||
final String defaultUserMessage = "Loan charge is missing due date.";
|
final String defaultUserMessage = "Loan charge is missing due date.";
|
||||||
@@ -207,7 +209,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
this.paid = determineIfFullyPaid();
|
this.paid = determineIfFullyPaid();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateDerivedFields(final BigDecimal amountPercentageAppliedTo, final BigDecimal chargeAmount,Integer numberOfRepayments, BigDecimal loanCharge) {
|
private void populateDerivedFields(final BigDecimal amountPercentageAppliedTo, final BigDecimal chargeAmount,
|
||||||
|
Integer numberOfRepayments, BigDecimal loanCharge) {
|
||||||
|
|
||||||
switch (ChargeCalculationType.fromInt(this.chargeCalculation)) {
|
switch (ChargeCalculationType.fromInt(this.chargeCalculation)) {
|
||||||
case INVALID:
|
case INVALID:
|
||||||
@@ -324,7 +327,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
this.loan = loan;
|
this.loan = loan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(final BigDecimal amount, final LocalDate dueDate, final BigDecimal loanPrincipal, Integer numberOfRepayments, BigDecimal loanCharge) {
|
public void update(final BigDecimal amount, final LocalDate dueDate, final BigDecimal loanPrincipal, Integer numberOfRepayments,
|
||||||
|
BigDecimal loanCharge) {
|
||||||
if (dueDate != null) {
|
if (dueDate != null) {
|
||||||
this.dueDate = dueDate.toDate();
|
this.dueDate = dueDate.toDate();
|
||||||
}
|
}
|
||||||
@@ -430,7 +434,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
case PERCENT_OF_INTEREST:
|
case PERCENT_OF_INTEREST:
|
||||||
this.percentage = newValue;
|
this.percentage = newValue;
|
||||||
this.amountPercentageAppliedTo = amount;
|
this.amountPercentageAppliedTo = amount;
|
||||||
BigDecimal loanCharge = this.loan.calculatePerInstallmentChargeAmount(ChargeCalculationType.fromInt(this.chargeCalculation),this.percentage);
|
BigDecimal loanCharge = this.loan.calculatePerInstallmentChargeAmount(
|
||||||
|
ChargeCalculationType.fromInt(this.chargeCalculation), this.percentage);
|
||||||
if (loanCharge.compareTo(BigDecimal.ZERO) == 0) {
|
if (loanCharge.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
loanCharge = percentageOf(this.amountPercentageAppliedTo);
|
loanCharge = percentageOf(this.amountPercentageAppliedTo);
|
||||||
}
|
}
|
||||||
@@ -485,16 +490,12 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean determineIfFullyPaid() {
|
private boolean determineIfFullyPaid() {
|
||||||
if(this.amount == null){
|
if (this.amount == null) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0;
|
return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal calculateOutstanding() {
|
private BigDecimal calculateOutstanding() {
|
||||||
if(this.amount == null){
|
if (this.amount == null) { return null; }
|
||||||
return null;
|
|
||||||
}
|
|
||||||
BigDecimal amountPaidLocal = BigDecimal.ZERO;
|
BigDecimal amountPaidLocal = BigDecimal.ZERO;
|
||||||
if (this.amountPaid != null) {
|
if (this.amountPaid != null) {
|
||||||
amountPaidLocal = this.amountPaid;
|
amountPaidLocal = this.amountPaid;
|
||||||
@@ -534,7 +535,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
/**
|
/**
|
||||||
* @param percentageOf
|
* @param percentageOf
|
||||||
* @returns a minimum cap or maximum cap set on charges if the criteria fits
|
* @returns a minimum cap or maximum cap set on charges if the criteria fits
|
||||||
* else it returns the percentageOf if the amount is within min and max cap
|
* else it returns the percentageOf if the amount is within min and
|
||||||
|
* max cap
|
||||||
*/
|
*/
|
||||||
private BigDecimal minimumAndMaximumCap(final BigDecimal percentageOf) {
|
private BigDecimal minimumAndMaximumCap(final BigDecimal percentageOf) {
|
||||||
BigDecimal minMaxCap = BigDecimal.ZERO;
|
BigDecimal minMaxCap = BigDecimal.ZERO;
|
||||||
@@ -637,7 +639,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param feeAmount TODO
|
* @param feeAmount
|
||||||
|
* TODO
|
||||||
* @param processAmount
|
* @param processAmount
|
||||||
* Amount used to pay off this charge
|
* Amount used to pay off this charge
|
||||||
* @return Actual amount paid on this charge
|
* @return Actual amount paid on this charge
|
||||||
@@ -739,18 +742,14 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
public LoanInstallmentCharge getInstallmentLoanCharge(final LocalDate periodDueDate) {
|
public LoanInstallmentCharge getInstallmentLoanCharge(final LocalDate periodDueDate) {
|
||||||
for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) {
|
for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) {
|
||||||
if (periodDueDate.isEqual(loanChargePerInstallment.getRepaymentInstallment().getDueDate())) {
|
if (periodDueDate.isEqual(loanChargePerInstallment.getRepaymentInstallment().getDueDate())) { return loanChargePerInstallment; }
|
||||||
return loanChargePerInstallment;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanInstallmentCharge getInstallmentLoanCharge(final Integer installmentNumber) {
|
public LoanInstallmentCharge getInstallmentLoanCharge(final Integer installmentNumber) {
|
||||||
for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) {
|
for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) {
|
||||||
if (installmentNumber.equals(loanChargePerInstallment.getRepaymentInstallment().getInstallmentNumber().intValue()) ){
|
if (installmentNumber.equals(loanChargePerInstallment.getRepaymentInstallment().getInstallmentNumber().intValue())) { return loanChargePerInstallment; }
|
||||||
return loanChargePerInstallment;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -773,10 +772,10 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
public LoanRepaymentScheduleInstallment fetchRepaymentInstallment(final Money trasferedAmount) {
|
public LoanRepaymentScheduleInstallment fetchRepaymentInstallment(final Money trasferedAmount) {
|
||||||
for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) {
|
for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) {
|
||||||
if (loanChargePerInstallment.isPending() &&
|
if (loanChargePerInstallment.isPending()
|
||||||
trasferedAmount.getAmount().equals(loanChargePerInstallment.getAmountThroughChargePayment(trasferedAmount.getCurrency()).getAmount()) ){
|
&& trasferedAmount.getAmount().equals(
|
||||||
return loanChargePerInstallment.getRepaymentInstallment();
|
loanChargePerInstallment.getAmountThroughChargePayment(trasferedAmount.getCurrency()).getAmount())) { return loanChargePerInstallment
|
||||||
}
|
.getRepaymentInstallment(); }
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -785,12 +784,10 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
|||||||
return this.active;
|
return this.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setActive(boolean active) {
|
public void setActive(boolean active) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal amountOrPercentage() {
|
public BigDecimal amountOrPercentage() {
|
||||||
return this.amountOrPercentage;
|
return this.amountOrPercentage;
|
||||||
}
|
}
|
||||||
|
|||||||
-4
@@ -24,7 +24,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
|||||||
@Table(name = "m_loan_disbursement_detail")
|
@Table(name = "m_loan_disbursement_detail")
|
||||||
public class LoanDisbursementDetails extends AbstractPersistable<Long> {
|
public class LoanDisbursementDetails extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "loan_id", nullable = false)
|
@JoinColumn(name = "loan_id", nullable = false)
|
||||||
private Loan loan;
|
private Loan loan;
|
||||||
@@ -90,7 +89,6 @@ public class LoanDisbursementDetails extends AbstractPersistable<Long> {
|
|||||||
this.principal = principal;
|
this.principal = principal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getDisbursementDate() {
|
public Date getDisbursementDate() {
|
||||||
Date disbursementDate = this.expectedDisbursementDate;
|
Date disbursementDate = this.expectedDisbursementDate;
|
||||||
if (this.actualDisbursementDate != null) {
|
if (this.actualDisbursementDate != null) {
|
||||||
@@ -112,7 +110,6 @@ public class LoanDisbursementDetails extends AbstractPersistable<Long> {
|
|||||||
return new DisbursementData(getId(), expectedDisburseDate, actualDisburseDate, this.principal, this.approvedPrincipal);
|
return new DisbursementData(getId(), expectedDisburseDate, actualDisburseDate, this.principal, this.approvedPrincipal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateActualDisbursementDate(Date actualDisbursementDate) {
|
public void updateActualDisbursementDate(Date actualDisbursementDate) {
|
||||||
this.actualDisbursementDate = actualDisbursementDate;
|
this.actualDisbursementDate = actualDisbursementDate;
|
||||||
}
|
}
|
||||||
@@ -121,7 +118,6 @@ public class LoanDisbursementDetails extends AbstractPersistable<Long> {
|
|||||||
return this.principal = this.approvedPrincipal;
|
return this.principal = this.approvedPrincipal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateExpectedDisbursementDate(Date expectedDisbursementDate) {
|
public void updateExpectedDisbursementDate(Date expectedDisbursementDate) {
|
||||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -23,7 +23,5 @@ public enum LoanEvent {
|
|||||||
WRITE_OFF_OUTSTANDING_UNDO, //
|
WRITE_OFF_OUTSTANDING_UNDO, //
|
||||||
LOAN_RESCHEDULE, //
|
LOAN_RESCHEDULE, //
|
||||||
INTERST_REBATE_OWED, //
|
INTERST_REBATE_OWED, //
|
||||||
LOAN_OVERPAYMENT, LOAN_CHARGE_PAYMENT,
|
LOAN_OVERPAYMENT, LOAN_CHARGE_PAYMENT, LOAN_CLOSED, LOAN_EDIT_MULTI_DISBURSE_DATE;
|
||||||
LOAN_CLOSED,
|
|
||||||
LOAN_EDIT_MULTI_DISBURSE_DATE;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-14
@@ -53,7 +53,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
@Column(name = "waived", nullable = false)
|
@Column(name = "waived", nullable = false)
|
||||||
private boolean waived = false;
|
private boolean waived = false;
|
||||||
|
|
||||||
|
|
||||||
public LoanInstallmentCharge() {
|
public LoanInstallmentCharge() {
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
@@ -75,7 +74,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
this.paid = determineIfFullyPaid();
|
this.paid = determineIfFullyPaid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Money waive(final MonetaryCurrency currency) {
|
public Money waive(final MonetaryCurrency currency) {
|
||||||
this.amountWaived = this.amountOutstanding;
|
this.amountWaived = this.amountOutstanding;
|
||||||
this.amountOutstanding = BigDecimal.ZERO;
|
this.amountOutstanding = BigDecimal.ZERO;
|
||||||
@@ -84,22 +82,17 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
return getAmountWaived(currency);
|
return getAmountWaived(currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Money getAmountWaived(final MonetaryCurrency currency) {
|
public Money getAmountWaived(final MonetaryCurrency currency) {
|
||||||
return Money.of(currency, this.amountWaived);
|
return Money.of(currency, this.amountWaived);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean determineIfFullyPaid() {
|
private boolean determineIfFullyPaid() {
|
||||||
if(this.amount == null){
|
if (this.amount == null) { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0;
|
return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal calculateOutstanding() {
|
private BigDecimal calculateOutstanding() {
|
||||||
if(this.amount == null){
|
if (this.amount == null) { return null; }
|
||||||
return null;
|
|
||||||
}
|
|
||||||
BigDecimal amountPaidLocal = BigDecimal.ZERO;
|
BigDecimal amountPaidLocal = BigDecimal.ZERO;
|
||||||
if (this.amountPaid != null) {
|
if (this.amountPaid != null) {
|
||||||
amountPaidLocal = this.amountPaid;
|
amountPaidLocal = this.amountPaid;
|
||||||
@@ -120,7 +113,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
return this.amount.subtract(totalAccountedFor);
|
return this.amount.subtract(totalAccountedFor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
public BigDecimal getAmount() {
|
||||||
return this.amount;
|
return this.amount;
|
||||||
}
|
}
|
||||||
@@ -141,7 +133,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
return getAmount(currency).minus(getAmountWaived(currency)).minus(getAmountPaid(currency)).getAmount();
|
return getAmount(currency).minus(getAmountWaived(currency)).minus(getAmountPaid(currency)).getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isPaid() {
|
public boolean isPaid() {
|
||||||
return this.paid;
|
return this.paid;
|
||||||
}
|
}
|
||||||
@@ -154,7 +145,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
return !(isPaid() || isWaived());
|
return !(isPaid() || isWaived());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LoanRepaymentScheduleInstallment getRepaymentInstallment() {
|
public LoanRepaymentScheduleInstallment getRepaymentInstallment() {
|
||||||
return this.installment;
|
return this.installment;
|
||||||
}
|
}
|
||||||
@@ -182,7 +172,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
return amountPaidOnThisCharge;
|
return amountPaidOnThisCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Money getAmountWrittenOff(final MonetaryCurrency currency) {
|
public Money getAmountWrittenOff(final MonetaryCurrency currency) {
|
||||||
return Money.of(currency, this.amountWrittenOff);
|
return Money.of(currency, this.amountWrittenOff);
|
||||||
}
|
}
|
||||||
@@ -202,7 +191,6 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
|||||||
this.waived = false;
|
this.waived = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Money getAmountThroughChargePayment(final MonetaryCurrency currency) {
|
public Money getAmountThroughChargePayment(final MonetaryCurrency currency) {
|
||||||
return Money.of(currency, this.amountThroughChargePayment);
|
return Money.of(currency, this.amountThroughChargePayment);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -52,7 +52,8 @@ public class LoanRepaymentScheduleProcessingWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Money cumulativeFeeChargesDueWithin(final LocalDate periodStart, final LocalDate periodEnd, final Set<LoanCharge> loanCharges,
|
private Money cumulativeFeeChargesDueWithin(final LocalDate periodStart, final LocalDate periodEnd, final Set<LoanCharge> loanCharges,
|
||||||
final MonetaryCurrency monetaryCurrency,LoanRepaymentScheduleInstallment period,int numberOfRepayments,final Money totalInterest) {
|
final MonetaryCurrency monetaryCurrency, LoanRepaymentScheduleInstallment period, int numberOfRepayments,
|
||||||
|
final Money totalInterest) {
|
||||||
|
|
||||||
Money cumulative = Money.zero(monetaryCurrency);
|
Money cumulative = Money.zero(monetaryCurrency);
|
||||||
|
|
||||||
@@ -74,8 +75,8 @@ public class LoanRepaymentScheduleProcessingWrapper {
|
|||||||
} else {
|
} else {
|
||||||
cumulative = cumulative.plus(loanCharge.amount().divide(BigDecimal.valueOf(numberOfRepayments)));
|
cumulative = cumulative.plus(loanCharge.amount().divide(BigDecimal.valueOf(numberOfRepayments)));
|
||||||
}
|
}
|
||||||
} else if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd) &&
|
} else if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd)
|
||||||
loanCharge.getChargeCalculation().isPercentageBased()) {
|
&& loanCharge.getChargeCalculation().isPercentageBased()) {
|
||||||
BigDecimal amount = BigDecimal.ZERO;
|
BigDecimal amount = BigDecimal.ZERO;
|
||||||
if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) {
|
if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) {
|
||||||
amount = amount.add(period.getLoan().getPrincpal().getAmount()).add(totalInterest.getAmount());
|
amount = amount.add(period.getLoan().getPrincpal().getAmount()).add(totalInterest.getAmount());
|
||||||
@@ -138,7 +139,8 @@ public class LoanRepaymentScheduleProcessingWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Money cumulativePenaltyChargesDueWithin(final LocalDate periodStart, final LocalDate periodEnd,
|
private Money cumulativePenaltyChargesDueWithin(final LocalDate periodStart, final LocalDate periodEnd,
|
||||||
final Set<LoanCharge> loanCharges, final MonetaryCurrency currency,LoanRepaymentScheduleInstallment period,int numberOfRepayments, Money totalInterest) {
|
final Set<LoanCharge> loanCharges, final MonetaryCurrency currency, LoanRepaymentScheduleInstallment period,
|
||||||
|
int numberOfRepayments, Money totalInterest) {
|
||||||
|
|
||||||
Money cumulative = Money.zero(currency);
|
Money cumulative = Money.zero(currency);
|
||||||
|
|
||||||
@@ -148,8 +150,8 @@ public class LoanRepaymentScheduleProcessingWrapper {
|
|||||||
if (loanCharge.getChargeCalculation().isPercentageBased()) {
|
if (loanCharge.getChargeCalculation().isPercentageBased()) {
|
||||||
BigDecimal amount = BigDecimal.ZERO;
|
BigDecimal amount = BigDecimal.ZERO;
|
||||||
if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) {
|
if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) {
|
||||||
amount = amount.add(period.getPrincipal(currency).getAmount())
|
amount = amount.add(period.getPrincipal(currency).getAmount()).add(
|
||||||
.add(period.getInterestCharged(currency).getAmount());
|
period.getInterestCharged(currency).getAmount());
|
||||||
} else if (loanCharge.getChargeCalculation().isPercentageOfInterest()) {
|
} else if (loanCharge.getChargeCalculation().isPercentageOfInterest()) {
|
||||||
amount = amount.add(period.getInterestCharged(currency).getAmount());
|
amount = amount.add(period.getInterestCharged(currency).getAmount());
|
||||||
} else {
|
} else {
|
||||||
@@ -160,8 +162,8 @@ public class LoanRepaymentScheduleProcessingWrapper {
|
|||||||
} else {
|
} else {
|
||||||
cumulative = cumulative.plus(loanCharge.amount().divide(BigDecimal.valueOf(numberOfRepayments)));
|
cumulative = cumulative.plus(loanCharge.amount().divide(BigDecimal.valueOf(numberOfRepayments)));
|
||||||
}
|
}
|
||||||
} else if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd) &&
|
} else if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd)
|
||||||
loanCharge.getChargeCalculation().isPercentageBased()) {
|
&& loanCharge.getChargeCalculation().isPercentageBased()) {
|
||||||
BigDecimal amount = BigDecimal.ZERO;
|
BigDecimal amount = BigDecimal.ZERO;
|
||||||
if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) {
|
if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) {
|
||||||
amount = amount.add(period.getLoan().getPrincpal().getAmount()).add(totalInterest.getAmount());
|
amount = amount.add(period.getLoan().getPrincpal().getAmount()).add(totalInterest.getAmount());
|
||||||
|
|||||||
-2
@@ -275,12 +275,10 @@ public final class LoanSummary {
|
|||||||
this.totalOutstanding = totalOutstanding.getAmount();
|
this.totalOutstanding = totalOutstanding.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getTotalPrincipalDisbursed() {
|
public BigDecimal getTotalPrincipalDisbursed() {
|
||||||
return this.totalPrincipalDisbursed;
|
return this.totalPrincipalDisbursed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getTotalPrincipalRepaid() {
|
public BigDecimal getTotalPrincipalRepaid() {
|
||||||
return this.totalPrincipalRepaid;
|
return this.totalPrincipalRepaid;
|
||||||
}
|
}
|
||||||
|
|||||||
-6
@@ -21,7 +21,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
|||||||
@Table(name = "m_loan_term_variations")
|
@Table(name = "m_loan_term_variations")
|
||||||
public class LoanTermVariations extends AbstractPersistable<Long> {
|
public class LoanTermVariations extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
@JoinColumn(name = "loan_id", nullable = false)
|
@JoinColumn(name = "loan_id", nullable = false)
|
||||||
private Loan loan;
|
private Loan loan;
|
||||||
@@ -36,7 +35,6 @@ public class LoanTermVariations extends AbstractPersistable<Long> {
|
|||||||
@Column(name = "term_value", scale = 6, precision = 19)
|
@Column(name = "term_value", scale = 6, precision = 19)
|
||||||
private BigDecimal termValue;
|
private BigDecimal termValue;
|
||||||
|
|
||||||
|
|
||||||
public LoanTermVariations(final Integer termType, final Date termApplicableFrom, final BigDecimal termValue, final Loan loan) {
|
public LoanTermVariations(final Integer termType, final Date termApplicableFrom, final BigDecimal termValue, final Loan loan) {
|
||||||
|
|
||||||
this.loan = loan;
|
this.loan = loan;
|
||||||
@@ -49,7 +47,6 @@ public class LoanTermVariations extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public LoanTermVariationType getTermType() {
|
public LoanTermVariationType getTermType() {
|
||||||
return LoanTermVariationType.fromInt(this.termType);
|
return LoanTermVariationType.fromInt(this.termType);
|
||||||
}
|
}
|
||||||
@@ -60,15 +57,12 @@ public class LoanTermVariations extends AbstractPersistable<Long> {
|
|||||||
return new LoanTermVariationsData(getId(), type, termStartDate, this.termValue);
|
return new LoanTermVariationsData(getId(), type, termStartDate, this.termValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getTermApplicableFrom() {
|
public Date getTermApplicableFrom() {
|
||||||
return this.termApplicableFrom;
|
return this.termApplicableFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getTermValue() {
|
public BigDecimal getTermValue() {
|
||||||
return this.termValue;
|
return this.termValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-7
@@ -133,22 +133,22 @@ public final class LoanTransaction extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LoanTransaction initiateTransfer(final Office office, final Loan loan, final LocalDate transferDate) {
|
public static LoanTransaction initiateTransfer(final Office office, final Loan loan, final LocalDate transferDate) {
|
||||||
return new LoanTransaction(loan, office, LoanTransactionType.INITIATE_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay().toDate(),
|
return new LoanTransaction(loan, office, LoanTransactionType.INITIATE_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay()
|
||||||
loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary()
|
.toDate(), loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary()
|
||||||
.getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary()
|
.getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary()
|
||||||
.getTotalPenaltyChargesOutstanding(), null, false, null, null);
|
.getTotalPenaltyChargesOutstanding(), null, false, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanTransaction approveTransfer(final Office office, final Loan loan, final LocalDate transferDate) {
|
public static LoanTransaction approveTransfer(final Office office, final Loan loan, final LocalDate transferDate) {
|
||||||
return new LoanTransaction(loan, office, LoanTransactionType.APPROVE_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay().toDate(),
|
return new LoanTransaction(loan, office, LoanTransactionType.APPROVE_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay()
|
||||||
loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary()
|
.toDate(), loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary()
|
||||||
.getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary()
|
.getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary()
|
||||||
.getTotalPenaltyChargesOutstanding(), null, false, null, null);
|
.getTotalPenaltyChargesOutstanding(), null, false, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanTransaction withdrawTransfer(final Office office, final Loan loan, final LocalDate transferDate) {
|
public static LoanTransaction withdrawTransfer(final Office office, final Loan loan, final LocalDate transferDate) {
|
||||||
return new LoanTransaction(loan, office, LoanTransactionType.WITHDRAW_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay().toDate(),
|
return new LoanTransaction(loan, office, LoanTransactionType.WITHDRAW_TRANSFER.getValue(), transferDate.toDateTimeAtStartOfDay()
|
||||||
loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary()
|
.toDate(), loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary()
|
||||||
.getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary()
|
.getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary()
|
||||||
.getTotalPenaltyChargesOutstanding(), null, false, null, null);
|
.getTotalPenaltyChargesOutstanding(), null, false, null, null);
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,6 @@ public final class LoanTransaction extends AbstractPersistable<Long> {
|
|||||||
return LoanTransactionType.REFUND.equals(getTypeOf()) && isNotReversed();
|
return LoanTransactionType.REFUND.equals(getTypeOf()) && isNotReversed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateExternalId(final String externalId) {
|
public void updateExternalId(final String externalId) {
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -19,19 +19,18 @@ import org.mifosplatform.portfolio.loanaccount.domain.transactionprocessor.LoanR
|
|||||||
* This {@link LoanRepaymentScheduleTransactionProcessor} defaults to having the
|
* This {@link LoanRepaymentScheduleTransactionProcessor} defaults to having the
|
||||||
* payment order of Interest first, then principal, penalties and fees.
|
* payment order of Interest first, then principal, penalties and fees.
|
||||||
*/
|
*/
|
||||||
public class EarlyPaymentLoanRepaymentScheduleTransactionProcessor extends
|
public class EarlyPaymentLoanRepaymentScheduleTransactionProcessor extends AbstractLoanRepaymentScheduleTransactionProcessor {
|
||||||
AbstractLoanRepaymentScheduleTransactionProcessor {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For early/'in advance' repayments, pay off in the same way as on-time
|
* For early/'in advance' repayments, pay off in the same way as on-time
|
||||||
* payments, interest first, principal, penalties and charges.
|
* payments, interest first, principal, penalties and charges.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
||||||
final List<LoanRepaymentScheduleInstallment> installments, final LoanTransaction loanTransaction,
|
final List<LoanRepaymentScheduleInstallment> installments, final LoanTransaction loanTransaction,
|
||||||
final LocalDate transactionDate, final Money paymentInAdvance) {
|
final LocalDate transactionDate, final Money paymentInAdvance) {
|
||||||
|
|
||||||
|
|
||||||
final MonetaryCurrency currency = paymentInAdvance.getCurrency();
|
final MonetaryCurrency currency = paymentInAdvance.getCurrency();
|
||||||
Money transactionAmountRemaining = paymentInAdvance;
|
Money transactionAmountRemaining = paymentInAdvance;
|
||||||
Money principalPortion = Money.zero(transactionAmountRemaining.getCurrency());
|
Money principalPortion = Money.zero(transactionAmountRemaining.getCurrency());
|
||||||
@@ -67,13 +66,13 @@ public class EarlyPaymentLoanRepaymentScheduleTransactionProcessor extends
|
|||||||
|
|
||||||
return transactionAmountRemaining;
|
return transactionAmountRemaining;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For late repayments, pay off in the same way as on-time payments,
|
* For late repayments, pay off in the same way as on-time payments,
|
||||||
* interest first then principal.
|
* interest first then principal.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
protected Money handleTransactionThatIsALateRepaymentOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
protected Money handleTransactionThatIsALateRepaymentOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
||||||
final List<LoanRepaymentScheduleInstallment> installments, final LoanTransaction loanTransaction,
|
final List<LoanRepaymentScheduleInstallment> installments, final LoanTransaction loanTransaction,
|
||||||
@@ -133,6 +132,4 @@ public class EarlyPaymentLoanRepaymentScheduleTransactionProcessor extends
|
|||||||
return transactionAmountRemaining;
|
return transactionAmountRemaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-1
@@ -4,7 +4,8 @@ import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRul
|
|||||||
|
|
||||||
public class MultiDisbursementDataRequiredException extends AbstractPlatformDomainRuleException {
|
public class MultiDisbursementDataRequiredException extends AbstractPlatformDomainRuleException {
|
||||||
|
|
||||||
public MultiDisbursementDataRequiredException(final String entity, final String defaultUserMessage, final Object... defaultUserMessageArgs) {
|
public MultiDisbursementDataRequiredException(final String entity, final String defaultUserMessage,
|
||||||
|
final Object... defaultUserMessageArgs) {
|
||||||
super("error.msg." + entity + ".required", defaultUserMessage, defaultUserMessageArgs);
|
super("error.msg." + entity + ".required", defaultUserMessage, defaultUserMessageArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -76,7 +76,6 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
final LocalDate idealDisbursementDate = this.scheduledDateGenerator.idealDisbursementDateBasedOnFirstRepaymentDate(
|
final LocalDate idealDisbursementDate = this.scheduledDateGenerator.idealDisbursementDateBasedOnFirstRepaymentDate(
|
||||||
loanApplicationTerms.getLoanTermPeriodFrequencyType(), loanApplicationTerms.getRepaymentEvery(), firstRepaymentdate);
|
loanApplicationTerms.getLoanTermPeriodFrequencyType(), loanApplicationTerms.getRepaymentEvery(), firstRepaymentdate);
|
||||||
|
|
||||||
|
|
||||||
LocalDate periodStartDateApplicableForInterest = periodStartDate;
|
LocalDate periodStartDateApplicableForInterest = periodStartDate;
|
||||||
|
|
||||||
int periodNumber = 1;
|
int periodNumber = 1;
|
||||||
@@ -97,15 +96,16 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
final int daysInPeriod = Days.daysBetween(periodStartDate, scheduledDueDate).getDays();
|
final int daysInPeriod = Days.daysBetween(periodStartDate, scheduledDueDate).getDays();
|
||||||
if (loanApplicationTerms.isMultiDisburseLoan()) {
|
if (loanApplicationTerms.isMultiDisburseLoan()) {
|
||||||
loanApplicationTerms.setFixedEmiAmountForPeriod(scheduledDueDate);
|
loanApplicationTerms.setFixedEmiAmountForPeriod(scheduledDueDate);
|
||||||
BigDecimal disburseAmt = disbursementForPeriod(loanApplicationTerms, periodStartDate, scheduledDueDate, periods,BigDecimal.ZERO);
|
BigDecimal disburseAmt = disbursementForPeriod(loanApplicationTerms, periodStartDate, scheduledDueDate, periods,
|
||||||
|
BigDecimal.ZERO);
|
||||||
principalDisbursed = principalDisbursed.plus(disburseAmt);
|
principalDisbursed = principalDisbursed.plus(disburseAmt);
|
||||||
loanApplicationTerms.setPrincipal(loanApplicationTerms.getPrincipal().plus(disburseAmt));
|
loanApplicationTerms.setPrincipal(loanApplicationTerms.getPrincipal().plus(disburseAmt));
|
||||||
outstandingBalance = outstandingBalance.plus(disburseAmt);
|
outstandingBalance = outstandingBalance.plus(disburseAmt);
|
||||||
if(loanApplicationTerms.getMaxOutstandingBalance() != null &&
|
if (loanApplicationTerms.getMaxOutstandingBalance() != null
|
||||||
outstandingBalance.isGreaterThan(loanApplicationTerms.getMaxOutstandingBalance())){
|
&& outstandingBalance.isGreaterThan(loanApplicationTerms.getMaxOutstandingBalance())) {
|
||||||
String errorMsg = "Outstanding balance must not exceed the amount: " + loanApplicationTerms.getMaxOutstandingBalance();
|
String errorMsg = "Outstanding balance must not exceed the amount: " + loanApplicationTerms.getMaxOutstandingBalance();
|
||||||
throw new MultiDisbursementOutstandingAmoutException(errorMsg,
|
throw new MultiDisbursementOutstandingAmoutException(errorMsg, loanApplicationTerms.getMaxOutstandingBalance()
|
||||||
loanApplicationTerms.getMaxOutstandingBalance().getAmount(),disburseAmt);
|
.getAmount(), disburseAmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int daysInPeriodApplicableForInterest = daysInPeriod;
|
int daysInPeriodApplicableForInterest = daysInPeriod;
|
||||||
@@ -150,8 +150,8 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
// 7. determine fees and penalties
|
// 7. determine fees and penalties
|
||||||
feeChargesForInstallment = cumulativeFeeChargesDueWithin(periodStartDate, scheduledDueDate, loanCharges, currency,
|
feeChargesForInstallment = cumulativeFeeChargesDueWithin(periodStartDate, scheduledDueDate, loanCharges, currency,
|
||||||
principalInterestForThisPeriod, principalDisbursed, totalInterestChargedForFullLoanTerm, numberOfRepayments);
|
principalInterestForThisPeriod, principalDisbursed, totalInterestChargedForFullLoanTerm, numberOfRepayments);
|
||||||
penaltyChargesForInstallment = cumulativePenaltyChargesDueWithin(periodStartDate, scheduledDueDate, loanCharges,
|
penaltyChargesForInstallment = cumulativePenaltyChargesDueWithin(periodStartDate, scheduledDueDate, loanCharges, currency,
|
||||||
currency, principalInterestForThisPeriod, principalDisbursed, totalInterestChargedForFullLoanTerm, numberOfRepayments);
|
principalInterestForThisPeriod, principalDisbursed, totalInterestChargedForFullLoanTerm, numberOfRepayments);
|
||||||
}
|
}
|
||||||
// 8. sum up real totalInstallmentDue from components
|
// 8. sum up real totalInstallmentDue from components
|
||||||
final Money totalInstallmentDue = principalInterestForThisPeriod.principal() //
|
final Money totalInstallmentDue = principalInterestForThisPeriod.principal() //
|
||||||
@@ -183,8 +183,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
throw new MultiDisbursementDisbursementDateException(errorMsg);
|
throw new MultiDisbursementDisbursementDateException(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loanApplicationTerms.isMultiDisburseLoan() && loanApplicationTerms.getFixedEmiAmount()!=null
|
if (loanApplicationTerms.isMultiDisburseLoan() && loanApplicationTerms.getFixedEmiAmount() != null && !loanCharges.isEmpty()) {
|
||||||
&& !loanCharges.isEmpty()){
|
|
||||||
// 7. determine fees and penalties
|
// 7. determine fees and penalties
|
||||||
for (LoanScheduleModelPeriod loanScheduleModelPeriod : periods) {
|
for (LoanScheduleModelPeriod loanScheduleModelPeriod : periods) {
|
||||||
if (loanScheduleModelPeriod.isRepaymentPeriod()) {
|
if (loanScheduleModelPeriod.isRepaymentPeriod()) {
|
||||||
@@ -194,8 +193,8 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
loanScheduleModelPeriod.periodDueDate(), loanCharges, currency, principalInterest, principalDisbursed,
|
loanScheduleModelPeriod.periodDueDate(), loanCharges, currency, principalInterest, principalDisbursed,
|
||||||
totalCumulativeInterest, numberOfRepayments);
|
totalCumulativeInterest, numberOfRepayments);
|
||||||
Money penaltyChargesForInstallment = cumulativePenaltyChargesDueWithin(loanScheduleModelPeriod.periodFromDate(),
|
Money penaltyChargesForInstallment = cumulativePenaltyChargesDueWithin(loanScheduleModelPeriod.periodFromDate(),
|
||||||
loanScheduleModelPeriod.periodDueDate(), loanCharges, currency, principalInterest, principalDisbursed, totalCumulativeInterest,
|
loanScheduleModelPeriod.periodDueDate(), loanCharges, currency, principalInterest, principalDisbursed,
|
||||||
numberOfRepayments);
|
totalCumulativeInterest, numberOfRepayments);
|
||||||
totalFeeChargesCharged = totalFeeChargesCharged.add(feeChargesForInstallment.getAmount());
|
totalFeeChargesCharged = totalFeeChargesCharged.add(feeChargesForInstallment.getAmount());
|
||||||
totalPenaltyChargesCharged = totalPenaltyChargesCharged.add(penaltyChargesForInstallment.getAmount());
|
totalPenaltyChargesCharged = totalPenaltyChargesCharged.add(penaltyChargesForInstallment.getAmount());
|
||||||
loanScheduleModelPeriod.addLoanCharges(feeChargesForInstallment.getAmount(), penaltyChargesForInstallment.getAmount());
|
loanScheduleModelPeriod.addLoanCharges(feeChargesForInstallment.getAmount(), penaltyChargesForInstallment.getAmount());
|
||||||
|
|||||||
+3
-6
@@ -31,7 +31,6 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
|||||||
return lastRepaymentDate;
|
return lastRepaymentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDate generateNextRepaymentDate(final LocalDate lastRepaymentDate, final LoanApplicationTerms loanApplicationTerms) {
|
public LocalDate generateNextRepaymentDate(final LocalDate lastRepaymentDate, final LoanApplicationTerms loanApplicationTerms) {
|
||||||
final LocalDate firstRepaymentPeriodDate = loanApplicationTerms.getCalculatedRepaymentsStartingFromLocalDate();
|
final LocalDate firstRepaymentPeriodDate = loanApplicationTerms.getCalculatedRepaymentsStartingFromLocalDate();
|
||||||
@@ -45,19 +44,17 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDate adjustRepaymentDate(final LocalDate dueRepaymentPeriodDate,final LoanApplicationTerms loanApplicationTerms,final boolean isHolidayEnabled,
|
public LocalDate adjustRepaymentDate(final LocalDate dueRepaymentPeriodDate, final LoanApplicationTerms loanApplicationTerms,
|
||||||
final List<Holiday> holidays, final WorkingDays workingDays){
|
final boolean isHolidayEnabled, final List<Holiday> holidays, final WorkingDays workingDays) {
|
||||||
LocalDate adjustedDate = dueRepaymentPeriodDate;
|
LocalDate adjustedDate = dueRepaymentPeriodDate;
|
||||||
final LocalDate nextDueRepaymentPeriodDate = getRepaymentPeriodDate(loanApplicationTerms, adjustedDate);
|
final LocalDate nextDueRepaymentPeriodDate = getRepaymentPeriodDate(loanApplicationTerms, adjustedDate);
|
||||||
adjustedDate = WorkingDaysUtil.getOffSetDateIfNonWorkingDay(adjustedDate, nextDueRepaymentPeriodDate,
|
adjustedDate = WorkingDaysUtil.getOffSetDateIfNonWorkingDay(adjustedDate, nextDueRepaymentPeriodDate, workingDays);
|
||||||
workingDays);
|
|
||||||
if (isHolidayEnabled) {
|
if (isHolidayEnabled) {
|
||||||
adjustedDate = HolidayUtil.getRepaymentRescheduleDateToIfHoliday(adjustedDate, holidays);
|
adjustedDate = HolidayUtil.getRepaymentRescheduleDateToIfHoliday(adjustedDate, holidays);
|
||||||
}
|
}
|
||||||
return adjustedDate;
|
return adjustedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private LocalDate getRepaymentPeriodDate(final LoanApplicationTerms loanApplicationTerms, final LocalDate startDate) {
|
private LocalDate getRepaymentPeriodDate(final LoanApplicationTerms loanApplicationTerms, final LocalDate startDate) {
|
||||||
final int repaidEvery = loanApplicationTerms.getRepaymentEvery();
|
final int repaidEvery = loanApplicationTerms.getRepaymentEvery();
|
||||||
LocalDate dueRepaymentPeriodDate = startDate;
|
LocalDate dueRepaymentPeriodDate = startDate;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user