State Machine Statuses
During the standard ‘happy path’ flow of calling the Transaction Import Connector API, the status of the Transaction Import will change depending on the progress throughout the flow.
When you call the POST Import Request endpoint, this is the initial status the Transaction Import will be set at. It will remain in this state, until a file has been uploaded via the pre-signed URL which was generated from the initial POST request.
The status of the Transaction Import will be set to ‘queued’ if there’s an earlier Transaction Import for the same Organisation in one of the following statuses:
If no other Transaction Imports in one of those statuses can be found, then assuming there’s no other Transaction Import for the same Organisation also in a ‘queued’ status, it will begin processing.
If they’re multiple ‘queued’ Transaction Imports for the same Organisation, then the one with the oldest ‘created’ date, will be the first to start processing.
The Transaction Import is being validated, parsed and the transactions are being submitted to ProviderAPI (PAPI) ready to be processed into Banking Service.
The Transaction Import has been validated by ProviderAPI, and is ready to be confirmed. This is the final chance for a user to cancel, and delete their Transaction Import request. The Transaction Import Connector will poll against PAPI every 10 seconds initially (then every 60 seconds once a poll attempt threshold has been hit). This is to check the status of the batch on PAPI.
At this point, the Transaction Import has been confirmed by the user, and PAPI has started processing the transactions into their bank account in Banking Service. Similar to the ‘awaitingConfirmation’ stage, a poll against PAPI will occur until PAPI returns a completed or error status.
PAPI successfully processed the batch of transactions and the Transaction Import has been marked as complete.
At any stage during the flow of importing transactions, various errors can occur, if this happens, the errorDetails object which contains error, warning and info details will be updated if the error was handled and then the status of the Transaction Import will be set to ‘error’.
A user can call the DELETE endpoint before the transactions are submitted to Banking Service and the Transaction Import will be marked as ‘deleted’. You can still perform a GET request against the Transaction Import and see it in its ‘deleted’ state. Calling the DELETE endpoint will:
- Delete the file from S3
- Delete the batch from PAPI
- Update the Transaction Import status to ‘deleted’