mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Revert "Merge pull request #2887 from alphagov/cache-the-serialised-things"
This reverts commitb8c2c6b291, reversing changes made to351aca2c5a.
This commit is contained in:
@@ -332,7 +332,7 @@ def process_letter_notification(
|
||||
if api_key.key_type == KEY_TYPE_TEAM:
|
||||
raise BadRequestError(message='Cannot send letters with a team api key', status_code=403)
|
||||
|
||||
if not service.research_mode and service.restricted and api_key.key_type != KEY_TYPE_TEST:
|
||||
if not api_key.service.research_mode and api_key.service.restricted and api_key.key_type != KEY_TYPE_TEST:
|
||||
raise BadRequestError(message='Cannot send letters when service is in trial mode', status_code=403)
|
||||
|
||||
if precompiled:
|
||||
@@ -342,7 +342,7 @@ def process_letter_notification(
|
||||
template=template,
|
||||
reply_to_text=reply_to_text)
|
||||
|
||||
validate_address(service, letter_data)
|
||||
validate_address(api_key, letter_data)
|
||||
|
||||
test_key = api_key.key_type == KEY_TYPE_TEST
|
||||
|
||||
@@ -391,10 +391,10 @@ def process_letter_notification(
|
||||
return resp
|
||||
|
||||
|
||||
def validate_address(service, letter_data):
|
||||
def validate_address(api_key, letter_data):
|
||||
address = PostalAddress.from_personalisation(
|
||||
letter_data['personalisation'],
|
||||
allow_international_letters=(INTERNATIONAL_LETTERS in service.permissions),
|
||||
allow_international_letters=api_key.service.has_permission(INTERNATIONAL_LETTERS),
|
||||
)
|
||||
if not address.has_enough_lines:
|
||||
raise ValidationError(
|
||||
|
||||
Reference in New Issue
Block a user