FINERACT-628 self service APIs for client image management
This commit is contained in:
@@ -3601,6 +3601,30 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>self/clients/{clientId}/images</td>
|
||||||
|
<td><a href="#self_client_images_upload">Upload client image (Data URI)</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>self/clients/{clientId}/images</td>
|
||||||
|
<td><a href="#self_client_images_upload_multi_part">Upload client image (Multi-part Form data)</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>self/clients/{clientId}/images</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td><a href="#self_client_image_delete">Delete client image</a></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#selfloantemplate">Loans</a></td>
|
<td><a href="#selfloantemplate">Loans</a></td>
|
||||||
<td>self/loans/template?templateType=individual</td>
|
<td>self/loans/template?templateType=individual</td>
|
||||||
@@ -49110,6 +49134,98 @@ GET https://DomainName/api/v1/self/clients/{clientId}/obligeedetails
|
|||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<a id="self_client_images_upload" name="self_client_images_upload" class="old-syle-anchor"> </a>
|
||||||
|
<div class="method-section">
|
||||||
|
<div class="method-description">
|
||||||
|
<h4>Upload client image (Data URI)</h4>
|
||||||
|
</div>
|
||||||
|
<div class="method-example">
|
||||||
|
<code class="method-declaration">
|
||||||
|
POST https://DomainName/api/v1/self/clients/{clientId}/images
|
||||||
|
</code>
|
||||||
|
<code class="method-request">
|
||||||
|
POST self/clients/14/images
|
||||||
|
Content-Type: text/plain
|
||||||
|
Request Body:
|
||||||
|
data:image/png;base64,iVBORw0KGgoAA
|
||||||
|
AANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0l
|
||||||
|
EQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6
|
||||||
|
P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC
|
||||||
|
</code>
|
||||||
|
<code class="method-response">
|
||||||
|
{
|
||||||
|
"resourceId": 14,
|
||||||
|
"changes": {},
|
||||||
|
"resourceIdentifier": "14"
|
||||||
|
}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a id="self_client_images_upload_multi_part" name="self_client_images_upload_multi_part" class="old-syle-anchor"> </a>
|
||||||
|
<div class="method-section">
|
||||||
|
<div class="method-description">
|
||||||
|
<h4>Upload client image (Multi-part Form data)</h4>
|
||||||
|
<table class=matrixHeading>
|
||||||
|
<tr class="matrixHeadingBG">
|
||||||
|
<td><div class="fineractHeading2">Mandatory Fields</div></td>
|
||||||
|
</tr>
|
||||||
|
<tr class=alt>
|
||||||
|
<td>file
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
The form should contain a required named body part with the
|
||||||
|
name "file". <br/> <br/>
|
||||||
|
If you are using a HTML form, a snippet like
|
||||||
|
<small> <input type="file" name="file"></input> </small>
|
||||||
|
can be used for uploading the image file
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="method-example">
|
||||||
|
<code class="method-declaration">
|
||||||
|
POST https://DomainName/api/v1/self/clients/{clientId}/images
|
||||||
|
</code>
|
||||||
|
<code class="method-request">
|
||||||
|
POST self/clients/14/images
|
||||||
|
Content-Type: multipart/form-data
|
||||||
|
Request Body: <i>Not shown</i>
|
||||||
|
</code>
|
||||||
|
<code class="method-response">
|
||||||
|
{
|
||||||
|
"resourceId": 14,
|
||||||
|
"changes": {},
|
||||||
|
"resourceIdentifier": "14"
|
||||||
|
}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a id="self_client_image_delete" name="self_client_image_delete" class="old-syle-anchor"> </a>
|
||||||
|
<div class="method-section">
|
||||||
|
<div class="method-description">
|
||||||
|
<h4>Delete an client's Image</h4>
|
||||||
|
</div>
|
||||||
|
<div class="method-example">
|
||||||
|
<code class="method-declaration">
|
||||||
|
DELETE https://DomainName/api/v1/self/clients/{clientId}/images
|
||||||
|
</code>
|
||||||
|
<code class="method-request">
|
||||||
|
DELETE self/clients/14/images
|
||||||
|
Content-Type: application/json
|
||||||
|
No Request Body:
|
||||||
|
</code>
|
||||||
|
<code class="method-response">
|
||||||
|
{
|
||||||
|
"resourceId": 14,
|
||||||
|
"changes": {},
|
||||||
|
"resourceIdentifier": "14"
|
||||||
|
}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- end of Customer Self Service APIs-->
|
<!-- end of Customer Self Service APIs-->
|
||||||
</div>
|
</div>
|
||||||
<!-- main-content-wrapper -->
|
<!-- main-content-wrapper -->
|
||||||
|
|||||||
+1
@@ -188,6 +188,7 @@ public class ClientApiConstants {
|
|||||||
public static final String datatables = "datatables";
|
public static final String datatables = "datatables";
|
||||||
public static final String obligeeData = "ObligeeDetails";
|
public static final String obligeeData = "ObligeeDetails";
|
||||||
|
|
||||||
|
public static final String clientEntityName = "clients";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These parameters will match the class level parameters of
|
* These parameters will match the class level parameters of
|
||||||
|
|||||||
+46
@@ -18,9 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.self.client.api;
|
package org.apache.fineract.portfolio.self.client.api;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.DELETE;
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.HeaderParam;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
@@ -44,6 +49,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||||
|
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||||
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
|
|
||||||
@Path("/self/clients")
|
@Path("/self/clients")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
@@ -217,6 +226,43 @@ public class SelfClientsApiResource {
|
|||||||
throw new ClientNotFoundException(clientId);
|
throw new ClientNotFoundException(clientId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("{clientId}/images")
|
||||||
|
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
public String addNewClientImage(@PathParam("clientId") final Long clientId,
|
||||||
|
@HeaderParam("Content-Length") final Long fileSize, @FormDataParam("file") final InputStream inputStream,
|
||||||
|
@FormDataParam("file") final FormDataContentDisposition fileDetails,
|
||||||
|
@FormDataParam("file") final FormDataBodyPart bodyPart) {
|
||||||
|
|
||||||
|
validateAppuserClientsMapping(clientId);
|
||||||
|
return this.imagesApiResource.addNewClientImage(ClientApiConstants.clientEntityName, clientId, fileSize,
|
||||||
|
inputStream, fileDetails, bodyPart);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("{clientId}/images")
|
||||||
|
@Consumes({ MediaType.TEXT_PLAIN, MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
public String addNewClientImage(@PathParam("entity") final String entityName,
|
||||||
|
@PathParam("clientId") final Long clientId, final String jsonRequestBody) {
|
||||||
|
validateAppuserClientsMapping(clientId);
|
||||||
|
return this.imagesApiResource.addNewClientImage(ClientApiConstants.clientEntityName, clientId, jsonRequestBody);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DELETE
|
||||||
|
@Path("{clientId}/images")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
public String deleteClientImage(@PathParam("clientId") final Long clientId) {
|
||||||
|
|
||||||
|
validateAppuserClientsMapping(clientId);
|
||||||
|
return this.imagesApiResource.deleteClientImage(ClientApiConstants.clientEntityName, clientId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{clientId}/obligeedetails")
|
@Path("{clientId}/obligeedetails")
|
||||||
|
|||||||
Reference in New Issue
Block a user