Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MODFISTO-460] Removed the old transaction API #408

Merged
merged 13 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 2 additions & 151 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,92 +412,25 @@
},
{
"id": "finance-storage.transactions",
"version": "4.1",
"version": "5.0",
"handlers": [
{
"methods": ["GET"],
"pathPattern": "/finance-storage/transactions",
"permissionsRequired": ["finance-storage.transactions.collection.get"]
},
{
"methods": ["POST"],
"pathPattern": "/finance-storage/transactions",
"permissionsRequired": ["finance-storage.transactions.item.post"]
},
{
"methods": ["GET"],
"pathPattern": "/finance-storage/transactions/{id}",
"permissionsRequired": ["finance-storage.transactions.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/finance-storage/transactions/{id}",
"permissionsRequired": ["finance-storage.transactions.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/finance-storage/transactions/{id}",
"permissionsRequired": ["finance-storage.transactions.item.delete"]
},
{
"methods": ["POST"],
"pathPattern": "/finance-storage/transactions/batch-all-or-nothing",
"permissionsRequired": ["finance-storage.transactions.batch"]
}
]
},
{
"id": "finance-storage.order-transaction-summaries",
"version": "1.1",
"handlers": [
{
"methods": ["POST"],
"pathPattern": "/finance-storage/order-transaction-summaries",
"permissionsRequired": ["finance-storage.order-transaction-summaries.item.post"]
},
{
"methods": ["GET"],
"pathPattern": "/finance-storage/order-transaction-summaries/{id}",
"permissionsRequired": ["finance-storage.order-transaction-summaries.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/finance-storage/order-transaction-summaries/{id}",
"permissionsRequired": ["finance-storage.order-transaction-summaries.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/finance-storage/order-transaction-summaries/{id}",
"permissionsRequired": ["finance-storage.order-transaction-summaries.item.delete"]
}
]
},
{
"id": "finance-storage.invoice-transaction-summaries",
"version": "2.1",
"handlers": [
{
"methods": ["POST"],
"pathPattern": "/finance-storage/invoice-transaction-summaries",
"permissionsRequired": ["finance-storage.invoice-transaction-summaries.item.post"]
},
{
"methods": ["GET"],
"pathPattern": "/finance-storage/invoice-transaction-summaries/{id}",
"permissionsRequired": ["finance-storage.invoice-transaction-summaries.item.get"]
},
{
"methods": ["PUT"],
"pathPattern": "/finance-storage/invoice-transaction-summaries/{id}",
"permissionsRequired": ["finance-storage.invoice-transaction-summaries.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/finance-storage/invoice-transaction-summaries/{id}",
"permissionsRequired": ["finance-storage.invoice-transaction-summaries.item.delete"]
}
]
},
{
"id" : "_tenant",
"version" : "2.0",
Expand Down Expand Up @@ -963,26 +896,11 @@
"displayName" : "finance-storage.transactions.-collection get",
"description" : "Get collection of transactions"
},
{
"permissionName" : "finance-storage.transactions.item.post",
"displayName" : "finance-storage.transactions.-item post",
"description" : "Create a new transaction"
},
{
"permissionName" : "finance-storage.transactions.item.get",
"displayName" : "finance-storage.transactions.-item get",
"description" : "Fetch a transaction"
},
{
"permissionName" : "finance-storage.transactions.item.put",
"displayName" : "finance-storage.transactions.-item put",
"description" : "Update a transaction"
},
{
"permissionName" : "finance-storage.transactions.item.delete",
"displayName" : "finance-storage.transactions.-item delete",
"description" : "Delete a transaction"
},
{
"permissionName" : "finance-storage.transactions.batch",
"displayName" : "process transactions in batch",
Expand All @@ -994,75 +912,10 @@
"description" : "All permissions for the transaction",
"subPermissions" : [
"finance-storage.transactions.collection.get",
"finance-storage.transactions.item.post",
"finance-storage.transactions.item.get",
"finance-storage.transactions.item.put",
"finance-storage.transactions.item.delete",
"finance-storage.transactions.batch"
]
},
{
"permissionName" : "finance-storage.order-transaction-summaries.item.get",
"displayName" : "Retrieve a new order transaction summary record",
"description" : "Retrieve a new order transaction summary record"
},
{
"permissionName" : "finance-storage.order-transaction-summaries.item.post",
"displayName" : "Create a new order transaction summary record",
"description" : "Create a new order transaction summary record"
},
{
"permissionName" : "finance-storage.order-transaction-summaries.item.put",
"displayName" : "Update order transaction summary record",
"description" : "Update order transaction summary record"
},
{
"permissionName" : "finance-storage.order-transaction-summaries.item.delete",
"displayName" : "Delete a new order transaction summary record",
"description" : "Delete a new order transaction summary record"
},
{
"permissionName" : "finance-storage.order-transaction-summaries.all",
"displayName" : "All order transaction summary perms",
"description" : "All permissions for the order transaction summary",
"subPermissions" : [
"finance-storage.order-transaction-summaries.item.get",
"finance-storage.order-transaction-summaries.item.post",
"finance-storage.order-transaction-summaries.item.put",
"finance-storage.order-transaction-summaries.item.delete"
]
},
{
"permissionName" : "finance-storage.invoice-transaction-summaries.item.get",
"displayName" : "Retrieve an invoice transaction summary record",
"description" : "Retrieve an invoice transaction summary record"
},
{
"permissionName" : "finance-storage.invoice-transaction-summaries.item.post",
"displayName" : "Create a new invoice transaction summary record",
"description" : "Create a new invoice transaction summary record"
},
{
"permissionName" : "finance-storage.invoice-transaction-summaries.item.put",
"displayName" : "Update invoice transaction summary record",
"description" : "Update invoice transaction summary record"
},
{
"permissionName" : "finance-storage.invoice-transaction-summaries.item.delete",
"displayName" : "Delete an invoice transaction summary record",
"description" : "Delete an invoice transaction summary record"
},
{
"permissionName" : "finance-storage.invoice-transaction-summaries.all",
"displayName" : "All invoice transaction summary perms",
"description" : "All permissions for the invoice transaction summary",
"subPermissions" : [
"finance-storage.invoice-transaction-summaries.item.get",
"finance-storage.invoice-transaction-summaries.item.post",
"finance-storage.invoice-transaction-summaries.item.put",
"finance-storage.invoice-transaction-summaries.item.delete"
]
},
{
"permissionName" : "finance.module.all",
"displayName" : "All finance-module perms",
Expand All @@ -1076,9 +929,7 @@
"finance-storage.groups.all",
"finance-storage.ledgers.all",
"finance-storage.transactions.all",
"finance-storage.fund-types.all",
"finance-storage.order-transaction-summaries.all",
"finance-storage.invoice-transaction-summaries.all"
"finance-storage.fund-types.all"
]
}
],
Expand Down
121 changes: 0 additions & 121 deletions ramls/transaction-summary.raml

This file was deleted.

18 changes: 5 additions & 13 deletions ramls/transaction.raml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#%RAML 1.0
title: "mod-finance-storage"
baseUri: https://github.com/folio-org/mod-finance-storage
version: v3
version: v4

documentation:
- title: mod-finance-storage (Transactions)
Expand All @@ -22,20 +22,15 @@ traits:
validate: !include raml-util/traits/validation.raml

resourceTypes:
collection: !include raml-util/rtypes/collection.raml
collection-item: !include raml-util/rtypes/item-collection.raml
collection-get: !include raml-util/rtypes/collection-get.raml
collection-item-get: !include raml-util/rtypes/item-collection-get-with-json-response.raml


/finance-storage/transactions:
type:
collection:
collection-get:
exampleCollection: !include acq-models/mod-finance/examples/transaction_collection.sample
exampleItem: !include acq-models/mod-finance/examples/transaction.sample
schemaCollection: transaction-collection
schemaItem: transaction
post:
description: Deprecated for encumbrances, pending payments, payments and credits - use batch-all-or-nothing instead.
is: [validate]
get:
description: Get list of transactions
is: [
Expand All @@ -48,12 +43,9 @@ resourceTypes:
description: The UUID of a transaction
type: UUID
type:
collection-item:
collection-item-get:
exampleItem: !include acq-models/mod-finance/examples/transaction.sample
schema: transaction
put:
description: Deprecated for encumbrances, pending payments, payments and credits - use batch-all-or-nothing instead.
is: [validate]
/batch-all-or-nothing:
displayName: Batch processing of transactions
post:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import javax.ws.rs.core.Response;

import io.vertx.ext.web.handler.HttpException;
import org.folio.rest.exception.HttpException;
import io.vertx.pgclient.PgException;
import org.folio.rest.persist.HelperUtils;
import org.folio.rest.persist.PgExceptionUtil;
Expand All @@ -20,9 +20,8 @@ public class NameCodeConstraintErrorBuilder {

public <T> HttpException buildException(AsyncResult<T> reply, Class<?> clazz ) {
Throwable cause = reply.cause();
if (cause instanceof PgException && "23F09".equals(((PgException)cause).getCode())) {
String message = MessageFormat.format(ErrorCodes.CONFLICT.getDescription(), ((PgException)cause).getTable(),
((PgException)cause).getErrorMessage());
if (cause instanceof PgException pgEx && PgExceptionUtil.isVersionConflict(pgEx)) {
String message = MessageFormat.format(ErrorCodes.CONFLICT.getDescription(), pgEx.getTable(), pgEx.getErrorMessage());
return new HttpException(Response.Status.CONFLICT.getStatusCode(), message);
}
String error = convertExceptionToStringError(reply, clazz);
Expand Down
Loading
Loading