diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 0e1c89243..1ae1db7b5 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -105,6 +105,13 @@ def send_sms_to_provider(notification): # The future home of the validation is TBD _experimentally_validate_phone_numbers(recipient) + # We need to handle the case where people ignored the "1" country code for US + # East Timor (670) has ten digit numbers including code so requires special handling + recipient = str(recipient) + if len(recipient) == 10 and not recipient.startswith("670"): + if os.getenv("NOTIFY_ENVIRONMENT") not in ["test"]: + recipient = f"1{recipient}" + sender_numbers = get_sender_numbers(notification) if notification.reply_to_text not in sender_numbers: raise ValueError( diff --git a/poetry.lock b/poetry.lock index 1e7e0204e..6f6eefd7a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1424,20 +1424,20 @@ typing = ["typing-extensions (>=4.12.2) ; python_version < \"3.11\""] [[package]] name = "flake8" -version = "7.1.1" +version = "7.2.0" description = "the modular source code checker: pep8 pyflakes and co" optional = false -python-versions = ">=3.8.1" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "flake8-7.1.1-py2.py3-none-any.whl", hash = "sha256:597477df7860daa5aa0fdd84bf5208a043ab96b8e96ab708770ae0364dd03213"}, - {file = "flake8-7.1.1.tar.gz", hash = "sha256:049d058491e228e03e67b390f311bbf88fce2dbaa8fa673e7aea87b7198b8d38"}, + {file = "flake8-7.2.0-py2.py3-none-any.whl", hash = "sha256:93b92ba5bdb60754a6da14fa3b93a9361fd00a59632ada61fd7b130436c40343"}, + {file = "flake8-7.2.0.tar.gz", hash = "sha256:fa558ae3f6f7dbf2b4f22663e5343b6b6023620461f8d4ff2019ef4b5ee70426"}, ] [package.dependencies] mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.12.0,<2.13.0" -pyflakes = ">=3.2.0,<3.3.0" +pycodestyle = ">=2.13.0,<2.14.0" +pyflakes = ">=3.3.0,<3.4.0" [[package]] name = "flake8-bugbear" @@ -3009,14 +3009,14 @@ test = ["pytest"] [[package]] name = "packaging" -version = "24.1" +version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" groups = ["main", "dev"] files = [ - {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, - {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] [[package]] @@ -3572,14 +3572,14 @@ files = [ [[package]] name = "pycodestyle" -version = "2.12.1" +version = "2.13.0" description = "Python style guide checker" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "pycodestyle-2.12.1-py2.py3-none-any.whl", hash = "sha256:46f0fb92069a7c28ab7bb558f05bfc0110dac69a0cd23c61ea0040283a9d78b3"}, - {file = "pycodestyle-2.12.1.tar.gz", hash = "sha256:6838eae08bbce4f6accd5d5572075c63626a15ee3e6f842df996bf62f6d73521"}, + {file = "pycodestyle-2.13.0-py2.py3-none-any.whl", hash = "sha256:35863c5974a271c7a726ed228a14a4f6daf49df369d8c50cd9a6f58a5e143ba9"}, + {file = "pycodestyle-2.13.0.tar.gz", hash = "sha256:c8415bf09abe81d9c7f872502a6eee881fbe85d8763dd5b9924bb0a01d67efae"}, ] [[package]] @@ -3596,14 +3596,14 @@ files = [ [[package]] name = "pyflakes" -version = "3.2.0" +version = "3.3.2" description = "passive checker of Python programs" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, - {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, + {file = "pyflakes-3.3.2-py2.py3-none-any.whl", hash = "sha256:5039c8339cbb1944045f4ee5466908906180f13cc99cc9949348d10f82a5c32a"}, + {file = "pyflakes-3.3.2.tar.gz", hash = "sha256:6dfd61d87b97fba5dcfaaf781171ac16be16453be6d816147989e7f6e6a9576b"}, ] [[package]] @@ -5199,4 +5199,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.1" python-versions = "^3.12.2" -content-hash = "577bb10233d08e2fab803cfcb0395103d1314d60d15ae19a49adccf57be743d9" +content-hash = "7271eb94d243b979aef076dc1b116cfe0d7566c4581ef4c1ac623d846542b518" diff --git a/pyproject.toml b/pyproject.toml index 15a6feba1..7862d9700 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ marshmallow-sqlalchemy = "==1.0.0" newrelic = "*" notifications-python-client = "==10.0.0" oscrypto = { git = "https://github.com/wbond/oscrypto.git", rev = "1547f53" } -packaging = "==24.1" +packaging = "==24.2" poetry-dotenv-plugin = "==0.2.0" psycopg2-binary = "==2.9.9" pyjwt = "==2.10.1" @@ -84,7 +84,7 @@ bandit = "*" black = "^25.1.0" cloudfoundry-client = "*" exceptiongroup = "==1.2.2" -flake8 = "^7.1.1" +flake8 = "^7.2.0" flake8-bugbear = "^24.1.17" freezegun = "^1.5.1" honcho = "*"