Check for invalid chars in letter addresses when sending through the API

This uses the new method in notifications-utils to validate for invalid
characters in address blocks.
This commit is contained in:
Katie Smith
2020-07-28 14:43:31 +01:00
parent 4931fc396c
commit c9f663fe76
2 changed files with 41 additions and 19 deletions

View File

@@ -409,6 +409,10 @@ def validate_address(service, letter_data):
raise ValidationError(
message='Must be a real UK postcode'
)
if address.has_invalid_characters:
raise ValidationError(
message='Address lines must not start with any of the following characters: @ ( ) = [ ] ” \\ / ,'
)
def process_precompiled_letter_notifications(*, letter_data, api_key, service, template, reply_to_text):