mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 14:49:49 -04:00
Organisation billing details visible on organisation settings page
This commit is contained in:
@@ -46,6 +46,10 @@ class Organisation(JSONModel):
|
|||||||
'domains',
|
'domains',
|
||||||
'request_to_go_live_notes',
|
'request_to_go_live_notes',
|
||||||
'count_of_live_services',
|
'count_of_live_services',
|
||||||
|
'billing_contact_email_addresses',
|
||||||
|
'billing_contact_names',
|
||||||
|
'billing_reference',
|
||||||
|
'purchase_order_number',
|
||||||
'notes'
|
'notes'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +138,19 @@ class Organisation(JSONModel):
|
|||||||
abort(404)
|
abort(404)
|
||||||
return self.crown
|
return self.crown
|
||||||
|
|
||||||
|
@property
|
||||||
|
def billing_details(self):
|
||||||
|
billing_details = [
|
||||||
|
self.billing_contact_email_addresses,
|
||||||
|
self.billing_contact_names,
|
||||||
|
self.billing_reference,
|
||||||
|
self.purchase_order_number
|
||||||
|
]
|
||||||
|
if any(billing_details):
|
||||||
|
return billing_details
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def services(self):
|
def services(self):
|
||||||
return organisations_client.get_organisation_services(self.id)
|
return organisations_client.get_organisation_services(self.id)
|
||||||
|
|||||||
@@ -72,6 +72,12 @@
|
|||||||
}}
|
}}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
|
{% call row() %}
|
||||||
|
{{ text_field('Billing details')}}
|
||||||
|
{{ optional_text_field(current_org.billing_details, default="No billing details yet", wrap=True) }}
|
||||||
|
{{ edit_field('Change', url_for('.organisation_settings', org_id=current_org.id), suffix='billing details for the organisation') }}
|
||||||
|
{% endcall %}
|
||||||
|
|
||||||
{% call row() %}
|
{% call row() %}
|
||||||
{{ text_field('Notes')}}
|
{{ text_field('Notes')}}
|
||||||
{{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }}
|
{{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }}
|
||||||
|
|||||||
@@ -219,6 +219,10 @@ def organisation_json(
|
|||||||
organisation_type='central',
|
organisation_type='central',
|
||||||
request_to_go_live_notes=None,
|
request_to_go_live_notes=None,
|
||||||
notes=None,
|
notes=None,
|
||||||
|
billing_contact_email_addresses=None,
|
||||||
|
billing_contact_names=None,
|
||||||
|
billing_reference=None,
|
||||||
|
purchase_order_number=None
|
||||||
):
|
):
|
||||||
if users is None:
|
if users is None:
|
||||||
users = []
|
users = []
|
||||||
@@ -244,6 +248,10 @@ def organisation_json(
|
|||||||
'request_to_go_live_notes': request_to_go_live_notes,
|
'request_to_go_live_notes': request_to_go_live_notes,
|
||||||
'count_of_live_services': len(services),
|
'count_of_live_services': len(services),
|
||||||
'notes': notes,
|
'notes': notes,
|
||||||
|
'billing_contact_email_addresses': billing_contact_email_addresses,
|
||||||
|
'billing_contact_names': billing_contact_names,
|
||||||
|
'billing_reference': billing_reference,
|
||||||
|
'purchase_order_number': purchase_order_number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -691,6 +691,7 @@ def test_organisation_settings_for_platform_admin(
|
|||||||
'Crown organisation Yes Change',
|
'Crown organisation Yes Change',
|
||||||
'Data sharing and financial agreement Not signed Change',
|
'Data sharing and financial agreement Not signed Change',
|
||||||
'Request to go live notes None Change',
|
'Request to go live notes None Change',
|
||||||
|
'Billing details No billing details yet Change billing details for the organisation',
|
||||||
'Notes No notes yet Change the notes for the organisation',
|
'Notes No notes yet Change the notes for the organisation',
|
||||||
'Default email branding GOV.UK Change',
|
'Default email branding GOV.UK Change',
|
||||||
'Default letter branding No branding Change',
|
'Default letter branding No branding Change',
|
||||||
13
tests/app/models/test_organisation.py
Normal file
13
tests/app/models/test_organisation.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from app.models.organisation import Organisation
|
||||||
|
from tests import organisation_json
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("purchase_order_number,expected_result", [
|
||||||
|
[None, None],
|
||||||
|
["PO1234", [None, None, None, "PO1234"]]
|
||||||
|
])
|
||||||
|
def test_organisation_billing_details(purchase_order_number, expected_result):
|
||||||
|
organisation = Organisation(organisation_json(purchase_order_number=purchase_order_number))
|
||||||
|
assert organisation.billing_details == expected_result
|
||||||
Reference in New Issue
Block a user