Indeed, we only scratched the surface of the complexity of metered billing, we'll do a deep dive soon on this topic (it does deserve its own post).
I think for the'nightmares' you mention: - some might be specific to utility (not applicable to an online business), such as '- meter readings are available on dates totally independent from billing cycle'. - Some topics might be simpler for a utility co: tax for instance (you know where your users are, and they are limited to a geographic region)
- But some nightmares such as '- the prices can change mid-billing cycle for some customers but the consumption data is not available with that granularity' do really resonate for online businesses too, indeed
Thanks for sharing, great insights for our future post!
Sounds like a nightmare to deal with, of course this is only assuming it is enforced. If it is not well who cares, companies like Lyft/Uber view laws as a starting point in negotiations when expanding into new areas not as a brick wall of dogma.
I think we call ourselves CPAs :). In all seriousness the 'solution' depends on what industry we're talking about. Short term rentals? Avalara. Software as a service? Various accounting firms and startups. Etc.
Bonus points if the meters can send data out of order.
When connected they would emit events as they happened, but when there was poor service or disconnection they would buffer them and send them as a burst once they reconnected... in reverse order.
I forget the finer details, but the service I was writing was supposed to notify of trucks entering and leaving geofences, inactivity etc. anything you can think of where the order of events is important.
https://www.ibm.com/docs/en/db2/10.5?topic=tables-bitemporal
In a time-series (or event) table you have one date - when the data point is valid (event occurred).
In a temporal table you have two dates - interval when the data is valid.
In a bitemporal table you have two intervals. First describes when the data is valid in real world, the second when does the system know about the real-world state.
I.e. if company changed address on 2022-05-01 but the system will not get that information until three day later (2022-05-03) you have two validity intervals.
Then you may ask - what was the company address on 2022-05-02? And what did the system think the address was on 2022-05-02? You will get two different answers. This is important if you need e.g. to make a correction to previously issued invoice. You need to know what data was used for original invoice and what data should have been used.
Apparently the billing system provided for 7 'counters' and hence the smart-meter had to have exactly 7 counters.
The meter being replaced shouldnt be a major issue, this is relational (at least we treat this all as relational) data that should be captured (by the customer information 'CIS' system), and should be available with a 1-2 day delay. Similar argument applies to other relational aspects of the premise under consideration. Not saying that those are easy (more ways for this process to have gaps).
Dates are no problem, everything is billed at the end of month, quarter or year.
Upgrades are downgrades are simplified, customer can legally change tariff only on predefined dates/events.
Usage - yes, but exampled in the article do not even scratch the complexity of this
Idempotency is not really needed, the billing process is not continuous, it is a batch job.
Cash collection is out of scope of billing software.
Taxing was clear. Yes, there were multiple billable items with different tax rates, but not too complex. All customers were local.
The nightmare part was:
- customers can have multiple consumption locations, location can have multiple meters and customer can request to split the bill on multiple invoices or combine multiple bills to single invoice as they please
- meters can be replaced at any time
- meter readings are available on dates totally independent from billing cycle. Most of consumption data are mere forecasts.
- when the actual consumption data is available, everything must be recalculated AND compensated (on a correction invoice showing the difference)
- actual consumption data can be wrong and may be corrected at a later date, even multiple times
- consumption points can be added or removed or moved to different customer at any time, but this information is only available after the fact
- the prices can change mid-billing cycle for some customers but the consumption data is not available with that granularity
- customer legal information (company name, address) can change mid-cycle