POS
POS Application Features
The POS application allows users to create invoices based on sales transaction data and predefined templates. After the user selects a template and inputs the necessary information, the application sends the invoice creation request to the Koffi
REST API server for validation and further processing.
Invoice Processing Workflow
1. Fetching Templates:
- The POS application retrieves a list of available templates from the
Koffi
REST API server. - The user selects one of the templates to create an invoice.
2. Creating the Invoice:
- The selected template is used to generate the invoice.
- The invoice data is sent to
Koffi
REST API for validation through theValidate request
process.
3. Request Validation:
- If the invoice request is invalid, the
Koffi
REST API returns validation errors to the POS system. - If the request is valid,
Koffi
enqueues the invoice request for further processing and returns atracking request ID
along with the statusNEW
.
4. Polling for Invoice Status:
- The POS application periodically polls the
Koffi
REST API using thetracking request ID
to check the invoice processing status. - The invoice status can either be SUCCESS or FAILED.
5. Handling Success and Failure:
- Success: If the invoice status is
SUCCESS
, theKoffi
REST API returns the processed invoice data to the POS system. - Failure: If the invoice status is
FAILED
, theKoffi
REST API returns processing errors.
6. Further API Calls:
- If necessary, additional API calls can be made using the invoice ID to retrieve more information or interact with the processed invoice.
Asynchronous Processing System
- Koffi REST API: An external service responsible for validating invoice data and enqueuing valid requests into a queue system for further processing.
- Queue System: Ensures that invoices are processed in the order they are received, enabling efficient tracking of the process and scalability.
Error Handling
The system handles errors during invoice creation and processing. If any validation or processing errors occur, the Koffi
REST API returns detailed error messages, which are displayed to the user.