Update billing mocks and get_sum_billing_units function

Updated the 'get_sum_billing_units' function to no longer multiply the
billing units by the rate multiplier. The billing_units that come from
notifications-api already consist of the billable_units * rate_multiplier.
The rate_multiplier is also not returned from the api response anymore.

Also updated the billing mocks since these were not mocking the right fields in
the JSON responses from the API billing endpoints, and added the new
'postage' field which will get returned from the monthly-usage endpoint
in notifications-api.
This commit is contained in:
Katie Smith
2018-10-03 09:13:28 +01:00
parent 99d7da87c7
commit b1f2b1bc0f
2 changed files with 35 additions and 52 deletions

View File

@@ -418,8 +418,8 @@ def get_months_for_year(start, end, year):
def get_sum_billing_units(billing_units, month=None):
if month:
return sum(b['billing_units'] * b.get('rate_multiplier', 1) for b in billing_units if b['month'] == month)
return sum(b['billing_units'] * b.get('rate_multiplier', 1) for b in billing_units)
return sum(b['billing_units'] for b in billing_units if b['month'] == month)
return sum(b['billing_units'] for b in billing_units)
def get_free_paid_breakdown_for_billable_units(year, free_sms_fragment_limit, billing_units):