Pass service domain to api when adding a new service

We need to pass the domain to api when adding a service so that api can
link the domain of the service with a letter brand.
This commit is contained in:
Katie Smith
2019-02-12 14:02:21 +00:00
parent 1cb1ce310a
commit 31a1c1ca51
6 changed files with 21 additions and 12 deletions

View File

@@ -10,10 +10,9 @@ from app.utils import AgreementInfo, email_safe, user_is_gov_user
def _create_service(service_name, organisation_type, email_from, form):
free_sms_fragment_limit = current_app.config['DEFAULT_FREE_SMS_FRAGMENT_LIMITS'].get(organisation_type)
email_branding = email_branding_client.get_email_branding_id_for_domain(
'nhs.uk' if organisation_type == 'nhs' else
AgreementInfo.from_current_user().canonical_domain
)
domain = 'nhs.uk' if organisation_type == 'nhs' else AgreementInfo.from_current_user().canonical_domain
email_branding = email_branding_client.get_email_branding_id_for_domain(domain)
try:
service_id = service_api_client.create_service(
service_name=service_name,
@@ -22,6 +21,7 @@ def _create_service(service_name, organisation_type, email_from, form):
restricted=True,
user_id=session['user_id'],
email_from=email_from,
service_domain=domain
)
session['service_id'] = service_id

View File

@@ -13,6 +13,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
restricted,
user_id,
email_from,
service_domain,
):
"""
Create a service and return the json.
@@ -24,7 +25,8 @@ class ServiceAPIClient(NotifyAdminAPIClient):
"message_limit": message_limit,
"user_id": user_id,
"restricted": restricted,
"email_from": email_from
"email_from": email_from,
"service_domain": service_domain
}
data = _attach_current_user(data)
return self.post("/service", data)['data']['id']