Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
SMS_STATUS_FORMATTED = {
"failed": "Failed",
"technical-failure": "Tech issue",
"technical-failure-billable": "Tech issue - billable",
"temporary-failure": "Carrier issue",
"permanent-failure": "No such number",
"delivered": "Delivered",
Expand Down Expand Up @@ -1605,6 +1606,7 @@ def check_code(self, cde):
NOTIFICATION_PENDING = "pending"
NOTIFICATION_FAILED = "failed"
NOTIFICATION_TECHNICAL_FAILURE = "technical-failure"
NOTIFICATION_TECHNICAL_FAILURE_BILLABLE = "technical-failure-billable"
NOTIFICATION_TEMPORARY_FAILURE = "temporary-failure"
NOTIFICATION_PERMANENT_FAILURE = "permanent-failure"
NOTIFICATION_PROVIDER_FAILURE = "provider-failure"
Expand All @@ -1616,6 +1618,7 @@ def check_code(self, cde):

NOTIFICATION_STATUS_TYPES_FAILED = [
NOTIFICATION_TECHNICAL_FAILURE,
NOTIFICATION_TECHNICAL_FAILURE_BILLABLE,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_PERMANENT_FAILURE,
NOTIFICATION_PROVIDER_FAILURE,
Expand All @@ -1631,6 +1634,7 @@ def check_code(self, cde):
NOTIFICATION_DELIVERED,
NOTIFICATION_FAILED,
NOTIFICATION_TECHNICAL_FAILURE,
NOTIFICATION_TECHNICAL_FAILURE_BILLABLE,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_PERMANENT_FAILURE,
NOTIFICATION_RETURNED_LETTER,
Expand All @@ -1649,6 +1653,7 @@ def check_code(self, cde):
NOTIFICATION_SENDING,
NOTIFICATION_SENT,
NOTIFICATION_DELIVERED,
NOTIFICATION_TECHNICAL_FAILURE_BILLABLE,
NOTIFICATION_FAILED,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_PERMANENT_FAILURE,
Expand All @@ -1664,6 +1669,7 @@ def check_code(self, cde):
NOTIFICATION_PENDING,
NOTIFICATION_FAILED,
NOTIFICATION_TECHNICAL_FAILURE,
NOTIFICATION_TECHNICAL_FAILURE_BILLABLE,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_PERMANENT_FAILURE,
NOTIFICATION_PROVIDER_FAILURE,
Expand Down
19 changes: 19 additions & 0 deletions migrations/versions/0505_add_tech_fail_billable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Revision ID: 0505_add_tech_fail_billable
Revises: 0504_fix_template_link
Create Date: 2026-02-23 00:00:00

"""
from alembic import op

revision = "0505_add_tech_fail_billable"
down_revision = "0504_fix_template_link"

NOTIFICATION_TECHNICAL_FAILURE_BILLABLE = "technical-failure-billable"

def upgrade():
op.execute("INSERT INTO notification_status_types (name) VALUES ('{}')".format(NOTIFICATION_TECHNICAL_FAILURE_BILLABLE))


def downgrade():
op.execute("DELETE FROM notification_status_types where name = '{}'".format(NOTIFICATION_TECHNICAL_FAILURE_BILLABLE))
4 changes: 2 additions & 2 deletions tests/app/dao/test_ft_billing_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ def test_fetch_billing_data_for_day_bills_correctly_for_status(notify_db_session
sms_results = [x for x in results if x[2] == "sms"]
email_results = [x for x in results if x[2] == "email"]
letter_results = [x for x in results if x[2] == "letter"]
assert 7 == sms_results[0][7]
assert 7 == email_results[0][7]
assert 8 == sms_results[0][7]
assert 8 == email_results[0][7]
assert 3 == letter_results[0][7]


Expand Down
2 changes: 1 addition & 1 deletion tests/app/v2/notifications/test_get_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,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, provider-failure, "
"sent, delivered, pending, failed, technical-failure, technical-failure-billable, temporary-failure, permanent-failure, provider-failure, "
"pending-virus-check, validation-failed, virus-scan-failed, returned-letter, "
"pii-check-failed, accepted, received]"
)
Expand Down
4 changes: 2 additions & 2 deletions tests/app/v2/notifications/test_notification_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_get_notifications_request_invalid_statuses(invalid_statuses, valid_stat
partial_error_status = (
"is not one of "
"[cancelled, created, sending, sent, delivered, pending, failed, "
"technical-failure, temporary-failure, permanent-failure, provider-failure, pending-virus-check, "
"technical-failure, technical-failure-billable, temporary-failure, permanent-failure, provider-failure, pending-virus-check, "
"validation-failed, virus-scan-failed, returned-letter, pii-check-failed, accepted, received]"
)

Expand Down Expand Up @@ -103,7 +103,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, provider-failure, "
"pending, failed, technical-failure, technical-failure-billable, temporary-failure, permanent-failure, provider-failure, "
"pending-virus-check, validation-failed, virus-scan-failed, returned-letter, "
"pii-check-failed, accepted, received]".format(invalid_status)
in error_messages
Expand Down
Loading