Skip to content

Commit bbc9d94

Browse files
committed
FINERACT-1222: Add Swagger tags for Journal Entries
1 parent 53269ba commit bbc9d94

10 files changed

Lines changed: 64 additions & 48 deletions

File tree

fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3170,15 +3170,6 @@ public CommandWrapperBuilder payClientCharge(final Long clientId, final Long cha
31703170
return this;
31713171
}
31723172

3173-
public CommandWrapperBuilder inactivateClientCharge(final Long clientId, final Long chargeId) {
3174-
this.actionName = ACTION_INACTIVATE;
3175-
this.entityName = ClientApiConstants.CLIENT_CHARGES_RESOURCE_NAME;
3176-
this.entityId = chargeId;
3177-
this.clientId = clientId;
3178-
this.href = "/clients/" + clientId + "/charges/" + chargeId + "?command=inactivate";
3179-
return this;
3180-
}
3181-
31823173
public CommandWrapperBuilder undoClientTransaction(final Long clientId, final Long transactionId) {
31833174
this.actionName = ClientApiConstants.CLIENT_TRANSACTION_ACTION_UNDO;
31843175
this.entityName = ClientApiConstants.CLIENT_RESOURCE_NAME;

fineract-core/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class ClientApiConstants {
3333
public static final String CLIENT_CHARGE_ACTION_DELETE = "DELETE";
3434
public static final String CLIENT_CHARGE_ACTION_WAIVE = "WAIVE";
3535
public static final String CLIENT_CHARGE_ACTION_PAY = "PAY";
36-
public static final String CLIENT_CHARGE_ACTION_INACTIVATE = "INACTIVATE";
3736

3837
// Client charge associations and query parameters
3938
public static final String CLIENT_CHARGE_QUERY_PARAM_STATUS = "chargeStatus";
@@ -49,7 +48,6 @@ public class ClientApiConstants {
4948
// Commands
5049
public static final String CLIENT_CHARGE_COMMAND_WAIVE_CHARGE = "waive";
5150
public static final String CLIENT_CHARGE_COMMAND_PAY_CHARGE = "paycharge";
52-
public static final String CLIENT_CHARGE_COMMAND_INACTIVATE_CHARGE = "inactivate";
5351
public static final String CLIENT_TRANSACTION_COMMAND_UNDO = "undo";
5452

5553
public static final String CLIENT_CLOSURE_REASON = "ClientClosureReason";

fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,14 @@ public class JournalEntriesApiResource {
9898

9999
@GET
100100
@Produces({ MediaType.APPLICATION_JSON })
101-
@Operation(summary = "List Journal Entries", operationId = "retrieveAllJournalEntries", description = "The list capability of journal entries can support pagination and sorting.\n\n"
102-
+ "Example Requests:\n" + "\n" + "journalentries\n" + "\n" + "journalentries?transactionId=PB37X8Y21EQUY4S\n" + "\n"
103-
+ "journalentries?officeId=1&manualEntriesOnly=true&fromDate=1 July 2013&toDate=15 July 2013&dateFormat=dd MMMM yyyy&locale=en\n"
104-
+ "\n" + "journalentries?fields=officeName,glAccountName,transactionDate\n" + "\n" + "journalentries?offset=10&limit=50\n"
105-
+ "\n" + "journalentries?orderBy=transactionId&sortOrder=DESC\n" + "\n" + "journalentries?runningBalance=true\n" + "\n"
106-
+ "journalentries?transactionDetails=true\n" + "\n" + "journalentries?loanId=12\n" + "\n" + "journalentries?savingsId=24")
101+
@Operation(summary = "List Journal Entries", operationId = "retrieveAllJournalEntries", tags = {
102+
"Journal Entries" }, description = "The list capability of journal entries can support pagination and sorting.\n\n"
103+
+ "Example Requests:\n" + "\n" + "journalentries\n" + "\n" + "journalentries?transactionId=PB37X8Y21EQUY4S\n" + "\n"
104+
+ "journalentries?officeId=1&manualEntriesOnly=true&fromDate=1 July 2013&toDate=15 July 2013&dateFormat=dd MMMM yyyy&locale=en\n"
105+
+ "\n" + "journalentries?fields=officeName,glAccountName,transactionDate\n" + "\n"
106+
+ "journalentries?offset=10&limit=50\n" + "\n" + "journalentries?orderBy=transactionId&sortOrder=DESC\n" + "\n"
107+
+ "journalentries?runningBalance=true\n" + "\n" + "journalentries?transactionDetails=true\n" + "\n"
108+
+ "journalentries?loanId=12\n" + "\n" + "journalentries?savingsId=24")
107109
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.GetJournalEntriesTransactionIdResponse.class)))
108110
public String retrieveAll(@Context final UriInfo uriInfo,
109111
@QueryParam("officeId") @Parameter(description = "officeId") final Long officeId,
@@ -165,9 +167,9 @@ public String retrieveAll(@Context final UriInfo uriInfo,
165167
@GET
166168
@Path("{journalEntryId}")
167169
@Produces({ MediaType.APPLICATION_JSON })
168-
@Operation(summary = "Retrieve a single Entry", description = "Example Requests:\n" + "\n" + "journalentries/1\n" + "\n" + "\n" + "\n"
169-
+ "journalentries/1?fields=officeName,glAccountId,entryType,amount\n" + "\n" + "journalentries/1?runningBalance=true\n" + "\n"
170-
+ "journalentries/1?transactionDetails=true")
170+
@Operation(summary = "Retrieve a single Entry", tags = { "Journal Entries" }, description = "Example Requests:\n" + "\n"
171+
+ "journalentries/1\n" + "\n" + "\n" + "\n" + "journalentries/1?fields=officeName,glAccountId,entryType,amount\n" + "\n"
172+
+ "journalentries/1?runningBalance=true\n" + "\n" + "journalentries/1?transactionDetails=true")
171173
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.JournalEntryTransactionItem.class)))
172174
public String retrieveJournalEntryById(
173175
@PathParam("journalEntryId") @Parameter(description = "journalEntryId") final Long journalEntryId,
@@ -188,11 +190,12 @@ public String retrieveJournalEntryById(
188190
@POST
189191
@Consumes({ MediaType.APPLICATION_JSON })
190192
@Produces({ MediaType.APPLICATION_JSON })
191-
@Operation(summary = "Create \"Balanced\" Journal Entries", description = "Note: A Balanced (simple) Journal entry would have atleast one \"Debit\" and one \"Credit\" entry whose amounts are equal \n"
192-
+ "Compound Journal entries may have \"n\" debits and \"m\" credits where both \"m\" and \"n\" are greater than 0 and the net sum or all debits and credits are equal \n\n"
193-
+ "\n" + "Mandatory Fields\n" + "officeId, transactionDate\n\n" + "\ncredits- glAccountId, amount, comments\n\n "
194-
+ "\ndebits- glAccountId, amount, comments\n\n " + "\n" + "Optional Fields\n"
195-
+ "paymentTypeId, accountNumber, checkNumber, routingCode, receiptNumber, bankNumber")
193+
@Operation(summary = "Create \"Balanced\" Journal Entries", tags = {
194+
"Journal Entries" }, description = "Note: A Balanced (simple) Journal entry would have atleast one \"Debit\" and one \"Credit\" entry whose amounts are equal \n"
195+
+ "Compound Journal entries may have \"n\" debits and \"m\" credits where both \"m\" and \"n\" are greater than 0 and the net sum or all debits and credits are equal \n\n"
196+
+ "\n" + "Mandatory Fields\n" + "officeId, transactionDate\n\n" + "\ncredits- glAccountId, amount, comments\n\n "
197+
+ "\ndebits- glAccountId, amount, comments\n\n " + "\n" + "Optional Fields\n"
198+
+ "paymentTypeId, accountNumber, checkNumber, routingCode, receiptNumber, bankNumber")
196199
@RequestBody(content = @Content(schema = @Schema(implementation = JournalEntryCommand.class)))
197200
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.PostJournalEntriesResponse.class)))
198201
public String createGLJournalEntry(@Parameter(hidden = true) final String jsonRequestBody,
@@ -218,8 +221,9 @@ public String createGLJournalEntry(@Parameter(hidden = true) final String jsonRe
218221
@Path("{transactionId}")
219222
@Consumes({ MediaType.APPLICATION_JSON })
220223
@Produces({ MediaType.APPLICATION_JSON })
221-
@Operation(summary = "Update Running balances for Journal Entries", description = "This API calculates the running balances for office. If office ID not provided this API calculates running balances for all offices. \n"
222-
+ "Mandatory Fields\n" + "officeId")
224+
@Operation(summary = "Update Running balances for Journal Entries", tags = {
225+
"Journal Entries" }, description = "This API calculates the running balances for office. If office ID not provided this API calculates running balances for all offices. \n"
226+
+ "Mandatory Fields\n" + "officeId")
223227
@RequestBody(content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdRequest.class)))
224228
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = JournalEntriesApiResourceSwagger.PostJournalEntriesTransactionIdResponse.class)))
225229
public String createReversalJournalEntry(@Parameter(hidden = true) final String jsonRequestBody,
@@ -240,6 +244,8 @@ public String createReversalJournalEntry(@Parameter(hidden = true) final String
240244
@GET
241245
@Path("provisioning")
242246
@Produces({ MediaType.APPLICATION_JSON })
247+
@Operation(summary = "Retrieve Journal Entries for Provisioning", description = "Returns journal entries related to provisioning entries based on entry ID.", tags = {
248+
"Journal Entries" })
243249
public String retrieveJournalEntries(@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
244250
@QueryParam("entryId") final Long entryId, @Context final UriInfo uriInfo) {
245251
this.context.authenticatedUser();
@@ -254,6 +260,8 @@ public String retrieveJournalEntries(@QueryParam("offset") final Integer offset,
254260
@GET
255261
@Path("openingbalance")
256262
@Produces({ MediaType.APPLICATION_JSON })
263+
@Operation(summary = "Retrieve Opening Balance", description = "Returns the opening balance for a specific office and currency.", tags = {
264+
"Journal Entries" })
257265
public String retrieveOpeningBalance(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId,
258266
@QueryParam("currencyCode") final String currencyCode) {
259267

@@ -271,6 +279,8 @@ private boolean is(final String commandParam, final String commandValue) {
271279
@GET
272280
@Path("downloadtemplate")
273281
@Produces("application/vnd.ms-excel")
282+
@Operation(summary = "Download journal entries template", description = "Returns an Excel template for bulk importing journal entries.", tags = {
283+
"Journal Entries" })
274284
public Response getJournalEntriesTemplate(@QueryParam("officeId") final Long officeId,
275285
@QueryParam("dateFormat") final String dateFormat) {
276286
return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.GL_JOURNAL_ENTRIES.toString(), officeId, null, dateFormat);
@@ -281,6 +291,8 @@ public Response getJournalEntriesTemplate(@QueryParam("officeId") final Long off
281291
@Consumes(MediaType.MULTIPART_FORM_DATA)
282292
@RequestBody(description = "Upload journal entries template", content = {
283293
@Content(mediaType = MediaType.MULTIPART_FORM_DATA, schema = @Schema(implementation = UploadRequest.class)) })
294+
@Operation(summary = "Upload journal entries template", description = "Uploads a filled Excel template to create multiple journal entries in bulk.", tags = {
295+
"Journal Entries" })
284296
public String postJournalEntriesTemplate(@FormDataParam("file") InputStream uploadedInputStream,
285297
@FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale,
286298
@FormDataParam("dateFormat") final String dateFormat) {

fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,10 @@ public String payOrWaiveClientCharge(@PathParam("clientId") @Parameter(descripti
205205

206206
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
207207

208-
json = this.toApiJsonSerializer.serialize(result);
209-
} else if (is(commandParam, ClientApiConstants.CLIENT_CHARGE_COMMAND_INACTIVATE_CHARGE)) {
210-
final CommandWrapper commandRequest = new CommandWrapperBuilder().inactivateClientCharge(clientId, chargeId).build();
211-
212-
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
213-
214208
json = this.toApiJsonSerializer.serialize(result);
215209
} else {
216210
throw new UnrecognizedQueryParamException("command", commandParam, ClientApiConstants.CLIENT_CHARGE_COMMAND_WAIVE_CHARGE,
217-
ClientApiConstants.CLIENT_CHARGE_COMMAND_PAY_CHARGE, ClientApiConstants.CLIENT_CHARGE_COMMAND_INACTIVATE_CHARGE);
211+
ClientApiConstants.CLIENT_CHARGE_COMMAND_PAY_CHARGE);
218212
}
219213

220214
return json;

fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformService.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,4 @@ public interface ClientChargeWritePlatformService {
3939
@Transactional
4040
CommandProcessingResult payCharge(Long clientId, Long clientChargeId, JsonCommand command);
4141

42-
@Transactional
43-
CommandProcessingResult inactivateCharge(Long clientId, Long clientChargeId);
44-
4542
}

fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceImpl.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,6 @@ public CommandProcessingResult updateCharge(@SuppressWarnings("unused") Long cli
355355
return null;
356356
}
357357

358-
@Override
359-
@SuppressWarnings("unused")
360-
public CommandProcessingResult inactivateCharge(Long clientId, Long clientChargeId) {
361-
// functionality not yet supported
362-
return null;
363-
}
364-
365358
/**
366359
* Ensures that the charge due date is not on a holiday or a non working day
367360
*

fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,5 @@
249249
<include file="parts/0228_add_configuration_block_transactions_on_closed_overpaid_loans.xml" relativeToChangelogFile="true" />
250250
<include file="parts/0229_trial_balance_summary_fix_empty_space.xml" relativeToChangelogFile="true" />
251251
<include file="parts/0230_add_forgot_password.xml" relativeToChangelogFile="true" />
252+
<include file="parts/0231_remove_clientcharge_inactivate_permissions.xml" relativeToChangelogFile="true" />
252253
</databaseChangeLog>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
25+
<changeSet author="ashharahmadkhan" id="1">
26+
<comment>Remove INACTIVATE_CLIENTCHARGE permissions - command was never implemented and the client-charge inactivate write path is being removed.</comment>
27+
<delete tableName="m_permission">
28+
<where>code='INACTIVATE_CLIENTCHARGE'</where>
29+
</delete>
30+
<delete tableName="m_permission">
31+
<where>code='INACTIVATE_CLIENTCHARGE_CHECKER'</where>
32+
</delete>
33+
</changeSet>
34+
</databaseChangeLog>

fineract-provider/src/main/resources/sql/migrations/sample_data/barebones_db.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3738,13 +3738,11 @@ INSERT INTO `m_permission` (`id`, `grouping`, `code`, `entity_name`, `action_nam
37383738
(668, 'portfolio', 'DELETE_CLIENTCHARGE', 'CLIENTCHARGE', 'DELETE', 0),
37393739
(669, 'portfolio', 'WAIVE_CLIENTCHARGE', 'CLIENTCHARGE', 'WAIVE', 0),
37403740
(670, 'portfolio', 'PAY_CLIENTCHARGE', 'CLIENTCHARGE', 'PAY', 0),
3741-
(671, 'portfolio', 'INACTIVATE_CLIENTCHARGE', 'CLIENTCHARGE', 'INACTIVATE', 0),
37423741
(672, 'portfolio', 'UPDATE_CLIENTCHARGE', 'CLIENTCHARGE', 'UPDATE', 0),
37433742
(673, 'portfolio', 'CREATE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'CREATE_CHECKER', 0),
37443743
(674, 'portfolio', 'DELETE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'DELETE_CHECKER', 0),
37453744
(675, 'portfolio', 'WAIVE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'WAIVE_CHECKER', 0),
37463745
(676, 'portfolio', 'PAY_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'PAY_CHECKER', 0),
3747-
(677, 'portfolio', 'INACTIVATE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'INACTIVATE_CHECKER', 0),
37483746
(678, 'portfolio', 'UPDATE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'UPDATE_CHECKER', 0),
37493747
(679, 'transaction_client', 'READTRANSACTION_CLIENT', 'CLIENT', 'READTRANSACTION', 0),
37503748
(680, 'transaction_client', 'UNDOTRANSACTION_CLIENT', 'CLIENT', 'UNDOTRANSACTION', 0),

fineract-provider/src/main/resources/sql/migrations/sample_data/load_sample_data.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3910,13 +3910,11 @@ INSERT INTO `m_permission` (`id`, `grouping`, `code`, `entity_name`, `action_nam
39103910
(668, 'portfolio', 'DELETE_CLIENTCHARGE', 'CLIENTCHARGE', 'DELETE', 0),
39113911
(669, 'portfolio', 'WAIVE_CLIENTCHARGE', 'CLIENTCHARGE', 'WAIVE', 0),
39123912
(670, 'portfolio', 'PAY_CLIENTCHARGE', 'CLIENTCHARGE', 'PAY', 0),
3913-
(671, 'portfolio', 'INACTIVATE_CLIENTCHARGE', 'CLIENTCHARGE', 'INACTIVATE', 0),
39143913
(672, 'portfolio', 'UPDATE_CLIENTCHARGE', 'CLIENTCHARGE', 'UPDATE', 0),
39153914
(673, 'portfolio', 'CREATE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'CREATE_CHECKER', 0),
39163915
(674, 'portfolio', 'DELETE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'DELETE_CHECKER', 0),
39173916
(675, 'portfolio', 'WAIVE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'WAIVE_CHECKER', 0),
39183917
(676, 'portfolio', 'PAY_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'PAY_CHECKER', 0),
3919-
(677, 'portfolio', 'INACTIVATE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'INACTIVATE_CHECKER', 0),
39203918
(678, 'portfolio', 'UPDATE_CLIENTCHARGE_CHECKER', 'CLIENTCHARGE', 'UPDATE_CHECKER', 0),
39213919
(679, 'transaction_client', 'READTRANSACTION_CLIENT', 'CLIENT', 'READTRANSACTION', 0),
39223920
(680, 'transaction_client', 'UNDOTRANSACTION_CLIENT', 'CLIENT', 'UNDOTRANSACTION', 0),

0 commit comments

Comments
 (0)