This adds new endpoints to retrieve billing data from the new table:

1. Create a separate billing blueprint to house these endpoints

2. Return monthly breakdown in same format as we did before

3. Return yearly breakdown but only return {billing units, rate,
notification_type}. Admin only makes use of these.
This commit is contained in:
Imdad Ahad
2017-08-15 17:26:10 +01:00
parent 9085cc1a57
commit f40889e6e0
5 changed files with 215 additions and 7 deletions

View File

@@ -510,13 +510,14 @@ def get_yearly_billing_usage(service_id):
try:
year = int(request.args.get('year'))
results = notification_usage_dao.get_yearly_billing_data(service_id, year)
json_result = [{"credits": x[0],
"billing_units": x[1],
"rate_multiplier": x[2],
"notification_type": x[3],
"international": x[4],
"rate": x[5]
} for x in results]
json_result = [{
"credits": x[0],
"billing_units": x[1],
"rate_multiplier": x[2],
"notification_type": x[3],
"international": x[4],
"rate": x[5]
} for x in results]
return json.dumps(json_result)
except TypeError: