Invoices are generated based on an Order. However, they’re not linked to it, as you can see in the class diagram below:


You can generate an Order’s invoice from the admin Order edit page. The Invoice can also be generated by the Customer once the payment is successful. We’ll check for existing invoices with same order reference before trying to generate the invoice.

Beware, the relation is not explicitly set in database; there is no explicit link between an Invoice and an Order (this is a design choice, in order to be able to generate invoices from several orders for instance, or several invoices for one order, and so on). Our implementation makes a link through the reference, but it’s only a default behavior.

Invoice Statuses

The various statuses for the Invoice are as follows:

interface InvoiceInterface
    const STATUS_OPEN     = 0; // created but not paid
    const STATUS_PAID     = 1; // the invoice has been paid
    const STATUS_CONFLICT = 2; // there is a conflict about this invoice

Feel free to add your own statuses in your implementations; but remember to override the corresponding getStatusList static method.