Skip to content

Commit

Permalink
FINERACT-628 guarantor api for self service user
Browse files Browse the repository at this point in the history
  • Loading branch information
ShruthiRajaram committed Oct 10, 2018
1 parent 7cef5ed commit ab10ecc
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 6 deletions.
248 changes: 248 additions & 0 deletions api-docs/apiLive.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3769,6 +3769,22 @@ <h2 class="flybar-button">Self Service</h2>
<td></td>
<td></td>
</tr>
<tr>
<td><a href="#self_guarantors_list">Guarantor and Obligee details</a></td>
<td>self/loans/{loanId}/guarantors</td>
<td></td>
<td><a href="#self_guarantors_list">Guarantors list</a></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>self/clients/{clientId}/obligeedetails</td>
<td></td>
<td><a href="#self_obligee_list">Obligee list</a></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
Expand Down Expand Up @@ -48394,6 +48410,238 @@ <h2>Retrieve a share application/account:</h2>
</div>
</div>

<a id="self_guarantors_list" name="self_guarantors_list"
class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
<h4>List Guarantors</h4>
<p>Example Requests:</p>
<div class=apiClick>self/loans/33/guarantors</div>
<br>
</div>
<div class="method-example">
<code class="method-declaration">
GET https://DomainName/api/v1/self/loans/{loanId}/guarantors
</code>
<code class="method-response">
[
{
"id":6,
"loanId":33,
"guarantorType":{
"id":1,
"code":"guarantor.existing.customer",
"value":"CUSTOMER"
},
"firstname":"Abhishek v",
"lastname":"M",
"entityId":12,
"officeName":"Head Office",
"joinedDate":[
2014,
7,
5
],
"guarantorFundingDetails":[
{
"id":7,
"status":{
"id":100,
"code":"guarantorFundStatusType.active",
"value":"ACTIVE"
},
"savingsAccount":{
"id":28,
"accountNo":"000000028"
},
"amount":2000,
"amountReleased":0,
"amountRemaining":2000,
"amountTransfered":0,
"guarantorTransactions":[
{
"id":6,
"onHoldTransactionData":{
"id":6,
"amount":2000,
"transactionType":{
"id":1,
"code":"deposutAccountOnHoldTransactionType.hold",
"value":"hold"
},
"transactionDate":[
2018,
10,
10
],
"reversed":false,
"savingsId":0,
"loanId":0
},
"reversed":false
}
]
}
],
"status":true
},
{
"id":7,
"loanId":33,
"clientRelationshipType":{
"id":6,
"name":"Parent",
"active":false,
"mandatory":false
},
"guarantorType":{
"id":1,
"code":"guarantor.existing.customer",
"value":"CUSTOMER"
},
"firstname":"Bheem",
"lastname":"Test",
"entityId":14,
"officeName":"Head Office",
"joinedDate":[
2013,
7,
3
],
"guarantorFundingDetails":[
{
"id":8,
"status":{
"id":100,
"code":"guarantorFundStatusType.active",
"value":"ACTIVE"
},
"savingsAccount":{
"id":37,
"accountNo":"000000037"
},
"amount":1000,
"amountReleased":0,
"amountRemaining":1000,
"amountTransfered":0,
"guarantorTransactions":[
{
"id":7,
"onHoldTransactionData":{
"id":7,
"amount":1000,
"transactionType":{
"id":1,
"code":"deposutAccountOnHoldTransactionType.hold",
"value":"hold"
},
"transactionDate":[
2018,
10,
10
],
"reversed":false,
"savingsId":0,
"loanId":0
},
"reversed":false
}
]
}
],
"status":true
}
]
</code>
</div>
</div>
<a id="self_obligee_list" name="self_obligee_list"
class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
<h4>Obligee List</h4>
<p>Obligee list provides list of clients and other details, to whom the user has agreed to be a guarantor.</p>

<table class=matrixHeading>
<tr class="matrixHeadingBG"><td><div class="fineractHeading2">Field Descriptions</div></td></tr>

<tr class=alt><td>clientId</td></tr>
<tr><td class=fielddesc>The client id of the self service user.</td></tr>

<tr class=alt><td>firstName, lastName, displayName</td></tr>
<tr><td class=fielddesc>The first name, last name and display name of the obligee</td></tr>

<tr class=alt><td>accountNumber, loanAmount</td></tr>
<tr><td class=fielddesc>The loan account number and principal amount of the obligee </td></tr>

<tr class=alt><td>guaranteeAmount, amountReleased, amountTransferred</td></tr>
<tr><td class=fielddesc>Guranteed amount, released and transferred amount of the client</td></tr>
</table>

<p>Example Requests:</p>
<div class=apiClick>self/clients/14/obligeedetails</div>
<br>
</div>
<div class="method-example">
<code class="method-declaration">
GET https://DomainName/api/v1/self/clients/{clientId}/obligeedetails
</code>
<code class="method-response">
[
{
"firstName":"App",
"lastName":"Test",
"displayName":"App Test",
"accountNumber":"000000005",
"loanAmount":50000,
"guaranteeAmount":10000,
"amountReleased":0,
"amountTransferred":0
},
{
"firstName":"App",
"lastName":"Test",
"displayName":"App Test",
"accountNumber":"000000005",
"loanAmount":50000,
"guaranteeAmount":5000,
"amountReleased":0,
"amountTransferred":0
},
{
"firstName":"App",
"lastName":"Test",
"displayName":"App Test",
"accountNumber":"000000006",
"loanAmount":50000,
"guaranteeAmount":10000,
"amountReleased":0,
"amountTransferred":0
},
{
"firstName":"Abhishek v",
"lastName":"M",
"displayName":"Abhishek v M",
"accountNumber":"000000032",
"loanAmount":10000,
"guaranteeAmount":1000,
"amountReleased":1000,
"amountTransferred":0
},
{
"firstName":"Abhishek v",
"lastName":"M",
"displayName":"Abhishek v M",
"accountNumber":"000000033",
"loanAmount":10000,
"guaranteeAmount":1000,
"amountReleased":0,
"amountTransferred":0
}
]
</code>
</div>
</div>
<!-- end of Customer Self Service APIs-->
</div>
<!-- main-content-wrapper -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public class ClientApiConstants {
public static final String staffOptionsParamName = "staffOptions";

public static final String datatables = "datatables";
public static final String obligeeData = "ObligeeDetails";


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.ws.rs.Consumes;
Expand All @@ -39,8 +40,6 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataParam;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
Expand All @@ -59,12 +58,17 @@
import org.apache.fineract.portfolio.accountdetails.service.AccountDetailsReadPlatformService;
import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
import org.apache.fineract.portfolio.loanaccount.guarantor.data.ObligeeData;
import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorReadPlatformService;
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataParam;

@Path("/clients")
@Component
@Scope("singleton")
Expand All @@ -80,6 +84,7 @@ public class ClientsApiResource {
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final BulkImportWorkbookService bulkImportWorkbookService;
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
private final GuarantorReadPlatformService guarantorReadPlatformService;

@Autowired
public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService,
Expand All @@ -90,7 +95,7 @@ public ClientsApiResource(final PlatformSecurityContext context, final ClientRea
final AccountDetailsReadPlatformService accountDetailsReadPlatformService,
final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService,
final BulkImportWorkbookService bulkImportWorkbookService) {
final BulkImportWorkbookService bulkImportWorkbookService, final GuarantorReadPlatformService guarantorReadPlatformService) {
this.context = context;
this.clientReadPlatformService = readPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
Expand All @@ -101,6 +106,7 @@ public ClientsApiResource(final PlatformSecurityContext context, final ClientRea
this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
this.bulkImportWorkbookPopulatorService=bulkImportWorkbookPopulatorService;
this.bulkImportWorkbookService=bulkImportWorkbookService;
this.guarantorReadPlatformService = guarantorReadPlatformService;
}

@GET
Expand Down Expand Up @@ -341,4 +347,18 @@ public String postClientTemplate(@QueryParam("legalFormType")final String legalF
final Long importDocumentId = bulkImportWorkbookService.importWorkbook(legalFormType, uploadedInputStream,fileDetail,locale,dateFormat);
return this.toApiJsonSerializer.serialize(importDocumentId);
}

@GET
@Path("{clientId}/obligeedetails")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveObligeeDetails(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {

this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);

final List<ObligeeData> ObligeeList = this.guarantorReadPlatformService.retrieveObligeeDetails(clientId);

return this.toApiJsonSerializer.serialize(ObligeeList);
}

}
Loading

0 comments on commit ab10ecc

Please sign in to comment.