Invoices (v1)

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

Table of contents

Invoice CRUD API

This documents the API calls that can be made to manage invoices

/invoice-storage

GET /invoice-storage/invoices

Get list of invoices

GET /invoice-storage/invoices
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 folioInvoiceNo

    Example:

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

    Requested language. Optional. [lang=en]

Response 200

Returns a list of invoice items

Body

Media type: application/json

Type: json

Content:

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

Example:

{
  "invoices": [
    {
      "id": "c0d08448-347b-418a-8c2f-5fb50248d67e",
      "adjustments": [
        {
          "id": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
          "description": "Shipping",
          "type": "Amount",
          "value": 4.50,
          "prorate": "By line",
          "relationToTotal": "In addition to"
        }
      ],
      "adjustmentsTotal": 4.50,
      "approvedBy": "ab18897b-0e40-4f31-896b-9c9adc979a88",
      "approvalDate": "2018-07-29T00:00:00.000+0000",
      "billTo": "1df71bab-818c-46ea-988b-a23676d91ae6",
      "chkSubscriptionOverlap": false,
      "currency": "USD",
      "folioInvoiceNo": "123invoicenumber45",
      "invoiceDate": "2018-07-20T00:00:00.000+0000",
      "lockTotal": false,
      "note": "Some note",
      "paymentDue": "2018-08-29T00:00:00.000+0000",
      "paymentTerms": "Payment in Advance",
      "paymentMethod": "EFT",
      "status": "Approved",
      "source": "024b6f41-c5c6-4280-858e-33fba452a334",
      "subTotal": 45.35,
      "total": 49.85,
      "vendorInvoiceNo": "YK75851",
      "disbursementNumber": "58",
      "voucherNumber": "478",
      "paymentId": "a5065f0d-fb88-4d23-b0c1-57e754fba40e",
      "disbursementDate": "2018-08-19T00:00:00.000+0000",
      "poNumbers": [
        "AB268758XYZ"
      ],
      "vendorId": "168f8a63-d612-406e-813f-c7527f241ac3",
      "manualPayment": true,
      "metadata": {
        "createdDate": "2018-07-19T00: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 invoices -- 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 invoices -- 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 /invoice-storage/invoices

Create a new invoice item.

POST /invoice-storage/invoices
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": "invoice",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this invoice",
      "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}$"
    },
    "adjustments": {
      "description": "List of invoice level adjustments. The adjustments can be pro-rated which are defined at the invoice level, but are applied to the invoice lines. A generic example is a shipping fee which should be spread out across all of the invoice lines so that all funds involved pay some portion of the fee.",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "adjustment.json"
      }
    },
    "adjustmentsTotal": {
      "description": "Total amount which is sum of all invoice line adjustments and all non-prorated invoice level adjustments. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "approvedBy": {
      "description": "UUID of user that approved this invoice",
      "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}$"
    },
    "approvalDate": {
      "description": "Date the invoice was approved for processing",
      "type": "string",
      "format": "date-time"
    },
    "billTo": {
      "description": "UUID of the billing address",
      "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}$"
    },
    "chkSubscriptionOverlap": {
      "description": "IF TRUE the system will check if there is another invoice for this subscription and whether the dates overlap. IF the dates overlap, the system should issue an alert.",
      "type": "boolean"
    },
    "currency":{
      "description": "Ideally this is the ISO code and not something the user defines",
      "type": "string"
    },
    "exportToAccounting": {
      "description": "This would keep the invoice from being feed into the batch process (i.e. not generate an external voucher/payment) but would still move values in the system. This might be defined by the vendor relationship and exposed for override on the invoice.",
      "type": "boolean",
      "default": false
    },
    "folioInvoiceNo": {
      "description": "Invoice number in folio system",
      "type": "string"
    },
    "invoiceDate": {
      "description": "Invoice date",
      "type": "string",
      "format": "date-time"
    },
    "lockTotal": {
      "description": "Indicates that the total is keyed in and shouldn't be updated based on calculations. The calculated total must match this before the invoice can be approved",
      "type": "boolean",
      "default": false
    },
    "note": {
      "description": "Invoice note",
      "type": "string"
    },
    "paymentDue": {
      "description": "When this is required to be paid. Generally governed by the relationship with the Vendor",
      "type": "string",
      "format": "date-time"
    },
    "paymentTerms": {
      "description": "Invoice payment terms",
      "type": "string"
    },
    "paymentMethod": {
      "description": "Inherited from vendor record",
      "type": "string"
    },
    "status": {
      "description": "Open: Record has been created, Reviewed: details have been verified, Approved: Funds are release, Paid: confirmation that funds have been exchanged and check number has been returned amounts are frozen, cancelled.\nNote: invoices are never partially paid.",
      "type": "string",
      "enum": [
        "Open",
        "Reviewed",
        "Approved",
        "Paid",
        "Cancelled"
      ]
    },
    "source": {
      "description": "This does not denote a user ID but describes how the record was created. Eg. Manually, EDIFACT, MARC etc",
      "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}$"
    },
    "subTotal": {
      "description": "Invoice amount before adjustments are applied. This is sum of all subTotal amounts of the corresponding invoice lines. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "total": {
      "description": "The total amount of this invoice which is sum of subTotal and adjustmentsTotal. If lockTotal is true, then total is persisted and never replaced with a calculated value. Otherwise total is calculated \"on the fly\" and never persisted.",
      "type": "number"
    },
    "vendorInvoiceNo": {
      "description": "This is the number from the vendor's invoice, which is different from the folioInvoiceNo",
      "type": "string"
    },
    "disbursementNumber": {
      "description": "The identifier for the physical transaction corresponding to a payment (Eg. Check #, EFT # etc.) Brought in from external source",
      "type": "string"
    },
    "voucherNumber": {
      "description": "Number generated by folio that will eventually identify the payment request sent out to external financial system.",
      "type": "string"
    },
    "paymentId": {
      "description": "Id of payment",
      "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}$"
    },
    "disbursementDate": {
      "description": "Date payment was made from financial system (eg. corresponding check date)",
      "type": "string",
      "format": "date-time"
    },
    "poNumbers": {
      "description": "May or may not be provided; references the PO associated to the invoice",
      "id": "poNumbers",
      "type": "array",
      "items": {
        "description": "A human readable ID assigned to this purchase order",
        "type": "string",
        "pattern": "^[a-zA-Z0-9]{5,16}$"
      }
    },
    "vendorId": {
      "description": "UUID of vendor",
      "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}$"
    },
    "manualPayment": {
      "description": "This would keep the invoice from being feed into the batch process (Not generate a external voucher/payment) but would still move values in the system. Note: this is ideally defined by the vendor relationship and exposed for override on the invoice.",
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "currency",
    "invoiceDate",
    "paymentMethod",
    "status",
    "source",
    "vendorInvoiceNo",
    "vendorId"
  ]
}

Example:

{
  "id": "733cafd3-895f-4e33-87b7-bf40dc3c8069",
  "adjustments": [
    {
      "id": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description": "Shipping",
      "type": "Amount",
      "value": 4.50,
      "prorate": "By line",
      "relationToTotal": "In addition to"
    },
    {
      "description": "Some Tax",
      "fundDistributions": [
        {
          "code": "USHIST",
          "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
          "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
          "percentage": 100
        }
      ],
      "type": "Amount",
      "value": 10,
      "prorate": "Not prorated",
      "relationToTotal": "In addition to"
    }
  ],
  "adjustmentsTotal": 14.50,
  "chkSubscriptionOverlap": false,
  "currency": "USD",
  "exportToAccounting": true,
  "folioInvoiceNo": "123invoicenumber45",
  "invoiceDate": "2018-07-20T00:00:00.000+0000",
  "lockTotal": true,
  "note": "Some note",
  "paymentDue": "2018-08-29T00:00:00.000+0000",
  "paymentTerms": "Payment in Advance",
  "paymentMethod": "EFT",
  "status": "Reviewed",
  "source": "024b6f41-c5c6-4280-858e-33fba452a334",
  "subTotal": 50.00,
  "total": 64.50,
  "vendorInvoiceNo": "YK75851",
  "disbursementNumber": "58",
  "voucherNumber": "478",
  "paymentId": "a5065f0d-fb88-4d23-b0c1-57e754fba40e",
  "disbursementDate": "2018-08-19T00:00:00.000+0000",
  "poNumbers": [
    "AB268758XYZ"
  ],
  "vendorId": "168f8a63-d612-406e-813f-c7527f241ac3",
  "manualPayment": true,
  "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 invoice item

Body

Media type: application/json

Type: any

Example:

{
  "id": "733cafd3-895f-4e33-87b7-bf40dc3c8069",
  "adjustments": [
    {
      "id": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description": "Shipping",
      "type": "Amount",
      "value": 4.50,
      "prorate": "By line",
      "relationToTotal": "In addition to"
    },
    {
      "description": "Some Tax",
      "fundDistributions": [
        {
          "code": "USHIST",
          "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
          "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
          "percentage": 100
        }
      ],
      "type": "Amount",
      "value": 10,
      "prorate": "Not prorated",
      "relationToTotal": "In addition to"
    }
  ],
  "adjustmentsTotal": 14.50,
  "chkSubscriptionOverlap": false,
  "currency": "USD",
  "exportToAccounting": true,
  "folioInvoiceNo": "123invoicenumber45",
  "invoiceDate": "2018-07-20T00:00:00.000+0000",
  "lockTotal": true,
  "note": "Some note",
  "paymentDue": "2018-08-29T00:00:00.000+0000",
  "paymentTerms": "Payment in Advance",
  "paymentMethod": "EFT",
  "status": "Reviewed",
  "source": "024b6f41-c5c6-4280-858e-33fba452a334",
  "subTotal": 50.00,
  "total": 64.50,
  "vendorInvoiceNo": "YK75851",
  "disbursementNumber": "58",
  "voucherNumber": "478",
  "paymentId": "a5065f0d-fb88-4d23-b0c1-57e754fba40e",
  "disbursementDate": "2018-08-19T00:00:00.000+0000",
  "poNumbers": [
    "AB268758XYZ"
  ],
  "vendorId": "168f8a63-d612-406e-813f-c7527f241ac3",
  "manualPayment": true,
  "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 invoice -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create invoices -- 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 /invoice-storage/invoices/{id}

Retrieve invoice item with given {invoiceId}

GET /invoice-storage/invoices/{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 invoice

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": "invoice",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this invoice",
      "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}$"
    },
    "adjustments": {
      "description": "List of invoice level adjustments. The adjustments can be pro-rated which are defined at the invoice level, but are applied to the invoice lines. A generic example is a shipping fee which should be spread out across all of the invoice lines so that all funds involved pay some portion of the fee.",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "adjustment.json"
      }
    },
    "adjustmentsTotal": {
      "description": "Total amount which is sum of all invoice line adjustments and all non-prorated invoice level adjustments. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "approvedBy": {
      "description": "UUID of user that approved this invoice",
      "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}$"
    },
    "approvalDate": {
      "description": "Date the invoice was approved for processing",
      "type": "string",
      "format": "date-time"
    },
    "billTo": {
      "description": "UUID of the billing address",
      "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}$"
    },
    "chkSubscriptionOverlap": {
      "description": "IF TRUE the system will check if there is another invoice for this subscription and whether the dates overlap. IF the dates overlap, the system should issue an alert.",
      "type": "boolean"
    },
    "currency":{
      "description": "Ideally this is the ISO code and not something the user defines",
      "type": "string"
    },
    "exportToAccounting": {
      "description": "This would keep the invoice from being feed into the batch process (i.e. not generate an external voucher/payment) but would still move values in the system. This might be defined by the vendor relationship and exposed for override on the invoice.",
      "type": "boolean",
      "default": false
    },
    "folioInvoiceNo": {
      "description": "Invoice number in folio system",
      "type": "string"
    },
    "invoiceDate": {
      "description": "Invoice date",
      "type": "string",
      "format": "date-time"
    },
    "lockTotal": {
      "description": "Indicates that the total is keyed in and shouldn't be updated based on calculations. The calculated total must match this before the invoice can be approved",
      "type": "boolean",
      "default": false
    },
    "note": {
      "description": "Invoice note",
      "type": "string"
    },
    "paymentDue": {
      "description": "When this is required to be paid. Generally governed by the relationship with the Vendor",
      "type": "string",
      "format": "date-time"
    },
    "paymentTerms": {
      "description": "Invoice payment terms",
      "type": "string"
    },
    "paymentMethod": {
      "description": "Inherited from vendor record",
      "type": "string"
    },
    "status": {
      "description": "Open: Record has been created, Reviewed: details have been verified, Approved: Funds are release, Paid: confirmation that funds have been exchanged and check number has been returned amounts are frozen, cancelled.\nNote: invoices are never partially paid.",
      "type": "string",
      "enum": [
        "Open",
        "Reviewed",
        "Approved",
        "Paid",
        "Cancelled"
      ]
    },
    "source": {
      "description": "This does not denote a user ID but describes how the record was created. Eg. Manually, EDIFACT, MARC etc",
      "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}$"
    },
    "subTotal": {
      "description": "Invoice amount before adjustments are applied. This is sum of all subTotal amounts of the corresponding invoice lines. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "total": {
      "description": "The total amount of this invoice which is sum of subTotal and adjustmentsTotal. If lockTotal is true, then total is persisted and never replaced with a calculated value. Otherwise total is calculated \"on the fly\" and never persisted.",
      "type": "number"
    },
    "vendorInvoiceNo": {
      "description": "This is the number from the vendor's invoice, which is different from the folioInvoiceNo",
      "type": "string"
    },
    "disbursementNumber": {
      "description": "The identifier for the physical transaction corresponding to a payment (Eg. Check #, EFT # etc.) Brought in from external source",
      "type": "string"
    },
    "voucherNumber": {
      "description": "Number generated by folio that will eventually identify the payment request sent out to external financial system.",
      "type": "string"
    },
    "paymentId": {
      "description": "Id of payment",
      "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}$"
    },
    "disbursementDate": {
      "description": "Date payment was made from financial system (eg. corresponding check date)",
      "type": "string",
      "format": "date-time"
    },
    "poNumbers": {
      "description": "May or may not be provided; references the PO associated to the invoice",
      "id": "poNumbers",
      "type": "array",
      "items": {
        "description": "A human readable ID assigned to this purchase order",
        "type": "string",
        "pattern": "^[a-zA-Z0-9]{5,16}$"
      }
    },
    "vendorId": {
      "description": "UUID of vendor",
      "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}$"
    },
    "manualPayment": {
      "description": "This would keep the invoice from being feed into the batch process (Not generate a external voucher/payment) but would still move values in the system. Note: this is ideally defined by the vendor relationship and exposed for override on the invoice.",
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "currency",
    "invoiceDate",
    "paymentMethod",
    "status",
    "source",
    "vendorInvoiceNo",
    "vendorId"
  ]
}

Example:

{
  "id": "733cafd3-895f-4e33-87b7-bf40dc3c8069",
  "adjustments": [
    {
      "id": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description": "Shipping",
      "type": "Amount",
      "value": 4.50,
      "prorate": "By line",
      "relationToTotal": "In addition to"
    },
    {
      "description": "Some Tax",
      "fundDistributions": [
        {
          "code": "USHIST",
          "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
          "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
          "percentage": 100
        }
      ],
      "type": "Amount",
      "value": 10,
      "prorate": "Not prorated",
      "relationToTotal": "In addition to"
    }
  ],
  "adjustmentsTotal": 14.50,
  "chkSubscriptionOverlap": false,
  "currency": "USD",
  "exportToAccounting": true,
  "folioInvoiceNo": "123invoicenumber45",
  "invoiceDate": "2018-07-20T00:00:00.000+0000",
  "lockTotal": true,
  "note": "Some note",
  "paymentDue": "2018-08-29T00:00:00.000+0000",
  "paymentTerms": "Payment in Advance",
  "paymentMethod": "EFT",
  "status": "Reviewed",
  "source": "024b6f41-c5c6-4280-858e-33fba452a334",
  "subTotal": 50.00,
  "total": 64.50,
  "vendorInvoiceNo": "YK75851",
  "disbursementNumber": "58",
  "voucherNumber": "478",
  "paymentId": "a5065f0d-fb88-4d23-b0c1-57e754fba40e",
  "disbursementDate": "2018-08-19T00:00:00.000+0000",
  "poNumbers": [
    "AB268758XYZ"
  ],
  "vendorId": "168f8a63-d612-406e-813f-c7527f241ac3",
  "manualPayment": true,
  "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:

"invoice 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 /invoice-storage/invoices/{id}

Delete invoice item with given {invoiceId}

DELETE /invoice-storage/invoices/{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 invoice

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"invoice 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 /invoice-storage/invoices/{id}

Update invoice item with given {invoiceId}

PUT /invoice-storage/invoices/{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 invoice

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": "invoice",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this invoice",
      "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}$"
    },
    "adjustments": {
      "description": "List of invoice level adjustments. The adjustments can be pro-rated which are defined at the invoice level, but are applied to the invoice lines. A generic example is a shipping fee which should be spread out across all of the invoice lines so that all funds involved pay some portion of the fee.",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "adjustment.json"
      }
    },
    "adjustmentsTotal": {
      "description": "Total amount which is sum of all invoice line adjustments and all non-prorated invoice level adjustments. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "approvedBy": {
      "description": "UUID of user that approved this invoice",
      "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}$"
    },
    "approvalDate": {
      "description": "Date the invoice was approved for processing",
      "type": "string",
      "format": "date-time"
    },
    "billTo": {
      "description": "UUID of the billing address",
      "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}$"
    },
    "chkSubscriptionOverlap": {
      "description": "IF TRUE the system will check if there is another invoice for this subscription and whether the dates overlap. IF the dates overlap, the system should issue an alert.",
      "type": "boolean"
    },
    "currency":{
      "description": "Ideally this is the ISO code and not something the user defines",
      "type": "string"
    },
    "exportToAccounting": {
      "description": "This would keep the invoice from being feed into the batch process (i.e. not generate an external voucher/payment) but would still move values in the system. This might be defined by the vendor relationship and exposed for override on the invoice.",
      "type": "boolean",
      "default": false
    },
    "folioInvoiceNo": {
      "description": "Invoice number in folio system",
      "type": "string"
    },
    "invoiceDate": {
      "description": "Invoice date",
      "type": "string",
      "format": "date-time"
    },
    "lockTotal": {
      "description": "Indicates that the total is keyed in and shouldn't be updated based on calculations. The calculated total must match this before the invoice can be approved",
      "type": "boolean",
      "default": false
    },
    "note": {
      "description": "Invoice note",
      "type": "string"
    },
    "paymentDue": {
      "description": "When this is required to be paid. Generally governed by the relationship with the Vendor",
      "type": "string",
      "format": "date-time"
    },
    "paymentTerms": {
      "description": "Invoice payment terms",
      "type": "string"
    },
    "paymentMethod": {
      "description": "Inherited from vendor record",
      "type": "string"
    },
    "status": {
      "description": "Open: Record has been created, Reviewed: details have been verified, Approved: Funds are release, Paid: confirmation that funds have been exchanged and check number has been returned amounts are frozen, cancelled.\nNote: invoices are never partially paid.",
      "type": "string",
      "enum": [
        "Open",
        "Reviewed",
        "Approved",
        "Paid",
        "Cancelled"
      ]
    },
    "source": {
      "description": "This does not denote a user ID but describes how the record was created. Eg. Manually, EDIFACT, MARC etc",
      "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}$"
    },
    "subTotal": {
      "description": "Invoice amount before adjustments are applied. This is sum of all subTotal amounts of the corresponding invoice lines. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "total": {
      "description": "The total amount of this invoice which is sum of subTotal and adjustmentsTotal. If lockTotal is true, then total is persisted and never replaced with a calculated value. Otherwise total is calculated \"on the fly\" and never persisted.",
      "type": "number"
    },
    "vendorInvoiceNo": {
      "description": "This is the number from the vendor's invoice, which is different from the folioInvoiceNo",
      "type": "string"
    },
    "disbursementNumber": {
      "description": "The identifier for the physical transaction corresponding to a payment (Eg. Check #, EFT # etc.) Brought in from external source",
      "type": "string"
    },
    "voucherNumber": {
      "description": "Number generated by folio that will eventually identify the payment request sent out to external financial system.",
      "type": "string"
    },
    "paymentId": {
      "description": "Id of payment",
      "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}$"
    },
    "disbursementDate": {
      "description": "Date payment was made from financial system (eg. corresponding check date)",
      "type": "string",
      "format": "date-time"
    },
    "poNumbers": {
      "description": "May or may not be provided; references the PO associated to the invoice",
      "id": "poNumbers",
      "type": "array",
      "items": {
        "description": "A human readable ID assigned to this purchase order",
        "type": "string",
        "pattern": "^[a-zA-Z0-9]{5,16}$"
      }
    },
    "vendorId": {
      "description": "UUID of vendor",
      "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}$"
    },
    "manualPayment": {
      "description": "This would keep the invoice from being feed into the batch process (Not generate a external voucher/payment) but would still move values in the system. Note: this is ideally defined by the vendor relationship and exposed for override on the invoice.",
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "currency",
    "invoiceDate",
    "paymentMethod",
    "status",
    "source",
    "vendorInvoiceNo",
    "vendorId"
  ]
}

Example:

{
  "id": "733cafd3-895f-4e33-87b7-bf40dc3c8069",
  "adjustments": [
    {
      "id": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description": "Shipping",
      "type": "Amount",
      "value": 4.50,
      "prorate": "By line",
      "relationToTotal": "In addition to"
    },
    {
      "description": "Some Tax",
      "fundDistributions": [
        {
          "code": "USHIST",
          "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
          "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
          "percentage": 100
        }
      ],
      "type": "Amount",
      "value": 10,
      "prorate": "Not prorated",
      "relationToTotal": "In addition to"
    }
  ],
  "adjustmentsTotal": 14.50,
  "chkSubscriptionOverlap": false,
  "currency": "USD",
  "exportToAccounting": true,
  "folioInvoiceNo": "123invoicenumber45",
  "invoiceDate": "2018-07-20T00:00:00.000+0000",
  "lockTotal": true,
  "note": "Some note",
  "paymentDue": "2018-08-29T00:00:00.000+0000",
  "paymentTerms": "Payment in Advance",
  "paymentMethod": "EFT",
  "status": "Reviewed",
  "source": "024b6f41-c5c6-4280-858e-33fba452a334",
  "subTotal": 50.00,
  "total": 64.50,
  "vendorInvoiceNo": "YK75851",
  "disbursementNumber": "58",
  "voucherNumber": "478",
  "paymentId": "a5065f0d-fb88-4d23-b0c1-57e754fba40e",
  "disbursementDate": "2018-08-19T00:00:00.000+0000",
  "poNumbers": [
    "AB268758XYZ"
  ],
  "vendorId": "168f8a63-d612-406e-813f-c7527f241ac3",
  "manualPayment": true,
  "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 invoice -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"invoice 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 /invoice-storage/invoice-lines

Get list of invoice lines

GET /invoice-storage/invoice-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 poLineId

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    poLineId=="c0d08448-347b-418a-8c2f-5fb50248d67e"
    
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of invoice-line items

Body

Media type: application/json

Type: json

Content:

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

Example:

{
  "invoiceLines": [
    {
      "id": "e0d08448-343b-118a-8c2f-4fb50248d672",
      "adjustments": [
        {
          "description":"Service Fee",
          "type":"Amount",
          "value":2.25,
          "prorate":"Not prorated",
          "relationToTotal":"In addition to"
        },
        {
          "description":"Shipping",
          "type":"Amount",
          "value":2.75,
          "prorate":"Not prorated",
          "relationToTotal":"In addition to"
        }
      ],
      "adjustmentsTotal": 5.00,
      "description": "Some description",
      "fundDistributions": [
        {
          "code": "USHIST",
          "encumbrance": "949c9e5d-2c7d-45d6-bd7f-8e82a0b27889",
          "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
          "percentage": 50
        }
      ],
      "poLineId": "e8971620-8ee4-4f3b-b5b5-93b864df16ed",
      "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
      "invoiceLineNumber": "123invoicenumber45-1",
      "invoiceLineStatus": "Open",
      "vendorRefNo": "2019-184",
      "productId": "9780764354113",
      "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422",
      "comment": "Sample invoice line",
      "quantity": 3,
      "releaseEncumbrance": true,
      "subscriptionInfo": "Subscription information",
      "subscriptionStart": "2018-08-01T00:00:00.000+0000",
      "subscriptionEnd": "2020-01-01T00:00:00.000+0000",
      "subTotal": 125.00,
      "total": 130.00,
      "metadata": {
        "createdDate": "2018-07-19T00: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 invoice-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 invoice-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 /invoice-storage/invoice-lines

Create a new invoice-line item.

POST /invoice-storage/invoice-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": "invoice line",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this invoice 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}$"
    },
    "adjustments": {
      "description": "Defined in settings - the amount field will be editable and pro-rate toggle will be editable if enabled for that adjustment",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "adjustment.json"
      }
    },
    "adjustmentsTotal": {
      "description": "Sum of all invoice line adjustments. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "description": {
      "description": "Title as captured in the Purchase Order Line. In the absence of a POL link this could be used to describe the POL",
      "type": "string"
    },
    "fundDistributions": {
      "description": "List of fund distributions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "fund_distribution.json"
      },
      "minItems": 1
    },
    "invoiceId": {
      "description": "UUID of this parent invoice",
      "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}$"
    },
    "invoiceLineNumber": {
      "description": "Sequentially generated and not editable by the user.",
      "type": "string"
    },
    "invoiceLineStatus": {
      "description": "Invoice line status",
      "type": "string",
      "enum": [
        "Open",
        "Reviewed",
        "Approved",
        "Paid",
        "Cancelled",
        "Error"
      ]
    },
    "poLineId": {
      "description": "UUID of the corresponding purchase order line this invoice line is based on",
      "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}$"
    },
    "productId": {
      "description": "product identifier",
      "type": "string"
    },
    "productIdType": {
      "description": "the type of product id",
      "type": "string",
      "$ref": "../../common/schemas/product_id_type.json"
    },
    "quantity": {
      "description": "quantity",
      "type": "integer"
    },
    "releaseEncumbrance": {
      "description": "This is intended to not only release encumbrances but to indicate that this is the final invoice line for corresponding order line. This should take into account the fiscal year. We may release encumbrance for this FY but for on-going orders expect to encumber again next year.",
      "type": "boolean",
      "default": true
    },
    "subscriptionInfo": {
      "description": "The user should use this field to provide info on the subscription (eg. which volumes are being invoiced). It is MANDATORY if the chk_subscription_overlap is FALSE AND there is no start date provided",
      "type": "string"
    },
    "subscriptionStart": {
      "description": "Subscription start date",
      "type": "string",
      "format": "date-time"
    },
    "subscriptionEnd": {
      "description": "Subscription end date",
      "type": "string",
      "format": "date-time"
    },
    "subTotal": {
      "description": "Invoice line amount before adjustments are applied",
      "type": "number"
    },
    "total": {
      "description": "Invoice line total amount which is sum of subTotal and adjustmentsTotal. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "vendorRefNo": {
      "description": "This is the number used to match POLs created by import to invoices created by import",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "description",
    "fundDistributions",
    "invoiceId",
    "invoiceLineStatus",
    "subTotal",
    "quantity",
    "releaseEncumbrance"
  ]
}

Example:

{
  "id": "2be1e551-be27-4b03-b770-30e5e8211d19",
  "adjustments": [
    {
      "description":"Service Fee",
      "type":"Amount",
      "value":4.00,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "description":"Sales Tax",
      "type":"Percentage",
      "value":8,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "adjustmentId": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description":"Shipping",
      "type":"Amount",
      "value":2.50,
      "prorate":"By line",
      "relationToTotal":"In addition to"
    }

  ],
  "adjustmentsTotal": 8.50,
  "comment": "Sample invoice line",
  "description": "Some description",
  "fundDistributions": [
    {
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50
    },
    {
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50
    }
  ],
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "invoiceLineNumber": "123invoicenumber45-1",
  "invoiceLineStatus": "Open",
  "poLineId": "e8971620-8ee4-4f3b-b5b5-93b864df16ed",
  "productId": "9780764354113",
  "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422",
  "quantity": 3,
  "releaseEncumbrance": true,
  "subscriptionInfo": "Subscription information",
  "subscriptionStart": "2018-08-01T00:00:00.000+0000",
  "subscriptionEnd": "2019-01-01T00:00:00.000+0000",
  "subTotal": 25.00,
  "total": 33.50,
  "vendorRefNo": "1",
  "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 invoice-line item

Body

Media type: application/json

Type: any

Example:

{
  "id": "2be1e551-be27-4b03-b770-30e5e8211d19",
  "adjustments": [
    {
      "description":"Service Fee",
      "type":"Amount",
      "value":4.00,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "description":"Sales Tax",
      "type":"Percentage",
      "value":8,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "adjustmentId": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description":"Shipping",
      "type":"Amount",
      "value":2.50,
      "prorate":"By line",
      "relationToTotal":"In addition to"
    }

  ],
  "adjustmentsTotal": 8.50,
  "comment": "Sample invoice line",
  "description": "Some description",
  "fundDistributions": [
    {
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50
    },
    {
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50
    }
  ],
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "invoiceLineNumber": "123invoicenumber45-1",
  "invoiceLineStatus": "Open",
  "poLineId": "e8971620-8ee4-4f3b-b5b5-93b864df16ed",
  "productId": "9780764354113",
  "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422",
  "quantity": 3,
  "releaseEncumbrance": true,
  "subscriptionInfo": "Subscription information",
  "subscriptionStart": "2018-08-01T00:00:00.000+0000",
  "subscriptionEnd": "2019-01-01T00:00:00.000+0000",
  "subTotal": 25.00,
  "total": 33.50,
  "vendorRefNo": "1",
  "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 invoice-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 invoice-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 /invoice-storage/invoice-lines/{id}

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

PUT /invoice-storage/invoice-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 invoice 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": "invoice line",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this invoice 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}$"
    },
    "adjustments": {
      "description": "Defined in settings - the amount field will be editable and pro-rate toggle will be editable if enabled for that adjustment",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "adjustment.json"
      }
    },
    "adjustmentsTotal": {
      "description": "Sum of all invoice line adjustments. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "description": {
      "description": "Title as captured in the Purchase Order Line. In the absence of a POL link this could be used to describe the POL",
      "type": "string"
    },
    "fundDistributions": {
      "description": "List of fund distributions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "fund_distribution.json"
      },
      "minItems": 1
    },
    "invoiceId": {
      "description": "UUID of this parent invoice",
      "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}$"
    },
    "invoiceLineNumber": {
      "description": "Sequentially generated and not editable by the user.",
      "type": "string"
    },
    "invoiceLineStatus": {
      "description": "Invoice line status",
      "type": "string",
      "enum": [
        "Open",
        "Reviewed",
        "Approved",
        "Paid",
        "Cancelled",
        "Error"
      ]
    },
    "poLineId": {
      "description": "UUID of the corresponding purchase order line this invoice line is based on",
      "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}$"
    },
    "productId": {
      "description": "product identifier",
      "type": "string"
    },
    "productIdType": {
      "description": "the type of product id",
      "type": "string",
      "$ref": "../../common/schemas/product_id_type.json"
    },
    "quantity": {
      "description": "quantity",
      "type": "integer"
    },
    "releaseEncumbrance": {
      "description": "This is intended to not only release encumbrances but to indicate that this is the final invoice line for corresponding order line. This should take into account the fiscal year. We may release encumbrance for this FY but for on-going orders expect to encumber again next year.",
      "type": "boolean",
      "default": true
    },
    "subscriptionInfo": {
      "description": "The user should use this field to provide info on the subscription (eg. which volumes are being invoiced). It is MANDATORY if the chk_subscription_overlap is FALSE AND there is no start date provided",
      "type": "string"
    },
    "subscriptionStart": {
      "description": "Subscription start date",
      "type": "string",
      "format": "date-time"
    },
    "subscriptionEnd": {
      "description": "Subscription end date",
      "type": "string",
      "format": "date-time"
    },
    "subTotal": {
      "description": "Invoice line amount before adjustments are applied",
      "type": "number"
    },
    "total": {
      "description": "Invoice line total amount which is sum of subTotal and adjustmentsTotal. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "vendorRefNo": {
      "description": "This is the number used to match POLs created by import to invoices created by import",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "description",
    "fundDistributions",
    "invoiceId",
    "invoiceLineStatus",
    "subTotal",
    "quantity",
    "releaseEncumbrance"
  ]
}

Example:

{
  "id": "2be1e551-be27-4b03-b770-30e5e8211d19",
  "adjustments": [
    {
      "description":"Service Fee",
      "type":"Amount",
      "value":4.00,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "description":"Sales Tax",
      "type":"Percentage",
      "value":8,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "adjustmentId": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description":"Shipping",
      "type":"Amount",
      "value":2.50,
      "prorate":"By line",
      "relationToTotal":"In addition to"
    }

  ],
  "adjustmentsTotal": 8.50,
  "comment": "Sample invoice line",
  "description": "Some description",
  "fundDistributions": [
    {
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50
    },
    {
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50
    }
  ],
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "invoiceLineNumber": "123invoicenumber45-1",
  "invoiceLineStatus": "Open",
  "poLineId": "e8971620-8ee4-4f3b-b5b5-93b864df16ed",
  "productId": "9780764354113",
  "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422",
  "quantity": 3,
  "releaseEncumbrance": true,
  "subscriptionInfo": "Subscription information",
  "subscriptionStart": "2018-08-01T00:00:00.000+0000",
  "subscriptionEnd": "2019-01-01T00:00:00.000+0000",
  "subTotal": 25.00,
  "total": 33.50,
  "vendorRefNo": "1",
  "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 invoice-line -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"invoice-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 /invoice-storage/invoice-lines/{id}

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

GET /invoice-storage/invoice-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 invoice 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": "invoice line",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this invoice 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}$"
    },
    "adjustments": {
      "description": "Defined in settings - the amount field will be editable and pro-rate toggle will be editable if enabled for that adjustment",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "adjustment.json"
      }
    },
    "adjustmentsTotal": {
      "description": "Sum of all invoice line adjustments. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "description": {
      "description": "Title as captured in the Purchase Order Line. In the absence of a POL link this could be used to describe the POL",
      "type": "string"
    },
    "fundDistributions": {
      "description": "List of fund distributions",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "fund_distribution.json"
      },
      "minItems": 1
    },
    "invoiceId": {
      "description": "UUID of this parent invoice",
      "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}$"
    },
    "invoiceLineNumber": {
      "description": "Sequentially generated and not editable by the user.",
      "type": "string"
    },
    "invoiceLineStatus": {
      "description": "Invoice line status",
      "type": "string",
      "enum": [
        "Open",
        "Reviewed",
        "Approved",
        "Paid",
        "Cancelled",
        "Error"
      ]
    },
    "poLineId": {
      "description": "UUID of the corresponding purchase order line this invoice line is based on",
      "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}$"
    },
    "productId": {
      "description": "product identifier",
      "type": "string"
    },
    "productIdType": {
      "description": "the type of product id",
      "type": "string",
      "$ref": "../../common/schemas/product_id_type.json"
    },
    "quantity": {
      "description": "quantity",
      "type": "integer"
    },
    "releaseEncumbrance": {
      "description": "This is intended to not only release encumbrances but to indicate that this is the final invoice line for corresponding order line. This should take into account the fiscal year. We may release encumbrance for this FY but for on-going orders expect to encumber again next year.",
      "type": "boolean",
      "default": true
    },
    "subscriptionInfo": {
      "description": "The user should use this field to provide info on the subscription (eg. which volumes are being invoiced). It is MANDATORY if the chk_subscription_overlap is FALSE AND there is no start date provided",
      "type": "string"
    },
    "subscriptionStart": {
      "description": "Subscription start date",
      "type": "string",
      "format": "date-time"
    },
    "subscriptionEnd": {
      "description": "Subscription end date",
      "type": "string",
      "format": "date-time"
    },
    "subTotal": {
      "description": "Invoice line amount before adjustments are applied",
      "type": "number"
    },
    "total": {
      "description": "Invoice line total amount which is sum of subTotal and adjustmentsTotal. The value is calculated \"on the fly\" and never persisted",
      "type": "number",
      "readonly": true
    },
    "vendorRefNo": {
      "description": "This is the number used to match POLs created by import to invoices created by import",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "description",
    "fundDistributions",
    "invoiceId",
    "invoiceLineStatus",
    "subTotal",
    "quantity",
    "releaseEncumbrance"
  ]
}

Example:

{
  "id": "2be1e551-be27-4b03-b770-30e5e8211d19",
  "adjustments": [
    {
      "description":"Service Fee",
      "type":"Amount",
      "value":4.00,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "description":"Sales Tax",
      "type":"Percentage",
      "value":8,
      "prorate":"Not prorated",
      "relationToTotal":"In addition to"
    },
    {
      "adjustmentId": "14263aab-b22b-4ddc-9ecc-3434427c2c8f",
      "description":"Shipping",
      "type":"Amount",
      "value":2.50,
      "prorate":"By line",
      "relationToTotal":"In addition to"
    }

  ],
  "adjustmentsTotal": 8.50,
  "comment": "Sample invoice line",
  "description": "Some description",
  "fundDistributions": [
    {
      "code": "USHIST",
      "encumbrance": "1c8fc9f4-d2cc-4bd1-aa9a-cb02291cbe65",
      "fundId": "1d1574f1-9196-4a57-8d1f-3b2e4309eb81",
      "percentage": 50
    },
    {
      "code": "EUHIST",
      "encumbrance": "5f9bfc74-f6ff-4877-be1f-793f8ce90ade",
      "fundId": "63157e96-0693-426d-b0df-948bacdfdb08",
      "percentage": 50
    }
  ],
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "invoiceLineNumber": "123invoicenumber45-1",
  "invoiceLineStatus": "Open",
  "poLineId": "e8971620-8ee4-4f3b-b5b5-93b864df16ed",
  "productId": "9780764354113",
  "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422",
  "quantity": 3,
  "releaseEncumbrance": true,
  "subscriptionInfo": "Subscription information",
  "subscriptionStart": "2018-08-01T00:00:00.000+0000",
  "subscriptionEnd": "2019-01-01T00:00:00.000+0000",
  "subTotal": 25.00,
  "total": 33.50,
  "vendorRefNo": "1",
  "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:

"invoice-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 /invoice-storage/invoice-lines/{id}

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

DELETE /invoice-storage/invoice-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 invoice 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 invoice-line -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"invoice-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