MIFOSX-1841
This commit is contained in:
+19
-21
@@ -708,25 +708,27 @@ public class SavingsAccountCharge extends AbstractPersistable<Long> {
|
||||
|
||||
public void updateToNextDueDateFrom(final LocalDate startingDate) {
|
||||
if (isAnnualFee() || isMonthlyFee() || isWeeklyFee()) {
|
||||
LocalDate nextDueLocalDate = null;
|
||||
if (isAnnualFee() || isMonthlyFee()) {
|
||||
nextDueLocalDate = startingDate.withMonthOfYear(this.feeOnMonth);
|
||||
nextDueLocalDate = setDayOfMonth(nextDueLocalDate);
|
||||
while (startingDate.isAfter(nextDueLocalDate)) {
|
||||
nextDueLocalDate = calculateNextDueDate(nextDueLocalDate);
|
||||
}
|
||||
} else if (isWeeklyFee()) {
|
||||
nextDueLocalDate = getDueLocalDate();
|
||||
while (startingDate.isAfter(nextDueLocalDate)) {
|
||||
nextDueLocalDate = calculateNextDueDate(nextDueLocalDate);
|
||||
}
|
||||
} else {
|
||||
nextDueLocalDate = calculateNextDueDate(startingDate);
|
||||
}
|
||||
|
||||
this.dueDate = nextDueLocalDate.toDate();
|
||||
this.dueDate = getNextDueDateFrom(startingDate).toDate();
|
||||
}
|
||||
}
|
||||
|
||||
public LocalDate getNextDueDateFrom(final LocalDate startingDate) {
|
||||
LocalDate nextDueLocalDate = null;
|
||||
if (isAnnualFee() || isMonthlyFee()) {
|
||||
nextDueLocalDate = startingDate.withMonthOfYear(this.feeOnMonth);
|
||||
nextDueLocalDate = setDayOfMonth(nextDueLocalDate);
|
||||
while (startingDate.isAfter(nextDueLocalDate)) {
|
||||
nextDueLocalDate = calculateNextDueDate(nextDueLocalDate);
|
||||
}
|
||||
} else if (isWeeklyFee()) {
|
||||
nextDueLocalDate = getDueLocalDate();
|
||||
while (startingDate.isAfter(nextDueLocalDate)) {
|
||||
nextDueLocalDate = calculateNextDueDate(nextDueLocalDate);
|
||||
}
|
||||
} else {
|
||||
nextDueLocalDate = calculateNextDueDate(startingDate);
|
||||
}
|
||||
return nextDueLocalDate;
|
||||
}
|
||||
|
||||
private LocalDate calculateNextDueDate(final LocalDate date) {
|
||||
@@ -809,10 +811,6 @@ public class SavingsAccountCharge extends AbstractPersistable<Long> {
|
||||
return this.amountPaid;
|
||||
}
|
||||
|
||||
public LocalDate nextDuDate(final LocalDate date) {
|
||||
return calculateNextDueDate(date);
|
||||
}
|
||||
|
||||
public void inactiavateCharge(final LocalDate inactivationOnDate) {
|
||||
this.inactivationDate = inactivationOnDate.toDate();
|
||||
this.status = false;
|
||||
|
||||
+1
-1
@@ -1052,7 +1052,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||
|
||||
} else {
|
||||
final LocalDate nextDueDate = savingsAccountCharge.nextDuDate(inactivationOnDate);
|
||||
final LocalDate nextDueDate = savingsAccountCharge.getNextDueDateFrom(inactivationOnDate);
|
||||
|
||||
if (savingsAccountCharge.isChargeIsDue(nextDueDate)) {
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("inactivation.of.charge.not.allowed.when.charge.is.due");
|
||||
|
||||
Reference in New Issue
Block a user