LocalDate check should be according to timezone of tenant.

This commit is contained in:
Mohit Sinha
2019-04-10 23:03:43 +02:00
committed by Michael Vorburger ⛑️
parent 3ee051cf57
commit 2ae916618b
2 changed files with 4 additions and 4 deletions
@@ -2929,7 +2929,7 @@ public class Loan extends AbstractPersistableCustom<Long> {
validateRepaymentDateIsOnNonWorkingDay(paymentTransaction.getTransactionDate(), holidayDetailDTO.getWorkingDays(),
holidayDetailDTO.isAllowTransactionsOnNonWorkingDay());
if (paymentTransaction.getTransactionDate().isAfter(new LocalDate())) {
if (paymentTransaction.getTransactionDate().isAfter(DateUtils.getLocalDateOfTenant())) {
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());
@@ -3767,7 +3767,7 @@ public class Loan extends AbstractPersistableCustom<Long> {
rescheduledOnLocalDate, getDisbursementDate());
}
if (rescheduledOnLocalDate.isAfter(new LocalDate())) {
if (rescheduledOnLocalDate.isAfter(DateUtils.getLocalDateOfTenant())) {
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,
rescheduledOnLocalDate);
@@ -1794,7 +1794,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
.retrieveInstallmentLoanCharges(chargeData.getId(), true);
PortfolioAccountData portfolioAccountData = null;
for (final LoanInstallmentChargeData installmentChargeData : chargePerInstallments) {
if (!installmentChargeData.getDueDate().isAfter(new LocalDate())) {
if (!installmentChargeData.getDueDate().isAfter(DateUtils.getLocalDateOfTenant())) {
if (portfolioAccountData == null) {
portfolioAccountData = this.accountAssociationsReadPlatformService.retriveLoanLinkedAssociation(chargeData
.getLoanId());
@@ -1810,7 +1810,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
transferFeeCharge(sb, accountTransferDTO);
}
}
} else if (chargeData.getDueDate() != null && !chargeData.getDueDate().isAfter(new LocalDate())) {
} else if (chargeData.getDueDate() != null && !chargeData.getDueDate().isAfter(DateUtils.getLocalDateOfTenant())) {
final PortfolioAccountData portfolioAccountData = this.accountAssociationsReadPlatformService
.retriveLoanLinkedAssociation(chargeData.getLoanId());
final SavingsAccount fromSavingsAccount = null;