mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Merge pull request #3928 from alphagov/billing-report
Add total_letters to the billing report
This commit is contained in:
@@ -282,7 +282,7 @@ def get_billing_report():
|
|||||||
end_date = form.end_date.data
|
end_date = form.end_date.data
|
||||||
headers = [
|
headers = [
|
||||||
"organisation_id", "organisation_name", "service_id", "service_name",
|
"organisation_id", "organisation_name", "service_id", "service_name",
|
||||||
"sms_cost", "sms_fragments", "letter_cost", "letter_breakdown", "purchase_order_number",
|
"sms_cost", "sms_fragments", "total_letters", "letter_cost", "letter_breakdown", "purchase_order_number",
|
||||||
"contact_names", "contact_email_addresses", "billing_reference"
|
"contact_names", "contact_email_addresses", "billing_reference"
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
@@ -297,7 +297,7 @@ def get_billing_report():
|
|||||||
rows = [
|
rows = [
|
||||||
[
|
[
|
||||||
r["organisation_id"], r["organisation_name"], r["service_id"], r["service_name"],
|
r["organisation_id"], r["organisation_name"], r["service_id"], r["service_name"],
|
||||||
r["sms_cost"], r["sms_fragments"], r["letter_cost"], r["letter_breakdown"].strip(),
|
r["sms_cost"], r["sms_fragments"], r["total_letters"], r["letter_cost"], r["letter_breakdown"].strip(),
|
||||||
r.get("purchase_order_number"), r.get("contact_names"), r.get("contact_email_addresses"),
|
r.get("purchase_order_number"), r.get("contact_names"), r.get("contact_email_addresses"),
|
||||||
r.get("billing_reference")
|
r.get("billing_reference")
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -851,6 +851,7 @@ def test_get_billing_report_when_calls_api_and_download_data(platform_admin_clie
|
|||||||
"app.main.views.platform_admin.billing_api_client.get_data_for_billing_report",
|
"app.main.views.platform_admin.billing_api_client.get_data_for_billing_report",
|
||||||
return_value=[{
|
return_value=[{
|
||||||
'letter_breakdown': '6 second class letters at 45p\n2 first class letters at 35p\n',
|
'letter_breakdown': '6 second class letters at 45p\n2 first class letters at 35p\n',
|
||||||
|
'total_letters': 8,
|
||||||
'letter_cost': 3.4,
|
'letter_cost': 3.4,
|
||||||
'organisation_id': '7832a1be-a1f0-4f2a-982f-05adfd3d6354',
|
'organisation_id': '7832a1be-a1f0-4f2a-982f-05adfd3d6354',
|
||||||
'organisation_name': 'Org for a - with sms and letter',
|
'organisation_name': 'Org for a - with sms and letter',
|
||||||
@@ -875,7 +876,7 @@ def test_get_billing_report_when_calls_api_and_download_data(platform_admin_clie
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert response.get_data(as_text=True) == (
|
assert response.get_data(as_text=True) == (
|
||||||
'organisation_id,organisation_name,service_id,service_name,sms_cost,sms_fragments,letter_cost' +
|
'organisation_id,organisation_name,service_id,service_name,sms_cost,sms_fragments,total_letters,letter_cost' +
|
||||||
',letter_breakdown,purchase_order_number,contact_names,contact_email_addresses,billing_reference' +
|
',letter_breakdown,purchase_order_number,contact_names,contact_email_addresses,billing_reference' +
|
||||||
|
|
||||||
'\r\n' +
|
'\r\n' +
|
||||||
@@ -886,6 +887,7 @@ def test_get_billing_report_when_calls_api_and_download_data(platform_admin_clie
|
|||||||
'a - with sms and letter,' +
|
'a - with sms and letter,' +
|
||||||
'0,' +
|
'0,' +
|
||||||
'0,' +
|
'0,' +
|
||||||
|
'8,' +
|
||||||
'3.4,' +
|
'3.4,' +
|
||||||
'"6 second class letters at 45p' +
|
'"6 second class letters at 45p' +
|
||||||
'\n' +
|
'\n' +
|
||||||
|
|||||||
Reference in New Issue
Block a user