Vouchers (v1)

http://github.com/folio-org/mod-invoice-storage

Table of contents

Vouchers CRUD API

This documents the API calls that can be made to manage vouchers;This API is intended for internal use only

/voucher-storage

GET /voucher-storage/vouchers

Get list of vouchers

GET /voucher-storage/vouchers
Query Parameters
  • 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
  • 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 voucherStatus

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    voucherStatus=="Paid"
    
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of voucher items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "collection of vouchers",
  "type": "object",
  "properties": {
    "vouchers": {
      "description": "an array of voucher records",
      "id": "vouchers",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "voucher.json"
      }
    },
    "totalRecords": {
      "description": "total number of records in the array",
      "type": "integer"
    }
  },
  "required": [
    "vouchers",
    "totalRecords"
  ]
}

Example:

{
  "vouchers": [
    {
      "id": "a9b99f8a-7100-47f2-9903-6293d44a9905",
      "accountingCode": "0206",
      "amount": 23.45,
      "batchNumber": "101",
      "disbursementNumber": "EFT546789",
      "disbursementDate": "2019-05-05T00:00:00.000+0000",
      "disbursementAmount": 5,
      "invoiceCurrency": "EUR",
      "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
      "exchangeRate": 1.12,
      "exportToAccounting": false,
      "status": "Paid",
      "systemCurrency": "USD",
      "type": "Pre-payment",
      "voucherDate": "2019-05-06T00:00:00.000+0000",
      "voucherNumber": "1000",
      "acqUnitIds": [
        "1895e539-8dac-441e-b1f5-aab62b3fde60",
        "47f504bd-0c1b-498e-a2ae-e2f0a0cea273"
      ],
      "metadata": {
         "createdDate": "2019-05-06T00:00:00.000+0000",
         "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
      }
    }
  ],
  "totalRecords": 1
}

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 vouchers -- 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 vouchers -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /voucher-storage/vouchers

Create a new voucher item.

POST /voucher-storage/vouchers
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": "voucher",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this voucher",
      "type": "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}$"
    },
    "accountingCode": {
      "description": "Number that represents the vendor is an external accounting system which may include details like \"Address code\" in it. This is the number as stated on the invoice",
      "type": "string"
    },
    "amount": {
      "description": "The amount that is actually paid",
      "type": "number"
    },
    "batchNumber": {
      "description": "Only required when voucher is being output automatically; date formatted or allow library to specify structure and start",
      "type": "string"
    },
    "disbursementNumber": {
      "description": "The identifier for the physical transaction corresponding to a payment;Brought in from external source",
      "type": "string"
    },
    "disbursementDate": {
      "description": "Date payment was made from financial system",
      "type": "string",
      "format": "date-time"
    },
    "disbursementAmount": {
      "description": "The amount of the payment made outside of FOLIO",
      "type": "number"
    },
    "invoiceCurrency": {
      "description": "The currency in which invoice was originally defined",
      "type": "string"
    },
    "invoiceId": {
      "description": "Corresponding invoice Id",
      "type": "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}$"
    },
    "exchangeRate": {
      "description": "Exchange rate used to generate transaction",
      "type": "number"
    },
    "exportToAccounting": {
      "description": "Export this payment record to a financial system",
      "type": "boolean"
    },
    "status": {
      "description": "Status of the voucher",
      "type": "string",
      "enum": [
        "Awaiting payment",
        "Paid"
      ]
    },
    "systemCurrency": {
      "description": "The currency in which the voucher was paid",
      "type": "string"
    },
    "type": {
      "description": "Indicates type of payment to account",
      "type": "string",
      "enum": [
        "Payment",
        "Pre-payment",
        "Credit",
        "Voucher"
      ]
    },
    "voucherDate": {
      "description": "The date the invoice status changes to approved",
      "type": "string",
      "format": "date-time"
    },
    "voucherNumber": {
      "description": "Invoice number in folio system",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]*$"
    },
    "acqUnitIds": {
      "description": "acquisition unit ids associated with this voucher",
      "type": "array",
      "items": {
        "$ref": "../../common/schemas/uuid.json"
      }
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "accountingCode",
    "amount",
    "exportToAccounting",
    "invoiceCurrency",
    "invoiceId",
    "type",
    "status",
    "systemCurrency",
    "voucherNumber"
  ]
}

Example:

{
  "id": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "accountingCode": "0206",
  "amount": 23.45,
  "batchNumber": "101",
  "disbursementNumber": "EFT546789",
  "disbursementDate": "2019-05-05T00:00:00.000+0000",
  "disbursementAmount": 5,
  "exchangeRate": 1.12,
  "exportToAccounting": false,
  "invoiceCurrency": "EUR",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "status": "Awaiting payment",
  "systemCurrency": "USD",
  "type": "Payment",
  "voucherDate": "2019-05-06T00:00:00.000+0000",
  "voucherNumber": "1000",
  "acqUnitIds": [
    "1895e539-8dac-441e-b1f5-aab62b3fde60",
    "47f504bd-0c1b-498e-a2ae-e2f0a0cea273"
  ],
  "metadata": {
    "createdDate": "2019-05-06T00: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 voucher item

Body

Media type: application/json

Type: any

Example:

{
  "id": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "accountingCode": "0206",
  "amount": 23.45,
  "batchNumber": "101",
  "disbursementNumber": "EFT546789",
  "disbursementDate": "2019-05-05T00:00:00.000+0000",
  "disbursementAmount": 5,
  "exchangeRate": 1.12,
  "exportToAccounting": false,
  "invoiceCurrency": "EUR",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "status": "Awaiting payment",
  "systemCurrency": "USD",
  "type": "Payment",
  "voucherDate": "2019-05-06T00:00:00.000+0000",
  "voucherNumber": "1000",
  "acqUnitIds": [
    "1895e539-8dac-441e-b1f5-aab62b3fde60",
    "47f504bd-0c1b-498e-a2ae-e2f0a0cea273"
  ],
  "metadata": {
    "createdDate": "2019-05-06T00: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 voucher -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create vouchers -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /voucher-storage/vouchers/{id}

Retrieve voucher item with given {voucherId}

GET /voucher-storage/vouchers/{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 voucher

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": "voucher",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this voucher",
      "type": "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}$"
    },
    "accountingCode": {
      "description": "Number that represents the vendor is an external accounting system which may include details like \"Address code\" in it. This is the number as stated on the invoice",
      "type": "string"
    },
    "amount": {
      "description": "The amount that is actually paid",
      "type": "number"
    },
    "batchNumber": {
      "description": "Only required when voucher is being output automatically; date formatted or allow library to specify structure and start",
      "type": "string"
    },
    "disbursementNumber": {
      "description": "The identifier for the physical transaction corresponding to a payment;Brought in from external source",
      "type": "string"
    },
    "disbursementDate": {
      "description": "Date payment was made from financial system",
      "type": "string",
      "format": "date-time"
    },
    "disbursementAmount": {
      "description": "The amount of the payment made outside of FOLIO",
      "type": "number"
    },
    "invoiceCurrency": {
      "description": "The currency in which invoice was originally defined",
      "type": "string"
    },
    "invoiceId": {
      "description": "Corresponding invoice Id",
      "type": "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}$"
    },
    "exchangeRate": {
      "description": "Exchange rate used to generate transaction",
      "type": "number"
    },
    "exportToAccounting": {
      "description": "Export this payment record to a financial system",
      "type": "boolean"
    },
    "status": {
      "description": "Status of the voucher",
      "type": "string",
      "enum": [
        "Awaiting payment",
        "Paid"
      ]
    },
    "systemCurrency": {
      "description": "The currency in which the voucher was paid",
      "type": "string"
    },
    "type": {
      "description": "Indicates type of payment to account",
      "type": "string",
      "enum": [
        "Payment",
        "Pre-payment",
        "Credit",
        "Voucher"
      ]
    },
    "voucherDate": {
      "description": "The date the invoice status changes to approved",
      "type": "string",
      "format": "date-time"
    },
    "voucherNumber": {
      "description": "Invoice number in folio system",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]*$"
    },
    "acqUnitIds": {
      "description": "acquisition unit ids associated with this voucher",
      "type": "array",
      "items": {
        "$ref": "../../common/schemas/uuid.json"
      }
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "accountingCode",
    "amount",
    "exportToAccounting",
    "invoiceCurrency",
    "invoiceId",
    "type",
    "status",
    "systemCurrency",
    "voucherNumber"
  ]
}

Example:

{
  "id": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "accountingCode": "0206",
  "amount": 23.45,
  "batchNumber": "101",
  "disbursementNumber": "EFT546789",
  "disbursementDate": "2019-05-05T00:00:00.000+0000",
  "disbursementAmount": 5,
  "exchangeRate": 1.12,
  "exportToAccounting": false,
  "invoiceCurrency": "EUR",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "status": "Awaiting payment",
  "systemCurrency": "USD",
  "type": "Payment",
  "voucherDate": "2019-05-06T00:00:00.000+0000",
  "voucherNumber": "1000",
  "acqUnitIds": [
    "1895e539-8dac-441e-b1f5-aab62b3fde60",
    "47f504bd-0c1b-498e-a2ae-e2f0a0cea273"
  ],
  "metadata": {
    "createdDate": "2019-05-06T00: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:

"voucher not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /voucher-storage/vouchers/{id}

Delete voucher item with given {voucherId}

DELETE /voucher-storage/vouchers/{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 voucher

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 voucher -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"voucher not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

PUT /voucher-storage/vouchers/{id}

Update voucher item with given {voucherId}

PUT /voucher-storage/vouchers/{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 voucher

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": "voucher",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this voucher",
      "type": "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}$"
    },
    "accountingCode": {
      "description": "Number that represents the vendor is an external accounting system which may include details like \"Address code\" in it. This is the number as stated on the invoice",
      "type": "string"
    },
    "amount": {
      "description": "The amount that is actually paid",
      "type": "number"
    },
    "batchNumber": {
      "description": "Only required when voucher is being output automatically; date formatted or allow library to specify structure and start",
      "type": "string"
    },
    "disbursementNumber": {
      "description": "The identifier for the physical transaction corresponding to a payment;Brought in from external source",
      "type": "string"
    },
    "disbursementDate": {
      "description": "Date payment was made from financial system",
      "type": "string",
      "format": "date-time"
    },
    "disbursementAmount": {
      "description": "The amount of the payment made outside of FOLIO",
      "type": "number"
    },
    "invoiceCurrency": {
      "description": "The currency in which invoice was originally defined",
      "type": "string"
    },
    "invoiceId": {
      "description": "Corresponding invoice Id",
      "type": "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}$"
    },
    "exchangeRate": {
      "description": "Exchange rate used to generate transaction",
      "type": "number"
    },
    "exportToAccounting": {
      "description": "Export this payment record to a financial system",
      "type": "boolean"
    },
    "status": {
      "description": "Status of the voucher",
      "type": "string",
      "enum": [
        "Awaiting payment",
        "Paid"
      ]
    },
    "systemCurrency": {
      "description": "The currency in which the voucher was paid",
      "type": "string"
    },
    "type": {
      "description": "Indicates type of payment to account",
      "type": "string",
      "enum": [
        "Payment",
        "Pre-payment",
        "Credit",
        "Voucher"
      ]
    },
    "voucherDate": {
      "description": "The date the invoice status changes to approved",
      "type": "string",
      "format": "date-time"
    },
    "voucherNumber": {
      "description": "Invoice number in folio system",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]*$"
    },
    "acqUnitIds": {
      "description": "acquisition unit ids associated with this voucher",
      "type": "array",
      "items": {
        "$ref": "../../common/schemas/uuid.json"
      }
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "accountingCode",
    "amount",
    "exportToAccounting",
    "invoiceCurrency",
    "invoiceId",
    "type",
    "status",
    "systemCurrency",
    "voucherNumber"
  ]
}

Example:

{
  "id": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "accountingCode": "0206",
  "amount": 23.45,
  "batchNumber": "101",
  "disbursementNumber": "EFT546789",
  "disbursementDate": "2019-05-05T00:00:00.000+0000",
  "disbursementAmount": 5,
  "exchangeRate": 1.12,
  "exportToAccounting": false,
  "invoiceCurrency": "EUR",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "status": "Awaiting payment",
  "systemCurrency": "USD",
  "type": "Payment",
  "voucherDate": "2019-05-06T00:00:00.000+0000",
  "voucherNumber": "1000",
  "acqUnitIds": [
    "1895e539-8dac-441e-b1f5-aab62b3fde60",
    "47f504bd-0c1b-498e-a2ae-e2f0a0cea273"
  ],
  "metadata": {
    "createdDate": "2019-05-06T00: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 voucher -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"voucher not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

GET /voucher-storage/voucher-lines

Get list of voucher lines

GET /voucher-storage/voucher-lines
Query Parameters
  • 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
  • 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 externalAccountNumber

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    externalAccountNumber=="567891045"
    
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of voucher-line items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "collection of voucher lines",
  "type": "object",
  "properties": {
    "voucherLines": {
      "description": "an array of voucher line records",
      "id": "voucherLines",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "voucher_line.json"
      }
    },
    "totalRecords": {
      "description": "total number of records in the array",
      "type": "integer"
    }
  },
  "required": [
    "voucherLines",
    "totalRecords"
  ]
}

Example:

{
  "voucherLines": [
    {
      "id": "7a09dfd7-8588-49b5-bd15-5119414ff0b5",
      "amount": 23.45,
      "externalAccountNumber": "54321098",
      "fundDistributions": [
        {
          "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
          "percentage": 50,
          "code": "EUHIST",
          "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
          "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
        }
      ],
      "sourceIds": [
        "e0d08448-343b-118a-8c2f-4fb50248d672"
      ],
      "subTransactionId": "7b1f7179-b83f-4eab-a4db-3c600eebe271",
      "voucherId": "a9b99f8a-7100-47f2-9903-6293d44a9905"
    }
  ],
  "totalRecords": 1
}

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 voucher-lines -- 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 voucher-lines -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /voucher-storage/voucher-lines

Create a new voucher-line item.

POST /voucher-storage/voucher-lines
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": "voucher line",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this voucher line",
      "type": "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}$"
    },
    "amount": {
      "description": "Total amount of this voucher",
      "type": "number"
    },
    "externalAccountNumber": {
      "description": "All distributions that come from funds with the same account number are grouped by voucher line",
      "type": "string"
    },
    "fundDistributions": {
      "description": "List of fund distributions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "fund_distribution.json"
      },
      "minItems": 1
    },
    "sourceIds": {
      "description": "UUID of invoice lines. There could be many invoice lines against a single voucher line. These are group on a voucher line based on External account number",
      "type": "array",
      "items": {
        "type": "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}$"
      }
    },
    "subTransactionId": {
      "description": "UUID of sub transactions",
      "type": "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}$"
    },
    "voucherId": {
      "description": "UUID of the voucher this line belongs to",
      "type": "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}$"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "amount",
    "externalAccountNumber",
    "fundDistributions",
    "sourceIds",
    "voucherId"
  ]
}

Example:

{
  "id": "7a09dfd7-8588-49b5-bd15-5119414ff0b5",
  "amount": 23.45,
  "externalAccountNumber": "54321098",
  "fundDistributions": [
    {
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50,
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    },
    {
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50,
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    }
  ],
  "sourceIds": [
    "e0d08448-343b-118a-8c2f-4fb50248d672"
  ],
  "subTransactionId": "7b1f7179-b83f-4eab-a4db-3c600eebe271",
  "voucherId": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "metadata": {
    "createdDate": "2019-05-06T00: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 voucher-line item

Body

Media type: application/json

Type: any

Example:

{
  "id": "7a09dfd7-8588-49b5-bd15-5119414ff0b5",
  "amount": 23.45,
  "externalAccountNumber": "54321098",
  "fundDistributions": [
    {
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50,
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    },
    {
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50,
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    }
  ],
  "sourceIds": [
    "e0d08448-343b-118a-8c2f-4fb50248d672"
  ],
  "subTransactionId": "7b1f7179-b83f-4eab-a4db-3c600eebe271",
  "voucherId": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "metadata": {
    "createdDate": "2019-05-06T00: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 voucher-line -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create voucher-lines -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

PUT /voucher-storage/voucher-lines/{id}

Update voucher-line item with given {voucher-lineId}

PUT /voucher-storage/voucher-lines/{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 an voucher line

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": "voucher line",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this voucher line",
      "type": "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}$"
    },
    "amount": {
      "description": "Total amount of this voucher",
      "type": "number"
    },
    "externalAccountNumber": {
      "description": "All distributions that come from funds with the same account number are grouped by voucher line",
      "type": "string"
    },
    "fundDistributions": {
      "description": "List of fund distributions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "fund_distribution.json"
      },
      "minItems": 1
    },
    "sourceIds": {
      "description": "UUID of invoice lines. There could be many invoice lines against a single voucher line. These are group on a voucher line based on External account number",
      "type": "array",
      "items": {
        "type": "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}$"
      }
    },
    "subTransactionId": {
      "description": "UUID of sub transactions",
      "type": "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}$"
    },
    "voucherId": {
      "description": "UUID of the voucher this line belongs to",
      "type": "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}$"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "amount",
    "externalAccountNumber",
    "fundDistributions",
    "sourceIds",
    "voucherId"
  ]
}

Example:

{
  "id": "7a09dfd7-8588-49b5-bd15-5119414ff0b5",
  "amount": 23.45,
  "externalAccountNumber": "54321098",
  "fundDistributions": [
    {
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50,
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    },
    {
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50,
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    }
  ],
  "sourceIds": [
    "e0d08448-343b-118a-8c2f-4fb50248d672"
  ],
  "subTransactionId": "7b1f7179-b83f-4eab-a4db-3c600eebe271",
  "voucherId": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "metadata": {
    "createdDate": "2019-05-06T00: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 voucher-line -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"voucher-line 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

GET /voucher-storage/voucher-lines/{id}

Retrieve voucher-line item with given {voucher-lineId}

GET /voucher-storage/voucher-lines/{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 an voucher line

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": "voucher line",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this voucher line",
      "type": "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}$"
    },
    "amount": {
      "description": "Total amount of this voucher",
      "type": "number"
    },
    "externalAccountNumber": {
      "description": "All distributions that come from funds with the same account number are grouped by voucher line",
      "type": "string"
    },
    "fundDistributions": {
      "description": "List of fund distributions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "fund_distribution.json"
      },
      "minItems": 1
    },
    "sourceIds": {
      "description": "UUID of invoice lines. There could be many invoice lines against a single voucher line. These are group on a voucher line based on External account number",
      "type": "array",
      "items": {
        "type": "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}$"
      }
    },
    "subTransactionId": {
      "description": "UUID of sub transactions",
      "type": "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}$"
    },
    "voucherId": {
      "description": "UUID of the voucher this line belongs to",
      "type": "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}$"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "amount",
    "externalAccountNumber",
    "fundDistributions",
    "sourceIds",
    "voucherId"
  ]
}

Example:

{
  "id": "7a09dfd7-8588-49b5-bd15-5119414ff0b5",
  "amount": 23.45,
  "externalAccountNumber": "54321098",
  "fundDistributions": [
    {
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50,
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    },
    {
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50,
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "invoiceLineId": "e0d08448-343b-118a-8c2f-4fb50248d672"
    }
  ],
  "sourceIds": [
    "e0d08448-343b-118a-8c2f-4fb50248d672"
  ],
  "subTransactionId": "7b1f7179-b83f-4eab-a4db-3c600eebe271",
  "voucherId": "a9b99f8a-7100-47f2-9903-6293d44a9905",
  "metadata": {
    "createdDate": "2019-05-06T00: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:

"voucher-line not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /voucher-storage/voucher-lines/{id}

Delete voucher-line item with given {voucher-lineId}

DELETE /voucher-storage/voucher-lines/{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 an voucher line

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 voucher-line -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"voucher-line not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator