Search in sources :

Example 1 with CommandProcessingResult

use of org.apache.fineract.infrastructure.core.data.CommandProcessingResult in project fineract by apache.

the class SmsCampaignApiResource method delete.

@DELETE
@Path("{campaignId}")
@Operation(summary = "Delete a SMS Campaign", description = "Note: Only closed SMS Campaigns can be deleted")
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class)))
public String delete(@PathParam("campaignId") final Long campaignId) {
    final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSmsCampaign(campaignId).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse)

Example 2 with CommandProcessingResult

use of org.apache.fineract.infrastructure.core.data.CommandProcessingResult in project fineract by apache.

the class SmsCampaignApiResource method createCampaign.

@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Create a SMS Campaign", description = "Mandatory Fields\n" + "campaignName, campaignType, triggerType, providerId, runReportId, message\n" + "\n" + "Mandatory Fields for Cash based on selected report id\n" + "paramValue in json format")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = CommandWrapper.class)))
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class)))
public String createCampaign(@Parameter(hidden = true) final String apiRequestBodyAsJson) {
    this.platformSecurityContext.authenticatedUser();
    final CommandWrapper commandRequest = new CommandWrapperBuilder().createSmsCampaign().withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) RequestBody(io.swagger.v3.oas.annotations.parameters.RequestBody)

Example 3 with CommandProcessingResult

use of org.apache.fineract.infrastructure.core.data.CommandProcessingResult in project fineract by apache.

the class SmsCampaignApiResource method handleCommands.

@POST
@Path("{campaignId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "SMS Campaign", description = "Activates | Deactivates | Reactivates")
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CommandProcessingResult.class)))
public String handleCommands(@PathParam("campaignId") final Long campaignId, @QueryParam("command") final String commandParam, @Parameter(hidden = true) final String apiRequestBodyAsJson) {
    final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson);
    CommandProcessingResult result = null;
    CommandWrapper commandRequest = null;
    if (is(commandParam, "activate")) {
        commandRequest = builder.activateSmsCampaign(campaignId).build();
        result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    } else if (is(commandParam, "close")) {
        commandRequest = builder.closeSmsCampaign(campaignId).build();
        result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    } else if (is(commandParam, "reactivate")) {
        commandRequest = builder.reactivateSmsCampaign(campaignId).build();
        result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    }
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse)

Example 4 with CommandProcessingResult

use of org.apache.fineract.infrastructure.core.data.CommandProcessingResult in project fineract by apache.

the class CreditBureauConfigurationAPI method createCreditBureauLoanProductMapping.

@POST
@Path("/mappings/{organisationCreditBureauId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String createCreditBureauLoanProductMapping(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, final String apiRequestBodyAsJson) {
    final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(organisationCreditBureauId).withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 5 with CommandProcessingResult

use of org.apache.fineract.infrastructure.core.data.CommandProcessingResult in project fineract by apache.

the class CreditBureauConfigurationAPI method updateCreditBureauLoanProductMapping.

@PUT
@Path("/mappings")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String updateCreditBureauLoanProductMapping(final String apiRequestBodyAsJson) {
    final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureauLoanProductMapping().withJson(apiRequestBodyAsJson).build();
    final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
    return this.toApiJsonSerializer.serialize(result);
}
Also used : CommandWrapperBuilder(org.apache.fineract.commands.service.CommandWrapperBuilder) CommandWrapper(org.apache.fineract.commands.domain.CommandWrapper) CommandProcessingResult(org.apache.fineract.infrastructure.core.data.CommandProcessingResult) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) PUT(javax.ws.rs.PUT)

Aggregations

CommandProcessingResult (org.apache.fineract.infrastructure.core.data.CommandProcessingResult)352 CommandWrapper (org.apache.fineract.commands.domain.CommandWrapper)299 CommandWrapperBuilder (org.apache.fineract.commands.service.CommandWrapperBuilder)299 Produces (javax.ws.rs.Produces)259 Consumes (javax.ws.rs.Consumes)257 Operation (io.swagger.v3.oas.annotations.Operation)202 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)196 Path (javax.ws.rs.Path)187 RequestBody (io.swagger.v3.oas.annotations.parameters.RequestBody)152 POST (javax.ws.rs.POST)124 PUT (javax.ws.rs.PUT)90 DELETE (javax.ws.rs.DELETE)63 Transactional (org.springframework.transaction.annotation.Transactional)34 UnrecognizedQueryParamException (org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException)28 GsonBuilder (com.google.gson.GsonBuilder)26 DateSerializer (org.apache.fineract.infrastructure.bulkimport.importhandler.helper.DateSerializer)25 Cell (org.apache.poi.ss.usermodel.Cell)17 Sheet (org.apache.poi.ss.usermodel.Sheet)17 JsonObject (com.google.gson.JsonObject)15 JsonElement (com.google.gson.JsonElement)14