BLasan commented on a change in pull request #1770:
URL: https://github.com/apache/fineract/pull/1770#discussion_r701828922



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
##########
@@ -524,6 +545,20 @@ public void recalculateAccruals(Loan loan, boolean 
isInterestCalcualtionHappened
                 throw new 
GeneralPlatformDomainRuleException(globalisationMessageCode, e.getMessage(), e);
             }
         }
+
+        // Update loan transaction on repayment.

Review comment:
       Fixed

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
##########
@@ -847,38 +871,67 @@ public void validateForModify(final String json, final 
LoanProduct loanProduct,
             }
         }
 
-        // collateral
-        final String collateralParameterName = "collateral";
-        if (element.isJsonObject() && 
this.fromApiJsonHelper.parameterExists(collateralParameterName, element)) {
-            final JsonObject topLevelJsonElement = element.getAsJsonObject();
-            final Locale locale = 
this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
-            if (topLevelJsonElement.get("collateral").isJsonArray()) {
-
-                final Type collateralParameterTypeOfMap = new 
TypeToken<Map<String, Object>>() {}.getType();
-                final Set<String> supportedParameters = new 
HashSet<>(Arrays.asList("id", "type", "value", "description"));
-                final JsonArray array = 
topLevelJsonElement.get("collateral").getAsJsonArray();
-                for (int i = 1; i <= array.size(); i++) {
-                    final JsonObject collateralItemElement = array.get(i - 
1).getAsJsonObject();
-
-                    final String collateralJson = 
this.fromApiJsonHelper.toJson(collateralItemElement);
-                    
this.fromApiJsonHelper.checkForUnsupportedParameters(collateralParameterTypeOfMap,
 collateralJson, supportedParameters);
-
-                    final Long collateralTypeId = 
this.fromApiJsonHelper.extractLongNamed("type", collateralItemElement);
-                    
baseDataValidator.reset().parameter("collateral").parameterAtIndexArray("type", 
i).value(collateralTypeId).notNull()
-                            .integerGreaterThanZero();
-
-                    final BigDecimal collateralValue = 
this.fromApiJsonHelper.extractBigDecimalNamed("value", collateralItemElement,
-                            locale);
-                    
baseDataValidator.reset().parameter("collateral").parameterAtIndexArray("value",
 i).value(collateralValue)
-                            .ignoreIfNull().positiveAmount();
+        final String loanTypeParameterName = "loanType";
+        final String loanTypeStr = 
this.fromApiJsonHelper.extractStringNamed(loanTypeParameterName, element);
+        
baseDataValidator.reset().parameter(loanTypeParameterName).value(loanTypeStr).notNull();
 
-                    final String description = 
this.fromApiJsonHelper.extractStringNamed("description", collateralItemElement);
-                    
baseDataValidator.reset().parameter("collateral").parameterAtIndexArray("description",
 i).value(description).notBlank()
-                            .notExceedingLengthOf(500);
+        if (!StringUtils.isBlank(loanTypeStr)) {
+            final AccountType loanType = AccountType.fromName(loanTypeStr);
+            
baseDataValidator.reset().parameter(loanTypeParameterName).value(loanType.getValue()).inMinMaxRange(1,
 4);

Review comment:
       Fixed

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
##########
@@ -627,6 +636,29 @@ private void checkForProductMixRestrictions(final 
List<Long> activeLoansLoanProd
         }
     }
 
+    // private void updateLoanCollateral(Set<LoanCollateralManagement> 
loanCollateralManagementSet) {
+    // 
this.loanCollateralManagementRepository.saveAll(loanCollateralManagementSet);
+    // }
+    //
+    // private void updateClientCollaterals(Set<ClientCollateralManagement> 
clientCollateralManagementSet) {
+    // 
this.clientCollateralManagementRepository.saveAll(clientCollateralManagementSet);
+    // }
+    //
+    // private boolean isLoanCollateralUpdatable(JsonCommand command) {
+    // boolean isExist = this.fromJsonHelper.parameterExists("collaterals", 
command.parsedJson());
+    // if (!isExist) {
+    // return false;
+    // }
+    //
+    // int length = this.fromJsonHelper.extractJsonArrayNamed("collaterals", 
command.parsedJson()).size();
+    //
+    // if (length == 0) {
+    // return false;
+    // }

Review comment:
       Removed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to