Add billing details property

This property lets service settings know if there are any
billing details to preview.
This commit is contained in:
Pea Tyczynska
2021-01-25 12:54:23 +00:00
parent 8219e5a2f9
commit 4a7bfcc9c5
4 changed files with 43 additions and 8 deletions

View File

@@ -151,6 +151,10 @@ def service_json(
organisation_id=None,
rate_limit=3000,
notes=None,
billing_contact_email_address=None,
billing_contact_name=None,
billing_reference=None,
purchase_order_number=None
):
if users is None:
users = []
@@ -189,7 +193,11 @@ def service_json(
'consent_to_research': True,
'count_as_live': True,
'organisation': organisation_id,
'notes': notes
'notes': notes,
'billing_contact_email_address': billing_contact_email_address,
'billing_contact_name': billing_contact_name,
'billing_reference': billing_reference,
'purchase_order_number': purchase_order_number,
}

View File

@@ -5,7 +5,7 @@ import pytest
from app.models.organisation import Organisation
from app.models.service import Service
from app.models.user import User
from tests import organisation_json
from tests import organisation_json, service_json
from tests.conftest import ORGANISATION_ID
INV_PARENT_FOLDER_ID = '7e979e79-d970-43a5-ac69-b625a8d147b0'
@@ -255,3 +255,13 @@ def test_bad_permission_raises(service_one):
with pytest.raises(KeyError) as e:
Service(service_one).has_permission('foo')
assert str(e.value) == "'foo is not a service permission'"
@pytest.mark.parametrize("purchase_order_number,expected_result", [
[None, None],
["PO1234", [None, None, None, "PO1234"]]
])
def test_service_billing_details(purchase_order_number, expected_result):
service = Service(service_json(purchase_order_number=purchase_order_number))
service._dict['purchase_order_number'] = purchase_order_number
assert service.billing_details == expected_result