add support for charges when create new or modifying loan aplication on the GET of data.
This commit is contained in:
@@ -137,14 +137,19 @@ public class LoansApiResource {
|
|||||||
Collection<FundData> fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
Collection<FundData> fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
||||||
Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions = this.dropdownReadPlatformService.retreiveTransactionProcessingStrategies();
|
Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions = this.dropdownReadPlatformService.retreiveTransactionProcessingStrategies();
|
||||||
|
|
||||||
LoanBasicDetailsData loanBasicDetails = this.loanReadPlatformService.retrieveClientAndProductDetails(clientId, productId);
|
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges();
|
||||||
|
|
||||||
|
LoanBasicDetailsData loanBasicDetails = this.loanReadPlatformService.retrieveClientAndProductDetails(clientId, productId);
|
||||||
|
if (loanBasicDetails.getCharges() != null) {
|
||||||
|
chargeOptions.removeAll(loanBasicDetails.getCharges());
|
||||||
|
}
|
||||||
|
|
||||||
final boolean convenienceDataRequired = false;
|
final boolean convenienceDataRequired = false;
|
||||||
Collection<ChargeData> charges = null;
|
Collection<ChargeData> charges = loanBasicDetails.getCharges();
|
||||||
final LoanAccountData newLoanAccount = new LoanAccountData(loanBasicDetails, convenienceDataRequired, null, null, null, null, charges,
|
final LoanAccountData newLoanAccount = new LoanAccountData(loanBasicDetails, convenienceDataRequired, null, null, null, null, charges,
|
||||||
productOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
productOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
||||||
transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
|
transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
|
||||||
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions);
|
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions);
|
||||||
|
|
||||||
return this.apiJsonSerializerService.serialzieLoanAccountDataToJson(prettyPrint, responseParameters, newLoanAccount);
|
return this.apiJsonSerializerService.serialzieLoanAccountDataToJson(prettyPrint, responseParameters, newLoanAccount);
|
||||||
}
|
}
|
||||||
@@ -213,6 +218,7 @@ public class LoansApiResource {
|
|||||||
Collection<EnumOptionData> interestTypeOptions = new ArrayList<EnumOptionData>();
|
Collection<EnumOptionData> interestTypeOptions = new ArrayList<EnumOptionData>();
|
||||||
Collection<EnumOptionData> interestCalculationPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
Collection<EnumOptionData> interestCalculationPeriodTypeOptions = new ArrayList<EnumOptionData>();
|
||||||
Collection<FundData> fundOptions = new ArrayList<FundData>();
|
Collection<FundData> fundOptions = new ArrayList<FundData>();
|
||||||
|
Collection<ChargeData> chargeOptions = null;
|
||||||
|
|
||||||
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
||||||
if(template) {
|
if(template) {
|
||||||
@@ -230,12 +236,16 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
||||||
transactionProcessingStrategyOptions = this.dropdownReadPlatformService.retreiveTransactionProcessingStrategies();
|
transactionProcessingStrategyOptions = this.dropdownReadPlatformService.retreiveTransactionProcessingStrategies();
|
||||||
|
chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges();
|
||||||
|
if (charges != null) {
|
||||||
|
chargeOptions.removeAll(charges);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, convenienceDataRequired, summary, repaymentSchedule, loanRepayments, permissions, charges,
|
final LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, convenienceDataRequired, summary, repaymentSchedule, loanRepayments, permissions, charges,
|
||||||
productOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
productOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
||||||
transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
|
transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
|
||||||
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions);
|
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions);
|
||||||
|
|
||||||
return this.apiJsonSerializerService.serialzieLoanAccountDataToJson(prettyPrint, responseParameters, loanAccount);
|
return this.apiJsonSerializerService.serialzieLoanAccountDataToJson(prettyPrint, responseParameters, loanAccount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ public class LoanAccountData {
|
|||||||
private final EnumOptionData interestType;
|
private final EnumOptionData interestType;
|
||||||
private final EnumOptionData interestCalculationPeriodType;
|
private final EnumOptionData interestCalculationPeriodType;
|
||||||
|
|
||||||
private Collection<ChargeData> charges;
|
|
||||||
|
|
||||||
private final LocalDate submittedOnDate;
|
private final LocalDate submittedOnDate;
|
||||||
private final LocalDate approvedOnDate;
|
private final LocalDate approvedOnDate;
|
||||||
private final LocalDate expectedDisbursementDate;
|
private final LocalDate expectedDisbursementDate;
|
||||||
@@ -49,6 +47,14 @@ public class LoanAccountData {
|
|||||||
private final LocalDate expectedMaturityDate;
|
private final LocalDate expectedMaturityDate;
|
||||||
private final LocalDate lifeCycleStatusDate;
|
private final LocalDate lifeCycleStatusDate;
|
||||||
|
|
||||||
|
// associations
|
||||||
|
private final LoanAccountSummaryData summary;
|
||||||
|
private final Collection<LoanRepaymentPeriodData> repaymentSchedule;
|
||||||
|
private final Collection<LoanRepaymentTransactionData> loanRepayments;
|
||||||
|
private final Collection<ChargeData> charges;
|
||||||
|
private final LoanPermissionData permissions;
|
||||||
|
private final LoanConvenienceData convenienceData;
|
||||||
|
|
||||||
// template
|
// template
|
||||||
private final Collection<LoanProductLookup> productOptions;
|
private final Collection<LoanProductLookup> productOptions;
|
||||||
private final Collection<EnumOptionData> termFrequencyTypeOptions;
|
private final Collection<EnumOptionData> termFrequencyTypeOptions;
|
||||||
@@ -59,14 +65,7 @@ public class LoanAccountData {
|
|||||||
private final Collection<EnumOptionData> interestTypeOptions;
|
private final Collection<EnumOptionData> interestTypeOptions;
|
||||||
private final Collection<EnumOptionData> interestCalculationPeriodTypeOptions;
|
private final Collection<EnumOptionData> interestCalculationPeriodTypeOptions;
|
||||||
private final Collection<FundData> fundOptions;
|
private final Collection<FundData> fundOptions;
|
||||||
|
private final Collection<ChargeData> chargeOptions;
|
||||||
// associations
|
|
||||||
private final LoanAccountSummaryData summary;
|
|
||||||
private final Collection<LoanRepaymentPeriodData> repaymentSchedule;
|
|
||||||
private final Collection<LoanRepaymentTransactionData> loanRepayments;
|
|
||||||
|
|
||||||
private final LoanPermissionData permissions;
|
|
||||||
private final LoanConvenienceData convenienceData;
|
|
||||||
|
|
||||||
public LoanAccountData(
|
public LoanAccountData(
|
||||||
final LoanBasicDetailsData basicDetails,
|
final LoanBasicDetailsData basicDetails,
|
||||||
@@ -84,7 +83,8 @@ public class LoanAccountData {
|
|||||||
final Collection<EnumOptionData> amortizationTypeOptions,
|
final Collection<EnumOptionData> amortizationTypeOptions,
|
||||||
final Collection<EnumOptionData> interestTypeOptions,
|
final Collection<EnumOptionData> interestTypeOptions,
|
||||||
final Collection<EnumOptionData> interestCalculationPeriodTypeOptions,
|
final Collection<EnumOptionData> interestCalculationPeriodTypeOptions,
|
||||||
final Collection<FundData> fundOptions) {
|
final Collection<FundData> fundOptions,
|
||||||
|
final Collection<ChargeData> chargeOptions) {
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
this.repaymentSchedule = repaymentSchedule;
|
this.repaymentSchedule = repaymentSchedule;
|
||||||
this.loanRepayments = loanRepayments;
|
this.loanRepayments = loanRepayments;
|
||||||
@@ -99,6 +99,7 @@ public class LoanAccountData {
|
|||||||
this.interestTypeOptions = interestTypeOptions;
|
this.interestTypeOptions = interestTypeOptions;
|
||||||
this.interestCalculationPeriodTypeOptions = interestCalculationPeriodTypeOptions;
|
this.interestCalculationPeriodTypeOptions = interestCalculationPeriodTypeOptions;
|
||||||
this.fundOptions = fundOptions;
|
this.fundOptions = fundOptions;
|
||||||
|
this.chargeOptions = chargeOptions;
|
||||||
|
|
||||||
if (convenienceDataRequired) {
|
if (convenienceDataRequired) {
|
||||||
int maxSubmittedOnOffsetFromToday = basicDetails
|
int maxSubmittedOnOffsetFromToday = basicDetails
|
||||||
@@ -324,10 +325,6 @@ public class LoanAccountData {
|
|||||||
return this.charges;
|
return this.charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCharges(Collection<ChargeData> charges) {
|
|
||||||
this.charges = charges;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<LoanProductLookup> getProductOptions() {
|
public Collection<LoanProductLookup> getProductOptions() {
|
||||||
return productOptions;
|
return productOptions;
|
||||||
}
|
}
|
||||||
@@ -363,4 +360,8 @@ public class LoanAccountData {
|
|||||||
public Collection<FundData> getFundOptions() {
|
public Collection<FundData> getFundOptions() {
|
||||||
return fundOptions;
|
return fundOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<ChargeData> getChargeOptions() {
|
||||||
|
return chargeOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+16
-3
@@ -1,6 +1,7 @@
|
|||||||
package org.mifosng.platform.api.data;
|
package org.mifosng.platform.api.data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Days;
|
import org.joda.time.Days;
|
||||||
@@ -49,6 +50,8 @@ public class LoanBasicDetailsData {
|
|||||||
private final LocalDate expectedMaturityDate;
|
private final LocalDate expectedMaturityDate;
|
||||||
private final LocalDate lifeCycleStatusDate;
|
private final LocalDate lifeCycleStatusDate;
|
||||||
|
|
||||||
|
private final Collection<ChargeData> charges;
|
||||||
|
|
||||||
public static LoanBasicDetailsData populateForNewLoanCreation(final Long clientId, final String clientName, final LocalDate expectedDisbursementDate) {
|
public static LoanBasicDetailsData populateForNewLoanCreation(final Long clientId, final String clientName, final LocalDate expectedDisbursementDate) {
|
||||||
return new LoanBasicDetailsData(clientId, clientName, expectedDisbursementDate);
|
return new LoanBasicDetailsData(clientId, clientName, expectedDisbursementDate);
|
||||||
}
|
}
|
||||||
@@ -64,7 +67,7 @@ public class LoanBasicDetailsData {
|
|||||||
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(), product.getRepaymentFrequencyType(),
|
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(), product.getRepaymentFrequencyType(),
|
||||||
product.getTransactionProcessingStrategyId(), product.getAmortizationType(),
|
product.getTransactionProcessingStrategyId(), product.getAmortizationType(),
|
||||||
product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(), product.getInterestType(), product.getInterestCalculationPeriodType(),
|
product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(), product.getInterestType(), product.getInterestCalculationPeriodType(),
|
||||||
loanAccount.expectedDisbursementDate);
|
loanAccount.expectedDisbursementDate, product.getCharges());
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoanBasicDetailsData(
|
private LoanBasicDetailsData(
|
||||||
@@ -82,7 +85,7 @@ public class LoanBasicDetailsData {
|
|||||||
final EnumOptionData interestRateFrequencyType,
|
final EnumOptionData interestRateFrequencyType,
|
||||||
final EnumOptionData interestType,
|
final EnumOptionData interestType,
|
||||||
final EnumOptionData interestCalculationPeriodType,
|
final EnumOptionData interestCalculationPeriodType,
|
||||||
final LocalDate expectedDisbursementDate) {
|
final LocalDate expectedDisbursementDate, final Collection<ChargeData> charges) {
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.externalId = null;
|
this.externalId = null;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
@@ -127,6 +130,8 @@ public class LoanBasicDetailsData {
|
|||||||
this.repaymentsStartingFromDate = null;
|
this.repaymentsStartingFromDate = null;
|
||||||
this.interestChargedFromDate = null;
|
this.interestChargedFromDate = null;
|
||||||
this.lifeCycleStatusDate = null;
|
this.lifeCycleStatusDate = null;
|
||||||
|
|
||||||
|
this.charges = charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoanBasicDetailsData(final Long clientId, final String clientName, final LocalDate expectedDisbursementDate) {
|
private LoanBasicDetailsData(final Long clientId, final String clientName, final LocalDate expectedDisbursementDate) {
|
||||||
@@ -168,6 +173,8 @@ public class LoanBasicDetailsData {
|
|||||||
this.expectedMaturityDate = null;
|
this.expectedMaturityDate = null;
|
||||||
this.repaymentsStartingFromDate = null;
|
this.repaymentsStartingFromDate = null;
|
||||||
this.interestChargedFromDate = null;
|
this.interestChargedFromDate = null;
|
||||||
|
|
||||||
|
this.charges = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanBasicDetailsData(
|
public LoanBasicDetailsData(
|
||||||
@@ -202,7 +209,8 @@ public class LoanBasicDetailsData {
|
|||||||
final LocalDate lifeCycleStatusDate,
|
final LocalDate lifeCycleStatusDate,
|
||||||
final Integer termFrequency,
|
final Integer termFrequency,
|
||||||
final EnumOptionData termPeriodFrequencyType,
|
final EnumOptionData termPeriodFrequencyType,
|
||||||
final Integer transactionStrategyId) {
|
final Integer transactionStrategyId,
|
||||||
|
final Collection<ChargeData> charges) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
@@ -237,6 +245,7 @@ public class LoanBasicDetailsData {
|
|||||||
this.termFrequency = termFrequency;
|
this.termFrequency = termFrequency;
|
||||||
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
||||||
this.transactionStrategyId = transactionStrategyId;
|
this.transactionStrategyId = transactionStrategyId;
|
||||||
|
this.charges = charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxSubmittedOnOffsetFromToday() {
|
public int getMaxSubmittedOnOffsetFromToday() {
|
||||||
@@ -463,4 +472,8 @@ public class LoanBasicDetailsData {
|
|||||||
public Integer getTransactionStrategyId() {
|
public Integer getTransactionStrategyId() {
|
||||||
return transactionStrategyId;
|
return transactionStrategyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<ChargeData> getCharges() {
|
||||||
|
return charges;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+3
-1
@@ -6,6 +6,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
|
import org.mifosng.platform.api.data.ChargeData;
|
||||||
import org.mifosng.platform.api.data.ClientData;
|
import org.mifosng.platform.api.data.ClientData;
|
||||||
import org.mifosng.platform.api.data.CurrencyData;
|
import org.mifosng.platform.api.data.CurrencyData;
|
||||||
import org.mifosng.platform.api.data.EnumOptionData;
|
import org.mifosng.platform.api.data.EnumOptionData;
|
||||||
@@ -469,6 +470,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
lifeCycleStatusDate = closedOnDate;
|
lifeCycleStatusDate = closedOnDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collection<ChargeData> charges = null;
|
||||||
return new LoanBasicDetailsData(id, externalId, clientId, clientName,
|
return new LoanBasicDetailsData(id, externalId, clientId, clientName,
|
||||||
loanProductId, loanProductName, loanProductDescription,
|
loanProductId, loanProductName, loanProductDescription,
|
||||||
fundId, fundName,
|
fundId, fundName,
|
||||||
@@ -483,7 +485,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
amortizationType, interestType,
|
amortizationType, interestType,
|
||||||
interestCalculationPeriodType,
|
interestCalculationPeriodType,
|
||||||
status,
|
status,
|
||||||
lifeCycleStatusDate, termFrequency, termPeriodFrequencyType, transactionStrategyId);
|
lifeCycleStatusDate, termFrequency, termPeriodFrequencyType, transactionStrategyId, charges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user