Stop trying to infer branding when adding services

The API handles this now.
This commit is contained in:
Chris Hill-Scott
2019-04-04 11:15:42 +01:00
parent 72f49a9a1e
commit 98249158cb
3 changed files with 6 additions and 61 deletions

View File

@@ -2,17 +2,15 @@ from flask import current_app, redirect, render_template, session, url_for
from flask_login import login_required
from notifications_python_client.errors import HTTPError
from app import billing_api_client, email_branding_client, service_api_client
from app import billing_api_client, service_api_client
from app.main import main
from app.main.forms import CreateServiceForm
from app.utils import AgreementInfo, email_safe, user_is_gov_user
from app.utils import 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)
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,
@@ -21,13 +19,9 @@ 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
if email_branding:
service_api_client.update_service(service_id, email_branding=email_branding)
billing_api_client.create_or_update_free_sms_fragment_limit(service_id, free_sms_fragment_limit)
return service_id, None