Invoice Lifecycle & Events
This documentation details the technical and business statuses an invoice transitions through within the A-Cube API. The invoice lifecycle is governed by a state machine that determines which transitions are permitted based on the invoice's current status and its direction relative to the user (Inbound vs. Outbound).
Every invoice begins in the ACQUIRED state when it first enters the A-Cube system. From there, it moves through the state machine based on network responses and business actions.
AFNOR to Internal Status Mapping
When the system receives an official AFNOR status code, it automatically maps it to a unified internal InvoiceStatus to more closely correspond to the API's internal logic and state.
| Internal Status | AFNOR Statuses |
|---|---|
| SUBMITTED | "SUBMITTED 200 or ISSUED 201" |
| RECEIVED | "RECEIVED 202 or MADE_AVAILABLE 203 or IN_HAND 204" |
| APPROVED | "APPROVED 205 or PARTIALLY_APPROVED 206 or PAYMENT_SENT" |
| DISPUTED | DISPUTED 207 |
| SUSPENDED | SUSPENDED 208 |
| COMPLETED | COMPLETED 209 |
| REFUSED | REFUSED 210 |
| PAID | PAYMENT_RECEIVED 212 |
| REJECTED | REJECTED 213 |
Allowed Transitions
Transitions from state to state are only allowed for the party (INBOUND or OUTBOUND) that can verify the next step in the process
| From State | Target State | Available For |
|---|---|---|
| ACQUIRED | RECEIVED | Inbound |
| ACQUIRED | SUBMITTED | Outbound |
| SUBMITTED | RECEIVED | Both (Inbound & Outbound) |
| ACQUIRED or SUBMITTED | REJECTED | Inbound |
| RECEIVED | SUSPENDED | Inbound |
| RECEIVED | DISPUTED | Inbound |
| RECEIVED | REFUSED | Inbound |
| RECEIVED or DISPUTED | APPROVED | Inbound |
| SUSPENDED | COMPLETED | Outbound |
| COMPLETED | RECEIVED | Outbound |
| APPROVED | PAID | Outbound |
REJECTED or REFUSED invoices are in "end states" and cannot be reactivate, another correct invoice needs to be sent.
SUSPENDED invoices are those that require further clarification between buyer and seller. The buyer (INBOUND party) SUSPENDs the invoice, the seller COMPLETEs it when ready to move forward. The cycle can continue as needed.
Similarly, DISPUTED invoices also need to be APPROVED or not by the INBOUND party.
The Happy Path
Example of the minumum state trasition needed for the correct resolution of an invoice.
| Status | Description |
|---|---|
| ACQUIRED | The initial state for all invoices upon entering the A-Cube system. |
| SUBMITTED | Applicable to outbound invoices. The document has been processed and sent to the network. |
| RECEIVED | The invoice has been successfully delivered to the recipient. |
| APPROVED | The recipient has reviewed and accepted the invoice. |
| COMPLETED | Processing has successfully resumed and concluded for an invoice that was previously suspended. |
| PAID | The approved invoice has been fully settled. |