foliolib.folio.api.financeStorage.Transaction
- class foliolib.folio.api.financeStorage.Transaction(tenant: str)
Bases:
foliolib.folio.FolioApimod-finance-storage (Transactions)
CRUD APIs used to manage transactions.
Base class of the Folio API
- Parameters
tenant (str) – Tenant id
Methods
delete_transaction(transactionsId)Delete transaction item with given {transactionId}
get_transaction(transactionsId)Retrieve transaction item with given {transactionId}
get_transactions(**kwargs)Get list of transactions
modify_transaction(transactionsId, transaction)Deprecated for encumbrances, pending payments, payments and credits - use batch-all-or-nothing instead.
set_batchAllOrNothing(batchAllOrNothing)Process actions on transactions in a single all-or-nothing operation
set_transaction(transaction)Deprecated for encumbrances, pending payments, payments and credits - use batch-all-or-nothing instead.
- delete_transaction(transactionsId: str)
Delete transaction item with given {transactionId}
DELETE /finance-storage/transactions/{transactionsId}- Parameters
transactionsId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestFatalError – Server Error
- get_transaction(transactionsId: str)
Retrieve transaction item with given {transactionId}
GET /finance-storage/transactions/{transactionsId}- Parameters
transactionsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A financial transaction", "type": "object", "javaName": "transaction", "properties": { "id": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of this transaction" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "amount": { "description": "The amount of this transaction. For encumbrances: This is initialAmountEncumbered - (amountAwaitingPayment + amountExpended)", "type": "number" }, "awaitingPayment": { "description": "Pending payment sub-object - holds awaiting payment-specific information not applicable to other transaction types", "$ref": "awaiting_payment.json" }, "currency": { "description": "Currency code for this transaction - from the system currency", "type": "string" }, "description": { "description": "Description of this transaction", "type": "string" }, "encumbrance": { "$ref": "encumbrance.json", "description": "Encumbrance sub-object - holds encumbrance-specific information not applicable to other transaction types", "type": "object" }, "expenseClassId": { "description": "UUID of the associated expense class", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fiscal year that the transaction is taking place in" }, "fromFundId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fund money is moving from" }, "invoiceCancelled": { "description": "Indicates that related invoice was cancelled", "type": "boolean" }, "paymentEncumbranceId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the encumbrance associated with this payment/credit taking place." }, "source": { "description": "The readable identifier of the record that resulted in the creation of this transaction", "type": "string", "enum": [ "User", "PoLine", "Invoice" ] }, "sourceFiscalYearId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fiscal year that triggered the creation of this transaction (Used during fiscal year rollover)" }, "sourceInvoiceId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the Invoice that triggered the creation of this transaction" }, "sourceInvoiceLineId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the Invoice Line that triggered the creation of this transaction" }, "tags": { "$ref": "../../../raml-util/schemas/tags.schema", "description": "Arbitrary tags associated with this transaction", "type": "object" }, "toFundId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fund money is moving to" }, "transactionType": { "description": "This describes the type of transaction", "enum": [ "Allocation", "Credit", "Encumbrance", "Payment", "Pending payment", "Rollover transfer", "Transfer" ], "type": "string" }, "voidedAmount": { "description": "Voided amount, not to be counted in budget totals", "type": "number" }, "metadata": { "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true, "type": "object" } }, "required": [ "amount", "currency", "fiscalYearId", "source", "transactionType" ], "additionalProperties": false }
- get_transactions(**kwargs)
Get list of transactions
GET /finance-storage/transactions- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
query (str) –
A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://dev.folio.org/reference/glossary#cql)) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.
with valid searchable fields: for example code
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
[“code”, “MEDGRANT”, “=”]
totalRecords (str) –
(default=auto) How to calculate the totalRecords property. “exact” for the correct number, “estimated” for an estimation, “auto” to automatically select “exact” or “estimated”, “none” for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords
Example
none
offset (int) –
(default=0) Skip over a number of elements by specifying an offset value for the query
Example
0
limit (int) –
(default=10) Limit the number of elements returned in the response
Example
10
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiRequestFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A collection of transactions", "type": "object", "properties": { "transactions": { "description": "The list of objects contained in this collection", "type": "array", "id": "transactions", "items": { "type": "object", "$ref": "transaction.json" } }, "totalRecords": { "description": "The number of objects in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "transactions", "totalRecords" ] }
- modify_transaction(transactionsId: str, transaction: dict)
Deprecated for encumbrances, pending payments, payments and credits - use batch-all-or-nothing instead.
PUT /finance-storage/transactions/{transactionsId}- Parameters
transactionsId (str) –
transaction (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestConflict – Conflict
OkapiRequestFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A financial transaction", "type": "object", "javaName": "transaction", "properties": { "id": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of this transaction" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "amount": { "description": "The amount of this transaction. For encumbrances: This is initialAmountEncumbered - (amountAwaitingPayment + amountExpended)", "type": "number" }, "awaitingPayment": { "description": "Pending payment sub-object - holds awaiting payment-specific information not applicable to other transaction types", "$ref": "awaiting_payment.json" }, "currency": { "description": "Currency code for this transaction - from the system currency", "type": "string" }, "description": { "description": "Description of this transaction", "type": "string" }, "encumbrance": { "$ref": "encumbrance.json", "description": "Encumbrance sub-object - holds encumbrance-specific information not applicable to other transaction types", "type": "object" }, "expenseClassId": { "description": "UUID of the associated expense class", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fiscal year that the transaction is taking place in" }, "fromFundId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fund money is moving from" }, "invoiceCancelled": { "description": "Indicates that related invoice was cancelled", "type": "boolean" }, "paymentEncumbranceId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the encumbrance associated with this payment/credit taking place." }, "source": { "description": "The readable identifier of the record that resulted in the creation of this transaction", "type": "string", "enum": [ "User", "PoLine", "Invoice" ] }, "sourceFiscalYearId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fiscal year that triggered the creation of this transaction (Used during fiscal year rollover)" }, "sourceInvoiceId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the Invoice that triggered the creation of this transaction" }, "sourceInvoiceLineId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the Invoice Line that triggered the creation of this transaction" }, "tags": { "$ref": "../../../raml-util/schemas/tags.schema", "description": "Arbitrary tags associated with this transaction", "type": "object" }, "toFundId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fund money is moving to" }, "transactionType": { "description": "This describes the type of transaction", "enum": [ "Allocation", "Credit", "Encumbrance", "Payment", "Pending payment", "Rollover transfer", "Transfer" ], "type": "string" }, "voidedAmount": { "description": "Voided amount, not to be counted in budget totals", "type": "number" }, "metadata": { "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true, "type": "object" } }, "required": [ "amount", "currency", "fiscalYearId", "source", "transactionType" ], "additionalProperties": false }
- set_batchAllOrNothing(batchAllOrNothing: dict)
Process actions on transactions in a single all-or-nothing operation
POST /finance-storage/transactions/batch-all-or-nothing- Parameters
batchAllOrNothing (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Batch processing of transactions", "type": "object", "properties": { "transactionsToCreate": { "description": "Transactions to create (they must include the id)", "type": "array", "items": { "$ref": "transaction.json" } }, "transactionsToUpdate": { "description": "Transactions to update", "type": "array", "items": { "$ref": "transaction.json" } }, "idsOfTransactionsToDelete": { "description": "Ids of transactions to delete", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "transactionPatches": { "description": "Transaction patches (incomplete transactions that must include the id)", "type": "array", "items": { "type": "object", "properties": { "id": { "description": "UUID of the transaction to patch", "$ref": "../../common/schemas/uuid.json" } }, "additionalProperties": true, "required": [ "id" ] } } }, "additionalProperties": false }
- set_transaction(transaction: dict)
Deprecated for encumbrances, pending payments, payments and credits - use batch-all-or-nothing instead.
POST /finance-storage/transactions- Parameters
transaction (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiRequestFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Headers
Location - URI to the created transaction item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A financial transaction", "type": "object", "javaName": "transaction", "properties": { "id": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of this transaction" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "amount": { "description": "The amount of this transaction. For encumbrances: This is initialAmountEncumbered - (amountAwaitingPayment + amountExpended)", "type": "number" }, "awaitingPayment": { "description": "Pending payment sub-object - holds awaiting payment-specific information not applicable to other transaction types", "$ref": "awaiting_payment.json" }, "currency": { "description": "Currency code for this transaction - from the system currency", "type": "string" }, "description": { "description": "Description of this transaction", "type": "string" }, "encumbrance": { "$ref": "encumbrance.json", "description": "Encumbrance sub-object - holds encumbrance-specific information not applicable to other transaction types", "type": "object" }, "expenseClassId": { "description": "UUID of the associated expense class", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fiscal year that the transaction is taking place in" }, "fromFundId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fund money is moving from" }, "invoiceCancelled": { "description": "Indicates that related invoice was cancelled", "type": "boolean" }, "paymentEncumbranceId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the encumbrance associated with this payment/credit taking place." }, "source": { "description": "The readable identifier of the record that resulted in the creation of this transaction", "type": "string", "enum": [ "User", "PoLine", "Invoice" ] }, "sourceFiscalYearId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fiscal year that triggered the creation of this transaction (Used during fiscal year rollover)" }, "sourceInvoiceId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the Invoice that triggered the creation of this transaction" }, "sourceInvoiceLineId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the Invoice Line that triggered the creation of this transaction" }, "tags": { "$ref": "../../../raml-util/schemas/tags.schema", "description": "Arbitrary tags associated with this transaction", "type": "object" }, "toFundId": { "$ref": "../../common/schemas/uuid.json", "description": "UUID of the fund money is moving to" }, "transactionType": { "description": "This describes the type of transaction", "enum": [ "Allocation", "Credit", "Encumbrance", "Payment", "Pending payment", "Rollover transfer", "Transfer" ], "type": "string" }, "voidedAmount": { "description": "Voided amount, not to be counted in budget totals", "type": "number" }, "metadata": { "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true, "type": "object" } }, "required": [ "amount", "currency", "fiscalYearId", "source", "transactionType" ], "additionalProperties": false }