When integrating with Accounting as a Service, it's crucial to understand how the system validates incoming data and handles errors. This ensures that data integrity is maintained and that your requests are processed efficiently and correctly. Here's a detailed overview of the validation process and how to manage errors:
AQI (Accounting Queue Interface) performs the first layer of validation for incoming requests. The process is as follows:
400
HTTP error, indicating that the data is incomplete or incorrect.400
HTTP error response.400
error is returned.500
HTTP error is returned.For all 400
and 500
errors, the request is not saved or processed in AQI, and the client must correct the data and resend the request.
Example for 400 error:
{
"type" : "RequestBody",
"title" : "IncorrectMessage",
"code": 400,
"description" :"Body of the request does not conform to the definition which is associated with the content type application/json. Path:billToAddress.email Message: String 'null' does not validate against format 'email'. Line: 1, Position: 134 SchemaId: #/components/schemas/BillToAddress/allOf/1/properties/email"
}
If the initial validations are successful, AQI returns a 200
HTTP response, indicating that the message has been received, but it has not yet been fully validated. Further validation occurs asynchronously in Accounting as a Service.
Once AQI accepts a request, it undergoes further validation directly within the Accounting as a Service system. This validation covers:
Mandatory Fields Validation: Checks that all mandatory fields are filled, without validating the specific content of those fields.
Dependent Mandatory Fields: Some fields become mandatory based on specific conditions, such as payment methods or order types.
Content Validations: Ensures that the values provided are unique and interpretable by the system. For example:
Field Length Checks: The system verifies field lengths against predefined limits. If a value is too long, it may be truncated based on whether the field is critical:
Error (Status "E"): For fields affecting downstream processes, exceeding the length results in an error, and the request will not be processed.
Warning (Status "W"): For non-critical fields, values exceeding the length are truncated, and the request is processed with a warning noted.
Duplicate Submissions: Each request must include a unique transactionId. If this transactionId is reused for a processed request, an error is returned to prevent duplicates.
Message Order: Requests must follow the correct sequence. For example, a return order cannot be processed if the initial order has not yet been received and processed in the system.
After validation, Accounting as a Service issues an EDI Error Sent notification, which provides feedback on the processed request:
Error Notification Example:
{
"parameters": {
"requestType": "GET_ORDER",
"transactionId": "0a6b660174a3306898a924639688dffb",
"details": {
"orderNo": "ORDPL8100235158",
"result": "ERROR_IN_FILE",
"errorDetails": [
{
"fieldName": "LINEITEMSTATUS",
"ErrorDescription": "Field LINEITEMSTATUS must not be empty."
},
{
"fieldName": "BILLTOLANGUAGECODE",
"providedValue": "PL",
"ErrorDescription": "The content of field BILLTOLANGUAGECODE may only consist of lower case letters."
}
]
}
This notification includes the transactionId
, orderNo
, the result
(ERROR_IN_FILE
), and specific details about each error encountered.
The client should correct the data and resend the request using the information provided in this notification.
Success Notification Example:
{
"parameters": {
"requestType": "GET_ORDER",
"transactionId": "OR20240903100030",
"details": {
"orderNo": "996003767",
"result": "OK",
"errorDetails": [
{
"ErrorDescription": "The request was successfully validated."
}
]
}
},
"type": "accounting/EDIErrorSent"
}
A success message confirms that the data was correct, and no further action is needed. The client can mark the request as confirmed in their system.
get_order
(create order), get_cancellation
(cancel order), get_goodwill
(add goodwill), get_booking_confirmation
(create invoice), get_return
(return order), get_payment
(create payment).DataSource
specifies the environment (PreProd
for UAT or Prod
for Production).ERROR_IN_FILE
: Indicates that the sent data needs correction and must be resent.OK
: Indicates successful validation without errors.Understanding and managing these validation processes and error responses are essential for a smooth integration with Accounting as a Service. Properly handling errors and resubmitting corrected data ensures that the business processes continue without disruption.