diff --git a/app/models/organisation.py b/app/models/organisation.py index daae6e4f1..6a658d792 100644 --- a/app/models/organisation.py +++ b/app/models/organisation.py @@ -46,6 +46,10 @@ class Organisation(JSONModel): 'domains', 'request_to_go_live_notes', 'count_of_live_services', + 'billing_contact_email_addresses', + 'billing_contact_names', + 'billing_reference', + 'purchase_order_number', 'notes' } @@ -134,6 +138,19 @@ class Organisation(JSONModel): abort(404) 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 def services(self): return organisations_client.get_organisation_services(self.id) diff --git a/app/templates/views/organisations/organisation/settings/index.html b/app/templates/views/organisations/organisation/settings/index.html index a58679938..0bd7e4542 100644 --- a/app/templates/views/organisations/organisation/settings/index.html +++ b/app/templates/views/organisations/organisation/settings/index.html @@ -72,6 +72,12 @@ }} {% 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() %} {{ text_field('Notes')}} {{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }} diff --git a/tests/__init__.py b/tests/__init__.py index c67df7a9f..e39b22797 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -219,6 +219,10 @@ def organisation_json( organisation_type='central', request_to_go_live_notes=None, notes=None, + billing_contact_email_addresses=None, + billing_contact_names=None, + billing_reference=None, + purchase_order_number=None ): if users is None: users = [] @@ -244,6 +248,10 @@ def organisation_json( 'request_to_go_live_notes': request_to_go_live_notes, 'count_of_live_services': len(services), '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, } diff --git a/tests/app/main/views/organisations/test_organisation.py b/tests/app/main/views/organisations/test_organisations.py similarity index 99% rename from tests/app/main/views/organisations/test_organisation.py rename to tests/app/main/views/organisations/test_organisations.py index 81639a064..d879d9e9b 100644 --- a/tests/app/main/views/organisations/test_organisation.py +++ b/tests/app/main/views/organisations/test_organisations.py @@ -691,6 +691,7 @@ def test_organisation_settings_for_platform_admin( 'Crown organisation Yes Change', 'Data sharing and financial agreement Not signed 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', 'Default email branding GOV.UK Change', 'Default letter branding No branding Change', diff --git a/tests/app/models/test_organisation.py b/tests/app/models/test_organisation.py new file mode 100644 index 000000000..7d66dca29 --- /dev/null +++ b/tests/app/models/test_organisation.py @@ -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