Fix trial mode allowance bug

This commit is contained in:
Andrew Shumway
2024-02-07 14:43:39 -07:00
parent 53c193587d
commit 5a440863af
3 changed files with 12 additions and 0 deletions

View File

@@ -322,6 +322,14 @@ def get_dashboard_partials(service_id):
free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year(
current_service.id,
)
# These 2 calls will update the dashboard sms allowance count while in trial mode.
billing_api_client.get_monthly_usage_for_service(
service_id, get_current_financial_year()
)
billing_api_client.create_or_update_free_sms_fragment_limit(
service_id, free_sms_fragment_limit=free_sms_allowance
)
yearly_usage = billing_api_client.get_annual_usage_for_service(
service_id,
get_current_financial_year(),

View File

@@ -1386,7 +1386,9 @@ def test_route_for_service_permissions(
mock_has_no_jobs,
mock_get_template_statistics,
mock_get_service_statistics,
mock_get_monthly_usage_for_service,
mock_get_annual_usage_for_service,
mock_create_or_update_free_sms_fragment_limit,
mock_get_free_sms_fragment_limit,
mock_get_inbound_sms_summary,
):

View File

@@ -2327,6 +2327,8 @@ def client_request(logged_in_client, mocker, service_one): # noqa (C901 too com
"app.billing_api_client.create_or_update_free_sms_fragment_limit", autospec=True
)
mocker.patch("app.billing_api_client.get_monthly_usage_for_service", autospec=True)
class ClientRequest:
@staticmethod
@contextmanager