Prototype
Buckets
- Consume
- Sink for consumed service; source for refunds
- Service
- Current allocation for service (can go negative if customer desires, or act as access cutoff)
- Balance
- Current customer balance not allocated for service (can go negative as consumed, or positive if prepaid)
- Invoice
- Amount owed on current invoice
Ticks
Automatic Ticks
Service tick
Service -> Consume
Consumes a bit of service
- once a day for daily consumption (disk, etc)
- once a month for granular service (hosting)
- once a year for registration (domain)
Refund tick
Service -> Balance
- Refund for unused service, in case of overprovisioning or unconfigured service
Billing tick
Balance -> Service
- Replenishes Service with enough to cover the next billing period
Invoice tick
Invoice -> Balance
- Bring Balance from negative to zero to account for currently owed outstanding
- Bring Invoice from positive to zero to account for overpayment
Payment tick
Outside -> Invoice
- Incoming payments are placed here until they're accounted for by an invoice run
Manual Ticks
Prepay tick
Invoice -> Balance
- Preemptively move money to indicate a customer's desire to prepay by owing more on next invoice than is actually outstanding
Service Refund tick
Consume -> Service
- Refund for consumed but unprovided service (outage, etc)
Invoice Generation
- Generate Refund tick to refund unused service
- Generate Billing tick to fund next billing period
- Generate Invoice tick to account for payments and refunds
- Compute invoice values and lines from all ticks between current and previous Invoice tick
Example flows
- January period starts December 20th
- New customer has empty buckets, provisioned for $10.00 VHOST MED service
- Bucket balances: C:0 S:0 B:0 I:0
- Service tick: $10.00 VHOST MED - C:10 S:-10 B:0 I:0
- February period starts January 20th
- Refund tick (none necessary, since service was consumed)
- Billing tick - C:10 S:10 B:-20 I:0
- Invoice tick - C:10 S:0 B:0 I:-20
Sample invoice:
$10.00 - VHOST MED: example.com 2011-Jan $10.00 - VHOST MED: example.com 2011-Feb ---- $10.00 - Amount due
- February 1st
- Service tick: $10.00 VHOST MED - C:20 S:-10 B:0 I:10
- Customer pays $10.00
- Payment tick - C:10 S:0 B:0 I:10
- Refund tick (none necessary)
- Billing tick - C:20 S:0 B:-10 I:10