Hacker News new | ask | show | jobs
by HideousKojima 1380 days ago
You need more than just a unique invoice number, you need a unique identifier for any actions that can modify an invoice.
2 comments

The dunning chain is dark and full of terrors. It's more Kafka (append-only log of unique operations) than some Platonic idea of idempotent operations.
Why? What happens if I update the invoice address twice?
Working on an ERP software atm, A lot. Often invoices HAVE to be immutable for accounting purposes, so changing the address has to keep an old copy around for the old invoice, while attaching it to any new ones/ones not printed yet. Along with that, some other data may be tied to that address that cant be changed. Like tracking a package in transit that has been sent to the old address.

Idempotency is a godsend for such actions.

If that is all there is to it, then the op is idempotent.

If on the other hand, there is a side effect such as modifying the last_updated column then it isn't and should be coded appropriately.