harrowio / harrow

The monorepo for the FOSS Harrow CI/CD collaboration project.
GNU Affero General Public License v3.0
33 stars 5 forks source link

Replace billing subsystem #3

Closed leehambley closed 7 years ago

leehambley commented 7 years ago

The current billing subsystem is very closely bound to Braintree, for the open sourcing of Harrow it's important that we get away from this model, for two principle reasons:

The current system opts into a plan, and communicates frequently with Braintree, storing events in the billing_events table such as the following:

uuid              | 91c29e51-******
organization_uuid | 49e835a8-******
event_name        | plan-selected
occurred_on       | 2016-06-22 12:47:34.05605+00
data              | {"UserUuid":"3eed9271-******","PlanUuid":"b99a21cc-******","PlanName":"free","SubscriptionId":"free:49e835a8-******","PrivateCodeAvailable":true,"PricePerMonth":"0.00 USD","UsersIncluded":1,"ProjectsIncluded":1,"PricePerAdditionalUser":"0.00 USD","NumberOfConcurrentJobs":1}

This doesn't reflect the book keeping nature, and requires that in order to have uninterrupted access to Harrow that braintree be frequently consulted.

We want to replace it with a system which behaves essentially the same way, but also generates simple credit/debit notes when an additional daemon is run. This would allow us to see the costs over time, switch to a more granular billing system.

The new ideal system would simply run an additional daemon which generated invoice entries bound to accounts in the database, and optionally registered payments against those by using the immediate billing APIs of some 3rd party, rather than relying on the 3rd party for subscription management.

Bringing control of subscriptions in-house, and having complete control of the billing would enable the FOSS/self-hosting users to simply not run this daemon, whilst the enterprise (supported self-hosted) system can run a different daemon. The cloud version of Harrow can run any daemon it likes.

This would make trials, optional added extras and other complex topics comparably trivial to implement.

leehambley commented 7 years ago

For now I don't let this block the release.

leehambley commented 7 years ago

Solved.