Skip to main content

Generate Single Invoice API

Introduction​

Builds a full individual (single-booking) invoice payload as InvoiceOriginal from one or more selected Invoicing rows. The handler loads booking details, expands planner/pickup/delivery/truck/equipment lines into InvoiceModel rows, computes totals and GST, attaches sales categories and settings (invoice format, GST %), and may set Cermat consignor/consignee fields and vendor agreed price messages when feature flags and data allow.

Source: GenerateInvoiceAPI.generateSingleInvoice — transportsupplyproject/src/in/greenorange/api/invoice/GenerateInvoiceAPI.java.

See also: Generate Invoice — all endpoints.


HTTP Endpoint​

PropertyValue
URL/rest/generateinvoice/generateSingleInvoice
MethodPOST
ConsumesRaw JSON (use Content-Type: application/json in clients)
Producestext/plain (entity is a JSON object string)

Request Body (JSON)​

FieldTypeRequiredDescription
userNameStringYesAuth username.
authKeyStringYesAuth key.
branchStringYesPresent in contract; often unused after parse.
invoicedataArrayYesGson → List<Invoicing>; first row’s bookingId drives booking fetch.

Authentication​

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

Success Response​

Body (JSON string):

KeyTypeDescription
resString"Valid" when the credit-term branch completes successfully; "NoCreditTerm" when it does not.
dataStringEmbedded JSON: InvoiceOriginal serialised with Gson + SpecificClassExclusionStrategy.

Headers: Access-Control-Allow-Origin: *


Example Request​

POST /rest/generateinvoice/generateSingleInvoice HTTP/1.1
Host: {base}
Content-Type: application/json

{
"userName": "alice",
"authKey": "secretKey",
"branch": "default",
"invoicedata": [
{
"bookingId": "BK-001",
"customerId": "C1",
"customerName": "Acme",
"...": "other Invoicing fields as used by the UI"
}
]
}

Parse the outer body as JSON, then parse data again as JSON for the invoice object.