Skip to main content

Upload Acknowledgement Document API

Introduction​

Uploads a PDF for an acknowledgement: multipart fields → SFTP via SFTPFileTransferTo.uploadFile under TmsConstants.ACKNOWLEDGEMENT_SERVER_ROOT_PATH + generated image id. Auth uses userId + authKey (passed to checkIfAuthKeyIsValid(userId, authKey, ...) — username is the user id field here).

On successful upload and image metadata save:

  • Sets acknowledgement ACTIVE, fileId, fileName.
  • acknowledgementService.saveAcknowledgement
  • For each related InvoiceOriginal from getInvoiceOriginalAcknowledgement, creates InvoiceSummary with acknowledgement status and saves via saveInvoiceSummary.

Source: InvoiceHomePageAPI.uploadAcknowledgementDocument — transportsupplyproject/src/in/greenorange/api/invoice/InvoiceHomePageAPI.java.

See also: Invoice Home — all endpoints.


HTTP Endpoint​

| URL | /rest/invoicehome/uploadAcknowledgementDocument | | Method | POST | | Consumes | multipart/form-data | | Produces | text/plain (JSON string) |


Form Fields​

FieldTypeRequiredDescription
ackNumberTextYesAcknowledgement number; also used as base file name ({ackNumber}.pdf).
ackFileFileYesPDF body.
userIdTextYesPassed as first argument to checkIfAuthKeyIsValid (acts as login id).
authKeyTextYesAuth key.

Response​

Code: 200

Body (JSON string):

On full success:

{
"Uploaded": "Ok",
"ImageId": "...",
"Filepath": "..."
}

Otherwise often:

{
"Uploaded": "No",
"Filepath": "..."
}

Note: Successful 401 responses include CORS; 200 response does not set Access-Control-Allow-Origin in code (same pattern as uploadInvoice).


Behaviour details​

  • Initial Thread.sleep(200).
  • ImageStoreService.generateImageId, setImageDetails, activity log on success.