Use new "cost" field in usage APIs

The previous, manual calculation could be incorrect depending on
which SMS rates the free allowance was attributed to.

The new field also supersedes the old "letter_total" bolt-on so we
can get cost information consistently for both types.
This commit is contained in:
Ben Thorner
2022-04-26 15:40:29 +01:00
parent 82c3e8093d
commit e0aa51c306
5 changed files with 14 additions and 12 deletions

View File

@@ -1020,7 +1020,7 @@ def test_usage_page(
assert '251,800 sent' in sms_column
assert '250,000 free allowance' in sms_column
assert '0 free allowance remaining' in sms_column
assert '£36.14 spent' in sms_column
assert '£29.85 spent' in sms_column
assert '1,800 at 1.65 pence' in sms_column
letter_column = normalize_spaces(annual_usage[2].text + annual_usage[5].text)
@@ -1855,7 +1855,7 @@ def test_service_dashboard_shows_usage(
) == (
'Unlimited '
'free email allowance '
'£36.14 '
'£29.85 '
'spent on text messages '
'£30.00 '
'spent on letters'