diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 1af8ed6dd..7b42732c3 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -1,5 +1,6 @@ from flask import ( abort, + current_app, flash, redirect, render_template, @@ -695,10 +696,15 @@ def set_organisation_type(service_id): form = OrganisationTypeForm(organisation_type=current_service.get('organisation_type')) if form.validate_on_submit(): + free_sms_fragment_limit = current_app.config['DEFAULT_FREE_SMS_FRAGMENT_LIMITS'].get( + form.organisation_type.data) + service_api_client.update_service( service_id, organisation_type=form.organisation_type.data, ) + billing_api_client.create_or_update_free_sms_fragment_limit(service_id, free_sms_fragment_limit) + return redirect(url_for('.service_settings', service_id=service_id)) return render_template( diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 8b5b11211..a360f06f7 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -1560,6 +1560,7 @@ def test_should_set_organisation_type( logged_in_platform_admin_client, mock_update_service, organisation_type, + mock_create_or_update_free_sms_fragment_limit ): response = logged_in_platform_admin_client.post( url_for(