Fix typo in error messages in Loan
This commit is contained in:
committed by
Arnold Gálovics
parent
7ce19d703b
commit
a765cb00f1
+87
-87
@@ -658,11 +658,11 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a loanTransaction for "Apply Charge Event" with transaction LocalDate set to "suppliedTransactionDate".
|
||||
* The newly created transaction is also added to the Loan on which this method is called.
|
||||
* Creates a loanTransaction for "Apply Charge Event" with transaction date set to "suppliedTransactionDate". The
|
||||
* newly created transaction is also added to the Loan on which this method is called.
|
||||
*
|
||||
* If "suppliedTransactionDate" is not passed Id, the transaction LocalDate is set to the loans due LocalDate if the
|
||||
* due date is lesser than todays date. If not, the transaction LocalDate is set to todays date
|
||||
* If "suppliedTransactionDate" is not passed Id, the transaction date is set to the loans due date if the due date
|
||||
* is lesser than todays date. If not, the transaction date is set to todays date
|
||||
*
|
||||
* @param loanCharge
|
||||
* @param suppliedTransactionDate
|
||||
@@ -686,7 +686,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final LocalDate currentDate = DateUtils.getBusinessLocalDate();
|
||||
|
||||
// if loan charge is to be applied on a future date, the loan
|
||||
// transaction would show todays LocalDate as applied date
|
||||
// transaction would show todays date as applied date
|
||||
if (transactionDate == null || currentDate.isBefore(transactionDate)) {
|
||||
transactionDate = currentDate;
|
||||
}
|
||||
@@ -759,7 +759,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final LocalDate lastRepaymentPeriodDueDate) {
|
||||
if (loanCharge.isSpecifiedDueDate()
|
||||
&& !loanCharge.isDueForCollectionFromAndUpToAndIncluding(disbursementDate, lastRepaymentPeriodDueDate)) {
|
||||
final String defaultUserMessage = "This charge with specified due LocalDate cannot be added as the it is not in schedule range.";
|
||||
final String defaultUserMessage = "This charge with specified due date cannot be added as the it is not in schedule range.";
|
||||
throw new LoanChargeCannotBeAddedException("loanCharge", "specified.due.date.outside.range", defaultUserMessage,
|
||||
getDisbursementDate(), lastRepaymentPeriodDueDate, loanCharge.name());
|
||||
}
|
||||
@@ -1049,7 +1049,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
&& (loanCharge.getDueLocalDate() == null || DateUtils.getBusinessLocalDate().isAfter(loanCharge.getDueLocalDate()))) {
|
||||
regenerateRepaymentScheduleWithInterestRecalculation(scheduleGeneratorDTO);
|
||||
}
|
||||
// Waive of charges whose due LocalDate falls after latest 'repayment'
|
||||
// Waive of charges whose due date falls after latest 'repayment'
|
||||
// transaction dont require entire loan schedule to be reprocessed.
|
||||
final LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor = this.transactionProcessorFactory
|
||||
.determineProcessor(this.transactionProcessingStrategy);
|
||||
@@ -1528,29 +1528,29 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
// the comparison should be done with the tenant date
|
||||
// (DateUtils.getBusinessDate()) and not the server LocalDate (new
|
||||
// (DateUtils.getBusinessDate()) and not the server date (new
|
||||
// LocalDate())
|
||||
if (getSubmittedOnDate().isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.a.future.date", errorMessage, getSubmittedOnDate());
|
||||
}
|
||||
|
||||
if (!(this.client == null)) {
|
||||
if (getSubmittedOnDate().isBefore(this.client.getActivationLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be earlier than client's activation date.";
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be earlier than client's activation date.";
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.before.client.activation.date", errorMessage,
|
||||
getSubmittedOnDate());
|
||||
}
|
||||
} else if (!(this.group == null)) {
|
||||
if (getSubmittedOnDate().isBefore(this.group.getActivationLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be earlier than groups's activation date.";
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be earlier than groups's activation date.";
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.before.group.activation.date", errorMessage,
|
||||
getSubmittedOnDate());
|
||||
}
|
||||
}
|
||||
|
||||
if (getSubmittedOnDate().isAfter(getExpectedDisbursedOnLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be after its expected disbursement date: "
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be after its expected disbursement date: "
|
||||
+ getExpectedDisbursedOnLocalDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.after.expected.disbursement.date", errorMessage,
|
||||
getSubmittedOnDate(), getExpectedDisbursedOnLocalDate());
|
||||
@@ -1772,7 +1772,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
return amount;
|
||||
}
|
||||
|
||||
// This method returns LocalDate format and locale if present in the JsonCommand
|
||||
// This method returns date format and locale if present in the JsonCommand
|
||||
private Map<String, String> getDateFormatAndLocale(final JsonCommand jsonCommand) {
|
||||
Map<String, String> returnObject = new HashMap<>();
|
||||
JsonElement jsonElement = jsonCommand.parsedJson();
|
||||
@@ -1852,7 +1852,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (disbursementDataArray != null && disbursementDataArray.size() > 0) {
|
||||
String dateFormat = null;
|
||||
Locale locale = null;
|
||||
// Gets LocalDate format and locate
|
||||
// Gets date format and locate
|
||||
Map<String, String> dateAndLocale = getDateFormatAndLocale(jsonCommand);
|
||||
dateFormat = dateAndLocale.get(LoanApiConstants.dateFormatParameterName);
|
||||
if (dateAndLocale.containsKey(LoanApiConstants.localeParameterName)) {
|
||||
@@ -2056,12 +2056,12 @@ public class Loan extends AbstractPersistableCustom {
|
||||
updateLoanScheduleDependentDerivedFields();
|
||||
|
||||
if (submittedOn.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.a.future.date", errorMessage, submittedOn);
|
||||
}
|
||||
|
||||
if (this.client != null && this.client.isActivatedAfter(submittedOn)) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be earlier than client's activation date.";
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be earlier than client's activation date.";
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.before.client.activation.date", errorMessage,
|
||||
submittedOn);
|
||||
}
|
||||
@@ -2069,12 +2069,12 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_CREATED, submittedOn);
|
||||
|
||||
if (this.group != null && this.group.isActivatedAfter(submittedOn)) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be earlier than groups's activation date.";
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be earlier than groups's activation date.";
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.before.group.activation.date", errorMessage, submittedOn);
|
||||
}
|
||||
|
||||
if (submittedOn.isAfter(getExpectedDisbursedOnLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is submitted cannot be after its expected disbursement date: "
|
||||
final String errorMessage = "The date on which a loan is submitted cannot be after its expected disbursement date: "
|
||||
+ getExpectedDisbursedOnLocalDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("submittal", "cannot.be.after.expected.disbursement.date", errorMessage,
|
||||
submittedOn, getExpectedDisbursedOnLocalDate());
|
||||
@@ -2088,7 +2088,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
updateSummaryWithTotalFeeChargesDueAtDisbursement(deriveSumTotalOfChargesDueAtDisbursement());
|
||||
|
||||
// validate if disbursement LocalDate is a holiday or a non-working day
|
||||
// validate if disbursement date is a holiday or a non-working day
|
||||
validateDisbursementDateIsOnNonWorkingDay(workingDays, allowTransactionsOnNonWorkingDay);
|
||||
validateDisbursementDateIsOnHoliday(allowTransactionsOnHoliday, holidays);
|
||||
|
||||
@@ -2147,7 +2147,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
actualChanges.put("closedOnDate", rejectedOn.format(fmt));
|
||||
|
||||
if (rejectedOn.isBefore(getSubmittedOnDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is rejected cannot be before its submittal date: "
|
||||
final String errorMessage = "The date on which a loan is rejected cannot be before its submittal date: "
|
||||
+ getSubmittedOnDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("reject", "cannot.be.before.submittal.date", errorMessage, rejectedOn,
|
||||
getSubmittedOnDate());
|
||||
@@ -2156,7 +2156,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_REJECTED, rejectedOn);
|
||||
|
||||
if (rejectedOn.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is rejected cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is rejected cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("reject", "cannot.be.a.future.date", errorMessage, rejectedOn);
|
||||
}
|
||||
} else {
|
||||
@@ -2196,7 +2196,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
actualChanges.put("closedOnDate", withdrawnOn.format(fmt));
|
||||
|
||||
if (withdrawnOn.isBefore(getSubmittedOnDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is withdrawn cannot be before its submittal date: "
|
||||
final String errorMessage = "The date on which a loan is withdrawn cannot be before its submittal date: "
|
||||
+ getSubmittedOnDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("withdraw", "cannot.be.before.submittal.date", errorMessage, command,
|
||||
getSubmittedOnDate());
|
||||
@@ -2205,7 +2205,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_WITHDRAWN, withdrawnOn);
|
||||
|
||||
if (withdrawnOn.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is withdrawn cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is withdrawn cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("withdraw", "cannot.be.a.future.date", errorMessage, command);
|
||||
}
|
||||
} else {
|
||||
@@ -2300,7 +2300,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate submittalDate = this.submittedOnDate;
|
||||
if (approvedOn.isBefore(submittalDate)) {
|
||||
final String errorMessage = "The LocalDate on which a loan is approved cannot be before its submittal date: "
|
||||
final String errorMessage = "The date on which a loan is approved cannot be before its submittal date: "
|
||||
+ submittalDate.toString();
|
||||
throw new InvalidLoanStateTransitionException("approval", "cannot.be.before.submittal.date", errorMessage,
|
||||
getApprovedOnDate(), submittalDate);
|
||||
@@ -2311,7 +2311,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
actualChanges.put("expectedDisbursementDate", expectedDisbursementDate);
|
||||
|
||||
if (expecteddisbursementDate.isBefore(approvedOn)) {
|
||||
final String errorMessage = "The expected disbursement LocalDate should be either on or after the approval date: "
|
||||
final String errorMessage = "The expected disbursement date should be either on or after the approval date: "
|
||||
+ approvedOn.toString();
|
||||
throw new InvalidLoanStateTransitionException("expecteddisbursal", "should.be.on.or.after.approval.date", errorMessage,
|
||||
getApprovedOnDate(), expecteddisbursementDate);
|
||||
@@ -2321,7 +2321,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_APPROVED, approvedOn);
|
||||
|
||||
if (approvedOn.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is approved cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is approved cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("approval", "cannot.be.a.future.date", errorMessage, getApprovedOnDate());
|
||||
}
|
||||
|
||||
@@ -2443,7 +2443,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
HolidayDetailDTO holidayDetailDTO = scheduleGeneratorDTO.getHolidayDetailDTO();
|
||||
|
||||
// validate if disbursement LocalDate is a holiday or a non-working day
|
||||
// validate if disbursement date is a holiday or a non-working day
|
||||
validateDisbursementDateIsOnNonWorkingDay(holidayDetailDTO.getWorkingDays(), holidayDetailDTO.isAllowTransactionsOnNonWorkingDay());
|
||||
validateDisbursementDateIsOnHoliday(holidayDetailDTO.isAllowTransactionsOnHoliday(), holidayDetailDTO.getHolidays());
|
||||
|
||||
@@ -2871,7 +2871,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
if (getApprovedOnDate() != null && disbursedOn.isBefore(getApprovedOnDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is disbursed cannot be before its approval date: "
|
||||
final String errorMessage = "The date on which a loan is disbursed cannot be before its approval date: "
|
||||
+ getApprovedOnDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("disbursal", "cannot.be.before.approval.date", errorMessage, disbursedOn,
|
||||
getApprovedOnDate());
|
||||
@@ -2890,7 +2890,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_DISBURSED, disbursedOn);
|
||||
|
||||
if (disbursedOn.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan with identifier : " + this.accountNumber
|
||||
final String errorMessage = "The date on which a loan with identifier : " + this.accountNumber
|
||||
+ " is disbursed cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("disbursal", "cannot.be.a.future.date", errorMessage, disbursedOn);
|
||||
}
|
||||
@@ -2957,7 +2957,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
updateLoanToPreDisbursalState();
|
||||
if (isScheduleRegenerateRequired || isDisbursedAmountChanged || isEmiAmountChanged
|
||||
|| this.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||
// clear off actual disbusrement LocalDate so schedule regeneration
|
||||
// clear off actual disbusrement date so schedule regeneration
|
||||
// uses expected date.
|
||||
|
||||
regenerateRepaymentSchedule(scheduleGeneratorDTO);
|
||||
@@ -3108,7 +3108,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
holidayDetailDTO.isAllowTransactionsOnNonWorkingDay());
|
||||
|
||||
if (paymentTransaction.getTransactionDate().isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan charge paid cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan charge paid cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("charge.payment", "cannot.be.a.future.date", errorMessage,
|
||||
paymentTransaction.getTransactionDate());
|
||||
}
|
||||
@@ -3200,14 +3200,14 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate loanTransactionDate = loanTransaction.getTransactionDate();
|
||||
if (loanTransactionDate.isBefore(getDisbursementDate())) {
|
||||
final String errorMessage = "The transaction LocalDate cannot be before the loan disbursement date: "
|
||||
final String errorMessage = "The transaction date cannot be before the loan disbursement date: "
|
||||
+ getApprovedOnDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("transaction", "cannot.be.before.disbursement.date", errorMessage,
|
||||
loanTransactionDate, getDisbursementDate());
|
||||
}
|
||||
|
||||
if (loanTransactionDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The transaction LocalDate cannot be in the future.";
|
||||
final String errorMessage = "The transaction date cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("transaction", "cannot.be.a.future.date", errorMessage, loanTransactionDate);
|
||||
}
|
||||
|
||||
@@ -3765,7 +3765,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
changes.put("writtenOffOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
|
||||
if (writtenOffOnLocalDate.isBefore(getDisbursementDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is written off cannot be before the loan disbursement date: "
|
||||
final String errorMessage = "The date on which a loan is written off cannot be before the loan disbursement date: "
|
||||
+ getDisbursementDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("writeoff", "cannot.be.before.submittal.date", errorMessage,
|
||||
writtenOffOnLocalDate, getDisbursementDate());
|
||||
@@ -3774,7 +3774,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.WRITE_OFF_OUTSTANDING, writtenOffOnLocalDate);
|
||||
|
||||
if (writtenOffOnLocalDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is written off cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is written off cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("writeoff", "cannot.be.a.future.date", errorMessage, writtenOffOnLocalDate);
|
||||
}
|
||||
|
||||
@@ -3782,7 +3782,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
loanTransaction = LoanTransaction.writeoff(this, getOffice(), writtenOffOnLocalDate, txnExternalId);
|
||||
LocalDate lastTransactionDate = getLastUserTransactionDate();
|
||||
if (lastTransactionDate.isAfter(writtenOffOnLocalDate)) {
|
||||
final String errorMessage = "The LocalDate of the writeoff transaction must occur on or before previous transactions.";
|
||||
final String errorMessage = "The date of the writeoff transaction must occur on or before previous transactions.";
|
||||
throw new InvalidLoanStateTransitionException("writeoff", "must.occur.on.or.after.other.transaction.dates", errorMessage,
|
||||
writtenOffOnLocalDate);
|
||||
}
|
||||
@@ -3851,14 +3851,14 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.REPAID_IN_FULL, closureDate);
|
||||
if (closureDate.isBefore(getDisbursementDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is closed cannot be before the loan disbursement date: "
|
||||
final String errorMessage = "The date on which a loan is closed cannot be before the loan disbursement date: "
|
||||
+ getDisbursementDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("close", "cannot.be.before.submittal.date", errorMessage, closureDate,
|
||||
getDisbursementDate());
|
||||
}
|
||||
|
||||
if (closureDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is closed cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is closed cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("close", "cannot.be.a.future.date", errorMessage, closureDate);
|
||||
}
|
||||
final LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor = this.transactionProcessorFactory
|
||||
@@ -3881,7 +3881,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
loanTransaction = LoanTransaction.writeoff(this, getOffice(), closureDate, txnExternalId);
|
||||
final boolean isLastTransaction = isChronologicallyLatestTransaction(loanTransaction, getLoanTransactions());
|
||||
if (!isLastTransaction) {
|
||||
final String errorMessage = "The closing LocalDate of the loan must be on or after latest transaction date.";
|
||||
final String errorMessage = "The closing date of the loan must be on or after latest transaction date.";
|
||||
throw new InvalidLoanStateTransitionException("close.loan", "must.occur.on.or.after.latest.transaction.date",
|
||||
errorMessage, closureDate);
|
||||
}
|
||||
@@ -3945,14 +3945,14 @@ public class Loan extends AbstractPersistableCustom {
|
||||
changes.put("rescheduledOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
|
||||
if (this.rescheduledOnDate.isBefore(getDisbursementDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is rescheduled cannot be before the loan disbursement date: "
|
||||
final String errorMessage = "The date on which a loan is rescheduled cannot be before the loan disbursement date: "
|
||||
+ getDisbursementDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("close.reschedule", "cannot.be.before.submittal.date", errorMessage,
|
||||
this.rescheduledOnDate, getDisbursementDate());
|
||||
}
|
||||
|
||||
if (this.rescheduledOnDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The LocalDate on which a loan is rescheduled cannot be in the future.";
|
||||
final String errorMessage = "The date on which a loan is rescheduled cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("close.reschedule", "cannot.be.a.future.date", errorMessage,
|
||||
this.rescheduledOnDate);
|
||||
}
|
||||
@@ -4218,26 +4218,26 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final LoanOfficerAssignmentHistory latestHistoryRecord = findLatestIncompleteHistoryRecord();
|
||||
final LoanOfficerAssignmentHistory lastAssignmentRecord = findLastAssignmentHistoryRecord(newLoanOfficer);
|
||||
|
||||
// assignment LocalDate should not be less than loan submitted date
|
||||
// assignment date should not be less than loan submitted date
|
||||
if (isSubmittedOnDateAfter(assignmentDate)) {
|
||||
|
||||
final String errorMessage = "The Loan Officer assignment LocalDate (" + assignmentDate.toString()
|
||||
+ ") cannot be before loan submitted LocalDate (" + getSubmittedOnDate().toString() + ").";
|
||||
final String errorMessage = "The Loan Officer assignment date (" + assignmentDate.toString()
|
||||
+ ") cannot be before loan submitted date (" + getSubmittedOnDate().toString() + ").";
|
||||
|
||||
throw new LoanOfficerAssignmentDateException("cannot.be.before.loan.submittal.date", errorMessage, assignmentDate,
|
||||
getSubmittedOnDate());
|
||||
|
||||
} else if (lastAssignmentRecord != null && lastAssignmentRecord.isEndDateAfter(assignmentDate)) {
|
||||
|
||||
final String errorMessage = "The Loan Officer assignment LocalDate (" + assignmentDate
|
||||
+ ") cannot be before previous Loan Officer unassigned LocalDate (" + lastAssignmentRecord.getEndDate() + ").";
|
||||
final String errorMessage = "The Loan Officer assignment date (" + assignmentDate
|
||||
+ ") cannot be before previous Loan Officer unassigned date (" + lastAssignmentRecord.getEndDate() + ").";
|
||||
|
||||
throw new LoanOfficerAssignmentDateException("cannot.be.before.previous.unassignement.date", errorMessage, assignmentDate,
|
||||
lastAssignmentRecord.getEndDate());
|
||||
|
||||
} else if (DateUtils.getBusinessLocalDate().isBefore(assignmentDate)) {
|
||||
|
||||
final String errorMessage = "The Loan Officer assignment LocalDate (" + assignmentDate + ") cannot be in the future.";
|
||||
final String errorMessage = "The Loan Officer assignment date (" + assignmentDate + ") cannot be in the future.";
|
||||
|
||||
throw new LoanOfficerAssignmentDateException("cannot.be.a.future.date", errorMessage, assignmentDate);
|
||||
|
||||
@@ -4247,7 +4247,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
latestHistoryRecord.updateLoanOfficer(newLoanOfficer);
|
||||
this.loanOfficer = newLoanOfficer;
|
||||
} else if (latestHistoryRecord != null && latestHistoryRecord.hasStartDateBefore(assignmentDate)) {
|
||||
final String errorMessage = "Loan with identifier " + getId() + " was already assigned before LocalDate " + assignmentDate;
|
||||
final String errorMessage = "Loan with identifier " + getId() + " was already assigned before date " + assignmentDate;
|
||||
throw new LoanOfficerAssignmentDateException("is.before.last.assignment.date", errorMessage, getId(), assignmentDate);
|
||||
} else {
|
||||
if (latestHistoryRecord != null) {
|
||||
@@ -4283,7 +4283,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
if (latestHistoryRecord.getStartDate().isAfter(unassignDate)) {
|
||||
|
||||
final String errorMessage = "The Loan officer Unassign date(" + unassignDate + ") cannot be before its assignment LocalDate ("
|
||||
final String errorMessage = "The Loan officer Unassign date(" + unassignDate + ") cannot be before its assignment date ("
|
||||
+ latestHistoryRecord.getStartDate() + ").";
|
||||
|
||||
throw new LoanOfficerUnassignmentDateException("cannot.be.before.assignment.date", errorMessage, getId(),
|
||||
@@ -4291,7 +4291,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
} else if (unassignDate.isAfter(today)) {
|
||||
|
||||
final String errorMessage = "The Loan Officer Unassign LocalDate (" + unassignDate + ") cannot be in the future.";
|
||||
final String errorMessage = "The Loan Officer Unassign date (" + unassignDate + ") cannot be in the future.";
|
||||
|
||||
throw new LoanOfficerUnassignmentDateException("cannot.be.a.future.date", errorMessage, unassignDate);
|
||||
}
|
||||
@@ -4458,9 +4458,9 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
/*
|
||||
* if (transaction.getTransactionDate().isAfter(tillDate) && transaction.isAccrual()) { final String
|
||||
* errorMessage =
|
||||
* "The LocalDate on which a loan is interest waived cannot be in after accrual transactions." ; throw new
|
||||
* InvalidLoanStateTransitionException("waive", "cannot.be.after.accrual.date", errorMessage, tillDate); }
|
||||
* errorMessage = "The date on which a loan is interest waived cannot be in after accrual transactions." ;
|
||||
* throw new InvalidLoanStateTransitionException("waive", "cannot.be.after.accrual.date", errorMessage,
|
||||
* tillDate); }
|
||||
*/
|
||||
}
|
||||
return receivableInterest;
|
||||
@@ -4486,7 +4486,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final Boolean reschedulebasedOnMeetingDates, final LocalDate presentMeetingDate, final LocalDate newMeetingDate,
|
||||
final boolean isSkipRepaymentonfirstdayofmonth, final Integer numberofDays) {
|
||||
|
||||
// first repayment's from LocalDate is same as disbursement date.
|
||||
// first repayment's from date is same as disbursement date.
|
||||
/*
|
||||
* meetingStartDate is used as seedDate Capture the seedDate from user and use the seedDate as meetingStart date
|
||||
*/
|
||||
@@ -4514,7 +4514,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
} else {
|
||||
// tmpFromDate.plusDays(1) is done to make sure
|
||||
// getNewRepaymentMeetingDate method returns next meeting
|
||||
// LocalDate and not the same as tmpFromDate
|
||||
// date and not the same as tmpFromDate
|
||||
newRepaymentDate = CalendarUtils.getNewRepaymentMeetingDate(recuringRule, tmpFromDate, tmpFromDate.plusDays(1),
|
||||
loanRepaymentInterval, frequency, workingDays, isSkipRepaymentonfirstdayofmonth, numberofDays);
|
||||
}
|
||||
@@ -4526,7 +4526,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
latestRepaymentDate = newRepaymentDate;
|
||||
}
|
||||
loanRepaymentScheduleInstallment.updateDueDate(newRepaymentDate);
|
||||
// reset from LocalDate to get actual daysInPeriod
|
||||
// reset from date to get actual daysInPeriod
|
||||
|
||||
if (!isFirstTime) {
|
||||
loanRepaymentScheduleInstallment.updateFromDate(tmpFromDate);
|
||||
@@ -4547,7 +4547,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final boolean isHolidayEnabled, final List<Holiday> holidays, final WorkingDays workingDays,
|
||||
final boolean isSkipRepaymentonfirstdayofmonth, final Integer numberofDays) {
|
||||
|
||||
// first repayment's from LocalDate is same as disbursement date.
|
||||
// first repayment's from date is same as disbursement date.
|
||||
LocalDate tmpFromDate = getDisbursementDate();
|
||||
final PeriodFrequencyType repaymentPeriodFrequencyType = this.loanRepaymentScheduleDetail.getRepaymentPeriodFrequencyType();
|
||||
final Integer loanRepaymentInterval = this.loanRepaymentScheduleDetail.getRepayEvery();
|
||||
@@ -4584,7 +4584,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
loanRepaymentScheduleInstallment.updateDueDate(newRepaymentDate);
|
||||
// reset from LocalDate to get actual daysInPeriod
|
||||
// reset from date to get actual daysInPeriod
|
||||
loanRepaymentScheduleInstallment.updateFromDate(tmpFromDate);
|
||||
tmpFromDate = newRepaymentDate;// update with new repayment
|
||||
// date
|
||||
@@ -4619,7 +4619,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
case WHOLE_TERM:
|
||||
break;
|
||||
}
|
||||
return dueRepaymentPeriodDate.minusDays(1);// get 2n-1 range LocalDate from
|
||||
return dueRepaymentPeriodDate.minusDays(1);// get 2n-1 range date from
|
||||
// startDate
|
||||
}
|
||||
|
||||
@@ -4667,7 +4667,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
adjustedRescheduleToDate = holiday.getRepaymentsRescheduledToLocalDate();
|
||||
}
|
||||
|
||||
// first repayment's from LocalDate is same as disbursement date.
|
||||
// first repayment's from date is same as disbursement date.
|
||||
LocalDate tmpFromDate = getDisbursementDate();
|
||||
|
||||
// Loop through all loanRepayments
|
||||
@@ -4680,7 +4680,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate oldDueDate = loanRepaymentScheduleInstallment.getDueDate();
|
||||
|
||||
// update from LocalDate if it's not same as previous installament's due
|
||||
// update from date if it's not same as previous installament's due
|
||||
// date.
|
||||
if (!loanRepaymentScheduleInstallment.getFromDate().isEqual(tmpFromDate)) {
|
||||
loanRepaymentScheduleInstallment.updateFromDate(tmpFromDate);
|
||||
@@ -4688,7 +4688,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
if (oldDueDate.equals(holiday.getFromDateLocalDate()) || oldDueDate.isAfter(holiday.getFromDateLocalDate())) {
|
||||
// FIXME: AA do we need to apply non-working days.
|
||||
// Assuming holiday's repayment reschedule to LocalDate cannot be
|
||||
// Assuming holiday's repayment reschedule to date cannot be
|
||||
// created on a non-working day.
|
||||
|
||||
adjustedRescheduleToDate = scheduledDateGenerator.generateNextRepaymentDate(adjustedRescheduleToDate, loanApplicationTerms,
|
||||
@@ -4702,7 +4702,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
private void validateDisbursementDateIsOnNonWorkingDay(final WorkingDays workingDays, final boolean allowTransactionsOnNonWorkingDay) {
|
||||
if (!allowTransactionsOnNonWorkingDay) {
|
||||
if (!WorkingDaysUtil.isWorkingDay(workingDays, getDisbursementDate())) {
|
||||
final String errorMessage = "Expected disbursement LocalDate cannot be on a non working day";
|
||||
final String errorMessage = "Expected disbursement date cannot be on a non working day";
|
||||
throw new LoanApplicationDateException("disbursement.date.on.non.working.day", errorMessage,
|
||||
getExpectedDisbursedOnLocalDate());
|
||||
}
|
||||
@@ -4712,7 +4712,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
private void validateDisbursementDateIsOnHoliday(final boolean allowTransactionsOnHoliday, final List<Holiday> holidays) {
|
||||
if (!allowTransactionsOnHoliday) {
|
||||
if (HolidayUtil.isHoliday(getDisbursementDate(), holidays)) {
|
||||
final String errorMessage = "Expected disbursement LocalDate cannot be on a holiday";
|
||||
final String errorMessage = "Expected disbursement date cannot be on a holiday";
|
||||
throw new LoanApplicationDateException("disbursement.date.on.holiday", errorMessage, getExpectedDisbursedOnLocalDate());
|
||||
}
|
||||
}
|
||||
@@ -4722,7 +4722,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final boolean allowTransactionsOnNonWorkingDay) {
|
||||
if (!allowTransactionsOnNonWorkingDay) {
|
||||
if (!WorkingDaysUtil.isWorkingDay(workingDays, repaymentDate)) {
|
||||
final String errorMessage = "Repayment LocalDate cannot be on a non working day";
|
||||
final String errorMessage = "Repayment date cannot be on a non working day";
|
||||
throw new LoanApplicationDateException("repayment.date.on.non.working.day", errorMessage, repaymentDate);
|
||||
}
|
||||
}
|
||||
@@ -4732,7 +4732,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final List<Holiday> holidays) {
|
||||
if (!allowTransactionsOnHoliday) {
|
||||
if (HolidayUtil.isHoliday(repaymentDate, holidays)) {
|
||||
final String errorMessage = "Repayment LocalDate cannot be on a holiday";
|
||||
final String errorMessage = "Repayment date cannot be on a holiday";
|
||||
throw new LoanApplicationDateException("repayment.date.on.holiday", errorMessage, repaymentDate);
|
||||
}
|
||||
}
|
||||
@@ -4804,7 +4804,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
public void validateExpectedDisbursementForHolidayAndNonWorkingDay(final WorkingDays workingDays,
|
||||
final boolean allowTransactionsOnHoliday, final List<Holiday> holidays, final boolean allowTransactionsOnNonWorkingDay) {
|
||||
// validate if disbursement LocalDate is a holiday or a non-working day
|
||||
// validate if disbursement date is a holiday or a non-working day
|
||||
validateDisbursementDateIsOnNonWorkingDay(workingDays, allowTransactionsOnNonWorkingDay);
|
||||
validateDisbursementDateIsOnHoliday(allowTransactionsOnHoliday, holidays);
|
||||
|
||||
@@ -4819,22 +4819,22 @@ public class Loan extends AbstractPersistableCustom {
|
||||
String postfix = null;
|
||||
switch (event) {
|
||||
case LOAN_CREATED:
|
||||
errorMessage = "The LocalDate on which a loan is submitted cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a loan is submitted cannot be earlier than client's transfer date to this office";
|
||||
action = "submittal";
|
||||
postfix = "cannot.be.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_APPROVED:
|
||||
errorMessage = "The LocalDate on which a loan is approved cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a loan is approved cannot be earlier than client's transfer date to this office";
|
||||
action = "approval";
|
||||
postfix = "cannot.be.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_APPROVAL_UNDO:
|
||||
errorMessage = "The LocalDate on which a loan is approved cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a loan is approved cannot be earlier than client's transfer date to this office";
|
||||
action = "approval";
|
||||
postfix = "cannot.be.undone.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_DISBURSED:
|
||||
errorMessage = "The LocalDate on which a loan is disbursed cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a loan is disbursed cannot be earlier than client's transfer date to this office";
|
||||
action = "disbursal";
|
||||
postfix = "cannot.be.before.client.transfer.date";
|
||||
break;
|
||||
@@ -4844,37 +4844,37 @@ public class Loan extends AbstractPersistableCustom {
|
||||
postfix = "cannot.be.undone.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_REPAYMENT_OR_WAIVER:
|
||||
errorMessage = "The LocalDate on which a repayment or waiver is made cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a repayment or waiver is made cannot be earlier than client's transfer date to this office";
|
||||
action = "repayment.or.waiver";
|
||||
postfix = "cannot.be.made.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_REJECTED:
|
||||
errorMessage = "The LocalDate on which a loan is rejected cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a loan is rejected cannot be earlier than client's transfer date to this office";
|
||||
action = "reject";
|
||||
postfix = "cannot.be.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_WITHDRAWN:
|
||||
errorMessage = "The LocalDate on which a loan is withdrawn cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a loan is withdrawn cannot be earlier than client's transfer date to this office";
|
||||
action = "withdraw";
|
||||
postfix = "cannot.be.before.client.transfer.date";
|
||||
break;
|
||||
case WRITE_OFF_OUTSTANDING:
|
||||
errorMessage = "The LocalDate on which a write off is made cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a write off is made cannot be earlier than client's transfer date to this office";
|
||||
action = "writeoff";
|
||||
postfix = "cannot.be.undone.before.client.transfer.date";
|
||||
break;
|
||||
case REPAID_IN_FULL:
|
||||
errorMessage = "The LocalDate on which the loan is repaid in full cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which the loan is repaid in full cannot be earlier than client's transfer date to this office";
|
||||
action = "close";
|
||||
postfix = "cannot.be.undone.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_CHARGE_PAYMENT:
|
||||
errorMessage = "The LocalDate on which a charge payment is made cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a charge payment is made cannot be earlier than client's transfer date to this office";
|
||||
action = "charge.payment";
|
||||
postfix = "cannot.be.made.before.client.transfer.date";
|
||||
break;
|
||||
case LOAN_REFUND:
|
||||
errorMessage = "The LocalDate on which a refund is made cannot be earlier than client's transfer LocalDate to this office";
|
||||
errorMessage = "The date on which a refund is made cannot be earlier than client's transfer date to this office";
|
||||
action = "refund";
|
||||
postfix = "cannot.be.made.before.client.transfer.date";
|
||||
break;
|
||||
@@ -4902,17 +4902,17 @@ public class Loan extends AbstractPersistableCustom {
|
||||
String postfix = null;
|
||||
switch (event) {
|
||||
case LOAN_REPAYMENT_OR_WAIVER:
|
||||
errorMessage = "The LocalDate on which a repayment or waiver is made cannot be earlier than last transaction date";
|
||||
errorMessage = "The date on which a repayment or waiver is made cannot be earlier than last transaction date";
|
||||
action = "repayment.or.waiver";
|
||||
postfix = "cannot.be.made.before.last.transaction.date";
|
||||
break;
|
||||
case WRITE_OFF_OUTSTANDING:
|
||||
errorMessage = "The LocalDate on which a write off is made cannot be earlier than last transaction date";
|
||||
errorMessage = "The date on which a write off is made cannot be earlier than last transaction date";
|
||||
action = "writeoff";
|
||||
postfix = "cannot.be.made.before.last.transaction.date";
|
||||
break;
|
||||
case LOAN_CHARGE_PAYMENT:
|
||||
errorMessage = "The LocalDate on which a charge payment is made cannot be earlier than last transaction date";
|
||||
errorMessage = "The date on which a charge payment is made cannot be earlier than last transaction date";
|
||||
action = "charge.payment";
|
||||
postfix = "cannot.be.made.before.last.transaction.date";
|
||||
break;
|
||||
@@ -5792,8 +5792,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
/**
|
||||
* @param dueDate
|
||||
* the due LocalDate of the installment
|
||||
* @return a schedule installment with similar due LocalDate to the one provided
|
||||
* the due date of the installment
|
||||
* @return a schedule installment with similar due date to the one provided
|
||||
**/
|
||||
public LoanRepaymentScheduleInstallment getRepaymentScheduleInstallment(LocalDate dueDate) {
|
||||
LoanRepaymentScheduleInstallment installment = null;
|
||||
@@ -6136,14 +6136,14 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate loanTransactionDate = loanTransaction.getTransactionDate();
|
||||
if (loanTransactionDate.isBefore(getDisbursementDate())) {
|
||||
final String errorMessage = "The transaction LocalDate cannot be before the loan disbursement date: "
|
||||
final String errorMessage = "The transaction date cannot be before the loan disbursement date: "
|
||||
+ getApprovedOnDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("transaction", "cannot.be.before.disbursement.date", errorMessage,
|
||||
loanTransactionDate, getDisbursementDate());
|
||||
}
|
||||
|
||||
if (loanTransactionDate.isAfter(DateUtils.getBusinessLocalDate())) {
|
||||
final String errorMessage = "The transaction LocalDate cannot be in the future.";
|
||||
final String errorMessage = "The transaction date cannot be in the future.";
|
||||
throw new InvalidLoanStateTransitionException("transaction", "cannot.be.a.future.date", errorMessage, loanTransactionDate);
|
||||
}
|
||||
|
||||
@@ -6378,9 +6378,9 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (isMultiDisburmentLoan() && loanCharge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue())) {
|
||||
amount = getApprovedPrincipal();
|
||||
} else {
|
||||
// If charge type is specified due LocalDate and loan is multi disburment
|
||||
// If charge type is specified due date and loan is multi disburment
|
||||
// loan.
|
||||
// Then we need to get as of this loan charge due LocalDate how much
|
||||
// Then we need to get as of this loan charge due date how much
|
||||
// amount disbursed.
|
||||
if (loanCharge.isSpecifiedDueDate() && this.isMultiDisburmentLoan()) {
|
||||
for (final LoanDisbursementDetails loanDisbursementDetails : this.getDisbursementDetails()) {
|
||||
|
||||
Reference in New Issue
Block a user