mod-finance-storage (v2)

https://github.com/folio-org/mod-finance-storage

Table of contents

mod-finance-storage (Transactions)

CRUD APIs used to manage transactions.

/finance-storage/transactions

Collection of transaction items.

GET /finance-storage/transactions

Get list of transactions

GET /finance-storage/transactions
Query Parameters
  • query: (string)

    A query expressed as a CQL string (see 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", "="]
    
  • offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response

    Example:

    10
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of transaction items

Body

Media type: application/json

Type: json

Content:

{
  "$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"
  ]
}

Example:

{
  "transactions": [
    {
      "id": "12ac70a4-5c9d-112f-9acb-852adf67d7e1",
      "amount": 140.80,
      "currency": "USD",
      "description": "PO_Line: History of Incas",
      "encumbrance": {
        "amountExpended": 1567.92,
        "amountAwaitingPayment": 12.50,
        "initialAmountEncumbered": 1720.50,
        "status": "Unreleased"
      },
      "fiscalYearId": "4438bc3b-4b4a-4e5e-9886-5f69b48a7a32",
      "fromFundId": "27f27438-3197-4281-a353-511829421d6e",
      "paymentEncumbranceId": "80c28fb4-c34e-48d6-b8c2-de6660c3e0aa",
      "source": "Voucher",
      "sourceFiscalYearId": "01705ce5-3c3d-4c30-b23d-a36feec28259",
      "sourceInvoiceId": "b360db6c-b825-4d74-ac63-5be506892e2b",
      "tags": {
        "tagList": [
          "important"
        ]
      },
      "toFundId": "2e51c019-97f3-4523-87e9-59250e3b48bc",
      "transactionType": "Encumbrance",
      "metadata": {
        "createdDate": "2018-07-19T00:00:00.000+0000",
        "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
      }
    },
    {
      "id": "a4780d61-e9c7-4206-b203-a8b22a6d5c38",
      "amount": 25,
      "currency": "USD",
      "description": "PO_Line: History of Incas",
      "fiscalYearId": "684b5dc5-92f6-4db7-b996-b549d88f5e4e",
      "fromFundId": "7fbd5d84-62d1-44c6-9c45-6cb173998bbd",
      "paymentEncumbranceId": "80c28fb4-c34e-48d6-b8c2-de6660c3e0aa",
      "source": "Voucher",
      "sourceFiscalYearId": "684b5dc5-92f6-4db7-b996-b549d88f5e4e",
      "sourceInvoiceId": "041c1fe8-adfa-44eb-b6b3-f85acdd71f81",
      "tags": {
        "tagList": [
          "important"
        ]
      },
      "toFundId": "69640328-788e-43fc-9c3c-af39e243f3b7",
      "transactionType": "Payment"
    }
  ],
  "totalRecords": 2
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

unable to list transactions -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to list transactions -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /finance-storage/transactions

Create a new transaction item.

POST /finance-storage/transactions
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A financial transaction",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "../../common/schemas/uuid.json",
      "description": "UUID of this transaction"
    },
    "amount": {
      "description": "The amount of this transaction. For encumbrances: This is initialAmountEncumbered - (amountAwaitingPayment + amountExpended)",
      "type": "number"
    },
    "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"
    },
    "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"
    },
    "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": [
        "Credit",
        "Manual",
        "User",
        "Voucher"
      ]
    },
    "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"
    },
    "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",
        "Transfer"
      ],
      "type": "string"
    },
    "metadata": {
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true,
      "type": "object"
    }
  },
  "required": [
    "amount",
    "currency",
    "fiscalYearId",
    "source",
    "transactionType"
  ],
  "additionalProperties": false
}

Example:

{
  "id": "12ac70a4-5c9d-112f-9acb-852adf67d7e1",
  "amount": 25,
  "currency": "USD",
  "description": "PO_Line: History of Incas",
  "fiscalYearId": "4438bc3b-4b4a-4e5e-9886-5f69b48a7a32",
  "fromFundId": "27f27438-3197-4281-a353-511829421d6e",
  "paymentEncumbranceId": "80c28fb4-c34e-48d6-b8c2-de6660c3e0aa",
  "source": "Voucher",
  "sourceFiscalYearId": "01705ce5-3c3d-4c30-b23d-a36feec28259",
  "sourceInvoiceId": "b360db6c-b825-4d74-ac63-5be506892e2b",
  "tags": {
    "tagList": [
      "important"
    ]
  },
  "toFundId": "2e51c019-97f3-4523-87e9-59250e3b48bc",
  "transactionType": "Payment",
  "metadata": {
    "createdDate": "2018-07-19T00:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

Response 201

Returns a newly created item, with server-controlled fields like 'id' populated

Headers
  • Location: required (string)

    URI to the created transaction item

Body

Media type: application/json

Type: any

Example:

{
  "id": "12ac70a4-5c9d-112f-9acb-852adf67d7e1",
  "amount": 25,
  "currency": "USD",
  "description": "PO_Line: History of Incas",
  "fiscalYearId": "4438bc3b-4b4a-4e5e-9886-5f69b48a7a32",
  "fromFundId": "27f27438-3197-4281-a353-511829421d6e",
  "paymentEncumbranceId": "80c28fb4-c34e-48d6-b8c2-de6660c3e0aa",
  "source": "Voucher",
  "sourceFiscalYearId": "01705ce5-3c3d-4c30-b23d-a36feec28259",
  "sourceInvoiceId": "b360db6c-b825-4d74-ac63-5be506892e2b",
  "tags": {
    "tagList": [
      "important"
    ]
  },
  "toFundId": "2e51c019-97f3-4523-87e9-59250e3b48bc",
  "transactionType": "Payment",
  "metadata": {
    "createdDate": "2018-07-19T00:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to add transaction -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create transactions -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /finance-storage/transactions/{id}

Retrieve transaction item with given {transactionId}

GET /finance-storage/transactions/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a transaction

Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A financial transaction",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "../../common/schemas/uuid.json",
      "description": "UUID of this transaction"
    },
    "amount": {
      "description": "The amount of this transaction. For encumbrances: This is initialAmountEncumbered - (amountAwaitingPayment + amountExpended)",
      "type": "number"
    },
    "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"
    },
    "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"
    },
    "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": [
        "Credit",
        "Manual",
        "User",
        "Voucher"
      ]
    },
    "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"
    },
    "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",
        "Transfer"
      ],
      "type": "string"
    },
    "metadata": {
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true,
      "type": "object"
    }
  },
  "required": [
    "amount",
    "currency",
    "fiscalYearId",
    "source",
    "transactionType"
  ],
  "additionalProperties": false
}

Example:

{
  "id": "12ac70a4-5c9d-112f-9acb-852adf67d7e1",
  "amount": 25,
  "currency": "USD",
  "description": "PO_Line: History of Incas",
  "fiscalYearId": "4438bc3b-4b4a-4e5e-9886-5f69b48a7a32",
  "fromFundId": "27f27438-3197-4281-a353-511829421d6e",
  "paymentEncumbranceId": "80c28fb4-c34e-48d6-b8c2-de6660c3e0aa",
  "source": "Voucher",
  "sourceFiscalYearId": "01705ce5-3c3d-4c30-b23d-a36feec28259",
  "sourceInvoiceId": "b360db6c-b825-4d74-ac63-5be506892e2b",
  "tags": {
    "tagList": [
      "important"
    ]
  },
  "toFundId": "2e51c019-97f3-4523-87e9-59250e3b48bc",
  "transactionType": "Payment",
  "metadata": {
    "createdDate": "2018-07-19T00:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"transaction not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /finance-storage/transactions/{id}

Delete transaction item with given {transactionId}

DELETE /finance-storage/transactions/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a transaction

Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 204

Item deleted successfully

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to delete transaction -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"transaction not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

PUT /finance-storage/transactions/{id}

Update transaction item with given {transactionId}

PUT /finance-storage/transactions/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a transaction

Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A financial transaction",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "../../common/schemas/uuid.json",
      "description": "UUID of this transaction"
    },
    "amount": {
      "description": "The amount of this transaction. For encumbrances: This is initialAmountEncumbered - (amountAwaitingPayment + amountExpended)",
      "type": "number"
    },
    "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"
    },
    "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"
    },
    "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": [
        "Credit",
        "Manual",
        "User",
        "Voucher"
      ]
    },
    "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"
    },
    "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",
        "Transfer"
      ],
      "type": "string"
    },
    "metadata": {
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true,
      "type": "object"
    }
  },
  "required": [
    "amount",
    "currency",
    "fiscalYearId",
    "source",
    "transactionType"
  ],
  "additionalProperties": false
}

Example:

{
  "id": "12ac70a4-5c9d-112f-9acb-852adf67d7e1",
  "amount": 25,
  "currency": "USD",
  "description": "PO_Line: History of Incas",
  "fiscalYearId": "4438bc3b-4b4a-4e5e-9886-5f69b48a7a32",
  "fromFundId": "27f27438-3197-4281-a353-511829421d6e",
  "paymentEncumbranceId": "80c28fb4-c34e-48d6-b8c2-de6660c3e0aa",
  "source": "Voucher",
  "sourceFiscalYearId": "01705ce5-3c3d-4c30-b23d-a36feec28259",
  "sourceInvoiceId": "b360db6c-b825-4d74-ac63-5be506892e2b",
  "tags": {
    "tagList": [
      "important"
    ]
  },
  "toFundId": "2e51c019-97f3-4523-87e9-59250e3b48bc",
  "transactionType": "Payment",
  "metadata": {
    "createdDate": "2018-07-19T00:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

Response 204

Item successfully updated

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to update transaction -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"transaction not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator