Add a tool to compute our monthly revenue.

This commit is contained in:
yackob03 2013-11-17 17:24:56 -05:00
parent b6be962bf3
commit 1f4834ad97
2 changed files with 19 additions and 0 deletions

0
tools/__init__.py Normal file
View file

19
tools/monthlyrevenue.py Normal file
View file

@ -0,0 +1,19 @@
from app import stripe
EXCLUDE_CID = {'cus_2iVlmwz8CpHgOj'}
offset = 0
total_monthly_revenue = 0
batch = stripe.Customer.all(count=100, offset=offset)
while batch.data:
for cust in batch.data:
if cust.id not in EXCLUDE_CID and cust.subscription:
sub = cust.subscription
total_monthly_revenue += sub.plan.amount * sub.quantity
offset += len(batch.data)
batch = stripe.Customer.all(count=100, offset=offset)
dollars = total_monthly_revenue / 100
cents = total_monthly_revenue % 100
print 'Monthly revenue: $%d.%02d' % (dollars, cents)