tidy up loan account data being returned breaking up into basic details, permissions, derived loan data and repayments.
This commit is contained in:
@@ -1,592 +0,0 @@
|
||||
package org.mifosng.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.Months;
|
||||
|
||||
@XmlRootElement(name = "loan")
|
||||
@JsonFilter("loanFilter")
|
||||
public class LoanAccountData {
|
||||
|
||||
private boolean open;
|
||||
private boolean openWithRepaymentMade;
|
||||
private boolean closed;
|
||||
private boolean interestRebateOutstanding;
|
||||
private boolean pendingApproval;
|
||||
private boolean waitingForDisbursal;
|
||||
private String lifeCycleStatusText;
|
||||
private LocalDate lifeCycleStatusDate;
|
||||
|
||||
private Long id;
|
||||
private String externalId;
|
||||
private String loanProductName;
|
||||
|
||||
private LocalDate submittedOnDate;
|
||||
private LocalDate approvedOnDate;
|
||||
|
||||
private LocalDate expectedDisbursementDate;
|
||||
private LocalDate actualDisbursementDate;
|
||||
private boolean undoDisbursalAllowed;
|
||||
|
||||
private LocalDate expectedFirstRepaymentOnDate;
|
||||
private LocalDate interestCalculatedFromDate;
|
||||
|
||||
private LocalDate closedOnDate;
|
||||
|
||||
private LocalDate expectedMaturityDate;
|
||||
|
||||
private MoneyData principal;
|
||||
private BigDecimal interestRatePerYear;
|
||||
private BigDecimal interestRatePerPeriod;
|
||||
private Integer interestPeriodFrequencyType;
|
||||
private String interestPeriodFrequencyText;
|
||||
private Integer interestMethodType;
|
||||
private String interestMethodText;
|
||||
private Integer amortizationMethodValue;
|
||||
private String amortizationMethodText;
|
||||
private Integer numberOfRepayments;
|
||||
|
||||
private Integer repaymentFrequencyNumber;
|
||||
private Integer repaymentFrequencyTypeEnumOrdinal;
|
||||
private String repaymentFrequencyTypeText;
|
||||
|
||||
private MoneyData interestRebateOwed;
|
||||
|
||||
private DerivedLoanData loanData;
|
||||
private MoneyData arrearsTolerance;
|
||||
|
||||
// permissions on actions against loan based on the user who request loan data.
|
||||
private boolean waiveAllowed;
|
||||
private boolean makeRepaymentAllowed;
|
||||
private boolean rejectAllowed;
|
||||
private boolean withdrawnByApplicantAllowed;
|
||||
private boolean undoApprovalAllowed;
|
||||
private boolean disbursalAllowed;
|
||||
|
||||
public LoanAccountData() {
|
||||
//
|
||||
}
|
||||
|
||||
public LoanAccountData(
|
||||
final boolean closed,
|
||||
final boolean open,
|
||||
final boolean openWithRepaymentMade,
|
||||
final boolean interestRebateOutstanding,
|
||||
final boolean pendingApproval,
|
||||
final boolean waitingForDisbursal,
|
||||
final boolean undoDisbursalAllowed,
|
||||
final boolean makeRepaymentAllowed,
|
||||
final boolean rejectAllowed,
|
||||
final boolean withdrawnByApplicantAllowed, final boolean undoApprovalAllowed, final boolean disbursalAllowed,
|
||||
final String lifeCycleStatusText,
|
||||
final LocalDate lifeCycleStatusDate,
|
||||
final Long id, String externalId,
|
||||
final String loanProductName, final LocalDate closedOnDate,
|
||||
final LocalDate submittedOnDate,
|
||||
final LocalDate approvedOnDate,
|
||||
final LocalDate expectedDisbursementDate,
|
||||
final LocalDate actualDisbursementDate,
|
||||
final LocalDate expectedMaturityDate,
|
||||
final LocalDate expectedFirstRepaymentOnDate,
|
||||
final LocalDate interestCalculatedFromDate,
|
||||
final MoneyData principal, final BigDecimal interestRatePerYear,
|
||||
final BigDecimal interestRatePerPeriod,
|
||||
final Integer interestPeriodFrequencyType,
|
||||
final String interestPeriodFrequencyText,
|
||||
final Integer interestMethodType,
|
||||
final String interestMethodText,
|
||||
final Integer amortizationMethodValue,
|
||||
final String amortizationMethodText,
|
||||
final Integer numberOfRepayments,
|
||||
final Integer repayEvery,
|
||||
final Integer repaymentFrequencyValue,
|
||||
final String repaymentFrequencyText,
|
||||
final MoneyData arrearsTolerance, final DerivedLoanData derivedLoanData,
|
||||
boolean waiveAllowed, final MoneyData interestRebateOwed) {
|
||||
this.closed = closed;
|
||||
this.open = open;
|
||||
this.openWithRepaymentMade = openWithRepaymentMade;
|
||||
this.makeRepaymentAllowed = makeRepaymentAllowed;
|
||||
this.rejectAllowed = rejectAllowed;
|
||||
this.withdrawnByApplicantAllowed = withdrawnByApplicantAllowed;
|
||||
this.undoApprovalAllowed = undoApprovalAllowed;
|
||||
this.disbursalAllowed = disbursalAllowed;
|
||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||
this.externalId = externalId;
|
||||
this.undoDisbursalAllowed = undoDisbursalAllowed;
|
||||
this.interestRebateOutstanding = interestRebateOutstanding;
|
||||
this.pendingApproval = pendingApproval;
|
||||
this.waitingForDisbursal = waitingForDisbursal;
|
||||
this.lifeCycleStatusText = lifeCycleStatusText;
|
||||
this.id = id;
|
||||
this.loanProductName = loanProductName;
|
||||
this.closedOnDate = closedOnDate;
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
this.actualDisbursementDate = actualDisbursementDate;
|
||||
this.expectedMaturityDate = expectedMaturityDate;
|
||||
this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate;
|
||||
this.interestCalculatedFromDate = interestCalculatedFromDate;
|
||||
this.principal = principal;
|
||||
this.interestRatePerYear = interestRatePerYear;
|
||||
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.interestPeriodFrequencyType = interestPeriodFrequencyType;
|
||||
this.interestPeriodFrequencyText = interestPeriodFrequencyText;
|
||||
this.interestMethodType = interestMethodType;
|
||||
this.interestMethodText = interestMethodText;
|
||||
this.amortizationMethodValue = amortizationMethodValue;
|
||||
this.amortizationMethodText = amortizationMethodText;
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
|
||||
this.repaymentFrequencyNumber = repayEvery;
|
||||
this.repaymentFrequencyTypeEnumOrdinal = repaymentFrequencyValue;
|
||||
this.repaymentFrequencyTypeText = repaymentFrequencyText;
|
||||
this.arrearsTolerance = arrearsTolerance;
|
||||
this.waiveAllowed = waiveAllowed;
|
||||
|
||||
this.loanData = derivedLoanData;
|
||||
this.interestRebateOwed = interestRebateOwed;
|
||||
}
|
||||
|
||||
public boolean isAnyActionOnLoanAllowed() {
|
||||
return isRejectAllowed() || isWithdrawnByApplicantAllowed() || isPendingApproval() || isUndoDisbursalAllowed() || isMakeRepaymentAllowed();
|
||||
}
|
||||
|
||||
public int getMaxSubmittedOnOffsetFromToday() {
|
||||
return Days.daysBetween(new DateTime(),
|
||||
this.getSubmittedOnDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
|
||||
public int getMaxApprovedOnOffsetFromToday() {
|
||||
|
||||
int offset = 0;
|
||||
if (this.getApprovedOnDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(),
|
||||
this.getApprovedOnDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
public int getMaxDisbursedOnOffsetFromToday() {
|
||||
|
||||
int offset = 0;
|
||||
if (this.getActualDisbursementDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(),
|
||||
this.getActualDisbursementDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
public int getActualLoanTermInDays() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public int getActualLoanTermInMonths() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
|
||||
public int getLoanTermInDays() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public int getLoanTermInMonths() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return this.open;
|
||||
}
|
||||
|
||||
public void setOpen(final boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return this.closed;
|
||||
}
|
||||
|
||||
public void setClosed(final boolean closed) {
|
||||
this.closed = closed;
|
||||
}
|
||||
|
||||
public boolean isInterestRebateOutstanding() {
|
||||
return this.interestRebateOutstanding;
|
||||
}
|
||||
|
||||
public void setInterestRebateOutstanding(
|
||||
final boolean interestRebateOutstanding) {
|
||||
this.interestRebateOutstanding = interestRebateOutstanding;
|
||||
}
|
||||
|
||||
public boolean isPendingApproval() {
|
||||
return this.pendingApproval;
|
||||
}
|
||||
|
||||
public void setPendingApproval(final boolean pendingApproval) {
|
||||
this.pendingApproval = pendingApproval;
|
||||
}
|
||||
|
||||
public boolean isWaitingForDisbursal() {
|
||||
return this.waitingForDisbursal;
|
||||
}
|
||||
|
||||
public void setWaitingForDisbursal(final boolean waitingForDisbursal) {
|
||||
this.waitingForDisbursal = waitingForDisbursal;
|
||||
}
|
||||
|
||||
public LocalDate getClosedOnDate() {
|
||||
return this.closedOnDate;
|
||||
}
|
||||
|
||||
public void setClosedOnDate(final LocalDate closedOnDate) {
|
||||
this.closedOnDate = closedOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return this.submittedOnDate;
|
||||
}
|
||||
|
||||
public void setSubmittedOnDate(final LocalDate submittedOnDate) {
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(final Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedDisbursementDate() {
|
||||
return this.expectedDisbursementDate;
|
||||
}
|
||||
|
||||
public void setExpectedDisbursementDate(
|
||||
final LocalDate expectedDisbursementDate) {
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
}
|
||||
|
||||
public LocalDate getActualDisbursementDate() {
|
||||
return this.actualDisbursementDate;
|
||||
}
|
||||
|
||||
public void setActualDisbursementDate(final LocalDate actualDisbursementDate) {
|
||||
this.actualDisbursementDate = actualDisbursementDate;
|
||||
}
|
||||
|
||||
public MoneyData getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
public void setPrincipal(final MoneyData principal) {
|
||||
this.principal = principal;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestRatePerYear() {
|
||||
return this.interestRatePerYear;
|
||||
}
|
||||
|
||||
public void setInterestRatePerYear(final BigDecimal interestRatePerYear) {
|
||||
this.interestRatePerYear = interestRatePerYear;
|
||||
}
|
||||
|
||||
public Integer getRepaymentFrequencyNumber() {
|
||||
return this.repaymentFrequencyNumber;
|
||||
}
|
||||
|
||||
public void setRepaymentFrequencyNumber(
|
||||
final Integer repaymentFrequencyNumber) {
|
||||
this.repaymentFrequencyNumber = repaymentFrequencyNumber;
|
||||
}
|
||||
|
||||
public Integer getRepaymentFrequencyTypeEnumOrdinal() {
|
||||
return this.repaymentFrequencyTypeEnumOrdinal;
|
||||
}
|
||||
|
||||
public void setRepaymentFrequencyTypeEnumOrdinal(
|
||||
final Integer repaymentFrequencyTypeEnumOrdinal) {
|
||||
this.repaymentFrequencyTypeEnumOrdinal = repaymentFrequencyTypeEnumOrdinal;
|
||||
}
|
||||
|
||||
public String getRepaymentFrequencyTypeText() {
|
||||
return this.repaymentFrequencyTypeText;
|
||||
}
|
||||
|
||||
public void setRepaymentFrequencyTypeText(
|
||||
final String repaymentFrequencyTypeText) {
|
||||
this.repaymentFrequencyTypeText = repaymentFrequencyTypeText;
|
||||
}
|
||||
|
||||
public String getLoanProductName() {
|
||||
return this.loanProductName;
|
||||
}
|
||||
|
||||
public void setLoanProductName(final String loanProductName) {
|
||||
this.loanProductName = loanProductName;
|
||||
}
|
||||
|
||||
public LocalDate getApprovedOnDate() {
|
||||
return this.approvedOnDate;
|
||||
}
|
||||
|
||||
public void setApprovedOnDate(final LocalDate approvedOnDate) {
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
}
|
||||
|
||||
public MoneyData getInterestRebateOwed() {
|
||||
return this.interestRebateOwed;
|
||||
}
|
||||
|
||||
public void setInterestRebateOwed(final MoneyData interestRebateOwed) {
|
||||
this.interestRebateOwed = interestRebateOwed;
|
||||
}
|
||||
|
||||
public String getLifeCycleStatusText() {
|
||||
return this.lifeCycleStatusText;
|
||||
}
|
||||
|
||||
public void setLifeCycleStatusText(final String lifeCycleStatusText) {
|
||||
this.lifeCycleStatusText = lifeCycleStatusText;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedMaturityDate() {
|
||||
return this.expectedMaturityDate;
|
||||
}
|
||||
|
||||
public void setMaturityDate(final LocalDate maturityDate) {
|
||||
this.expectedMaturityDate = maturityDate;
|
||||
}
|
||||
|
||||
public boolean isOpenWithRepaymentMade() {
|
||||
return this.openWithRepaymentMade;
|
||||
}
|
||||
|
||||
public void setOpenWithRepaymentMade(final boolean openWithRepaymentMade) {
|
||||
this.openWithRepaymentMade = openWithRepaymentMade;
|
||||
}
|
||||
|
||||
public boolean isUndoDisbursalAllowed() {
|
||||
return this.undoDisbursalAllowed;
|
||||
}
|
||||
|
||||
public void setUndoDisbursalAllowed(final boolean undoDisbursalAllowed) {
|
||||
this.undoDisbursalAllowed = undoDisbursalAllowed;
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
public void setExternalId(String externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestRatePerPeriod() {
|
||||
return interestRatePerPeriod;
|
||||
}
|
||||
|
||||
public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) {
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
}
|
||||
|
||||
public Integer getInterestPeriodFrequencyType() {
|
||||
return interestPeriodFrequencyType;
|
||||
}
|
||||
|
||||
public void setInterestPeriodFrequencyType(Integer interestPeriodFrequencyType) {
|
||||
this.interestPeriodFrequencyType = interestPeriodFrequencyType;
|
||||
}
|
||||
|
||||
public String getInterestPeriodFrequencyText() {
|
||||
return interestPeriodFrequencyText;
|
||||
}
|
||||
|
||||
public void setInterestPeriodFrequencyText(String interestPeriodFrequencyText) {
|
||||
this.interestPeriodFrequencyText = interestPeriodFrequencyText;
|
||||
}
|
||||
|
||||
public Integer getInterestMethodType() {
|
||||
return interestMethodType;
|
||||
}
|
||||
|
||||
public void setInterestMethodType(Integer interestMethodType) {
|
||||
this.interestMethodType = interestMethodType;
|
||||
}
|
||||
|
||||
public String getInterestMethodText() {
|
||||
return interestMethodText;
|
||||
}
|
||||
|
||||
public void setInterestMethodText(String interestMethodText) {
|
||||
this.interestMethodText = interestMethodText;
|
||||
}
|
||||
|
||||
public Integer getAmortizationMethodValue() {
|
||||
return amortizationMethodValue;
|
||||
}
|
||||
|
||||
public void setAmortizationMethodValue(Integer amortizationMethodValue) {
|
||||
this.amortizationMethodValue = amortizationMethodValue;
|
||||
}
|
||||
|
||||
public String getAmortizationMethodText() {
|
||||
return amortizationMethodText;
|
||||
}
|
||||
|
||||
public void setAmortizationMethodText(String amortizationMethodText) {
|
||||
this.amortizationMethodText = amortizationMethodText;
|
||||
}
|
||||
|
||||
public Integer getNumberOfRepayments() {
|
||||
return numberOfRepayments;
|
||||
}
|
||||
|
||||
public void setNumberOfRepayments(Integer numberOfRepayments) {
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
}
|
||||
|
||||
public DerivedLoanData getLoanData() {
|
||||
return loanData;
|
||||
}
|
||||
|
||||
public void setLoanData(DerivedLoanData loanData) {
|
||||
this.loanData = loanData;
|
||||
}
|
||||
|
||||
public MoneyData getArrearsTolerance() {
|
||||
return arrearsTolerance;
|
||||
}
|
||||
|
||||
public void setArrearsTolerance(MoneyData arrearsTolerance) {
|
||||
this.arrearsTolerance = arrearsTolerance;
|
||||
}
|
||||
|
||||
public boolean isWaiveAllowed() {
|
||||
return waiveAllowed;
|
||||
}
|
||||
|
||||
public void setWaiveAllowed(boolean waiveAllowed) {
|
||||
this.waiveAllowed = waiveAllowed;
|
||||
}
|
||||
|
||||
public boolean isMakeRepaymentAllowed() {
|
||||
return makeRepaymentAllowed;
|
||||
}
|
||||
|
||||
public void setMakeRepaymentAllowed(boolean makeRepaymentAllowed) {
|
||||
this.makeRepaymentAllowed = makeRepaymentAllowed;
|
||||
}
|
||||
|
||||
public LocalDate getLifeCycleStatusDate() {
|
||||
return lifeCycleStatusDate;
|
||||
}
|
||||
|
||||
public void setLifeCycleStatusDate(LocalDate lifeCycleStatusDate) {
|
||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||
}
|
||||
|
||||
public boolean isRejectAllowed() {
|
||||
return rejectAllowed;
|
||||
}
|
||||
|
||||
public void setRejectAllowed(boolean rejectAllowed) {
|
||||
this.rejectAllowed = rejectAllowed;
|
||||
}
|
||||
|
||||
public boolean isWithdrawnByApplicantAllowed() {
|
||||
return withdrawnByApplicantAllowed;
|
||||
}
|
||||
|
||||
public void setWithdrawnByApplicantAllowed(boolean withdrawnByApplicantAllowed) {
|
||||
this.withdrawnByApplicantAllowed = withdrawnByApplicantAllowed;
|
||||
}
|
||||
|
||||
public boolean isUndoApprovalAllowed() {
|
||||
return undoApprovalAllowed;
|
||||
}
|
||||
|
||||
public void setUndoApprovalAllowed(boolean undoApprovalAllowed) {
|
||||
this.undoApprovalAllowed = undoApprovalAllowed;
|
||||
}
|
||||
|
||||
public boolean isDisbursalAllowed() {
|
||||
return disbursalAllowed;
|
||||
}
|
||||
|
||||
public void setDisbursalAllowed(boolean disbursalAllowed) {
|
||||
this.disbursalAllowed = disbursalAllowed;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedFirstRepaymentOnDate() {
|
||||
return expectedFirstRepaymentOnDate;
|
||||
}
|
||||
|
||||
public void setExpectedFirstRepaymentOnDate(
|
||||
LocalDate expectedFirstRepaymentOnDate) {
|
||||
this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getInterestCalculatedFromDate() {
|
||||
return interestCalculatedFromDate;
|
||||
}
|
||||
|
||||
public void setInterestCalculatedFromDate(LocalDate interestCalculatedFromDate) {
|
||||
this.interestCalculatedFromDate = interestCalculatedFromDate;
|
||||
}
|
||||
|
||||
public void setExpectedMaturityDate(LocalDate expectedMaturityDate) {
|
||||
this.expectedMaturityDate = expectedMaturityDate;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -532,9 +532,9 @@ $(document).ready(function() {
|
||||
|
||||
var curTabID = currentTab.prop("id")
|
||||
|
||||
offsetToSubmittedDate = data.maxSubmittedOnOffsetFromToday;
|
||||
offsetToApprovalDate = data.maxApprovedOnOffsetFromToday;
|
||||
offsetToDisbursalDate = data.maxDisbursedOnOffsetFromToday;
|
||||
offsetToSubmittedDate = data.basicDetails.maxSubmittedOnOffsetFromToday;
|
||||
offsetToApprovalDate = data.basicDetails.maxApprovedOnOffsetFromToday;
|
||||
offsetToDisbursalDate = data.basicDetails.maxDisbursedOnOffsetFromToday;
|
||||
|
||||
var $loantabs = $(".loantabs").tabs({
|
||||
"show": function(event, ui) {
|
||||
@@ -715,7 +715,7 @@ $(document).ready(function() {
|
||||
basicAuthKey: base64,
|
||||
datasetType: "portfolio_loan",
|
||||
datasetPKValue: data.id,
|
||||
datasetTypeDiv: "loanadditionaldata" + data.id,
|
||||
datasetTypeDiv: "loanadditionaldata" + data.basicDetails.id,
|
||||
headingPrefix: "",
|
||||
headingClass: "",
|
||||
labelClass: "longrowlabel",
|
||||
|
||||
@@ -466,64 +466,66 @@
|
||||
'CAN_REJECT_LOAN_ROLE', 'CAN_REJECT_LOAN_IN_THE_PAST_ROLE', 'CAN_WITHDRAW_LOAN_ROLE', 'CAN_WITHDRAW_LOAN_IN_THE_PAST_ROLE', 'CAN_DELETE_LOAN_THAT_IS_SUBMITTED_AND_NOT_APPROVED',
|
||||
'CAN_UNDO_LOAN_APPROVAL_ROLE', 'CAN_MAKE_LOAN_REPAYMENT_ROLE', 'CAN_MAKE_LOAN_REPAYMENT_IN_THE_PAST_ROLE')">
|
||||
|
||||
{{#each permissions}}
|
||||
{{#if anyActionOnLoanAllowed}}
|
||||
<div id="loanactions">
|
||||
<span id="toolbar" class="ui-widget-header ui-corner-all">
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_REJECT_LOAN_ROLE', 'CAN_REJECT_LOAN_IN_THE_PAST_ROLE', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if rejectAllowed}}
|
||||
<button id="rejectbtn{{=id}}" class="rejectloan">Reject</button>
|
||||
<button id="rejectbtn{{=$parent.parent.parent.data.id}}" class="rejectloan">Reject</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_WITHDRAW_LOAN_ROLE', 'CAN_WITHDRAW_LOAN_IN_THE_PAST_ROLE', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if withdrawnByApplicantAllowed}}
|
||||
<button id="withdrawnbyapplicantloanbtn{{=id}}" class="withdrawnbyapplicantloan">Withdrawn By Applicant</button>
|
||||
<button id="withdrawnbyapplicantloanbtn{{=$parent.parent.parent.data.id}}" class="withdrawnbyapplicantloan">Withdrawn By Applicant</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_APPROVE_LOAN_ROLE', 'CAN_APPROVE_LOAN_IN_THE_PAST_ROLE', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if pendingApproval}}
|
||||
<button id="approvebtn{{=id}}" class="approveloan">Approve</button>
|
||||
<button id="approvebtn{{=$parent.parent.parent.data.id}}" class="approveloan">Approve</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_DELETE_LOAN_THAT_IS_SUBMITTED_AND_NOT_APPROVED', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if pendingApproval}}
|
||||
<button id="deletebtn{{=id}}" class="deleteloan">Delete</button>
|
||||
<button id="deletebtn{{=$parent.parent.parent.data.id}}" class="deleteloan">Delete</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_UNDO_LOAN_APPROVAL_ROLE', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if undoApprovalAllowed}}
|
||||
<button id="undoapprovebtn{{=id}}" class="undoapproveloan">Undo Approval</button>
|
||||
<button id="undoapprovebtn{{=$parent.parent.parent.data.id}}" class="undoapproveloan">Undo Approval</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_DISBURSE_LOAN_ROLE', 'CAN_DISBURSE_LOAN_IN_THE_PAST_ROLE','PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if disbursalAllowed}}
|
||||
<button id="disbursebtn{{=id}}" class="disburseloan">Disburse</button>
|
||||
<button id="disbursebtn{{=$parent.parent.parent.data.id}}" class="disburseloan">Disburse</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_UNDO_LOAN_DISBURSAL_ROLE', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if undoDisbursalAllowed}}
|
||||
<button id="undodisbursalbtn{{=id}}" class="undodisbursalloan">Undo Disbursal</button>
|
||||
{{/if}}
|
||||
{{#if undoDisbursalAllowed}}
|
||||
<button id="undodisbursalbtn{{=$parent.parent.parent.data.id}}" class="undodisbursalloan">Undo Disbursal</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize access="hasAnyRole('CAN_MAKE_LOAN_REPAYMENT_ROLE', 'CAN_MAKE_LOAN_REPAYMENT_IN_THE_PAST_ROLE', 'PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')" >
|
||||
{{#if makeRepaymentAllowed}}
|
||||
<button id="repaymentbtn{{=id}}" class="repaymentloan">Make Repayment</button>
|
||||
<button id="repaymentbtn{{=$parent.parent.parent.data.id}}" class="repaymentloan">Make Repayment</button>
|
||||
{{/if}}
|
||||
</sec:authorize>
|
||||
|
||||
{{#if waiveAllowed}}
|
||||
<button id="waivebtn{{=id}}" class="waiveloan">Waive</button>
|
||||
<button id="waivebtn{{=$parent.parent.parent.data.id}}" class="waiveloan">Waive</button>
|
||||
{{/if}}
|
||||
</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
|
||||
<div id="loantabs{{=id}}" class="loantabs">
|
||||
<ul>
|
||||
@@ -534,15 +536,17 @@
|
||||
{{/if}}
|
||||
</ul>
|
||||
<!-- first loan tab -->
|
||||
|
||||
{{#each basicDetails}}
|
||||
<div id="details{{=id}}" style="margin-top: 5px;">
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.status"/></span>
|
||||
<span class="rowvalue">{{=lifeCycleStatusText}} (<spring:message code="label.client.account.loan.status.since"/> {{=$ctx.globalDate(lifeCycleStatusDate)}})
|
||||
{{#if $ctx.numberGreaterThanZero(loanData.summary.totalInArrears.amount)}}
|
||||
{{#if open}}
|
||||
- <spring:message code="label.client.account.loan.status.arrears"/> {{=$ctx.moneyWithCurrency(loanData.summary.totalInArrears)}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<span class="rowvalue">{{=lifeCycleStatusText}} (<spring:message code="label.client.account.loan.status.since"/> {{=$ctx.globalDate(lifeCycleStatusDate)}})
|
||||
{{#if $ctx.numberGreaterThanZero($parent.data.loanData.summary.totalInArrears.amount)}}
|
||||
{{#if actualDisbursementDate !== null}}
|
||||
- <spring:message code="label.client.account.loan.status.arrears"/> {{=$ctx.moneyWithCurrency($parent.parent.parent.data.loanData.summary.totalInArrears)}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -581,14 +585,14 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if interestCalculatedFromDate !== null}}
|
||||
{{#if interestChargedFromDate !== null}}
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.interest.charged.from"/></span>
|
||||
<span class="rowvalue">{{=$ctx.globalDate(interestCalculatedFromDate)}}</span>
|
||||
<span class="rowvalue">{{=$ctx.globalDate(interestChargedFromDate)}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if open}}
|
||||
{{#if actualDisbursementDate !== null}}
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.expected.maturity.on"/></span>
|
||||
<span class="rowvalue">{{=$ctx.globalDate(expectedMaturityDate)}}</span>
|
||||
@@ -634,23 +638,24 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.repayments"/></span>
|
||||
<span class="rowvalue">{{=numberOfRepayments}} every {{=repaymentFrequencyNumber}} {{=repaymentFrequencyTypeText}}</span>
|
||||
<span class="rowvalue">{{=numberOfRepayments}} every {{=repaymentEvery}} {{=repaymentFrequencyType.value}}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.amortization"/></span>
|
||||
<span class="rowvalue">{{=amortizationMethodText}}</span>
|
||||
<span class="rowvalue">{{=amortizationType.value}}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.interest"/></span>
|
||||
<span class="rowvalue">{{=$ctx.decimal(interestRatePerYear, 4)}}% per annum ({{=$ctx.decimal(interestRatePerPeriod, 4)}}% per {{=interestPeriodFrequencyText}}) - {{=interestMethodText}}</span>
|
||||
<span class="rowvalue">{{=$ctx.decimal(annualInterestRate, 4)}}% per annum ({{=$ctx.decimal(interestRatePerPeriod, 4)}}% {{=interestRateFrequencyType.value}}) - {{=interestType.value}}</span>
|
||||
</div>
|
||||
|
||||
<div id="loanadditionaldata{{=id}}"></div>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
<!-- second loan tab -->
|
||||
<div id="schedule{{=id}}" style="margin-top: 5px;">
|
||||
<table id="summarytable{{=id}}" class="pretty displayschedule">
|
||||
<div id="schedule{{=basicDetails.id}}" style="margin-top: 5px;">
|
||||
<table id="summarytable{{=basicDetails.id}}" class="pretty displayschedule">
|
||||
<caption><spring:message code="tab.client.account.loan.schedule.table.summary.caption"/></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -690,7 +695,7 @@
|
||||
|
||||
<br/>
|
||||
|
||||
<table id="repaymentschedule_todate{{=id}}" class="pretty displayschedule">
|
||||
<table id="repaymentschedule_todate{{=basicDetails.id}}" class="pretty displayschedule">
|
||||
<caption><spring:message code="tab.client.account.loan.schedule.table.repaymentschedule.caption"/></caption>
|
||||
<colgroup span="2"></colgroup>
|
||||
<colgroup span="3">
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.mifosng.platform;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.mifosng.data.LoanAccountData;
|
||||
|
||||
public class ClosedLoanComparator implements Comparator<LoanAccountData> {
|
||||
|
||||
@Override
|
||||
public int compare(final LoanAccountData o1,
|
||||
final LoanAccountData o2) {
|
||||
return o1.getClosedOnDate().compareTo(o2.getClosedOnDate());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,10 +17,10 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.mifosng.platform.api.commands.NoteCommand;
|
||||
import org.mifosng.platform.api.data.ClientData;
|
||||
import org.mifosng.platform.api.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.EntityIdentifier;
|
||||
import org.mifosng.platform.api.data.NoteData;
|
||||
import org.mifosng.platform.api.data.OfficeLookup;
|
||||
|
||||
@@ -18,9 +18,6 @@ import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.LoanAccountData;
|
||||
import org.mifosng.data.LoanRepaymentData;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.commands.AdjustLoanTransactionCommand;
|
||||
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
|
||||
import org.mifosng.platform.api.commands.LoanStateTransitionCommand;
|
||||
@@ -28,6 +25,9 @@ import org.mifosng.platform.api.commands.LoanTransactionCommand;
|
||||
import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand;
|
||||
import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
|
||||
import org.mifosng.platform.api.data.EntityIdentifier;
|
||||
import org.mifosng.platform.api.data.LoanAccountData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.NewLoanData;
|
||||
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
||||
import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import java.math.BigDecimal;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
|
||||
@XmlRootElement
|
||||
public class SubmitLoanApplicationCommand {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
|
||||
@JsonFilter("myFilter")
|
||||
public class ConfigurationData implements Serializable {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||
|
||||
@JsonFilter("loanFilter")
|
||||
public class LoanAccountData {
|
||||
|
||||
private Long id;
|
||||
private LoanBasicDetailsData basicDetails;
|
||||
private DerivedLoanData loanData;
|
||||
private LoanPermissionData permissions;
|
||||
|
||||
protected LoanAccountData() {
|
||||
//
|
||||
}
|
||||
|
||||
public LoanAccountData(Long id, LoanBasicDetailsData basicDetails, DerivedLoanData loanData, LoanPermissionData permissions) {
|
||||
this.id = id;
|
||||
this.basicDetails = basicDetails;
|
||||
this.loanData = loanData;
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public LoanPermissionData getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void setPermissions(LoanPermissionData permissions) {
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
public LoanBasicDetailsData getBasicDetails() {
|
||||
return basicDetails;
|
||||
}
|
||||
|
||||
public void setBasicDetails(LoanBasicDetailsData basicDetails) {
|
||||
this.basicDetails = basicDetails;
|
||||
}
|
||||
|
||||
public DerivedLoanData getLoanData() {
|
||||
return loanData;
|
||||
}
|
||||
|
||||
public void setLoanData(DerivedLoanData loanData) {
|
||||
this.loanData = loanData;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
+363
@@ -0,0 +1,363 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.Months;
|
||||
|
||||
public class LoanBasicDetailsData {
|
||||
|
||||
private Long id;
|
||||
private String externalId;
|
||||
private String loanProductName;
|
||||
|
||||
private LocalDate submittedOnDate;
|
||||
private LocalDate approvedOnDate;
|
||||
private LocalDate expectedDisbursementDate;
|
||||
private LocalDate actualDisbursementDate;
|
||||
private LocalDate expectedFirstRepaymentOnDate;
|
||||
private LocalDate interestChargedFromDate;
|
||||
private LocalDate closedOnDate;
|
||||
private LocalDate expectedMaturityDate;
|
||||
|
||||
private MoneyData principal;
|
||||
private MoneyData inArrearsTolerance;
|
||||
|
||||
private Integer numberOfRepayments;
|
||||
private Integer repaymentEvery;
|
||||
private BigDecimal interestRatePerPeriod;
|
||||
private BigDecimal annualInterestRate;
|
||||
|
||||
private EnumOptionData repaymentFrequencyType;
|
||||
private EnumOptionData interestRateFrequencyType;
|
||||
private EnumOptionData amortizationType;
|
||||
private EnumOptionData interestType;
|
||||
private EnumOptionData interestCalculationPeriodType;
|
||||
|
||||
private String lifeCycleStatusText;
|
||||
private LocalDate lifeCycleStatusDate;
|
||||
|
||||
protected LoanBasicDetailsData() {
|
||||
//
|
||||
}
|
||||
|
||||
public LoanBasicDetailsData(Long id, String externalId,
|
||||
String loanProductName, LocalDate closedOnDate,
|
||||
LocalDate submittedOnDate, LocalDate approvedOnDate,
|
||||
LocalDate expectedDisbursedOnLocalDate,
|
||||
LocalDate acutalDisbursedOnLocalDate,
|
||||
LocalDate expectedMaturityDate,
|
||||
LocalDate expectedFirstRepaymentOnDate,
|
||||
LocalDate interestChargedFromDate,
|
||||
MoneyData principal, MoneyData inArrearsTolerance, Integer numberOfRepayments, Integer repaymentEvery,
|
||||
BigDecimal interestRatePerPeriod, BigDecimal annualInterestRate,
|
||||
EnumOptionData repaymentFrequencyType, EnumOptionData interestRateFrequencyType, EnumOptionData amortizationType,
|
||||
EnumOptionData interestType, EnumOptionData interestCalculationPeriodType,
|
||||
String lifeCycleStatusText, LocalDate lifeCycleStatusDate) {
|
||||
this.id = id;
|
||||
this.externalId = externalId;
|
||||
this.loanProductName = loanProductName;
|
||||
this.closedOnDate = closedOnDate;
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
this.expectedDisbursementDate = expectedDisbursedOnLocalDate;
|
||||
actualDisbursementDate = acutalDisbursedOnLocalDate;
|
||||
this.expectedMaturityDate = expectedMaturityDate;
|
||||
this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate;
|
||||
this.interestChargedFromDate = interestChargedFromDate;
|
||||
this.principal = principal;
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
this.repaymentEvery = repaymentEvery;
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
this.annualInterestRate = annualInterestRate;
|
||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||
this.interestRateFrequencyType = interestRateFrequencyType;
|
||||
this.amortizationType = amortizationType;
|
||||
this.interestType = interestType;
|
||||
this.interestCalculationPeriodType = interestCalculationPeriodType;
|
||||
this.lifeCycleStatusText = lifeCycleStatusText;
|
||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||
}
|
||||
|
||||
public int getMaxSubmittedOnOffsetFromToday() {
|
||||
return Days.daysBetween(new DateTime(),
|
||||
this.getSubmittedOnDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
|
||||
public int getMaxApprovedOnOffsetFromToday() {
|
||||
|
||||
int offset = 0;
|
||||
if (this.getApprovedOnDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(),
|
||||
this.getApprovedOnDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
public int getMaxDisbursedOnOffsetFromToday() {
|
||||
|
||||
int offset = 0;
|
||||
if (this.getActualDisbursementDate() != null) {
|
||||
offset = Days.daysBetween(new DateTime(),
|
||||
this.getActualDisbursementDate().toDateMidnight().toDateTime())
|
||||
.getDays();
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
public int getActualLoanTermInDays() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public int getActualLoanTermInMonths() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
if (getClosedOnDate() != null) {
|
||||
closingDateToUse = getClosedOnDate();
|
||||
}
|
||||
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
|
||||
public int getLoanTermInDays() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
|
||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||
}
|
||||
|
||||
public int getLoanTermInMonths() {
|
||||
|
||||
LocalDate dateToUse = getExpectedDisbursementDate();
|
||||
if (getActualDisbursementDate() != null) {
|
||||
dateToUse = getActualDisbursementDate();
|
||||
}
|
||||
|
||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||
|
||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
|
||||
public void setExternalId(String externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
public String getLoanProductName() {
|
||||
return loanProductName;
|
||||
}
|
||||
|
||||
public void setLoanProductName(String loanProductName) {
|
||||
this.loanProductName = loanProductName;
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return submittedOnDate;
|
||||
}
|
||||
|
||||
public void setSubmittedOnDate(LocalDate submittedOnDate) {
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getApprovedOnDate() {
|
||||
return approvedOnDate;
|
||||
}
|
||||
|
||||
public void setApprovedOnDate(LocalDate approvedOnDate) {
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedDisbursementDate() {
|
||||
return expectedDisbursementDate;
|
||||
}
|
||||
|
||||
public void setExpectedDisbursementDate(LocalDate expectedDisbursementDate) {
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
}
|
||||
|
||||
public LocalDate getActualDisbursementDate() {
|
||||
return actualDisbursementDate;
|
||||
}
|
||||
|
||||
public void setActualDisbursementDate(LocalDate actualDisbursementDate) {
|
||||
this.actualDisbursementDate = actualDisbursementDate;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedFirstRepaymentOnDate() {
|
||||
return expectedFirstRepaymentOnDate;
|
||||
}
|
||||
|
||||
public void setExpectedFirstRepaymentOnDate(
|
||||
LocalDate expectedFirstRepaymentOnDate) {
|
||||
this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getInterestChargedFromDate() {
|
||||
return interestChargedFromDate;
|
||||
}
|
||||
|
||||
public void setInterestChargedFromDate(LocalDate interestChargedFromDate) {
|
||||
this.interestChargedFromDate = interestChargedFromDate;
|
||||
}
|
||||
|
||||
public LocalDate getClosedOnDate() {
|
||||
return closedOnDate;
|
||||
}
|
||||
|
||||
public void setClosedOnDate(LocalDate closedOnDate) {
|
||||
this.closedOnDate = closedOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedMaturityDate() {
|
||||
return expectedMaturityDate;
|
||||
}
|
||||
|
||||
public void setExpectedMaturityDate(LocalDate expectedMaturityDate) {
|
||||
this.expectedMaturityDate = expectedMaturityDate;
|
||||
}
|
||||
|
||||
public MoneyData getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
|
||||
public void setPrincipal(MoneyData principal) {
|
||||
this.principal = principal;
|
||||
}
|
||||
|
||||
public MoneyData getInArrearsTolerance() {
|
||||
return inArrearsTolerance;
|
||||
}
|
||||
|
||||
public void setInArrearsTolerance(MoneyData inArrearsTolerance) {
|
||||
this.inArrearsTolerance = inArrearsTolerance;
|
||||
}
|
||||
|
||||
public Integer getNumberOfRepayments() {
|
||||
return numberOfRepayments;
|
||||
}
|
||||
|
||||
public void setNumberOfRepayments(Integer numberOfRepayments) {
|
||||
this.numberOfRepayments = numberOfRepayments;
|
||||
}
|
||||
|
||||
public Integer getRepaymentEvery() {
|
||||
return repaymentEvery;
|
||||
}
|
||||
|
||||
public void setRepaymentEvery(Integer repaymentEvery) {
|
||||
this.repaymentEvery = repaymentEvery;
|
||||
}
|
||||
|
||||
public BigDecimal getInterestRatePerPeriod() {
|
||||
return interestRatePerPeriod;
|
||||
}
|
||||
|
||||
public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) {
|
||||
this.interestRatePerPeriod = interestRatePerPeriod;
|
||||
}
|
||||
|
||||
public BigDecimal getAnnualInterestRate() {
|
||||
return annualInterestRate;
|
||||
}
|
||||
|
||||
public void setAnnualInterestRate(BigDecimal annualInterestRate) {
|
||||
this.annualInterestRate = annualInterestRate;
|
||||
}
|
||||
|
||||
public EnumOptionData getRepaymentFrequencyType() {
|
||||
return repaymentFrequencyType;
|
||||
}
|
||||
|
||||
public void setRepaymentFrequencyType(EnumOptionData repaymentFrequencyType) {
|
||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestRateFrequencyType() {
|
||||
return interestRateFrequencyType;
|
||||
}
|
||||
|
||||
public void setInterestRateFrequencyType(
|
||||
EnumOptionData interestRateFrequencyType) {
|
||||
this.interestRateFrequencyType = interestRateFrequencyType;
|
||||
}
|
||||
|
||||
public EnumOptionData getAmortizationType() {
|
||||
return amortizationType;
|
||||
}
|
||||
|
||||
public void setAmortizationType(EnumOptionData amortizationType) {
|
||||
this.amortizationType = amortizationType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestType() {
|
||||
return interestType;
|
||||
}
|
||||
|
||||
public void setInterestType(EnumOptionData interestType) {
|
||||
this.interestType = interestType;
|
||||
}
|
||||
|
||||
public EnumOptionData getInterestCalculationPeriodType() {
|
||||
return interestCalculationPeriodType;
|
||||
}
|
||||
|
||||
public void setInterestCalculationPeriodType(
|
||||
EnumOptionData interestCalculationPeriodType) {
|
||||
this.interestCalculationPeriodType = interestCalculationPeriodType;
|
||||
}
|
||||
|
||||
public String getLifeCycleStatusText() {
|
||||
return lifeCycleStatusText;
|
||||
}
|
||||
|
||||
public void setLifeCycleStatusText(String lifeCycleStatusText) {
|
||||
this.lifeCycleStatusText = lifeCycleStatusText;
|
||||
}
|
||||
|
||||
public LocalDate getLifeCycleStatusDate() {
|
||||
return lifeCycleStatusDate;
|
||||
}
|
||||
|
||||
public void setLifeCycleStatusDate(LocalDate lifeCycleStatusDate) {
|
||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
public class LoanPermissionData {
|
||||
|
||||
private boolean waiveAllowed;
|
||||
private boolean makeRepaymentAllowed;
|
||||
private boolean rejectAllowed;
|
||||
private boolean withdrawnByApplicantAllowed;
|
||||
private boolean undoApprovalAllowed;
|
||||
private boolean disbursalAllowed;
|
||||
private boolean undoDisbursalAllowed;
|
||||
|
||||
private boolean pendingApproval;
|
||||
private boolean waitingForDisbursal;
|
||||
|
||||
protected LoanPermissionData() {
|
||||
//
|
||||
}
|
||||
|
||||
public LoanPermissionData(boolean waiveAllowed,
|
||||
boolean makeRepaymentAllowed, boolean rejectAllowed,
|
||||
boolean withdrawnByApplicantAllowed, boolean undoApprovalAllowed,
|
||||
boolean undoDisbursalAllowed, boolean disbursalAllowed, boolean pendingApproval, boolean waitingForDisbursal) {
|
||||
this.waiveAllowed = waiveAllowed;
|
||||
this.makeRepaymentAllowed = makeRepaymentAllowed;
|
||||
this.rejectAllowed = rejectAllowed;
|
||||
this.withdrawnByApplicantAllowed = withdrawnByApplicantAllowed;
|
||||
this.undoApprovalAllowed = undoApprovalAllowed;
|
||||
this.undoDisbursalAllowed = undoDisbursalAllowed;
|
||||
this.disbursalAllowed = disbursalAllowed;
|
||||
this.pendingApproval = pendingApproval;
|
||||
this.waitingForDisbursal = waitingForDisbursal;
|
||||
}
|
||||
|
||||
public boolean isAnyActionOnLoanAllowed() {
|
||||
return isRejectAllowed() || isWithdrawnByApplicantAllowed() || isPendingApproval() || isUndoDisbursalAllowed() || isMakeRepaymentAllowed();
|
||||
}
|
||||
|
||||
public boolean isWaiveAllowed() {
|
||||
return waiveAllowed;
|
||||
}
|
||||
|
||||
public void setWaiveAllowed(boolean waiveAllowed) {
|
||||
this.waiveAllowed = waiveAllowed;
|
||||
}
|
||||
|
||||
public boolean isMakeRepaymentAllowed() {
|
||||
return makeRepaymentAllowed;
|
||||
}
|
||||
|
||||
public void setMakeRepaymentAllowed(boolean makeRepaymentAllowed) {
|
||||
this.makeRepaymentAllowed = makeRepaymentAllowed;
|
||||
}
|
||||
|
||||
public boolean isRejectAllowed() {
|
||||
return rejectAllowed;
|
||||
}
|
||||
|
||||
public void setRejectAllowed(boolean rejectAllowed) {
|
||||
this.rejectAllowed = rejectAllowed;
|
||||
}
|
||||
|
||||
public boolean isWithdrawnByApplicantAllowed() {
|
||||
return withdrawnByApplicantAllowed;
|
||||
}
|
||||
|
||||
public void setWithdrawnByApplicantAllowed(boolean withdrawnByApplicantAllowed) {
|
||||
this.withdrawnByApplicantAllowed = withdrawnByApplicantAllowed;
|
||||
}
|
||||
|
||||
public boolean isUndoApprovalAllowed() {
|
||||
return undoApprovalAllowed;
|
||||
}
|
||||
|
||||
public void setUndoApprovalAllowed(boolean undoApprovalAllowed) {
|
||||
this.undoApprovalAllowed = undoApprovalAllowed;
|
||||
}
|
||||
|
||||
public boolean isDisbursalAllowed() {
|
||||
return disbursalAllowed;
|
||||
}
|
||||
|
||||
public void setDisbursalAllowed(boolean disbursalAllowed) {
|
||||
this.disbursalAllowed = disbursalAllowed;
|
||||
}
|
||||
|
||||
public boolean isPendingApproval() {
|
||||
return pendingApproval;
|
||||
}
|
||||
|
||||
public void setPendingApproval(boolean pendingApproval) {
|
||||
this.pendingApproval = pendingApproval;
|
||||
}
|
||||
|
||||
public boolean isWaitingForDisbursal() {
|
||||
return waitingForDisbursal;
|
||||
}
|
||||
|
||||
public void setWaitingForDisbursal(boolean waitingForDisbursal) {
|
||||
this.waitingForDisbursal = waitingForDisbursal;
|
||||
}
|
||||
|
||||
public boolean isUndoDisbursalAllowed() {
|
||||
return undoDisbursalAllowed;
|
||||
}
|
||||
|
||||
public void setUndoDisbursalAllowed(boolean undoDisbursalAllowed) {
|
||||
this.undoDisbursalAllowed = undoDisbursalAllowed;
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,6 @@ import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||
import org.joda.time.DateTime;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.MoneyData;
|
||||
|
||||
@JsonFilter("myFilter")
|
||||
public class LoanProductData implements Serializable {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
|
||||
@JsonFilter("myFilter")
|
||||
public class NewLoanData implements Serializable {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data;
|
||||
package org.mifosng.platform.api.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
+1
-1
@@ -2,8 +2,8 @@ package org.mifosng.platform.client.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosng.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.ClientData;
|
||||
import org.mifosng.platform.api.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.NoteData;
|
||||
|
||||
public interface ClientReadPlatformService {
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ import javax.sql.DataSource;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.data.ClientLoanAccountSummaryData;
|
||||
import org.mifosng.platform.api.data.AppUserData;
|
||||
import org.mifosng.platform.api.data.ClientData;
|
||||
import org.mifosng.platform.api.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.platform.api.data.ClientLoanAccountSummaryData;
|
||||
import org.mifosng.platform.api.data.NoteData;
|
||||
import org.mifosng.platform.api.data.OfficeData;
|
||||
import org.mifosng.platform.api.data.OfficeLookup;
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ package org.mifosng.platform.configuration.service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.ConfigurationData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.mifosng.platform.currency.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
|
||||
public interface CurrencyReadPlatformService {
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.infrastructure.JdbcSupport;
|
||||
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||
import org.mifosng.platform.user.domain.AppUser;
|
||||
|
||||
+7
-7
@@ -5,13 +5,13 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.DerivedLoanData;
|
||||
import org.mifosng.data.LoanAccountSummaryData;
|
||||
import org.mifosng.data.LoanRepaymentData;
|
||||
import org.mifosng.data.LoanRepaymentPeriodData;
|
||||
import org.mifosng.data.LoanRepaymentScheduleData;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.DerivedLoanData;
|
||||
import org.mifosng.platform.api.data.LoanAccountSummaryData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentPeriodData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentScheduleData;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
import org.mifosng.platform.currency.domain.Money;
|
||||
|
||||
|
||||
@@ -25,12 +25,16 @@ import org.hibernate.annotations.LazyCollection;
|
||||
import org.hibernate.annotations.LazyCollectionOption;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.DerivedLoanData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.DerivedLoanData;
|
||||
import org.mifosng.platform.api.data.EnumOptionData;
|
||||
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.client.domain.Client;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
import org.mifosng.platform.currency.domain.Money;
|
||||
import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
|
||||
import org.mifosng.platform.loanproduct.service.LoanEnumerations;
|
||||
import org.mifosng.platform.organisation.domain.Organisation;
|
||||
import org.mifosng.platform.user.domain.AppUser;
|
||||
|
||||
@@ -86,7 +90,7 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "interest_calculated_from_date")
|
||||
private Date interestCalculatedFromDate;
|
||||
private Date interestChargedFromDate;
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
@Column(name = "disbursedon_date")
|
||||
@@ -173,7 +177,7 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
|
||||
public void submitApplication(final LocalDate submittedOn, final LocalDate expectedDisbursementDate,
|
||||
LocalDate repaymentsStartingFromDate, LocalDate interestCalculatedFromDate, LoanLifecycleStateMachine lifecycleStateMachine) {
|
||||
LocalDate repaymentsStartingFromDate, LocalDate interestChargedFromDate, LoanLifecycleStateMachine lifecycleStateMachine) {
|
||||
|
||||
this.loanStatus = lifecycleStateMachine.transition(LoanEvent.LOAN_CREATED, this.loanStatus);
|
||||
|
||||
@@ -191,8 +195,8 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
this.expectedFirstRepaymentOnDate = repaymentsStartingFromDate.toDateMidnight().toDate();
|
||||
}
|
||||
|
||||
if (interestCalculatedFromDate != null) {
|
||||
this.interestCalculatedFromDate = interestCalculatedFromDate.toDateMidnight().toDate();
|
||||
if (interestChargedFromDate != null) {
|
||||
this.interestChargedFromDate = interestChargedFromDate.toDateMidnight().toDate();
|
||||
}
|
||||
|
||||
if (new LocalDate(this.submittedOnDate).isAfter(new LocalDate())) {
|
||||
@@ -724,6 +728,14 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
public Date getExpectedDisbursedOnDate() {
|
||||
return this.expectedDisbursedOnDate;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedDisbursedOnLocalDate() {
|
||||
LocalDate expectedDisbursementDate = null;
|
||||
if (this.expectedDisbursedOnDate != null) {
|
||||
expectedDisbursementDate = new LocalDate(this.expectedDisbursedOnDate);
|
||||
}
|
||||
return expectedDisbursementDate;
|
||||
}
|
||||
|
||||
public LocalDate getExpectedFirstRepaymentOnDate() {
|
||||
LocalDate firstRepaymentDate = null;
|
||||
@@ -734,7 +746,7 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
|
||||
public LocalDate getDisbursementDate() {
|
||||
LocalDate disbursementDate = new LocalDate(this.expectedDisbursedOnDate);
|
||||
LocalDate disbursementDate = getExpectedDisbursedOnLocalDate();
|
||||
if (this.disbursedOnDate != null) {
|
||||
disbursementDate = new LocalDate(this.disbursedOnDate);
|
||||
}
|
||||
@@ -923,19 +935,17 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
return this.loanRepaymentScheduleDetail.getCurrency();
|
||||
}
|
||||
|
||||
public LocalDate getInterestCalculatedFromDate() {
|
||||
|
||||
LocalDate interestCalculatedFrom = null;
|
||||
if (this.interestCalculatedFromDate != null) {
|
||||
interestCalculatedFrom = new LocalDate(this.interestCalculatedFromDate);
|
||||
public LocalDate getInterestChargedFromDate() {
|
||||
LocalDate interestChargedFrom = null;
|
||||
if (this.interestChargedFromDate != null) {
|
||||
interestChargedFrom = new LocalDate(this.interestChargedFromDate);
|
||||
}
|
||||
|
||||
return interestCalculatedFrom;
|
||||
return interestChargedFrom;
|
||||
}
|
||||
|
||||
public LocalDate getLoanStatusSinceDate() {
|
||||
|
||||
LocalDate statusSinceDate = new LocalDate(this.submittedOnDate);
|
||||
LocalDate statusSinceDate = getSubmittedOnDate();
|
||||
if (isApproved()) {
|
||||
statusSinceDate = new LocalDate(this.approvedOnDate);
|
||||
}
|
||||
@@ -950,4 +960,30 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
return statusSinceDate;
|
||||
}
|
||||
|
||||
public LoanBasicDetailsData toBasicDetailsData(CurrencyData currencyData) {
|
||||
|
||||
Money loanPrincipal = this.loanRepaymentScheduleDetail.getPrincipal();
|
||||
MoneyData principal = MoneyData.of(currencyData, loanPrincipal.getAmount());
|
||||
|
||||
Money loanArrearsTolerance = this.loanRepaymentScheduleDetail.getInArrearsTolerance();
|
||||
MoneyData tolerance = MoneyData.of(currencyData, loanArrearsTolerance.getAmount());
|
||||
|
||||
EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(this.loanRepaymentScheduleDetail.getRepaymentPeriodFrequencyType());
|
||||
EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(this.loanRepaymentScheduleDetail.getInterestPeriodFrequencyType());
|
||||
EnumOptionData amortizationType = LoanEnumerations.amortizationType(this.loanRepaymentScheduleDetail.getAmortizationMethod());
|
||||
EnumOptionData interestType = LoanEnumerations.interestType(this.loanRepaymentScheduleDetail.getInterestMethod());
|
||||
EnumOptionData interestCalculationPeriodType = LoanEnumerations.interestCalculationPeriodType(this.loanRepaymentScheduleDetail.getInterestCalculationPeriodMethod());
|
||||
|
||||
return new LoanBasicDetailsData(getId(), this.externalId, this.loanProduct.getName(),
|
||||
getClosedOnDate(), getSubmittedOnDate(), getApprovedOnDate(), getExpectedDisbursedOnLocalDate(), getDisbursedOnDate(),
|
||||
getExpectedMaturityDate(), getExpectedFirstRepaymentOnDate(), getInterestChargedFromDate(), principal, tolerance,
|
||||
this.loanRepaymentScheduleDetail.getNumberOfRepayments(), this.loanRepaymentScheduleDetail.getRepayEvery(),
|
||||
this.loanRepaymentScheduleDetail.getNominalInterestRatePerPeriod(), this.loanRepaymentScheduleDetail.getAnnualNominalInterestRate(),
|
||||
repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, getLoanStatusDisplayName(), getLoanStatusSinceDate());
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.loanRepaymentScheduleDetail.getPrincipal().getCurrencyCode();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.mifosng.platform.loan.domain;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.mifosng.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentData;
|
||||
|
||||
|
||||
public class LoanRepaymentDataComparator implements Comparator<LoanRepaymentData> {
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package org.mifosng.platform.loan.service;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
|
||||
public interface CalculationPlatformService {
|
||||
|
||||
|
||||
+3
-3
@@ -3,10 +3,10 @@ package org.mifosng.platform.loan.service;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.currency.domain.ApplicationCurrency;
|
||||
import org.mifosng.platform.currency.domain.ApplicationCurrencyRepository;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
|
||||
@@ -6,10 +6,10 @@ import static org.mifosng.platform.Specifications.productThatMatches;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.client.domain.Client;
|
||||
import org.mifosng.platform.client.domain.ClientRepository;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package org.mifosng.platform.loan.service;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package org.mifosng.platform.loan.service;
|
||||
|
||||
import org.mifosng.data.LoanAccountData;
|
||||
import org.mifosng.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.LoanAccountData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.NewLoanData;
|
||||
|
||||
public interface LoanReadPlatformService {
|
||||
|
||||
+59
-78
@@ -7,14 +7,16 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.DerivedLoanData;
|
||||
import org.mifosng.data.LoanAccountData;
|
||||
import org.mifosng.data.LoanRepaymentData;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.ClientData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.DerivedLoanData;
|
||||
import org.mifosng.platform.api.data.LoanAccountData;
|
||||
import org.mifosng.platform.api.data.LoanBasicDetailsData;
|
||||
import org.mifosng.platform.api.data.LoanPermissionData;
|
||||
import org.mifosng.platform.api.data.LoanProductData;
|
||||
import org.mifosng.platform.api.data.LoanProductLookup;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.NewLoanData;
|
||||
import org.mifosng.platform.client.service.ClientReadPlatformService;
|
||||
import org.mifosng.platform.currency.domain.ApplicationCurrency;
|
||||
@@ -66,16 +68,13 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
// need of loan information.
|
||||
AppUser currentUser = context.authenticatedUser();
|
||||
|
||||
Loan loan = this.loanRepository.findOne(loansThatMatch(
|
||||
currentUser.getOrganisation(), loanId));
|
||||
Loan loan = this.loanRepository.findOne(loansThatMatch(currentUser.getOrganisation(), loanId));
|
||||
if (loan == null) {
|
||||
throw new LoanNotFoundException(loanId);
|
||||
}
|
||||
|
||||
final String currencyCode = loan.getLoanRepaymentScheduleDetail()
|
||||
.getPrincipal().getCurrencyCode();
|
||||
ApplicationCurrency currency = this.applicationCurrencyRepository
|
||||
.findOneByCode(currencyCode);
|
||||
final String currencyCode = loan.getCurrencyCode();
|
||||
ApplicationCurrency currency = this.applicationCurrencyRepository.findOneByCode(currencyCode);
|
||||
if (currency == null) {
|
||||
throw new CurrencyNotFoundException(currencyCode);
|
||||
}
|
||||
@@ -84,47 +83,23 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
currency.getName(), currency.getDecimalPlaces(),
|
||||
currency.getDisplaySymbol(), currency.getNameCode());
|
||||
|
||||
LoanAccountData loanData = convertToData(loan, currencyData);
|
||||
|
||||
return loanData;
|
||||
return convertToData(loan, currencyData);
|
||||
}
|
||||
|
||||
private LoanAccountData convertToData(final Loan realLoan,
|
||||
CurrencyData currencyData) {
|
||||
private LoanAccountData convertToData(final Loan realLoan, CurrencyData currencyData) {
|
||||
|
||||
DerivedLoanData loanData = realLoan.deriveLoanData(currencyData);
|
||||
|
||||
LocalDate expectedDisbursementDate = null;
|
||||
if (realLoan.getExpectedDisbursedOnDate() != null) {
|
||||
expectedDisbursementDate = new LocalDate(
|
||||
realLoan.getExpectedDisbursedOnDate());
|
||||
}
|
||||
|
||||
Money loanPrincipal = realLoan.getLoanRepaymentScheduleDetail()
|
||||
.getPrincipal();
|
||||
MoneyData principal = MoneyData.of(currencyData,
|
||||
loanPrincipal.getAmount());
|
||||
|
||||
Money loanArrearsTolerance = realLoan.getInArrearsTolerance();
|
||||
MoneyData tolerance = MoneyData.of(currencyData,
|
||||
loanArrearsTolerance.getAmount());
|
||||
|
||||
Money interestRebate = realLoan.getInterestRebateOwed();
|
||||
MoneyData interestRebateOwed = MoneyData.of(currencyData,
|
||||
interestRebate.getAmount());
|
||||
|
||||
boolean interestRebateOutstanding = false; // realLoan.isInterestRebateOutstanding(),
|
||||
|
||||
LoanBasicDetailsData basicDetails = realLoan.toBasicDetailsData(currencyData);
|
||||
|
||||
// permissions
|
||||
boolean waiveAllowed = loanData.getSummary().isWaiveAllowed(tolerance)
|
||||
boolean waiveAllowed = loanData.getSummary().isWaiveAllowed(basicDetails.getInArrearsTolerance())
|
||||
&& realLoan.isNotClosed();
|
||||
boolean undoDisbursalAllowed = realLoan.isDisbursed()
|
||||
&& realLoan.isOpenWithNoRepaymentMade();
|
||||
boolean makeRepaymentAllowed = realLoan.isDisbursed()
|
||||
&& realLoan.isNotClosed();
|
||||
|
||||
LocalDate loanStatusDate = realLoan.getLoanStatusSinceDate();
|
||||
|
||||
boolean rejectAllowed = realLoan.isNotApproved()
|
||||
&& realLoan.isNotDisbursed() && realLoan.isNotClosed();
|
||||
boolean withdrawnByApplicantAllowed = realLoan.isNotDisbursed()
|
||||
@@ -133,45 +108,51 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
&& realLoan.isNotClosed();
|
||||
boolean disbursalAllowed = realLoan.isApproved()
|
||||
&& realLoan.isNotDisbursed() && realLoan.isNotClosed();
|
||||
|
||||
LoanPermissionData permissions = new LoanPermissionData(waiveAllowed, makeRepaymentAllowed, rejectAllowed, withdrawnByApplicantAllowed,
|
||||
undoApprovalAllowed, undoDisbursalAllowed, disbursalAllowed, realLoan.isSubmittedAndPendingApproval(),
|
||||
realLoan.isWaitingForDisbursal());
|
||||
|
||||
return new LoanAccountData(realLoan.getId(), basicDetails, loanData, permissions);
|
||||
|
||||
return new LoanAccountData(realLoan.isClosed(), realLoan.isOpen(),
|
||||
realLoan.isOpenWithRepaymentMade(), interestRebateOutstanding,
|
||||
realLoan.isSubmittedAndPendingApproval(),
|
||||
realLoan.isWaitingForDisbursal(), undoDisbursalAllowed,
|
||||
makeRepaymentAllowed, rejectAllowed,
|
||||
withdrawnByApplicantAllowed, undoApprovalAllowed,
|
||||
disbursalAllowed, realLoan.getLoanStatusDisplayName(),
|
||||
loanStatusDate, realLoan.getId(), realLoan.getExternalId(),
|
||||
realLoan.getLoanProduct().getName(),
|
||||
realLoan.getClosedOnDate(), realLoan.getSubmittedOnDate(),
|
||||
realLoan.getApprovedOnDate(), expectedDisbursementDate,
|
||||
realLoan.getDisbursedOnDate(),
|
||||
realLoan.getExpectedMaturityDate(),
|
||||
realLoan.getExpectedFirstRepaymentOnDate(),
|
||||
realLoan.getInterestCalculatedFromDate(), principal, realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getAnnualNominalInterestRate(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getNominalInterestRatePerPeriod(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getInterestPeriodFrequencyType().getValue(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getInterestPeriodFrequencyType().toString(), realLoan
|
||||
.getLoanRepaymentScheduleDetail().getInterestMethod()
|
||||
.getValue(), realLoan.getLoanRepaymentScheduleDetail()
|
||||
.getInterestMethod().toString(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getAmortizationMethod().getValue(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getAmortizationMethod().toString(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getNumberOfRepayments(), realLoan
|
||||
.getLoanRepaymentScheduleDetail().getRepayEvery(),
|
||||
realLoan.getLoanRepaymentScheduleDetail()
|
||||
.getRepaymentPeriodFrequencyType().getValue(), realLoan
|
||||
.getLoanRepaymentScheduleDetail()
|
||||
.getRepaymentPeriodFrequencyType().toString(),
|
||||
tolerance, loanData, waiveAllowed, interestRebateOwed);
|
||||
// return new LoanAccountData(realLoan.isClosed(), realLoan.isOpen(),
|
||||
// realLoan.isOpenWithRepaymentMade(), interestRebateOutstanding,
|
||||
// realLoan.isSubmittedAndPendingApproval(),
|
||||
// realLoan.isWaitingForDisbursal(), undoDisbursalAllowed,
|
||||
// makeRepaymentAllowed, rejectAllowed,
|
||||
// withdrawnByApplicantAllowed, undoApprovalAllowed,
|
||||
// disbursalAllowed, realLoan.getLoanStatusDisplayName(),
|
||||
// loanStatusDate, realLoan.getId(), realLoan.getExternalId(),
|
||||
// realLoan.getLoanProduct().getName(),
|
||||
// realLoan.getClosedOnDate(), realLoan.getSubmittedOnDate(),
|
||||
// realLoan.getApprovedOnDate(), expectedDisbursementDate,
|
||||
// realLoan.getDisbursedOnDate(),
|
||||
// realLoan.getExpectedMaturityDate(),
|
||||
// realLoan.getExpectedFirstRepaymentOnDate(),
|
||||
// realLoan.getInterestCalculatedFromDate(), principal, realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getAnnualNominalInterestRate(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getNominalInterestRatePerPeriod(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getInterestPeriodFrequencyType().getValue(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getInterestPeriodFrequencyType().toString(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail().getInterestMethod()
|
||||
// .getValue(), realLoan.getLoanRepaymentScheduleDetail()
|
||||
// .getInterestMethod().toString(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getAmortizationMethod().getValue(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getAmortizationMethod().toString(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getNumberOfRepayments(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail().getRepayEvery(),
|
||||
// realLoan.getLoanRepaymentScheduleDetail()
|
||||
// .getRepaymentPeriodFrequencyType().getValue(), realLoan
|
||||
// .getLoanRepaymentScheduleDetail()
|
||||
// .getRepaymentPeriodFrequencyType().toString(),
|
||||
// tolerance, loanData, waiveAllowed, interestRebateOwed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class LoanStateTransitionCommandValidator {
|
||||
|
||||
DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transition");
|
||||
|
||||
baseDataValidator.reset().parameter("loanId").value(command.getLoanId()).notNull();
|
||||
baseDataValidator.reset().parameter("loanId").value(command.getLoanId()).notNull().greaterThanZero();
|
||||
baseDataValidator.reset().parameter("eventDate").value(command.getEventLocalDate()).notNull();
|
||||
baseDataValidator.reset().parameter("note").value(command.getNote()).notExceedingLengthOf(1000);
|
||||
|
||||
|
||||
+7
-19
@@ -3,7 +3,7 @@ package org.mifosng.platform.loan.service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.platform.DataValidatorBuilder;
|
||||
import org.mifosng.platform.api.commands.LoanTransactionCommand;
|
||||
import org.mifosng.platform.api.data.ApiParameterError;
|
||||
import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
|
||||
@@ -17,27 +17,15 @@ public class LoanTransactionCommandValidator {
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
|
||||
List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
|
||||
if (command.getLoanId() == null || command.getLoanId().doubleValue() <= 0) {
|
||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.id.is.invalid", "The parameter loanId is invalid.", "loanId", command.getLoanId());
|
||||
dataValidationErrors.add(error);
|
||||
}
|
||||
DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("role");
|
||||
|
||||
if (command.getTransactionLocalDate() == null) {
|
||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.repayment.date.cannot.be.blank", "The parameter transactionDateFormatted cannot be blank.", "transactionDateFormatted");
|
||||
dataValidationErrors.add(error);
|
||||
}
|
||||
|
||||
if (command.getTransactionAmount() == null || command.getTransactionAmountValue().doubleValue() <= 0) {
|
||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.repayment.must.be.greater.than.zero", "The parameter transactionAmountFormatted less than zero.", "transactionAmountFormatted", command.getTransactionAmountValue());
|
||||
dataValidationErrors.add(error);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(command.getNote()) && command.getNote().length() > 1000) {
|
||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.note.exceeds.max.length", "The parameter comment exceeds max allowed size of {0}", "comment", 1000);
|
||||
dataValidationErrors.add(error);
|
||||
}
|
||||
baseDataValidator.reset().parameter("loanid").value(command.getLoanId()).notNull().greaterThanZero();
|
||||
baseDataValidator.reset().parameter("transactionDate").value(command.getTransactionLocalDate()).notNull();
|
||||
baseDataValidator.reset().parameter("transactionAmount").value(command.getTransactionAmount()).notNull().positiveAmount();
|
||||
baseDataValidator.reset().parameter("note").value(command.getNote()).notExceedingLengthOf(1000);
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) {
|
||||
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors);
|
||||
|
||||
+3
-3
@@ -7,8 +7,6 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.api.commands.AdjustLoanTransactionCommand;
|
||||
import org.mifosng.platform.api.commands.CalculateLoanScheduleCommand;
|
||||
import org.mifosng.platform.api.commands.LoanStateTransitionCommand;
|
||||
@@ -16,6 +14,8 @@ import org.mifosng.platform.api.commands.LoanTransactionCommand;
|
||||
import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand;
|
||||
import org.mifosng.platform.api.commands.UndoStateTransitionCommand;
|
||||
import org.mifosng.platform.api.data.EntityIdentifier;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.client.domain.Note;
|
||||
import org.mifosng.platform.client.domain.NoteRepository;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
@@ -263,7 +263,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
if (loan.isRepaymentScheduleRegenerationRequiredForDisbursement(actualDisbursementDate)) {
|
||||
|
||||
LocalDate repaymentsStartingFromDate = loan.getExpectedFirstRepaymentOnDate();
|
||||
LocalDate interestCalculatedFromDate = loan.getInterestCalculatedFromDate();
|
||||
LocalDate interestCalculatedFromDate = loan.getInterestChargedFromDate();
|
||||
|
||||
Number principalAsDecimal = loan.getLoanRepaymentScheduleDetail().getPrincipal().getAmount();
|
||||
String currencyCode = loan.getLoanRepaymentScheduleDetail().getPrincipal().getCurrencyCode();
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class SubmitLoanApplicationCommandValidator {
|
||||
|
||||
if (command.getSubmittedOnLocalDate() == null) {
|
||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.submitted.on.date.cannot.be.blank",
|
||||
"The parameter submittedOnDate cannot be empty.", "submittedOnDateFormatted");
|
||||
"The parameter submittedOnDate cannot be empty.", "submittedOnDate");
|
||||
dataValidationErrors.add(error);
|
||||
} else {
|
||||
if (command.getSubmittedOnLocalDate().isAfter(command.getExpectedDisbursementLocalDate())) {
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.EnumOptionData;
|
||||
import org.mifosng.platform.api.data.LoanProductData;
|
||||
import org.mifosng.platform.api.data.LoanProductLookup;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.currency.service.CurrencyReadPlatformService;
|
||||
import org.mifosng.platform.exceptions.LoanProductNotFoundException;
|
||||
import org.mifosng.platform.infrastructure.JdbcSupport;
|
||||
|
||||
+4
-4
@@ -6,10 +6,10 @@ import java.util.List;
|
||||
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
import org.mifosng.platform.currency.domain.Money;
|
||||
import org.mifosng.platform.loan.domain.AmortizationMethod;
|
||||
|
||||
+4
-4
@@ -7,10 +7,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.platform.currency.domain.Money;
|
||||
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package org.mifosng.platform.loanschedule.domain;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.LoanSchedule;
|
||||
import org.mifosng.platform.loan.domain.LoanProductRelatedDetail;
|
||||
|
||||
public interface LoanScheduleGenerator {
|
||||
|
||||
+6
-6
@@ -10,12 +10,12 @@ import java.util.List;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mifosng.data.CurrencyData;
|
||||
import org.mifosng.data.DerivedLoanData;
|
||||
import org.mifosng.data.LoanRepaymentData;
|
||||
import org.mifosng.data.LoanRepaymentPeriodData;
|
||||
import org.mifosng.data.LoanRepaymentScheduleData;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.DerivedLoanData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentPeriodData;
|
||||
import org.mifosng.platform.api.data.LoanRepaymentScheduleData;
|
||||
import org.mifosng.platform.api.data.MoneyData;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
import org.mifosng.platform.currency.domain.Money;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
Reference in New Issue
Block a user