Finish migration from billing_units to API fields

This is now only used for letters and represents the number sent
[^1].  We could use the chargeable_units field, but using "_sent"
is more consistent with the annual attributes [^2].

In fact, chargeable_units isn't actually used anywhere, but I've
kept it in the test data as it is part of the real API and helps
clarify the other values for SMS - free vs. charged.

Note: for SMS I've used an arbitrary "1234" for "chargeable_units"
to indicate it's not used and may be different to the number sent -
for SMS it's related to the number of fragments.

[^1]: bb62d22f25/app/dao/fact_billing_dao.py (L339)
[^2]: 3a1ac189ff/app/main/views/dashboard.py (L339)
This commit is contained in:
Ben Thorner
2022-05-03 10:33:04 +01:00
parent c0ee24ff19
commit fb7c116046
3 changed files with 45 additions and 23 deletions

View File

@@ -2362,7 +2362,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'March',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 1230,
'chargeable_units': 1230,
'notifications_sent': 1234,
'postage': 'none',
'sms_charged': 1230,
'sms_free_allowance_used': 0,
@@ -2373,7 +2374,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'February',
'notification_type': 'sms',
'rate': 0.0165,
'billing_units': 1100,
'chargeable_units': 1100,
'notifications_sent': 1234,
'postage': 'none',
'sms_charged': 960,
'sms_free_allowance_used': 140,
@@ -2384,7 +2386,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'February',
'notification_type': 'letter',
'rate': 0.31,
'billing_units': 10,
'chargeable_units': 10,
'notifications_sent': 10,
'postage': 'second',
'sms_charged': 0,
'sms_free_allowance_used': 0,
@@ -2395,7 +2398,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'February',
'notification_type': 'letter',
'rate': 0.33,
'billing_units': 5,
'chargeable_units': 5,
'notifications_sent': 5,
'postage': 'first',
'sms_charged': 0,
'sms_free_allowance_used': 0,
@@ -2406,7 +2410,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'February',
'notification_type': 'letter',
'rate': 0.84,
'billing_units': 3,
'chargeable_units': 3,
'notifications_sent': 3,
'postage': 'europe',
'sms_charged': 0,
'sms_free_allowance_used': 0,
@@ -2417,7 +2422,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'February',
'notification_type': 'letter',
'rate': 0.84,
'billing_units': 7,
'chargeable_units': 7,
'notifications_sent': 7,
'postage': 'rest-of-world',
'sms_charged': 0,
'sms_free_allowance_used': 0,
@@ -2428,7 +2434,8 @@ def mock_get_monthly_usage_for_service(mocker):
'month': 'April',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 249860,
'chargeable_units': 249860,
'notifications_sent': 1234,
'postage': 'none',
'sms_charged': 0,
'sms_free_allowance_used': 249860,