fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] incubator-fineract git commit: FIN-260: add ensure client charge date not before client activation date
Date Tue, 13 Dec 2016 11:29:24 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop bc93c278c -> d5ac4e04a


FIN-260: add ensure client charge date not before client activation 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/46c0cec8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/46c0cec8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/46c0cec8

Branch: refs/heads/develop
Commit: 46c0cec8355145779c73fd7b0014094ce50e92ed
Parents: e9e3326
Author: abdulazizali77 <abdulazizali@acm.org>
Authored: Mon Nov 28 18:53:31 2016 +0800
Committer: abdulazizali77 <abdulazizali@acm.org>
Committed: Mon Nov 28 18:53:31 2016 +0800

----------------------------------------------------------------------
 ...entChargeWritePlatformServiceJpaRepositoryImpl.java | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/46c0cec8/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java
index 8ba8071..b5043fc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java
@@ -118,8 +118,19 @@ public class ClientChargeWritePlatformServiceJpaRepositoryImpl implements
Client
             }
 
             final ClientCharge clientCharge = ClientCharge.createNew(client, charge, command);
-
             final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat());
+            final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
+            final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
+                    .resource(ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME);
+            LocalDate activationDate = client.getActivationLocalDate();
+            LocalDate dueDate = clientCharge.getDueLocalDate();
+            if(dueDate.isBefore(activationDate)){
+                baseDataValidator.reset().parameter(ClientApiConstants.dueAsOfDateParamName).value(dueDate.toString(fmt))
+                .failWithCodeNoParameterAddedToErrorCode("dueDate.before.activationDate");
+
+                if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors);
}
+            }
+
             validateDueDateOnWorkingDay(clientCharge, fmt);
             this.clientChargeRepository.saveAndFlush(clientCharge);
 


Mime
View raw message