Merge pull request #3826 from alphagov/add-new-rates-for-2021-financial-year

Add new free allowance rates for 2021 financial year
This commit is contained in:
Chris Hill-Scott
2021-03-10 14:41:58 +00:00
committed by GitHub
5 changed files with 86 additions and 19 deletions

View File

@@ -33,14 +33,38 @@ class Config(object):
AWS_REGION = 'eu-west-1'
DEFAULT_SERVICE_LIMIT = 50
DEFAULT_FREE_SMS_FRAGMENT_LIMITS = {
'central': 250000,
'local': 25000,
'nhs_central': 250000,
'nhs_local': 25000,
'nhs_gp': 25000,
'emergency_service': 25000,
'school_or_college': 25000,
'other': 25000,
'central': {
2020: 250_000,
2021: 150_000,
},
'local': {
2020: 25_000,
2021: 25_000,
},
'nhs_central': {
2020: 250_000,
2021: 150_000,
},
'nhs_local': {
2020: 25_000,
2021: 25_000,
},
'nhs_gp': {
2020: 25_000,
2021: 10_000,
},
'emergency_service': {
2020: 25_000,
2021: 25_000,
},
'school_or_college': {
2020: 25_000,
2021: 10_000,
},
'other': {
2020: 25_000,
2021: 10_000,
},
}
EMAIL_EXPIRY_SECONDS = 3600 # 1 hour
INVITATION_EXPIRY_SECONDS = 3600 * 24 * 2 # 2 days - also set on api

View File

@@ -6,11 +6,21 @@ from app import billing_api_client, service_api_client
from app.formatters import email_safe
from app.main import main
from app.main.forms import CreateNhsServiceForm, CreateServiceForm
from app.utils import user_is_gov_user, user_is_logged_in
from app.utils import (
get_current_financial_year,
user_is_gov_user,
user_is_logged_in,
)
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)
free_sms_fragment_limit = current_app.config[
'DEFAULT_FREE_SMS_FRAGMENT_LIMITS'
][
organisation_type
][
get_current_financial_year()
]
try:
service_id = service_api_client.create_service(

View File

@@ -334,7 +334,9 @@ def get_template(
def get_current_financial_year():
now = datetime.utcnow()
now = utc_string_to_aware_gmt_datetime(
datetime.utcnow()
)
current_month = int(now.strftime('%-m'))
current_year = int(now.strftime('%Y'))
return current_year if current_month > 3 else current_year - 1