diff --git a/app/v2/notifications/create_response.py b/app/v2/notifications/create_response.py index 6c9532c44..fea4d2117 100644 --- a/app/v2/notifications/create_response.py +++ b/app/v2/notifications/create_response.py @@ -36,20 +36,6 @@ def create_post_email_response_from_notification( return resp -def create_post_letter_response_from_notification( - notification_id, client_reference, template_id, template_version, service_id, - content, subject, url_root -): - resp = __create_notification_response( - notification_id, client_reference, template_id, template_version, service_id, url_root - ) - resp['content'] = { - "body": content, - "subject": subject - } - return resp - - def __create_notification_response( notification_id, client_reference, template_id, template_version, service_id, url_root ): diff --git a/app/v2/notifications/notification_schemas.py b/app/v2/notifications/notification_schemas.py index 911ddff01..bf4aca221 100644 --- a/app/v2/notifications/notification_schemas.py +++ b/app/v2/notifications/notification_schemas.py @@ -1,6 +1,4 @@ from app.models import ( - NOTIFICATION_STATUS_LETTER_ACCEPTED, - NOTIFICATION_STATUS_LETTER_RECEIVED, NOTIFICATION_STATUS_TYPES, NOTIFICATION_TYPES, ) @@ -48,7 +46,7 @@ get_notification_response = { "line_5": {"type": ["string", "null"]}, "line_6": {"type": ["string", "null"]}, "postcode": {"type": ["string", "null"]}, - "type": {"enum": ["sms", "letter", "email"]}, + "type": {"enum": ["sms", "email"]}, "status": {"type": "string"}, "template": template, "body": {"type": "string"}, @@ -75,8 +73,7 @@ get_notifications_request = { "status": { "type": "array", "items": { - "enum": NOTIFICATION_STATUS_TYPES + - [NOTIFICATION_STATUS_LETTER_ACCEPTED + ', ' + NOTIFICATION_STATUS_LETTER_RECEIVED] + "enum": NOTIFICATION_STATUS_TYPES } }, "template_type": { @@ -216,46 +213,3 @@ post_email_response = { }, "required": ["id", "content", "uri", "template"] } - -post_letter_request = { - "$schema": "http://json-schema.org/draft-07/schema#", - "description": "POST letter notification schema", - "type": "object", - "title": "POST v2/notifications/letter", - "properties": { - "reference": {"type": "string"}, - "template_id": uuid, - "personalisation": personalisation - }, - "required": ["template_id", "personalisation"], - "additionalProperties": False -} - -letter_content = { - "$schema": "http://json-schema.org/draft-07/schema#", - "description": "Letter content for POST letter notification", - "type": "object", - "title": "notification letter content", - "properties": { - "body": {"type": "string"}, - "subject": {"type": "string"} - }, - "required": ["body", "subject"] -} - -post_letter_response = { - "$schema": "http://json-schema.org/draft-07/schema#", - "description": "POST sms notification response schema", - "type": "object", - "title": "response v2/notifications/letter", - "properties": { - "id": uuid, - "reference": {"type": ["string", "null"]}, - "content": letter_content, - "uri": {"type": "string", "format": "uri"}, - "template": template, - # letters cannot be scheduled - "scheduled_for": {"type": "null"} - }, - "required": ["id", "content", "uri", "template"] -} diff --git a/tests/app/v2/notifications/test_get_notifications.py b/tests/app/v2/notifications/test_get_notifications.py index 6b792699c..d48524e8a 100644 --- a/tests/app/v2/notifications/test_get_notifications.py +++ b/tests/app/v2/notifications/test_get_notifications.py @@ -382,7 +382,7 @@ def test_get_all_notifications_filter_by_status_invalid_status(client, sample_no assert len(json_response['errors']) == 1 assert json_response['errors'][0]['message'] == "status elephant is not one of [cancelled, created, sending, " \ "sent, delivered, pending, failed, technical-failure, temporary-failure, permanent-failure, " \ - "pending-virus-check, validation-failed, virus-scan-failed, returned-letter, accepted, received]" + "pending-virus-check, validation-failed, virus-scan-failed, returned-letter]" def test_get_all_notifications_filter_by_multiple_statuses(client, sample_template): diff --git a/tests/app/v2/notifications/test_notification_schemas.py b/tests/app/v2/notifications/test_notification_schemas.py index 8abe09dc4..e78000e73 100644 --- a/tests/app/v2/notifications/test_notification_schemas.py +++ b/tests/app/v2/notifications/test_notification_schemas.py @@ -45,7 +45,7 @@ def test_get_notifications_request_invalid_statuses( partial_error_status = "is not one of " \ "[cancelled, created, sending, sent, delivered, pending, failed, " \ "technical-failure, temporary-failure, permanent-failure, pending-virus-check, " \ - "validation-failed, virus-scan-failed, returned-letter, accepted, received]" + "validation-failed, virus-scan-failed, returned-letter]" with pytest.raises(ValidationError) as e: validate({'status': invalid_statuses + valid_statuses}, get_notifications_request) @@ -93,7 +93,7 @@ def test_get_notifications_request_invalid_statuses_and_template_types(): for invalid_status in ["elephant", "giraffe"]: assert "status {} is not one of [cancelled, created, sending, sent, delivered, " \ "pending, failed, technical-failure, temporary-failure, permanent-failure, " \ - "pending-virus-check, validation-failed, virus-scan-failed, returned-letter, accepted, received]".format( + "pending-virus-check, validation-failed, virus-scan-failed, returned-letter]".format( invalid_status ) in error_messages