MIFOSX-32: continue WIP on abilit to modify loan application.

This commit is contained in:
Keith Woodlock
2012-09-05 23:19:08 +01:00
parent 6b2ec54a31
commit 29e36a0797
10 changed files with 325 additions and 176 deletions
@@ -1,8 +1,10 @@
package org.mifosng.platform.api; package org.mifosng.platform.api;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@@ -26,24 +28,33 @@ import org.mifosng.platform.api.commands.LoanTransactionCommand;
import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand; import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand;
import org.mifosng.platform.api.commands.UndoStateTransitionCommand; import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
import org.mifosng.platform.api.data.ChargeData; import org.mifosng.platform.api.data.ChargeData;
import org.mifosng.platform.api.data.CurrencyData;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.data.FundData;
import org.mifosng.platform.api.data.LoanAccountData; import org.mifosng.platform.api.data.LoanAccountData;
import org.mifosng.platform.api.data.LoanAccountSummaryData; import org.mifosng.platform.api.data.LoanAccountSummaryData;
import org.mifosng.platform.api.data.LoanBasicDetailsData; import org.mifosng.platform.api.data.LoanBasicDetailsData;
import org.mifosng.platform.api.data.LoanPermissionData; import org.mifosng.platform.api.data.LoanPermissionData;
import org.mifosng.platform.api.data.LoanProductLookup;
import org.mifosng.platform.api.data.LoanRepaymentPeriodData; import org.mifosng.platform.api.data.LoanRepaymentPeriodData;
import org.mifosng.platform.api.data.LoanRepaymentTransactionData; import org.mifosng.platform.api.data.LoanRepaymentTransactionData;
import org.mifosng.platform.api.data.LoanSchedule; import org.mifosng.platform.api.data.LoanSchedule;
import org.mifosng.platform.api.data.LoanTransactionData; import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.NewLoanData; import org.mifosng.platform.api.data.NewLoanData;
import org.mifosng.platform.api.data.TransactionProcessingStrategyData;
import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.ApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.api.infrastructure.ApiParameterHelper;
import org.mifosng.platform.charge.service.ChargeReadPlatformService; import org.mifosng.platform.charge.service.ChargeReadPlatformService;
import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
import org.mifosng.platform.exceptions.UnrecognizedQueryParamException; import org.mifosng.platform.exceptions.UnrecognizedQueryParamException;
import org.mifosng.platform.fund.service.FundReadPlatformService;
import org.mifosng.platform.loan.service.CalculationPlatformService; import org.mifosng.platform.loan.service.CalculationPlatformService;
import org.mifosng.platform.loan.service.LoanReadPlatformService; import org.mifosng.platform.loan.service.LoanReadPlatformService;
import org.mifosng.platform.loan.service.LoanWritePlatformService; import org.mifosng.platform.loan.service.LoanWritePlatformService;
import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService;
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -58,7 +69,16 @@ public class LoansApiResource {
@Autowired @Autowired
private LoanWritePlatformService loanWritePlatformService; private LoanWritePlatformService loanWritePlatformService;
@Autowired
private LoanProductReadPlatformService loanProductReadPlatformService;
@Autowired
private LoanDropdownReadPlatformService dropdownReadPlatformService;
@Autowired
private FundReadPlatformService fundReadPlatformService;
@Autowired @Autowired
private ChargeReadPlatformService chargeReadPlatformService; private ChargeReadPlatformService chargeReadPlatformService;
@@ -70,7 +90,7 @@ public class LoansApiResource {
@Autowired @Autowired
private ApiJsonSerializerService apiJsonSerializerService; private ApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Path("template") @Path("template")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -110,7 +130,7 @@ public class LoansApiResource {
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType", "repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
"submittedOnDate", "approvedOnDate", "expectedDisbursementDate", "actualDisbursementDate", "submittedOnDate", "approvedOnDate", "expectedDisbursementDate", "actualDisbursementDate",
"expectedFirstRepaymentOnDate", "interestChargedFromDate", "closedOnDate", "expectedMaturityDate", "expectedFirstRepaymentOnDate", "interestChargedFromDate", "closedOnDate", "expectedMaturityDate",
"lifeCycleStatusId", "lifeCycleStatusText", "lifeCycleStatusDate") "status", "lifeCycleStatusDate")
); );
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
@@ -138,15 +158,47 @@ public class LoansApiResource {
loanRepayments = this.loanReadPlatformService.retrieveLoanPayments(loanId); loanRepayments = this.loanReadPlatformService.retrieveLoanPayments(loanId);
repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId); repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(loanId);
summary = this.loanReadPlatformService.retrieveSummary(loanBasicDetails.getPrincipal(), repaymentSchedule, loanRepayments); summary = this.loanReadPlatformService.retrieveSummary(loanBasicDetails.getCurrency(), repaymentSchedule, loanRepayments);
boolean isWaiveAllowed = summary.isWaiveAllowed(loanBasicDetails.getInArrearsTolerance()); boolean isWaiveAllowed = summary.isWaiveAllowed(loanBasicDetails.getCurrency(), loanBasicDetails.getInArrearsTolerance());
permissions = this.loanReadPlatformService.retrieveLoanPermissions(loanBasicDetails, isWaiveAllowed, loanRepayments.size()); permissions = this.loanReadPlatformService.retrieveLoanPermissions(loanBasicDetails, isWaiveAllowed, loanRepayments.size());
charges = this.chargeReadPlatformService.retrieveLoanCharges(loanId); charges = this.chargeReadPlatformService.retrieveLoanCharges(loanId);
} }
LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, summary, repaymentSchedule, loanRepayments, permissions, charges); Collection<LoanProductLookup> productOptions = new ArrayList<LoanProductLookup>();
List<EnumOptionData> loanTermFrequencyTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> repaymentFrequencyTypeOptions = new ArrayList<EnumOptionData>();
Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions = new ArrayList<TransactionProcessingStrategyData>();
List<EnumOptionData> interestRateFrequencyTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> amortizationTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> interestTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> interestCalculationPeriodTypeOptions = new ArrayList<EnumOptionData>();
Collection<FundData> fundOptions = new ArrayList<FundData>();
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if(template) {
responseParameters.addAll(Arrays.asList("productOptions", "amortizationTypeOptions", "interestTypeOptions", "interestCalculationPeriodTypeOptions",
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "transactionProcessingStrategyOptions", "chargeOptions"));
productOptions = this.loanProductReadPlatformService.retrieveAllLoanProductsForLookup();
loanTermFrequencyTypeOptions = dropdownReadPlatformService.retrieveLoanTermFrequencyTypeOptions();
repaymentFrequencyTypeOptions = dropdownReadPlatformService.retrieveRepaymentFrequencyTypeOptions();
interestRateFrequencyTypeOptions = dropdownReadPlatformService.retrieveInterestRateFrequencyTypeOptions();
amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
interestTypeOptions = dropdownReadPlatformService.retrieveLoanInterestTypeOptions();
interestCalculationPeriodTypeOptions = dropdownReadPlatformService.retrieveLoanInterestRateCalculatedInPeriodOptions();
fundOptions = this.fundReadPlatformService.retrieveAllFunds();
transactionProcessingStrategyOptions = this.dropdownReadPlatformService.retreiveTransactionProcessingStrategies();
}
LoanAccountData loanAccount = new LoanAccountData(loanBasicDetails, summary, repaymentSchedule, loanRepayments, permissions, charges,
productOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
transactionProcessingStrategyOptions, interestRateFrequencyTypeOptions,
fundOptions);
return this.apiJsonSerializerService.serialzieLoanAccountDataToJson(prettyPrint, responseParameters, loanAccount); return this.apiJsonSerializerService.serialzieLoanAccountDataToJson(prettyPrint, responseParameters, loanAccount);
} }
@@ -1,16 +1,10 @@
package org.mifosng.platform.api.data; package org.mifosng.platform.api.data;
import java.io.Serializable; public class EnumOptionData {
public class EnumOptionData implements Serializable { private final Long id;
private final String code;
private Long id; private final String value;
private String code;
private String value;
protected EnumOptionData() {
//
}
public EnumOptionData(final Long id, final String code, final String value) { public EnumOptionData(final Long id, final String code, final String value) {
this.id = id; this.id = id;
@@ -19,26 +13,14 @@ public class EnumOptionData implements Serializable {
} }
public Long getId() { public Long getId() {
return this.id; return id;
}
public void setId(final Long id) {
this.id = id;
}
public String getValue() {
return this.value;
}
public void setValue(final String value) {
this.value = value;
} }
public String getCode() { public String getCode() {
return code; return code;
} }
public void setCode(String code) { public String getValue() {
this.code = code; return value;
} }
} }
@@ -2,6 +2,7 @@ package org.mifosng.platform.api.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@@ -17,45 +18,54 @@ public class LoanAccountData {
private final Long loanProductId; private final Long loanProductId;
private final String loanProductName; private final String loanProductName;
private final String loanProductDescription; private final String loanProductDescription;
private final Integer lifeCycleStatusId; private final EnumOptionData status;
private final String lifeCycleStatusText;
private final LocalDate lifeCycleStatusDate;
private final Long fundId; private final Long fundId;
private final String fundName; private final String fundName;
private final CurrencyData currency;
private final BigDecimal principal;
private final BigDecimal inArrearsTolerance;
private final Integer termFrequency;
private final EnumOptionData termPeriodFrequencyType;
private final Integer numberOfRepayments;
private final Integer repaymentEvery;
private final EnumOptionData repaymentFrequencyType;
private final Integer transactionStrategyId;
private final EnumOptionData amortizationType;
private final BigDecimal interestRatePerPeriod;
private final EnumOptionData interestRateFrequencyType;
private final BigDecimal annualInterestRate;
private final EnumOptionData interestType;
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;
private final LocalDate actualDisbursementDate; private final LocalDate actualDisbursementDate;
private final LocalDate expectedFirstRepaymentOnDate; private final LocalDate repaymentsStartingFromDate;
private final LocalDate interestChargedFromDate; private final LocalDate interestChargedFromDate;
private final LocalDate closedOnDate; private final LocalDate closedOnDate;
private final LocalDate expectedMaturityDate; private final LocalDate expectedMaturityDate;
private final LocalDate lifeCycleStatusDate;
private final CurrencyData currency;
private final MoneyData principal; // template
private final MoneyData inArrearsTolerance; private final Collection<LoanProductLookup> productOptions;
private final List<EnumOptionData> termFrequencyTypeOptions;
private final Integer numberOfRepayments; private final List<EnumOptionData> repaymentFrequencyTypeOptions;
private final Integer repaymentEvery; private final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions;
private final BigDecimal interestRatePerPeriod; private final Collection<FundData> fundOptions;
private final BigDecimal annualInterestRate;
// associations
private final EnumOptionData repaymentFrequencyType;
private final EnumOptionData interestRateFrequencyType;
private final EnumOptionData amortizationType;
private final EnumOptionData interestType;
private final EnumOptionData interestCalculationPeriodType;
private final LoanAccountSummaryData summary; private final LoanAccountSummaryData summary;
private final Collection<LoanRepaymentPeriodData> repaymentSchedule; private final Collection<LoanRepaymentPeriodData> repaymentSchedule;
private final Collection<LoanRepaymentTransactionData> loanRepayments; private final Collection<LoanRepaymentTransactionData> loanRepayments;
private final LoanPermissionData permissions; private final LoanPermissionData permissions;
private final LoanConvenienceData convenienceData; private final LoanConvenienceData convenienceData;
private Collection<ChargeData> charges; private final List<EnumOptionData> interestRateFrequencyTypeOptions;
public LoanAccountData( public LoanAccountData(
final LoanBasicDetailsData basicDetails, final LoanBasicDetailsData basicDetails,
@@ -63,12 +73,24 @@ public class LoanAccountData {
final Collection<LoanRepaymentPeriodData> repaymentSchedule, final Collection<LoanRepaymentPeriodData> repaymentSchedule,
final Collection<LoanRepaymentTransactionData> loanRepayments, final Collection<LoanRepaymentTransactionData> loanRepayments,
final LoanPermissionData permissions, final LoanPermissionData permissions,
final Collection<ChargeData> charges) { final Collection<ChargeData> charges,
final Collection<LoanProductLookup> productOptions,
final List<EnumOptionData> termFrequencyTypeOptions,
final List<EnumOptionData> repaymentFrequencyTypeOptions,
final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions,
final List<EnumOptionData> interestRateFrequencyTypeOptions,
final Collection<FundData> fundOptions) {
this.summary = summary; this.summary = summary;
this.repaymentSchedule = repaymentSchedule; this.repaymentSchedule = repaymentSchedule;
this.loanRepayments = loanRepayments; this.loanRepayments = loanRepayments;
this.permissions = permissions; this.permissions = permissions;
this.charges = charges; this.charges = charges;
this.productOptions = productOptions;
this.termFrequencyTypeOptions = termFrequencyTypeOptions;
this.repaymentFrequencyTypeOptions = repaymentFrequencyTypeOptions;
this.repaymentStrategyOptions = transactionProcessingStrategyOptions;
this.interestRateFrequencyTypeOptions = interestRateFrequencyTypeOptions;
this.fundOptions = fundOptions;
int maxSubmittedOnOffsetFromToday = basicDetails int maxSubmittedOnOffsetFromToday = basicDetails
.getMaxSubmittedOnOffsetFromToday(); .getMaxSubmittedOnOffsetFromToday();
@@ -104,16 +126,18 @@ public class LoanAccountData {
this.actualDisbursementDate = basicDetails.getActualDisbursementDate(); this.actualDisbursementDate = basicDetails.getActualDisbursementDate();
this.closedOnDate = basicDetails.getClosedOnDate(); this.closedOnDate = basicDetails.getClosedOnDate();
this.expectedMaturityDate = basicDetails.getExpectedMaturityDate(); this.expectedMaturityDate = basicDetails.getExpectedMaturityDate();
this.expectedFirstRepaymentOnDate = basicDetails this.repaymentsStartingFromDate = basicDetails.getExpectedFirstRepaymentOnDate();
.getExpectedFirstRepaymentOnDate(); this.interestChargedFromDate = basicDetails.getInterestChargedFromDate();
this.interestChargedFromDate = basicDetails
.getInterestChargedFromDate();
this.currency = basicDetails.getCurrency(); this.currency = basicDetails.getCurrency();
this.principal = basicDetails.getPrincipal(); this.principal = basicDetails.getPrincipal();
this.inArrearsTolerance = basicDetails.getInArrearsTolerance(); this.inArrearsTolerance = basicDetails.getInArrearsTolerance();
this.termFrequency = basicDetails.getTermFrequency();
this.termPeriodFrequencyType = basicDetails.getTermPeriodFrequencyType();
this.numberOfRepayments = basicDetails.getNumberOfRepayments(); this.numberOfRepayments = basicDetails.getNumberOfRepayments();
this.repaymentEvery = basicDetails.getRepaymentEvery(); this.repaymentEvery = basicDetails.getRepaymentEvery();
this.transactionStrategyId = basicDetails.getTransactionStrategyId();
this.interestRatePerPeriod = basicDetails.getInterestRatePerPeriod(); this.interestRatePerPeriod = basicDetails.getInterestRatePerPeriod();
this.annualInterestRate = basicDetails.getAnnualInterestRate(); this.annualInterestRate = basicDetails.getAnnualInterestRate();
this.repaymentFrequencyType = basicDetails.getRepaymentFrequencyType(); this.repaymentFrequencyType = basicDetails.getRepaymentFrequencyType();
@@ -123,8 +147,8 @@ public class LoanAccountData {
this.interestType = basicDetails.getInterestType(); this.interestType = basicDetails.getInterestType();
this.interestCalculationPeriodType = basicDetails this.interestCalculationPeriodType = basicDetails
.getInterestCalculationPeriodType(); .getInterestCalculationPeriodType();
this.lifeCycleStatusText = basicDetails.getLifeCycleStatusText();
this.lifeCycleStatusId = basicDetails.getLifeCycleStatusId(); this.status = basicDetails.getStatus();
this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate(); this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate();
} }
@@ -155,6 +179,10 @@ public class LoanAccountData {
public String getLoanProductDescription() { public String getLoanProductDescription() {
return loanProductDescription; return loanProductDescription;
} }
public EnumOptionData getStatus() {
return status;
}
public Long getFundId() { public Long getFundId() {
return fundId; return fundId;
@@ -179,9 +207,9 @@ public class LoanAccountData {
public LocalDate getActualDisbursementDate() { public LocalDate getActualDisbursementDate() {
return actualDisbursementDate; return actualDisbursementDate;
} }
public LocalDate getExpectedFirstRepaymentOnDate() { public LocalDate getRepaymentsStartingFromDate() {
return expectedFirstRepaymentOnDate; return repaymentsStartingFromDate;
} }
public LocalDate getInterestChargedFromDate() { public LocalDate getInterestChargedFromDate() {
@@ -200,12 +228,20 @@ public class LoanAccountData {
return currency; return currency;
} }
public MoneyData getPrincipal() { public BigDecimal getPrincipal() {
return principal; return this.principal;
} }
public MoneyData getInArrearsTolerance() { public BigDecimal getInArrearsTolerance() {
return inArrearsTolerance; return this.inArrearsTolerance;
}
public Integer getTermFrequency() {
return termFrequency;
}
public EnumOptionData getTermPeriodFrequencyType() {
return termPeriodFrequencyType;
} }
public Integer getNumberOfRepayments() { public Integer getNumberOfRepayments() {
@@ -215,6 +251,10 @@ public class LoanAccountData {
public Integer getRepaymentEvery() { public Integer getRepaymentEvery() {
return repaymentEvery; return repaymentEvery;
} }
public Integer getTransactionStrategyId() {
return transactionStrategyId;
}
public BigDecimal getInterestRatePerPeriod() { public BigDecimal getInterestRatePerPeriod() {
return interestRatePerPeriod; return interestRatePerPeriod;
@@ -244,14 +284,6 @@ public class LoanAccountData {
return interestCalculationPeriodType; return interestCalculationPeriodType;
} }
public Integer getLifeCycleStatusId() {
return lifeCycleStatusId;
}
public String getLifeCycleStatusText() {
return lifeCycleStatusText;
}
public LocalDate getLifeCycleStatusDate() { public LocalDate getLifeCycleStatusDate() {
return lifeCycleStatusDate; return lifeCycleStatusDate;
} }
@@ -283,4 +315,28 @@ public class LoanAccountData {
public void setCharges(Collection<ChargeData> charges) { public void setCharges(Collection<ChargeData> charges) {
this.charges = charges; this.charges = charges;
} }
public Collection<LoanProductLookup> getProductOptions() {
return productOptions;
}
public List<EnumOptionData> getTermFrequencyTypeOptions() {
return termFrequencyTypeOptions;
}
public List<EnumOptionData> getRepaymentFrequencyTypeOptions() {
return repaymentFrequencyTypeOptions;
}
public Collection<TransactionProcessingStrategyData> getRepaymentStrategyOptions() {
return repaymentStrategyOptions;
}
public List<EnumOptionData> getInterestRateFrequencyTypeOptions() {
return interestRateFrequencyTypeOptions;
}
public Collection<FundData> getFundOptions() {
return fundOptions;
}
} }
@@ -1,5 +1,7 @@
package org.mifosng.platform.api.data; package org.mifosng.platform.api.data;
import java.math.BigDecimal;
public class LoanAccountSummaryData { public class LoanAccountSummaryData {
private MoneyData originalPrincipal; private MoneyData originalPrincipal;
@@ -46,7 +48,8 @@ public class LoanAccountSummaryData {
this.totalInArrears = totalInArrears; this.totalInArrears = totalInArrears;
} }
public boolean isWaiveAllowed(MoneyData tolerance) { public boolean isWaiveAllowed(final CurrencyData currency, final BigDecimal toleranceAmount) {
MoneyData tolerance = MoneyData.of(currency, toleranceAmount);
return this.totalOutstanding.isGreaterThanZero() && (tolerance.isGreaterThan(this.totalOutstanding) || tolerance.isEqualTo(this.totalOutstanding)); return this.totalOutstanding.isGreaterThanZero() && (tolerance.isGreaterThan(this.totalOutstanding) || tolerance.isEqualTo(this.totalOutstanding));
} }
@@ -18,6 +18,7 @@ public class LoanBasicDetailsData {
private final String loanProductDescription; private final String loanProductDescription;
private final Long fundId; private final Long fundId;
private final String fundName; private final String fundName;
private final EnumOptionData status;
private final LocalDate submittedOnDate; private final LocalDate submittedOnDate;
private final LocalDate approvedOnDate; private final LocalDate approvedOnDate;
@@ -29,11 +30,14 @@ public class LoanBasicDetailsData {
private final LocalDate expectedMaturityDate; private final LocalDate expectedMaturityDate;
private final CurrencyData currency; private final CurrencyData currency;
private final MoneyData principal; private final BigDecimal principal;
private final MoneyData inArrearsTolerance; private final BigDecimal inArrearsTolerance;
private final Integer termFrequency;
private final EnumOptionData termPeriodFrequencyType;
private final Integer numberOfRepayments; private final Integer numberOfRepayments;
private final Integer repaymentEvery; private final Integer repaymentEvery;
private final Integer transactionStrategyId;
private final BigDecimal interestRatePerPeriod; private final BigDecimal interestRatePerPeriod;
private final BigDecimal annualInterestRate; private final BigDecimal annualInterestRate;
@@ -43,8 +47,6 @@ public class LoanBasicDetailsData {
private final EnumOptionData interestType; private final EnumOptionData interestType;
private final EnumOptionData interestCalculationPeriodType; private final EnumOptionData interestCalculationPeriodType;
private final Integer lifeCycleStatusId;
private final String lifeCycleStatusText;
private final LocalDate lifeCycleStatusDate; private final LocalDate lifeCycleStatusDate;
public LoanBasicDetailsData( public LoanBasicDetailsData(
@@ -64,8 +66,8 @@ public class LoanBasicDetailsData {
final LocalDate expectedFirstRepaymentOnDate, final LocalDate expectedFirstRepaymentOnDate,
final LocalDate interestChargedFromDate, final LocalDate interestChargedFromDate,
final CurrencyData currency, final CurrencyData currency,
final MoneyData principal, final BigDecimal principal,
final MoneyData inArrearsTolerance, final BigDecimal inArrearsTolerance,
final Integer numberOfRepayments, final Integer numberOfRepayments,
final Integer repaymentEvery, final Integer repaymentEvery,
final BigDecimal interestRatePerPeriod, final BigDecimal interestRatePerPeriod,
@@ -75,9 +77,11 @@ public class LoanBasicDetailsData {
final EnumOptionData amortizationType, final EnumOptionData amortizationType,
final EnumOptionData interestType, final EnumOptionData interestType,
final EnumOptionData interestCalculationPeriodType, final EnumOptionData interestCalculationPeriodType,
final Integer lifeCycleStatusId, final EnumOptionData status,
final String lifeCycleStatusText, final LocalDate lifeCycleStatusDate,
final LocalDate lifeCycleStatusDate) { final Integer termFrequency,
final EnumOptionData termPeriodFrequencyType,
final Integer transactionStrategyId) {
this.id = id; this.id = id;
this.externalId = externalId; this.externalId = externalId;
this.clientId = clientId; this.clientId = clientId;
@@ -107,9 +111,11 @@ public class LoanBasicDetailsData {
this.amortizationType = amortizationType; this.amortizationType = amortizationType;
this.interestType = interestType; this.interestType = interestType;
this.interestCalculationPeriodType = interestCalculationPeriodType; this.interestCalculationPeriodType = interestCalculationPeriodType;
this.lifeCycleStatusId = lifeCycleStatusId; this.status = status;
this.lifeCycleStatusText = lifeCycleStatusText;
this.lifeCycleStatusDate = lifeCycleStatusDate; this.lifeCycleStatusDate = lifeCycleStatusDate;
this.termFrequency = termFrequency;
this.termPeriodFrequencyType = termPeriodFrequencyType;
this.transactionStrategyId = transactionStrategyId;
} }
public int getMaxSubmittedOnOffsetFromToday() { public int getMaxSubmittedOnOffsetFromToday() {
@@ -236,6 +242,18 @@ public class LoanBasicDetailsData {
public String getLoanProductDescription() { public String getLoanProductDescription() {
return loanProductDescription; return loanProductDescription;
} }
public EnumOptionData getStatus() {
return status;
}
public Integer getTermFrequency() {
return termFrequency;
}
public EnumOptionData getTermPeriodFrequencyType() {
return termPeriodFrequencyType;
}
public LocalDate getSubmittedOnDate() { public LocalDate getSubmittedOnDate() {
return submittedOnDate; return submittedOnDate;
@@ -273,11 +291,11 @@ public class LoanBasicDetailsData {
return currency; return currency;
} }
public MoneyData getPrincipal() { public BigDecimal getPrincipal() {
return principal; return principal;
} }
public MoneyData getInArrearsTolerance() { public BigDecimal getInArrearsTolerance() {
return inArrearsTolerance; return inArrearsTolerance;
} }
@@ -317,15 +335,11 @@ public class LoanBasicDetailsData {
return interestCalculationPeriodType; return interestCalculationPeriodType;
} }
public Integer getLifeCycleStatusId() {
return lifeCycleStatusId;
}
public String getLifeCycleStatusText() {
return lifeCycleStatusText;
}
public LocalDate getLifeCycleStatusDate() { public LocalDate getLifeCycleStatusDate() {
return lifeCycleStatusDate; return lifeCycleStatusDate;
} }
public Integer getTransactionStrategyId() {
return transactionStrategyId;
}
} }
@@ -1,17 +1,17 @@
package org.mifosng.platform.api.data; package org.mifosng.platform.api.data;
import java.io.Serializable; /**
* Immutable data object used for basic loan product info for lookup situations.
*
* TODO - kw - this can be replace and the normal {@link LoanProductData} used where only id and name are populated as google gson does
* not return null attributes/parameters.
*/
public class LoanProductLookup {
public class LoanProductLookup implements Serializable { private final Long id;
private final String name;
private Long id; public LoanProductLookup(final Long id, final String name) {
private String name;
public LoanProductLookup() {
//
}
public LoanProductLookup(Long id, String name) {
this.id = id; this.id = id;
this.name = name; this.name = name;
} }
@@ -20,15 +20,7 @@ public class LoanProductLookup implements Serializable {
return id; return id;
} }
public void setId(Long id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
} }
@@ -151,9 +151,11 @@ public class GoogleGsonApiJsonSerializerService implements
"expectedDisbursementDate", "actualDisbursementDate", "expectedDisbursementDate", "actualDisbursementDate",
"expectedFirstRepaymentOnDate", "interestChargedFromDate", "expectedFirstRepaymentOnDate", "interestChargedFromDate",
"closedOnDate", "expectedMaturityDate", "closedOnDate", "expectedMaturityDate",
"lifeCycleStatusId", "lifeCycleStatusText", "status",
"lifeCycleStatusDate", "summary", "repaymentSchedule", "lifeCycleStatusDate", "summary", "repaymentSchedule",
"loanRepayments", "permissions", "convenienceData", "charges")); "loanRepayments", "permissions", "convenienceData", "charges",
"productOptions", "amortizationTypeOptions", "interestTypeOptions", "interestCalculationPeriodTypeOptions",
"repaymentFrequencyTypeOptions", "interestRateFrequencyTypeOptions", "fundOptions", "transactionProcessingStrategyOptions", "chargeOptions"));
private static final Set<String> LOAN_TRANSACTION_DATA_PARAMETERS = new HashSet<String>( private static final Set<String> LOAN_TRANSACTION_DATA_PARAMETERS = new HashSet<String>(
Arrays.asList("id", "transactionType", "date", "principal", Arrays.asList("id", "transactionType", "date", "principal",
@@ -2,13 +2,13 @@ package org.mifosng.platform.loan.service;
import java.util.Collection; import java.util.Collection;
import org.mifosng.platform.api.data.CurrencyData;
import org.mifosng.platform.api.data.LoanAccountSummaryData; import org.mifosng.platform.api.data.LoanAccountSummaryData;
import org.mifosng.platform.api.data.LoanBasicDetailsData; import org.mifosng.platform.api.data.LoanBasicDetailsData;
import org.mifosng.platform.api.data.LoanPermissionData; import org.mifosng.platform.api.data.LoanPermissionData;
import org.mifosng.platform.api.data.LoanRepaymentPeriodData; import org.mifosng.platform.api.data.LoanRepaymentPeriodData;
import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.LoanRepaymentTransactionData; import org.mifosng.platform.api.data.LoanRepaymentTransactionData;
import org.mifosng.platform.api.data.MoneyData; import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.NewLoanData; import org.mifosng.platform.api.data.NewLoanData;
public interface LoanReadPlatformService { public interface LoanReadPlatformService {
@@ -19,7 +19,7 @@ public interface LoanReadPlatformService {
Collection<LoanRepaymentTransactionData> retrieveLoanPayments(Long loanId); Collection<LoanRepaymentTransactionData> retrieveLoanPayments(Long loanId);
LoanAccountSummaryData retrieveSummary(MoneyData principal, LoanAccountSummaryData retrieveSummary(CurrencyData currency,
Collection<LoanRepaymentPeriodData> repaymentSchedule, Collection<LoanRepaymentPeriodData> repaymentSchedule,
Collection<LoanRepaymentTransactionData> loanRepayments); Collection<LoanRepaymentTransactionData> loanRepayments);
@@ -17,8 +17,8 @@ import org.mifosng.platform.api.data.LoanPermissionData;
import org.mifosng.platform.api.data.LoanProductData; import org.mifosng.platform.api.data.LoanProductData;
import org.mifosng.platform.api.data.LoanProductLookup; import org.mifosng.platform.api.data.LoanProductLookup;
import org.mifosng.platform.api.data.LoanRepaymentPeriodData; import org.mifosng.platform.api.data.LoanRepaymentPeriodData;
import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.LoanRepaymentTransactionData; import org.mifosng.platform.api.data.LoanRepaymentTransactionData;
import org.mifosng.platform.api.data.LoanTransactionData;
import org.mifosng.platform.api.data.MoneyData; import org.mifosng.platform.api.data.MoneyData;
import org.mifosng.platform.api.data.NewLoanData; import org.mifosng.platform.api.data.NewLoanData;
import org.mifosng.platform.charge.service.ChargeReadPlatformService; import org.mifosng.platform.charge.service.ChargeReadPlatformService;
@@ -33,7 +33,6 @@ import org.mifosng.platform.infrastructure.JdbcSupport;
import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource; import org.mifosng.platform.infrastructure.TenantAwareRoutingDataSource;
import org.mifosng.platform.loan.domain.Loan; import org.mifosng.platform.loan.domain.Loan;
import org.mifosng.platform.loan.domain.LoanRepository; import org.mifosng.platform.loan.domain.LoanRepository;
import org.mifosng.platform.loan.domain.LoanStatus;
import org.mifosng.platform.loan.domain.LoanTransaction; import org.mifosng.platform.loan.domain.LoanTransaction;
import org.mifosng.platform.loan.domain.LoanTransactionRepository; import org.mifosng.platform.loan.domain.LoanTransactionRepository;
import org.mifosng.platform.loan.domain.LoanTransactionType; import org.mifosng.platform.loan.domain.LoanTransactionType;
@@ -114,14 +113,10 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
} }
@Override @Override
public LoanAccountSummaryData retrieveSummary(MoneyData principal, public LoanAccountSummaryData retrieveSummary(
Collection<LoanRepaymentPeriodData> repaymentSchedule, final CurrencyData currencyData,
Collection<LoanRepaymentTransactionData> loanRepayments) { final Collection<LoanRepaymentPeriodData> repaymentSchedule,
final Collection<LoanRepaymentTransactionData> loanRepayments) {
CurrencyData currencyData = new CurrencyData(
principal.getCurrencyCode(), principal.getDefaultName(),
principal.getDigitsAfterDecimal(),
principal.getDisplaySymbol(), principal.getNameCode());
BigDecimal originalPrincipal = BigDecimal.ZERO; BigDecimal originalPrincipal = BigDecimal.ZERO;
BigDecimal principalPaid = BigDecimal.ZERO; BigDecimal principalPaid = BigDecimal.ZERO;
@@ -214,11 +209,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
LoanBasicDetailsData loanBasicDetails, boolean isWaiverAllowed, LoanBasicDetailsData loanBasicDetails, boolean isWaiverAllowed,
int repaymentAndWaiveCount) { int repaymentAndWaiveCount) {
boolean pendingApproval = (loanBasicDetails.getLifeCycleStatusId() boolean pendingApproval = (loanBasicDetails.getStatus().getId().equals(100L));
.equals(100)); boolean waitingForDisbursal = (loanBasicDetails.getStatus().getId().equals(200L));
boolean waitingForDisbursal = (loanBasicDetails.getLifeCycleStatusId() boolean isActive = (loanBasicDetails.getStatus().getId().equals(300L));
.equals(200));
boolean isActive = (loanBasicDetails.getLifeCycleStatusId().equals(300));
boolean waiveAllowed = isWaiverAllowed && isActive; boolean waiveAllowed = isWaiverAllowed && isActive;
boolean makeRepaymentAllowed = isActive; boolean makeRepaymentAllowed = isActive;
@@ -421,8 +414,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
+ " l.principal_amount as principal, l.arrearstolerance_amount as inArrearsTolerance, l.number_of_repayments as numberOfRepayments, l.repay_every as repaymentEvery," + " l.principal_amount as principal, l.arrearstolerance_amount as inArrearsTolerance, l.number_of_repayments as numberOfRepayments, l.repay_every as repaymentEvery,"
+ " l.nominal_interest_rate_per_period as interestRatePerPeriod, l.annual_nominal_interest_rate as annualInterestRate, " + " l.nominal_interest_rate_per_period as interestRatePerPeriod, l.annual_nominal_interest_rate as annualInterestRate, "
+ " l.repayment_period_frequency_enum as repaymentFrequencyType, l.interest_period_frequency_enum as interestRateFrequencyType, " + " l.repayment_period_frequency_enum as repaymentFrequencyType, l.interest_period_frequency_enum as interestRateFrequencyType, "
+ " l.term_frequency as termFrequency, l.term_period_frequency_enum as termPeriodFrequencyType, "
+ " l.amortization_method_enum as amortizationType, l.interest_method_enum as interestType, l.interest_calculated_in_period_enum as interestCalculationPeriodType," + " l.amortization_method_enum as amortizationType, l.interest_method_enum as interestType, l.interest_calculated_in_period_enum as interestCalculationPeriodType,"
+ " l.loan_status_id as lifeCycleStatusId, " + " l.loan_status_id as lifeCycleStatusId, l.loan_transaction_strategy_id as transactionStrategyId, "
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode" + " l.currency_code as currencyCode, l.currency_digits as currencyDigits, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode"
+ " from m_loan l" + " from m_loan l"
+ " join m_client c on c.id = l.client_id" + " join m_client c on c.id = l.client_id"
@@ -471,45 +465,37 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
LocalDate expectedMaturityDate = JdbcSupport.getLocalDate(rs, LocalDate expectedMaturityDate = JdbcSupport.getLocalDate(rs,
"expectedMaturityDate"); "expectedMaturityDate");
BigDecimal principalBD = rs.getBigDecimal("principal"); BigDecimal principal = rs.getBigDecimal("principal");
MoneyData principal = MoneyData.of(currencyData, principalBD); BigDecimal inArrearsTolerance = rs.getBigDecimal("inArrearsTolerance");
BigDecimal inArrearsToleranceBD = rs
.getBigDecimal("inArrearsTolerance");
MoneyData inArrearsTolerance = MoneyData.of(currencyData,
inArrearsToleranceBD);
Integer numberOfRepayments = JdbcSupport.getInteger(rs, Integer numberOfRepayments = JdbcSupport.getInteger(rs,"numberOfRepayments");
"numberOfRepayments"); Integer repaymentEvery = JdbcSupport.getInteger(rs,"repaymentEvery");
Integer repaymentEvery = JdbcSupport.getInteger(rs, BigDecimal interestRatePerPeriod = rs.getBigDecimal("interestRatePerPeriod");
"repaymentEvery"); BigDecimal annualInterestRate = rs.getBigDecimal("annualInterestRate");
BigDecimal interestRatePerPeriod = rs
.getBigDecimal("interestRatePerPeriod");
BigDecimal annualInterestRate = rs
.getBigDecimal("annualInterestRate");
int repaymentFrequencyTypeInt = JdbcSupport.getInteger(rs, Integer termFrequency = JdbcSupport.getInteger(rs,"termFrequency");
"repaymentFrequencyType"); Integer termPeriodFrequencyTypeInt = JdbcSupport.getInteger(rs,"termPeriodFrequencyType");
int interestRateFrequencyTypeInt = JdbcSupport.getInteger(rs, EnumOptionData termPeriodFrequencyType = LoanEnumerations.termFrequencyType(termPeriodFrequencyTypeInt);
"interestRateFrequencyType");
int amortizationTypeInt = JdbcSupport.getInteger(rs, int repaymentFrequencyTypeInt = JdbcSupport.getInteger(rs,"repaymentFrequencyType");
"amortizationType"); EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(repaymentFrequencyTypeInt);
int interestRateFrequencyTypeInt = JdbcSupport.getInteger(rs,"interestRateFrequencyType");
EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(interestRateFrequencyTypeInt);
Integer transactionStrategyId = JdbcSupport.getInteger(rs,"transactionStrategyId");
int amortizationTypeInt = JdbcSupport.getInteger(rs,"amortizationType");
int interestTypeInt = JdbcSupport.getInteger(rs, "interestType"); int interestTypeInt = JdbcSupport.getInteger(rs, "interestType");
int interestCalculationPeriodTypeInt = JdbcSupport.getInteger(rs, int interestCalculationPeriodTypeInt = JdbcSupport.getInteger(rs,"interestCalculationPeriodType");
"interestCalculationPeriodType");
EnumOptionData repaymentFrequencyType = LoanEnumerations EnumOptionData amortizationType = LoanEnumerations.amortizationType(amortizationTypeInt);
.repaymentFrequencyType(repaymentFrequencyTypeInt); EnumOptionData interestType = LoanEnumerations.interestType(interestTypeInt);
EnumOptionData interestRateFrequencyType = LoanEnumerations EnumOptionData interestCalculationPeriodType = LoanEnumerations.interestCalculationPeriodType(interestCalculationPeriodTypeInt);
.interestRateFrequencyType(interestRateFrequencyTypeInt);
EnumOptionData amortizationType = LoanEnumerations
.amortizationType(amortizationTypeInt);
EnumOptionData interestType = LoanEnumerations
.interestType(interestTypeInt);
EnumOptionData interestCalculationPeriodType = LoanEnumerations
.interestCalculationPeriodType(interestCalculationPeriodTypeInt);
Integer lifeCycleStatusId = JdbcSupport.getInteger(rs, "lifeCycleStatusId"); Integer lifeCycleStatusId = JdbcSupport.getInteger(rs, "lifeCycleStatusId");
String lifeCycleStatusText = LoanStatus.fromInt(lifeCycleStatusId).getCode(); EnumOptionData status = LoanEnumerations.status(lifeCycleStatusId);
LocalDate lifeCycleStatusDate = submittedOnDate; LocalDate lifeCycleStatusDate = submittedOnDate;
if (approvedOnDate != null) { if (approvedOnDate != null) {
lifeCycleStatusDate = approvedOnDate; lifeCycleStatusDate = approvedOnDate;
@@ -523,7 +509,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
return new LoanBasicDetailsData(id, externalId, clientId, clientName, return new LoanBasicDetailsData(id, externalId, clientId, clientName,
loanProductId, loanProductName, loanProductDescription, loanProductId, loanProductName, loanProductDescription,
fundId, fundName, closedOnDate, fundId, fundName,
closedOnDate,
submittedOnDate, approvedOnDate, expectedDisbursementDate, submittedOnDate, approvedOnDate, expectedDisbursementDate,
actualDisbursementDate, expectedMaturityDate, actualDisbursementDate, expectedMaturityDate,
expectedFirstRepaymentOnDate, interestChargedFromDate, expectedFirstRepaymentOnDate, interestChargedFromDate,
@@ -532,8 +519,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
repaymentEvery, interestRatePerPeriod, annualInterestRate, repaymentEvery, interestRatePerPeriod, annualInterestRate,
repaymentFrequencyType, interestRateFrequencyType, repaymentFrequencyType, interestRateFrequencyType,
amortizationType, interestType, amortizationType, interestType,
interestCalculationPeriodType, lifeCycleStatusId, interestCalculationPeriodType,
lifeCycleStatusText, lifeCycleStatusDate); status,
lifeCycleStatusDate, termFrequency, termPeriodFrequencyType, transactionStrategyId);
} }
} }
@@ -4,6 +4,7 @@ import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.loan.domain.AmortizationMethod; import org.mifosng.platform.loan.domain.AmortizationMethod;
import org.mifosng.platform.loan.domain.InterestCalculationPeriodMethod; import org.mifosng.platform.loan.domain.InterestCalculationPeriodMethod;
import org.mifosng.platform.loan.domain.InterestMethod; import org.mifosng.platform.loan.domain.InterestMethod;
import org.mifosng.platform.loan.domain.LoanStatus;
import org.mifosng.platform.loan.domain.LoanTransactionType; import org.mifosng.platform.loan.domain.LoanTransactionType;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
@@ -36,6 +37,30 @@ public class LoanEnumerations {
return optionData; return optionData;
} }
public static EnumOptionData termFrequencyType(final int id) {
return termFrequencyType(PeriodFrequencyType.fromInt(id));
}
public static EnumOptionData termFrequencyType(final PeriodFrequencyType type) {
final String codePrefix = "termFrequency.";
EnumOptionData optionData = null;
switch (type) {
case DAYS:
optionData = new EnumOptionData(PeriodFrequencyType.DAYS.getValue().longValue(), codePrefix + PeriodFrequencyType.DAYS.getCode(), "Days");
break;
case WEEKS:
optionData = new EnumOptionData(PeriodFrequencyType.WEEKS.getValue().longValue(), codePrefix + PeriodFrequencyType.WEEKS.getCode(), "Weeks");
break;
case MONTHS:
optionData = new EnumOptionData(PeriodFrequencyType.MONTHS.getValue().longValue(), codePrefix + PeriodFrequencyType.MONTHS.getCode(), "Months");
break;
default:
optionData = new EnumOptionData(PeriodFrequencyType.INVALID.getValue().longValue(), PeriodFrequencyType.INVALID.getCode(), "Invalid");
break;
}
return optionData;
}
public static EnumOptionData repaymentFrequencyType(final int id) { public static EnumOptionData repaymentFrequencyType(final int id) {
return repaymentFrequencyType(PeriodFrequencyType.fromInt(id)); return repaymentFrequencyType(PeriodFrequencyType.fromInt(id));
} }
@@ -141,11 +166,11 @@ public class LoanEnumerations {
return optionData; return optionData;
} }
public static EnumOptionData transactionType(Integer id) { public static EnumOptionData transactionType(final Integer id) {
return transactionType(LoanTransactionType.fromInt(id)); return transactionType(LoanTransactionType.fromInt(id));
} }
public static EnumOptionData transactionType(LoanTransactionType type) { public static EnumOptionData transactionType(final LoanTransactionType type) {
EnumOptionData optionData = null; EnumOptionData optionData = null;
switch (type) { switch (type) {
case DISBURSEMENT: case DISBURSEMENT:
@@ -166,4 +191,39 @@ public class LoanEnumerations {
} }
return optionData; return optionData;
} }
public static EnumOptionData status(final Integer statusId) {
return status(LoanStatus.fromInt(statusId));
}
public static EnumOptionData status(final LoanStatus status) {
EnumOptionData optionData = null;
switch (status) {
case SUBMITED_AND_PENDING_APPROVAL:
optionData = new EnumOptionData(LoanStatus.SUBMITED_AND_PENDING_APPROVAL.getValue().longValue(), LoanStatus.SUBMITED_AND_PENDING_APPROVAL.getCode(), "Submitted and pending approval");
break;
case APPROVED:
optionData = new EnumOptionData(LoanStatus.APPROVED.getValue().longValue(), LoanStatus.APPROVED.getCode(), "Approved");
break;
case ACTIVE:
optionData = new EnumOptionData(LoanStatus.ACTIVE.getValue().longValue(), LoanStatus.ACTIVE.getCode(), "Active");
break;
case REJECTED:
optionData = new EnumOptionData(LoanStatus.REJECTED.getValue().longValue(), LoanStatus.REJECTED.getCode(), "Rejected");
break;
case WITHDRAWN_BY_CLIENT:
optionData = new EnumOptionData(LoanStatus.WITHDRAWN_BY_CLIENT.getValue().longValue(), LoanStatus.WITHDRAWN_BY_CLIENT.getCode(), "Withdrawn by applicant");
break;
case CLOSED:
optionData = new EnumOptionData(LoanStatus.CLOSED.getValue().longValue(), LoanStatus.CLOSED.getCode(), "Closed");
break;
case OVERPAID:
optionData = new EnumOptionData(LoanStatus.OVERPAID.getValue().longValue(), LoanStatus.OVERPAID.getCode(), "Overpaid");
break;
default:
optionData = new EnumOptionData(LoanStatus.INVALID.getValue().longValue(), LoanStatus.INVALID.getCode(), "Invalid");
break;
}
return optionData;
}
} }