From 1f4834ad97c51b5cabfdccd08169a03a69390abd Mon Sep 17 00:00:00 2001 From: yackob03 Date: Sun, 17 Nov 2013 17:24:56 -0500 Subject: [PATCH] Add a tool to compute our monthly revenue. --- tools/__init__.py | 0 tools/monthlyrevenue.py | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tools/__init__.py create mode 100644 tools/monthlyrevenue.py diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tools/monthlyrevenue.py b/tools/monthlyrevenue.py new file mode 100644 index 000000000..9472eeda6 --- /dev/null +++ b/tools/monthlyrevenue.py @@ -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)