Repository: incubator-fineract Updated Branches: refs/heads/develop 2f4ff30c9 -> fdcd2d447
FINERACT-344 : Should not allow to add guarantor ,If savings account activation date is gretar than loan application submitted date Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/fb1a8909 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/fb1a8909 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/fb1a8909 Branch: refs/heads/develop Commit: fb1a8909404afa11229da0c63ccc7c7e55a567a0 Parents: f1f3d65 Author: nazeer1100126 <nazeer.sh...@confluxtechnologies.com> Authored: Mon Mar 13 13:33:13 2017 +0530 Committer: nazeer1100126 <nazeer.sh...@confluxtechnologies.com> Committed: Mon Mar 13 13:33:13 2017 +0530 ---------------------------------------------------------------------- .../GuarantorWritePlatformServiceJpaRepositoryIImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/fb1a8909/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java index ab779af..fd6a634 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java @@ -30,6 +30,7 @@ import org.apache.fineract.infrastructure.core.data.ApiParameterError; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder; import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; +import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; import org.apache.fineract.organisation.staff.domain.StaffRepositoryWrapper; @@ -111,6 +112,7 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto AccountAssociations accountAssociations = null; if (guarantorCommand.getSavingsId() != null) { final SavingsAccount savingsAccount = this.savingsAccountAssembler.assembleFrom(guarantorCommand.getSavingsId()); + validateGuarantorSavingsAccountActivationDateWithLoanSubmittedOnDate(loan,savingsAccount); accountAssociations = AccountAssociations.associateSavingsAccount(loan, savingsAccount, AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION.getValue(), true); @@ -179,6 +181,14 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto } } + private void validateGuarantorSavingsAccountActivationDateWithLoanSubmittedOnDate(final Loan loan, final SavingsAccount savingsAccount) { + if (loan.getSubmittedOnDate().isBefore(savingsAccount.getActivationLocalDate())) { throw new GeneralPlatformDomainRuleException( + "error.msg.guarantor.saving.account.activation.date.is.on.or.before.loan.submitted.on.date", + "Guarantor saving account activation date [" + savingsAccount.getActivationLocalDate() + + "] is on or before the loan submitted on date [" + loan.getSubmittedOnDate() + "]", + savingsAccount.getActivationLocalDate(), loan.getSubmittedOnDate()); } + } + @Override @Transactional public CommandProcessingResult updateGuarantor(final Long loanId, final Long guarantorId, final JsonCommand command) {