I have been looking at a variety of open source billing implementations, but can't seem to find anything that supports a "billing on behalf of" paradigm properly (or where it can be bolted on easily). It seems as if all the open source billing systems have evolved from telecoms or ISP billing problems. They are too complex and with the wrong focus for my problem domain.
So I thought it seemed sensible to ask for insight from the larger community.
Its easy to implement some variation on the "double entry universal ledger" idea, and we've found this adequate for a whole range of accounting / billing problems. However, there seems to be a whole class of billing use cases that would be greatly facilitated by a more sophisticated approach:
- when a service provider bills a customer, a whole series of entries/transactions might actually result. For example, it may be a third party who is actually providing the service, in other words the service provider is actually billing on behalf of this third party. Also, at the time of this billing, some of the entries/transactions might relate to ascribing a portion of the billing to various OTHER third parties (eg commissions, service fees to be collected for disbursement to other providers which exist in the service chain, etc.). Then also, in some cases there are service tax ramifications, so there may be a tax portion to the billing which may likewise have to be split among various third parties. This all needs to be recorded at the time of the original billing, since it reflects earnings accrued to the various parties under general accounting principles.
- the primary requirement being that each third party must know at any point what money has been ascribed to it (even if no payment has been received yet) -- but no funds for the billing will actually be released to anyone, until the billed customer has paid over and cleared some funds (might be in the form of a chq or eft).
- at the same time, all information that goes into calculating a billing, must remain associated with that billing. (E.g. all formulas and all their parameters, such as tax rates etc -- these can obviously differ vastly for different billings). The reason being that a partial reversal could be made against a billing at any point in future, and money must then be "pulled back" proportionally from any third party to which it has been ascribed, according to the original rules which were in effect at the time of that billing. (The rules might have changed in the interim, eg different third parties might have become associated with an account, commission rate might have changed etc).
Now it seems to me that this class of requirement surely cannot be that uncommon -- and yet I seem unable to find any reference to this class of problem in any open source billing system I can locate; neither can I seem to find any books or other materials which might cover implementation patterns and best practices for these classes of system.
For the project that needs this, we can of course design and code up something ourselves (e.g. a ledger that tracks only cash accounts with a separate billing structure tracking the rest, settling to and from the cash accounts); and if it turns out there is a broader need for this type of use case, the project might support open sourcing this code.
Thus on the one hand, I would be interested to learn of anyone else who has faced a similar type of use case, and how this was approached, and whether there would be value in creating a new open source project that speaks to this class of requirement.
On the other hand, it always seems prudent to write less code and see where one can piggy-back on existing projects -- so if anyone knows of any existing open source that can do this, please let us know!