mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -04:00
Update attribute names following changes in API
This commit is contained in:
@@ -1687,8 +1687,8 @@ class EditServiceNotesForm(StripWhitespaceForm):
|
||||
|
||||
|
||||
class ServiceBillingDetailsForm(StripWhitespaceForm):
|
||||
billing_contact_email_address = GovukTextInputField('Billing contact email address')
|
||||
billing_contact_name = GovukTextInputField('Billing contact name')
|
||||
billing_contact_email_addresses = GovukTextInputField('Billing contact email address')
|
||||
billing_contact_names = GovukTextInputField('Billing contact name')
|
||||
billing_reference = GovukTextInputField('Billing reference')
|
||||
purchase_order_number = GovukTextInputField('Purchase order number')
|
||||
|
||||
|
||||
@@ -1215,16 +1215,16 @@ def edit_service_notes(service_id):
|
||||
@user_is_platform_admin
|
||||
def edit_service_billing_details(service_id):
|
||||
form = ServiceBillingDetailsForm(
|
||||
billing_contact_email_address=current_service.billing_contact_email_address,
|
||||
billing_contact_name=current_service.billing_contact_name,
|
||||
billing_contact_email_addresses=current_service.billing_contact_email_addresses,
|
||||
billing_contact_names=current_service.billing_contact_names,
|
||||
billing_reference=current_service.billing_reference,
|
||||
purchase_order_number=current_service.purchase_order_number
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.update(
|
||||
billing_contact_email_address=form.billing_contact_email_address.data,
|
||||
billing_contact_name=form.billing_contact_name.data,
|
||||
billing_contact_email_addresses=form.billing_contact_email_addresses.data,
|
||||
billing_contact_names=form.billing_contact_names.data,
|
||||
billing_reference=form.billing_reference.data,
|
||||
purchase_order_number=form.purchase_order_number.data
|
||||
)
|
||||
|
||||
@@ -31,8 +31,8 @@ class Service(JSONModel):
|
||||
ALLOWED_PROPERTIES = {
|
||||
'active',
|
||||
'allowed_broadcast_provider',
|
||||
'billing_contact_email_address',
|
||||
'billing_contact_name',
|
||||
'billing_contact_email_addresses',
|
||||
'billing_contact_names',
|
||||
'billing_reference',
|
||||
'consent_to_research',
|
||||
'contact_link',
|
||||
@@ -83,8 +83,8 @@ class Service(JSONModel):
|
||||
@property
|
||||
def billing_details(self):
|
||||
billing_details = [
|
||||
self.billing_contact_email_address,
|
||||
self.billing_contact_name,
|
||||
self.billing_contact_email_addresses,
|
||||
self.billing_contact_names,
|
||||
self.billing_reference,
|
||||
self.purchase_order_number
|
||||
]
|
||||
|
||||
@@ -80,8 +80,8 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
data = _attach_current_user(kwargs)
|
||||
disallowed_attributes = set(data.keys()) - {
|
||||
'active',
|
||||
'billing_contact_email_address',
|
||||
'billing_contact_name',
|
||||
'billing_contact_email_addresses',
|
||||
'billing_contact_names',
|
||||
'billing_reference',
|
||||
'consent_to_research',
|
||||
'contact_link',
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Change service billing details
|
||||
Change billing details
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header(
|
||||
'Change service billing details',
|
||||
'Change billing details',
|
||||
back_link=url_for('main.service_settings', service_id=current_service.id)
|
||||
) }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{ form.billing_contact_name }}
|
||||
{{ form.billing_contact_email_address }}
|
||||
{{ form.billing_contact_names }}
|
||||
{{ form.billing_contact_email_addresses }}
|
||||
{{ form.billing_reference }}
|
||||
{{ form.purchase_order_number }}
|
||||
{{ page_footer('Save') }}
|
||||
|
||||
@@ -151,8 +151,8 @@ def service_json(
|
||||
organisation_id=None,
|
||||
rate_limit=3000,
|
||||
notes=None,
|
||||
billing_contact_email_address=None,
|
||||
billing_contact_name=None,
|
||||
billing_contact_email_addresses=None,
|
||||
billing_contact_names=None,
|
||||
billing_reference=None,
|
||||
purchase_order_number=None
|
||||
):
|
||||
@@ -194,8 +194,8 @@ def service_json(
|
||||
'count_as_live': True,
|
||||
'organisation': organisation_id,
|
||||
'notes': notes,
|
||||
'billing_contact_email_address': billing_contact_email_address,
|
||||
'billing_contact_name': billing_contact_name,
|
||||
'billing_contact_email_addresses': billing_contact_email_addresses,
|
||||
'billing_contact_names': billing_contact_names,
|
||||
'billing_reference': billing_reference,
|
||||
'purchase_order_number': purchase_order_number,
|
||||
}
|
||||
|
||||
@@ -5309,7 +5309,7 @@ def test_view_edit_service_billing_details(
|
||||
):
|
||||
response = platform_admin_client.get(url_for('main.edit_service_billing_details', service_id=SERVICE_ONE_ID))
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.select_one('h1').text == "Change service billing details"
|
||||
assert page.select_one('h1').text == "Change billing details"
|
||||
labels = page.find_all('label', class_="form-label")
|
||||
labels_list = [
|
||||
'Billing contact email address', 'Billing contact name', 'Billing reference', 'Purchase order number'
|
||||
@@ -5317,7 +5317,9 @@ def test_view_edit_service_billing_details(
|
||||
for label in labels:
|
||||
assert label.text.strip() in labels_list
|
||||
textbox_names = page.find_all('input', class_='govuk-input govuk-!-width-two-thirds')
|
||||
names_list = ['billing_contact_email_address', 'billing_contact_name', 'billing_reference', 'purchase_order_number']
|
||||
names_list = [
|
||||
'billing_contact_email_addresses', 'billing_contact_names', 'billing_reference', 'purchase_order_number'
|
||||
]
|
||||
|
||||
for name in textbox_names:
|
||||
assert name.attrs["name"] in names_list
|
||||
@@ -5334,8 +5336,8 @@ def test_update_service_billing_details(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
),
|
||||
data={
|
||||
'billing_contact_email_address': 'accounts@fluff.gov.uk',
|
||||
'billing_contact_name': 'Flannellette von Fluff',
|
||||
'billing_contact_email_addresses': 'accounts@fluff.gov.uk',
|
||||
'billing_contact_names': 'Flannellette von Fluff',
|
||||
'billing_reference': '',
|
||||
'purchase_order_number': 'PO1234'
|
||||
}
|
||||
@@ -5346,8 +5348,8 @@ def test_update_service_billing_details(
|
||||
assert response.location == settings_url
|
||||
mock_update_service.assert_called_with(
|
||||
SERVICE_ONE_ID,
|
||||
billing_contact_email_address='accounts@fluff.gov.uk',
|
||||
billing_contact_name='Flannellette von Fluff',
|
||||
billing_contact_email_addresses='accounts@fluff.gov.uk',
|
||||
billing_contact_names='Flannellette von Fluff',
|
||||
billing_reference='',
|
||||
purchase_order_number='PO1234'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user