foliolib.folio.api.financeStorage.Transaction

class foliolib.folio.api.financeStorage.Transaction(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

mod-finance-storage (Transactions)

CRUD APIs used to manage transactions.

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

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)

Update transaction item with given {transactionId}

set_transaction(transaction)

Create a new transaction item.

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

  • OkapiFatalError – 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

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A financial transaction",
  "type": "object",
  "extends": {
    "$ref": "../../common/schemas/entity.json"
  },
  "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

  • OkapiFatalError – 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)

Update transaction item with given {transactionId}

PUT /finance-storage/transactions/{transactionsId}

Parameters
  • transactionsId (str) –

  • transaction (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A financial transaction",
  "type": "object",
  "extends": {
    "$ref": "../../common/schemas/entity.json"
  },
  "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_transaction(transaction: dict)

Create a new transaction item.

POST /finance-storage/transactions

Parameters

transaction (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – 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",
  "extends": {
    "$ref": "../../common/schemas/entity.json"
  },
  "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
}