In this article you will learn how to properly implement error handling in Spain.
Prerequisites
- FiscalClient as of version 1.6.5 / Spain 1.0.5 for features marked with *.
- FiscalClient as of version 1.5.0
Description
The Spanish TicketBai system provides the possibility to submit the generated receipts immediately, but also later. When submitting the receipts, validation errors may occur.
With synchronous processing, these validation errors are immediately reported back to the POS system. In the case of delayed transmission (TicketBAI system was not available at the time of receipt creation), the errors must be read out from the fiscal system and, depending on the cause of the error, the problem must be dealt with accordingly.
Synchronous processing
The TicketBAI system is available and receipts can be transferred.
Prerequisites
- TicketBAI system is available
- There are no files for transmission (from previous interruptions)
The receipt is synchronously transferred to the TicketBAI system. If the receipt is successfully transferred and there are no validation errors, the result is returned to the POS system with the status successful.
The receipt is stored in the fiscal system and in TicketBAI and must not be transferred again.
Causes of errors
TicketBAI system is now no longer available
The receipt is saved by the fiscal system and made available for the next transmission. This starts the asynchronous process.
The receipt is stored in the fiscal system and is later transferred to TicketBAI. It must not be transferred to the fiscal system again.
Validation error from TicketBAI
The receipt is not saved in the fiscal system and an error message is returned to the POS system about the invalid receipt.
The receipt must be correctly transferred to the fiscal system once again.
Asynchronous processing
The TicketBAI system or the connection to it is not available.
Prerequisites
- FiscalClient is available and ready to work
- TicketBAI system is not available or the connection to the TicketBAI system is interrupted.
The receipts are taken over by the fiscal system, stored and marked for later transfer.
Due to asynchronous processing, validation errors cannot be returned directly to the POS system. Therefore, the error states for these receipts must be queried.
All asynchronously transmitted receipts are stored in the fiscal system and may no longer be transmitted to the fiscal system.
Query error information and resolution *
This function is available from version 1.6.5 of the fiscal client.
The failed transfers can be queried at the fiscal system.
Query
There is the following endpoint to retrieve the error files:
REST:
GET /api/v1/transactions/errorDocuments/{clientId}
nuget:
TrustedFiscalModule.GetErrorDocuments(bool onlyAsync)
The endpoint returns the error information and the Guids (DocumentGuid) of the affected documents.
The parameter onlyAsync can be used to get back only errors that occurred asynchronously.
Solution
To resolve the problem, the document must be cancelled in the fiscal system, this is done via the following endpoint.
REST:
DELETE /api/v1/transactions/errorDocuments/{clientId}/{documentGuid}
nuget:
TrustedFiscalModule.CancelErrorDocument(Guid documentGuid)
With this call, the receipt is cancelled in the fiscal system, but the cancellation is not forwarded to the TicketBAI system (the receipt does not yet exist in the TicketBAI system). If this receipt is marked as cancelled, it will no longer be returned as faulty via the query above.
The document is cancelled in the fiscal system - not deleted!
The document can now be transferred again with new document header information (document number, DocumentGuid, etc.) to the fiscal system with the corrected data.
Comments
0 comments
Please sign in to leave a comment.