As @maikel has been going through my PR on this, I have been thinking about it some more. I got stuck trying to write an appropriate query and now I’m wondering if my current implementation is actually showing what we want.
In the screenshots above, it displays all “complete” orders, and the “completed” payments for those that have them. If an order has no payments, it shouldn’t be “complete”, but it can be “complete” and have incompleted payments with statuses like “void”, “invalid”, “checkout” etc.
My original thinking was that we shouldn’t show these, as they don’t count towards the balance for the order. However now I’m wondering if it is useful to see some or all of these - so the user will know if (for example) a card payment was declined. We could do something like this:
E.g. in the screenshot above we would want to show the cash on collection orders, since they contribute to the balance owed by the user and that’s probably useful information for them. Maybe more cryptic ones like ‘void’/‘invalid’ are not so useful…
@nick, @lin_d_hop @MyriamBoure - what do you think? Would need some formatting changes to make clear which payments were not counting towards the balance of the order.
@maikel I think the query problem boils down to: we still need to get an order row from the database even if there are only incomplete payments, but [in the current implementation] only actually show the payments that are completed. I still can’t find a SQL or AR solution, and this made me think that it is more of a display/filtering issue rather than a data issue after all.