Nice writeup, this is exactly the kind of line by line check that catches silent drift. One thing to watch if you ever run this against Canadian stores: the tax block is where cent level matching goes sideways. Some provinces show tax as one line, others split it into two or three lines, and Quebec computes its provincial tax on the pre GST price, so the lines do not add up the way you would expect if you assume one rate per order. Reconciliation tools that assume a single tax line per order quietly misattribute the difference. Worth a dedicated assertion on the tax lines if you expand this beyond one store.
That is a real gap and I had not looked for it. We reconcile one store, and every assumption that survives on one store is untested by definition.
The Quebec case is the sharp end: if provincial tax is computed on the pre-GST price, then a reconciler that derives tax from a single effective rate will be wrong in a way that still balances to the penny on every other province, which is the worst kind of wrong — it only fails where nobody is looking.
Taking the suggestion literally: a dedicated assertion on the tax lines rather than on the order total, so a multi-line tax block has to match line by line and not in aggregate. If you have a store where the lines split two or three ways, I would rather test against that shape than invent a fixture for it.
We're a place where coders share, stay up-to-date and grow their careers.
Nice writeup, this is exactly the kind of line by line check that catches silent drift. One thing to watch if you ever run this against Canadian stores: the tax block is where cent level matching goes sideways. Some provinces show tax as one line, others split it into two or three lines, and Quebec computes its provincial tax on the pre GST price, so the lines do not add up the way you would expect if you assume one rate per order. Reconciliation tools that assume a single tax line per order quietly misattribute the difference. Worth a dedicated assertion on the tax lines if you expand this beyond one store.
That is a real gap and I had not looked for it. We reconcile one store, and every assumption that survives on one store is untested by definition.
The Quebec case is the sharp end: if provincial tax is computed on the pre-GST price, then a reconciler that derives tax from a single effective rate will be wrong in a way that still balances to the penny on every other province, which is the worst kind of wrong — it only fails where nobody is looking.
Taking the suggestion literally: a dedicated assertion on the tax lines rather than on the order total, so a multi-line tax block has to match line by line and not in aggregate. If you have a store where the lines split two or three ways, I would rather test against that shape than invent a fixture for it.