BLasan commented on a change in pull request #1770:
URL: https://github.com/apache/fineract/pull/1770#discussion_r698540928
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
##########
@@ -494,10 +498,14 @@ private Loan(final String accountNo, final Client client,
final Group group, fin
this.charges = null;
this.summary = new LoanSummary();
}
- if (collateral != null && !collateral.isEmpty()) {
- this.collateral = associateWithThisLoan(collateral);
+
+ /**
+ * TODO: Apply for other loan type if required.
+ */
+ if (loanType.equals(1) && collateral != null && !collateral.isEmpty())
{
Review comment:
No. WIll remove these
##########
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:
Yeah
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java
##########
@@ -313,12 +322,28 @@ public ClientData retrieveOne(final Long clientId) {
final ClientData clientData =
this.jdbcTemplate.queryForObject(sql, this.clientMapper,
new Object[] { hierarchySearchString,
hierarchySearchString, clientId });
+ // Get client collaterals
+ final Collection<ClientCollateralManagement>
clientCollateralManagements = this.clientCollateralManagementRepositoryWrapper
+ .getCollateralsPerClient(clientId);
+ final Set<ClientCollateralManagementData>
clientCollateralManagementDataSet = new HashSet<>();
+
+ // Map to client collateral data class
+ for (ClientCollateralManagement clientCollateralManagement :
clientCollateralManagements) {
+ BigDecimal pctToBase =
clientCollateralManagement.getCollaterals().getPctToBase().divide(BigDecimal.valueOf(100));
+ BigDecimal basePrice =
clientCollateralManagement.getCollaterals().getBasePrice();
+ BigDecimal quantity = clientCollateralManagement.getQuantity();
+ BigDecimal total = basePrice.multiply(quantity);
+ BigDecimal totalCollateral = total.multiply(pctToBase);
+ clientCollateralManagementDataSet
Review comment:
By adding a new util function?
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java
##########
@@ -1814,6 +1822,32 @@ public CommandWrapperBuilder updateCollateral(final Long
loanId, final Long coll
return this;
}
+ public CommandWrapperBuilder updateCollateralProduct(final Long
collateralId) {
+ this.actionName = "UPDATE";
+ this.entityName = "COLLATERAL_PRODUCT";
+ this.entityId = collateralId;
+ this.href = "/collateral-management/" + collateralId;
+ return this;
+ }
+
+ public CommandWrapperBuilder updateClientCollateralProduct(final Long
clientId, final Long collateralId) {
+ this.actionName = "UPDATE";
+ this.entityName = "CLIENT_COLLATERAL_PRODUCT";
+ this.entityId = collateralId;
+ this.clientId = clientId;
+ this.href = "/clients/" + clientId + "/collateral" + collateralId;
+ return this;
Review comment:
Done
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java
##########
@@ -1814,6 +1822,32 @@ public CommandWrapperBuilder updateCollateral(final Long
loanId, final Long coll
return this;
}
+ public CommandWrapperBuilder updateCollateralProduct(final Long
collateralId) {
+ this.actionName = "UPDATE";
+ this.entityName = "COLLATERAL_PRODUCT";
+ this.entityId = collateralId;
+ this.href = "/collateral-management/" + collateralId;
+ return this;
+ }
+
+ public CommandWrapperBuilder updateClientCollateralProduct(final Long
clientId, final Long collateralId) {
+ this.actionName = "UPDATE";
+ this.entityName = "CLIENT_COLLATERAL_PRODUCT";
+ this.entityId = collateralId;
+ this.clientId = clientId;
+ this.href = "/clients/" + clientId + "/collateral" + collateralId;
+ return this;
+ }
+
+ public CommandWrapperBuilder deleteLoanCollateral(final Long loanId, final
Long collateralId) {
+ this.actionName = "DELETE";
+ this.entityName = "LOAN_COLLATERAL_PRODUCT";
+ this.entityId = collateralId;
+ this.loanId = loanId;
+ this.href = "/loans/" + loanId + "/collateral" + collateralId;
+ return this;
Review comment:
Done
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java
##########
@@ -1823,6 +1857,31 @@ public CommandWrapperBuilder deleteCollateral(final Long
loanId, final Long coll
return this;
}
+ public CommandWrapperBuilder deleteCollateralProduct(final Long
collateralId) {
+ this.actionName = "DELETE";
+ this.entityName = "COLLATERAL_PRODUCT";
+ this.entityId = collateralId;
+ this.href = "/collateral-management/delete/" + collateralId;
+ return this;
Review comment:
Fixed
--
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]