Skip to content

Commit

Permalink
Gci swagger integration (apache#33)
Browse files Browse the repository at this point in the history
* Swagger Documentation of StandingInstructionApiResource.java

* Swagger Documentation of StandingInstructionHistoryApiResource.java

* Swagger Documentation for ChargesApiResource.java

* Swagger Documentation of EntityFieldConfigurationApiResources.java and LoanChargesApiResource.java

* Swagger Documentation for CollateralsApiResource.java and InterestRateChartsApiResource.java (apache#5)

* Swagger Documentation for InterestRateChartSlabsApiResource.java (apache#8)

* Swagger Documentation for FundsApiResource.java (apache#9)

* Swagger Documentation for LoansApiResource.java (apache#10)

* Swagger Documentation for TaxGroupApiResource.java (apache#12)

* Swagger Documentation for FixedDepositAccountsApiResource.java (apache#13)

* Swagger Documentation for FixedDepositAccountsApiResource.java

* Added Example Request in GET Endpoint {accountId}

Added Example Request in GET Endpoint in "fixeddepositaccounts/{accountId}"

* Swagger Documentation for AccountTransfersApiResource.java (apache#14)

* Swagger Documentation for CollectionSheetApiResource.java and FloatingRatesApiResource.java (apache#15)

* Swagger Documentation for CentersApiResource.java (apache#16)

* Swagger documentation for GroupsApiResource.java (apache#11)

* Swagger Documentation for SelfBeneficiariesTPTApiResource.java and SelfAuthenticationApiResource.java (apache#21)

* Swagger Documentation for SelfClientsApiResource.java (apache#20)

* Swagger Documentation for AccountsApiResource.java (apache#19)

* Swagger Documentation for SelfUserApiResource.java, TaxComponentApiResource.java & SelfUserDetailsApiResource.java (apache#18)

* Swagger Documentation for FixedDepositProductsApiResource.java (apache#22)

* Swagger Documentation for SelfSavingsApiResource.java (apache#23)

* Swagger Documentation for RecurringDepositAccountsApiResource.java (apache#24)

* Swagger Documentation for SelfLoansApiResource.java (apache#17)

* Swagger Documentation for SelfLoansApiResource.java
* Added documentation for POST endpoint

* Swagger Documentation for SavingsAccountsApiResource.java (apache#26)

* Swagger Documentation for RecurringDepositAccountTransactionsApiResource.java (apache#29)

* Swagger Documentation for LoanProductsApiResource.java and NotesApiResource,java (apache#25)

* Swagger Documentation for RecurringDepositProductsApiResource.java & SavingAccountChargesApiResource.java (apache#27)

* Swagger Documenatation for LoanScheduleApiResource.java & LoanTransactionsApiResource.java (apache#28)

* Swagger Documentation for PaymentTypeApiResource.java and ProductsApiResource.java (apache#31)

* Swagger Documentation for SavingsProductsApiResource.java (apache#30)

* Swagger Documentation for Clients API (apache#32)

* Swagger Documentation for Clients API

* Changed the file name

* Fixed minor bugs/errors

* Requested Changes

* Some more changes
  • Loading branch information
Sanyam96 authored Mar 17, 2018
1 parent a13887b commit 8817e7f
Show file tree
Hide file tree
Showing 88 changed files with 15,616 additions and 1,192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
*/
package org.apache.fineract.portfolio.account.api;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;

import io.swagger.annotations.*;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
Expand All @@ -45,9 +35,15 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;

@Path("/accounttransfers")
@Component
@Scope("singleton")
@Api(value = "Account Transfers", description = "Ability to be able to transfer monetary funds from one account to another.\n\n" + "\n\n" + "Note: At present only savings account to savings account transfers are supported.")
public class AccountTransfersApiResource {

private final PlatformSecurityContext context;
Expand All @@ -73,11 +69,13 @@ public AccountTransfersApiResource(final PlatformSecurityContext context,
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String template(@QueryParam("fromOfficeId") final Long fromOfficeId, @QueryParam("fromClientId") final Long fromClientId,
@QueryParam("fromAccountId") final Long fromAccountId, @QueryParam("fromAccountType") final Integer fromAccountType,
@QueryParam("toOfficeId") final Long toOfficeId, @QueryParam("toClientId") final Long toClientId,
@QueryParam("toAccountId") final Long toAccountId, @QueryParam("toAccountType") final Integer toAccountType,
@Context final UriInfo uriInfo) {
@ApiOperation(value = "Retrieve Account Transfer Template", httpMethod = "GET", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n\n" + "\n\n" + "Field Defaults\n\n" + "Allowed Value Lists\n\n" + "Example Requests:\n\n" + "\n\n" + "accounttransfers/template?fromAccountType=2&fromOfficeId=1\n\n" + "\n\n" + "accounttransfers/template?fromAccountType=2&fromOfficeId=1&fromClientId=1\n\n" + "\n\n" + "accounttransfers/template?fromClientId=1&fromAccountType=2&fromAccountId=1")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersTemplateResponse.class)})
public String template(@QueryParam("fromOfficeId") @ApiParam(value = "fromOfficeId") final Long fromOfficeId, @QueryParam("fromClientId") @ApiParam(value = "fromClientId") final Long fromClientId,
@QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccountId, @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType,
@QueryParam("toOfficeId") @ApiParam(value = "toOfficeId") final Long toOfficeId, @QueryParam("toClientId") @ApiParam(value = "toClientId") final Long toClientId,
@QueryParam("toAccountId") @ApiParam(value = "toAccountId") final Long toAccountId, @QueryParam("toAccountType") @ApiParam(value = "toAccountType") final Integer toAccountType,
@Context final UriInfo uriInfo) {

this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);

Expand All @@ -91,7 +89,10 @@ public String template(@QueryParam("fromOfficeId") final Long fromOfficeId, @Que
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String create(final String apiRequestBodyAsJson) {
@ApiOperation(value = "Create new Transfer", httpMethod = "POST", notes = "Ability to create new transfer of monetary funds from one account to another.")
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountTransfersApiResourceSwagger.PostAccountTransfersRequest.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.PostAccountTransfersResponse.class)})
public String create(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {

final CommandWrapper commandRequest = new CommandWrapperBuilder().createAccountTransfer().withJson(apiRequestBodyAsJson).build();

Expand All @@ -103,10 +104,12 @@ public String create(final String apiRequestBodyAsJson) {
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") final String sqlSearch,
@QueryParam("externalId") final String externalId, @QueryParam("offset") final Integer offset,
@QueryParam("limit") final Integer limit, @QueryParam("orderBy") final String orderBy,
@QueryParam("sortOrder") final String sortOrder,@QueryParam("accountDetailId") final Long accountDetailId) {
@ApiOperation(value = "List account transfers", httpMethod = "GET", notes = "Lists account's transfers\n\n" + "Example Requests:\n\n" + "\n\n" + "accounttransfers")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersResponse.class)})
public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch") @ApiParam(value = "sqlSearch") final String sqlSearch,
@QueryParam("externalId") @ApiParam(value = "externalId") final String externalId, @QueryParam("offset") @ApiParam(value = "offset") final Integer offset,
@QueryParam("limit") @ApiParam(example = "limit") final Integer limit, @QueryParam("orderBy") @ApiParam(value = "orderBy") final String orderBy,
@QueryParam("sortOrder") @ApiParam(value = "sortOrder") final String sortOrder,@QueryParam("accountDetailId") @ApiParam(value = "accountDetailId") final Long accountDetailId) {

this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);

Expand All @@ -123,7 +126,9 @@ public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("sqlSearch
@Path("{transferId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveOne(@PathParam("transferId") final Long transferId, @Context final UriInfo uriInfo) {
@ApiOperation(value = "Retrieve account transfer", httpMethod = "GET", notes = "Retrieves account transfer\n\n" + "Example Requests :\n\n" + "\n\n" + "accounttransfers/1")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersResponse.GetAccountTransfersPageItems.class)})
public String retrieveOne(@PathParam("transferId") @ApiParam(value = "transferId") final Long transferId, @Context final UriInfo uriInfo) {

this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);

Expand All @@ -137,10 +142,12 @@ public String retrieveOne(@PathParam("transferId") final Long transferId, @Conte
@Path("templateRefundByTransfer")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String templateRefundByTransfer(@QueryParam("fromOfficeId") final Long fromOfficeId, @QueryParam("fromClientId") final Long fromClientId,
@QueryParam("fromAccountId") final Long fromAccountId, @QueryParam("fromAccountType") final Integer fromAccountType,
@QueryParam("toOfficeId") final Long toOfficeId, @QueryParam("toClientId") final Long toClientId,
@QueryParam("toAccountId") final Long toAccountId, @QueryParam("toAccountType") final Integer toAccountType,
@ApiOperation(value = "Retrieve Refund of an Active Loan by Transfer Template", httpMethod = "GET", notes = "Retrieves Refund of an Active Loan by Transfer Template" + "Example Requests :\n\n" + "\n\n" + "accounttransfers/templateRefundByTransfer?fromAccountId=2&fromAccountType=1& toAccountId=1&toAccountType=2&toClientId=1&toOfficeId=1")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.GetAccountTransfersTemplateRefundByTransferResponse.class)})
public String templateRefundByTransfer(@QueryParam("fromOfficeId") @ApiParam(value = "fromOfficeId") final Long fromOfficeId, @QueryParam("fromClientId") @ApiParam(value = "fromClientId") final Long fromClientId,
@QueryParam("fromAccountId") @ApiParam(value = "fromAccountId") final Long fromAccountId, @QueryParam("fromAccountType") @ApiParam(value = "fromAccountType") final Integer fromAccountType,
@QueryParam("toOfficeId") @ApiParam(value = "toOfficeId") final Long toOfficeId, @QueryParam("toClientId") @ApiParam(value = "toClientId") final Long toClientId,
@QueryParam("toAccountId") @ApiParam(value = "toAccountId") final Long toAccountId, @QueryParam("toAccountType") @ApiParam(value = "toAccountType") final Integer toAccountType,
@Context final UriInfo uriInfo) {

this.context.authenticatedUser().validateHasReadPermission(AccountTransfersApiConstants.ACCOUNT_TRANSFER_RESOURCE_NAME);
Expand All @@ -156,7 +163,10 @@ public String templateRefundByTransfer(@QueryParam("fromOfficeId") final Long fr
@Path("refundByTransfer")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String templateRefundByTransferPost(final String apiRequestBodyAsJson) {
@ApiOperation(value = "Refund of an Active Loan by Transfer", httpMethod = "POST", notes = "Ability to refund an active loan by transferring to a savings account.")
@ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = AccountTransfersApiResourceSwagger.PostAccountTransfersRefundByTransferRequest.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AccountTransfersApiResourceSwagger.PostAccountTransfersRefundByTransferResponse.class)})
public String templateRefundByTransferPost(@ApiParam(hidden = true) final String apiRequestBodyAsJson) {

final CommandWrapper commandRequest = new CommandWrapperBuilder().refundByTransfer().withJson(apiRequestBodyAsJson).build();

Expand Down
Loading

0 comments on commit 8817e7f

Please sign in to comment.