-
Notifications
You must be signed in to change notification settings - Fork 78
Billing Engine
Jacob Sayles edited this page Jun 25, 2017
·
4 revisions
At the heart of Nadine is the billing engine where bills are created based on the member subscriptions and usage activity.
A BillingBatch is a model that generates the bills, associates the subscriptions and activity, and keeps a record for each time it's run.
- Run for every day since the last successful batch run
- For every active ResourceSubscription not attached to a bill:
- Calculate the period start and end from the subscription membership and bill_day
- Get or create an open bill associated with the payor and period
- Add this subscription to a bill
- For every CoworkingDay not attached to a bill:
- Get or create an open bill associated with the payor and visit date
- Add this day to the bill
- Close all open bills that end on this day
- For every active ResourceSubscription not attached to a bill: