Merge branch 'master' into sms_sender_id-for-post-notfications

This commit is contained in:
Rebecca Law
2017-10-30 15:20:39 +00:00
14 changed files with 426 additions and 29 deletions

View File

@@ -73,7 +73,8 @@ from app.errors import (
InvalidRequest,
register_errors
)
from app.models import Service, ServiceInboundApi
from app.models import Service, ServiceInboundApi, AnnualBilling
from app.schema_validation import validate
from app.service import statistics
from app.service.service_inbound_api_schema import (
@@ -168,8 +169,6 @@ def create_service():
raise InvalidRequest(errors, status_code=400)
# TODO: to be removed when front-end is updated
if 'free_sms_fragment_limit' not in data:
data['free_sms_fragment_limit'] = current_app.config['FREE_SMS_TIER_FRAGMENT_COUNT']
# validate json with marshmallow
service_schema.load(request.get_json())

View File

@@ -6,6 +6,8 @@ from app.models import (
KEY_TYPE_TEST, KEY_TYPE_TEAM, KEY_TYPE_NORMAL)
from notifications_utils.recipients import allowed_to_send_to
from app.dao.notifications_dao import get_financial_year
from datetime import datetime
def get_recipients_from_request(request_json, key, type):
@@ -51,3 +53,12 @@ def service_allowed_to_send_to(recipient, service, key_type):
whitelist_members
)
)
def get_current_financial_year_start_year():
now = datetime.now()
financial_year_start = now.year
start_date, end_date = get_financial_year(now.year)
if now < start_date:
financial_year_start = financial_year_start - 1
return financial_year_start