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