Organisation billing details visible on organisation settings page

This commit is contained in:
Pea Tyczynska
2021-02-05 10:57:46 +00:00
parent f0d94a009e
commit 56b777872e
5 changed files with 45 additions and 0 deletions

View File

@@ -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)

View File

@@ -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) }}

View File

@@ -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,
}

View File

@@ -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',

View 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