Skip to main content

Hold Generated Invoice API

Introduction​

Caches the user’s selected generated invoices in TmsConstants.generatedInvoiceSelectionList keyed by lower-case username, after verifying invoice numbers are not already used on acknowledgements (AcknowledgementService.checkDuplicateInvoiceNumber). If duplicates exist, the selection is not stored and status is false.

Source: InvoiceHomePageAPI.holdGeneratedInvoice (@Path("invoicehome")).

See also: Invoice Home — all endpoints.


HTTP Endpoint​

PropertyValue
URL/rest/invoicehome/holdGeneratedInvoice
MethodPOST
ConsumesRaw JSON body
Producestext/plain (JSON string entity)

Request Body (JSON)​

FieldTypeRequiredDescription
userNameStringYesAuth and cache key (stored as lower-case).
authKeyStringYesAuth key.
branchStringYesParsed; not used after validation in current code.
invoiceDataArrayYesJSON array of InvoiceOriginal objects.

Authentication​

ConditionHTTP status
Invalid credentials401 Unauthorized (Access-Control-Allow-Origin: *)
Success200 OK

Behaviour​

  1. Validates auth.
  2. Deserialises invoiceData to List<InvoiceOriginal>.
  3. Builds list of invoiceNumber from each item.
  4. checkDuplicateInvoiceNumber(invoiceNumberList, tenantId):
    • If no duplicate: stores list in generatedInvoiceSelectionList for user.
    • If duplicate: does not update cache.

Response​

Code: 200 OK

Body (JSON string):

{"status":true}

status is true when no duplicate was found (selection stored). It is false when duplicates were detected (!checkDuplicateInvoiceNumber is false, so jo.put("status", !checkDuplicateInvoiceNumber) → false).

Headers: Access-Control-Allow-Origin: *


Example Request​

POST /rest/invoicehome/holdGeneratedInvoice HTTP/1.1
Host: {base}
Content-Type: application/json

{
"userName": "alice",
"authKey": "secretKey",
"branch": "default",
"invoiceData": [
{ "invoiceNumber": "INV-001", "customerId": "C1", "...": "..." }
]
}