update free sms fragment limit to go via billing client instead of service

This commit is contained in:
Leo Hemsted
2017-12-04 16:03:11 +00:00
parent 109832b090
commit eb3d4acb45
6 changed files with 9 additions and 25 deletions

View File

@@ -20,7 +20,8 @@ from app.notify_client.models import InvitedUser
from app import (
invite_api_client,
user_api_client,
service_api_client
service_api_client,
billing_api_client
)
from app.utils import (
@@ -46,15 +47,13 @@ def _create_service(service_name, organisation_type, email_from, form):
service_name=service_name,
organisation_type=organisation_type,
message_limit=current_app.config['DEFAULT_SERVICE_LIMIT'],
free_sms_fragment_limit=free_sms_fragment_limit,
restricted=True,
user_id=session['user_id'],
email_from=email_from,
)
session['service_id'] = service_id
# TODO: Comment out until data migration
# billing_api_client.create_or_update_free_sms_fragment_limit(service_id, free_sms_fragment_limit)
billing_api_client.create_or_update_free_sms_fragment_limit(service_id, free_sms_fragment_limit)
return service_id, None
except HTTPError as e:

View File

@@ -732,14 +732,7 @@ def set_free_sms_allowance(service_id):
form = FreeSMSAllowance(free_sms_allowance=billing_api_client.get_free_sms_fragment_limit_for_year(service_id))
if form.validate_on_submit():
service_api_client.update_service(
service_id,
# TODO: Retire this eventually after using annual_billing
free_sms_fragment_limit=form.free_sms_allowance.data,
)
# TODO: Comment out until data migration
# billing_api_client.create_or_update_free_sms_fragment_limit(service_id, form.free_sms_allowance.data)
billing_api_client.create_or_update_free_sms_fragment_limit(service_id, form.free_sms_allowance.data)
return redirect(url_for('.service_settings', service_id=service_id))