Skip to content

Commit

Permalink
Send User Notification When Single IVA is Unverified (GSI-1004) (#14)
Browse files Browse the repository at this point in the history
* Send user IVA unverified notification

* Bump version from 2.0.1 -> 2.1.0

* Update lock files

* Update docstring and notification text

* Remove 'type' from IVA unverified user notification

* Rephrase to remove ambiguity
  • Loading branch information
TheByronHimes authored Sep 30, 2024
1 parent 7451b25 commit ba69185
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, dev, --branch, int, --branch, main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
rev: v0.6.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nos"
version = "2.0.1"
version = "2.1.0"
description = "The Notification Orchestration Service controls the creation of notification events."
dependencies = [
"typer >= 0.9.0",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ We recommend using the provided Docker container.

A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/notification-orchestration-service):
```bash
docker pull ghga/notification-orchestration-service:2.0.1
docker pull ghga/notification-orchestration-service:2.1.0
```

Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
```bash
# Execute in the repo's root dir:
docker build -t ghga/notification-orchestration-service:2.0.1 .
docker build -t ghga/notification-orchestration-service:2.1.0 .
```

For production-ready deployment, we recommend using Kubernetes, however,
for simple use cases, you could execute the service using docker
on a single server:
```bash
# The entrypoint is preconfigured:
docker run -p 8080:8080 ghga/notification-orchestration-service:2.0.1 --help
docker run -p 8080:8080 ghga/notification-orchestration-service:2.1.0 --help
```

If you prefer not to use containers, you may install the service from source:
Expand Down
211 changes: 110 additions & 101 deletions lock/requirements-dev.txt

Large diffs are not rendered by default.

135 changes: 72 additions & 63 deletions lock/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ annotated-types==0.7.0 \
# via
# -c lock/requirements-dev.txt
# pydantic
anyio==4.4.0 \
--hash=sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94 \
--hash=sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7
anyio==4.5.0 \
--hash=sha256:c5a275fe5ca0afd788001f58fca1e69e29ce706d746e317d660e21f70c530ef9 \
--hash=sha256:fdeb095b7cc5a5563175eedd926ec4ae55413bb4be5770c424af0ba46ccb4a78
# via
# -c lock/requirements-dev.txt
# httpx
Expand All @@ -60,15 +60,15 @@ attrs==24.2.0 \
# -c lock/requirements-dev.txt
# jsonschema
# referencing
boto3==1.35.21 \
--hash=sha256:247f88eedce9ae4e014a8fc14a9473759bb8e391460d49396a3b600fb649f33b \
--hash=sha256:db5fbbd10248db060f2ccce3ae17764f1641c99c8b9f51d422c26ebe25703a1e
boto3==1.35.23 \
--hash=sha256:3fbf1d5b749c92ed43aa190650979dff9f83790a42522e1e9eefa54c8e44bc4b \
--hash=sha256:ecba4362f82e23ef775c72b3e6fdef3ef68443629b79e88886d5088302ffc050
# via
# -c lock/requirements-dev.txt
# hexkit
botocore==1.35.21 \
--hash=sha256:3db9ddfe521edc0753fc8c68caef71c7806e1d2d21ce8cbabc2065b7d79192f2 \
--hash=sha256:db917e7d7b3a2eed1310c6496784bc813c91f020a021c2ab5f9df7d28cdb4f1d
botocore==1.35.23 \
--hash=sha256:25b17a9ccba6ad32bb5bf7ba4f52656aa03c1cb29f6b4e438050ee4ad1967a3b \
--hash=sha256:cab9ec4e0367b9f33f0bc02c5a29f587b0119ecffd6d125bacee085dcbc8817d
# via
# -c lock/requirements-dev.txt
# boto3
Expand Down Expand Up @@ -302,9 +302,9 @@ mdurl==0.1.2 \
# via
# -c lock/requirements-dev.txt
# markdown-it-py
motor==3.5.1 \
--hash=sha256:1622bd7b39c3e6375607c14736f6e1d498128eadf6f5f93f8786cf17d37062ac \
--hash=sha256:f95a9ea0f011464235e0bd72910baa291db3a6009e617ac27b82f57885abafb8
motor==3.6.0 \
--hash=sha256:0ef7f520213e852bf0eac306adf631aabe849227d8aec900a2612512fb9c5b8d \
--hash=sha256:9f07ed96f1754963d4386944e1b52d403a5350c687edc60da487d66f98dbf894
# via
# -c lock/requirements-dev.txt
# hexkit
Expand Down Expand Up @@ -429,57 +429,66 @@ pygments==2.18.0 \
# via
# -c lock/requirements-dev.txt
# rich
pymongo==4.8.0 \
--hash=sha256:0fc18b3a093f3db008c5fea0e980dbd3b743449eee29b5718bc2dc15ab5088bb \
--hash=sha256:16e5019f75f6827bb5354b6fef8dfc9d6c7446894a27346e03134d290eb9e758 \
--hash=sha256:180d5eb1dc28b62853e2f88017775c4500b07548ed28c0bd9c005c3d7bc52526 \
--hash=sha256:18c9d8f975dd7194c37193583fd7d1eb9aea0c21ee58955ecf35362239ff31ac \
--hash=sha256:236bbd7d0aef62e64caf4b24ca200f8c8670d1a6f5ea828c39eccdae423bc2b2 \
--hash=sha256:284d0717d1a7707744018b0b6ee7801b1b1ff044c42f7be7a01bb013de639470 \
--hash=sha256:2ecd71b9226bd1d49416dc9f999772038e56f415a713be51bf18d8676a0841c8 \
--hash=sha256:31e4d21201bdf15064cf47ce7b74722d3e1aea2597c6785882244a3bb58c7eab \
--hash=sha256:3b5802151fc2b51cd45492c80ed22b441d20090fb76d1fd53cd7760b340ff554 \
--hash=sha256:3c68fe128a171493018ca5c8020fc08675be130d012b7ab3efe9e22698c612a1 \
--hash=sha256:3ed1c316718a2836f7efc3d75b4b0ffdd47894090bc697de8385acd13c513a70 \
--hash=sha256:408b2f8fdbeca3c19e4156f28fff1ab11c3efb0407b60687162d49f68075e63c \
--hash=sha256:417369ce39af2b7c2a9c7152c1ed2393edfd1cbaf2a356ba31eb8bcbd5c98dd7 \
--hash=sha256:454f2295875744dc70f1881e4b2eb99cdad008a33574bc8aaf120530f66c0cde \
--hash=sha256:47ec8c3f0a7b2212dbc9be08d3bf17bc89abd211901093e3ef3f2adea7de7a69 \
--hash=sha256:4bf58e6825b93da63e499d1a58de7de563c31e575908d4e24876234ccb910eba \
--hash=sha256:519d1bab2b5e5218c64340b57d555d89c3f6c9d717cecbf826fb9d42415e7750 \
--hash=sha256:52b4108ac9469febba18cea50db972605cc43978bedaa9fea413378877560ef8 \
--hash=sha256:658d0170f27984e0d89c09fe5c42296613b711a3ffd847eb373b0dbb5b648d5f \
--hash=sha256:6b50040d9767197b77ed420ada29b3bf18a638f9552d80f2da817b7c4a4c9c68 \
--hash=sha256:7148419eedfea9ecb940961cfe465efaba90595568a1fb97585fb535ea63fe2b \
--hash=sha256:77f53429515d2b3e86dcc83dadecf7ff881e538c168d575f3688698a8707b80a \
--hash=sha256:87075a1feb1e602e539bdb1ef8f4324a3427eb0d64208c3182e677d2c0718b6f \
--hash=sha256:8b18c8324809539c79bd6544d00e0607e98ff833ca21953df001510ca25915d1 \
--hash=sha256:9097c331577cecf8034422956daaba7ec74c26f7b255d718c584faddd7fa2e3c \
--hash=sha256:920d4f8f157a71b3cb3f39bc09ce070693d6e9648fb0e30d00e2657d1dca4e49 \
--hash=sha256:9365166aa801c63dff1a3cb96e650be270da06e3464ab106727223123405510f \
--hash=sha256:940d456774b17814bac5ea7fc28188c7a1338d4a233efbb6ba01de957bded2e8 \
--hash=sha256:aec2b9088cdbceb87e6ca9c639d0ff9b9d083594dda5ca5d3c4f6774f4c81b33 \
--hash=sha256:af3e98dd9702b73e4e6fd780f6925352237f5dce8d99405ff1543f3771201704 \
--hash=sha256:b6564780cafd6abeea49759fe661792bd5a67e4f51bca62b88faab497ab5fe89 \
--hash=sha256:b747c0e257b9d3e6495a018309b9e0c93b7f0d65271d1d62e572747f4ffafc88 \
--hash=sha256:bf821bd3befb993a6db17229a2c60c1550e957de02a6ff4dd0af9476637b2e4d \
--hash=sha256:c6b804bb4f2d9dc389cc9e827d579fa327272cdb0629a99bfe5b83cb3e269ebf \
--hash=sha256:cc8b8582f4209c2459b04b049ac03c72c618e011d3caa5391ff86d1bda0cc486 \
--hash=sha256:cd39455b7ee70aabee46f7399b32ab38b86b236c069ae559e22be6b46b2bbfc4 \
--hash=sha256:d0cf61450feadca81deb1a1489cb1a3ae1e4266efd51adafecec0e503a8dcd84 \
--hash=sha256:d18d86bc9e103f4d3d4f18b85a0471c0e13ce5b79194e4a0389a224bb70edd53 \
--hash=sha256:d5428dbcd43d02f6306e1c3c95f692f68b284e6ee5390292242f509004c9e3a8 \
--hash=sha256:de3a860f037bb51f968de320baef85090ff0bbb42ec4f28ec6a5ddf88be61871 \
--hash=sha256:e0061af6e8c5e68b13f1ec9ad5251247726653c5af3c0bbdfbca6cf931e99216 \
--hash=sha256:e5df28f74002e37bcbdfdc5109799f670e4dfef0fb527c391ff84f078050e7b5 \
--hash=sha256:e6a720a3d22b54183352dc65f08cd1547204d263e0651b213a0a2e577e838526 \
--hash=sha256:e8400587d594761e5136a3423111f499574be5fd53cf0aefa0d0f05b180710b0 \
--hash=sha256:e84bc7707492f06fbc37a9f215374d2977d21b72e10a67f1b31893ec5a140ad8 \
--hash=sha256:ef7225755ed27bfdb18730c68f6cb023d06c28f2b734597480fb4c0e500feb6f \
--hash=sha256:f2b7bec27e047e84947fbd41c782f07c54c30c76d14f3b8bf0c89f7413fac67a \
--hash=sha256:f2fbdb87fe5075c8beb17a5c16348a1ea3c8b282a5cb72d173330be2fecf22f5 \
--hash=sha256:f5bf0eb8b6ef40fa22479f09375468c33bebb7fe49d14d9c96c8fd50355188b0 \
--hash=sha256:fdc20cd1e1141b04696ffcdb7c71e8a4a665db31fe72e51ec706b3bdd2d09f36
pymongo==4.9.1 \
--hash=sha256:0492ef43f3342354cf581712e431621c221f60c877ebded84e3f3e53b71bbbe0 \
--hash=sha256:08fbab69f3fb6f8088c81f4c4a8abd84a99c132034f5e27e47f894bbcb6bf439 \
--hash=sha256:16d2efe559d0d96bc0b74b3ff76701ad6f6e1a65f6581b573dcacc29158131c8 \
--hash=sha256:172d8ba0f567e351a18765db23dab7dbcfdffd91a8788d90d46b350f80a40781 \
--hash=sha256:1b4b961fce213f2bcdc92268f85111a3668c61b9b4d4e7ece27dce3a137cfcbd \
--hash=sha256:1d79f20f9c7cbc1c708fb80b648b6fbd3220fd3437a9bd6017c1eb592e03b361 \
--hash=sha256:1d7aa9cc2d92e73bdb036c578ba019da94ea165eb147e691cd910a6fab7ce3b7 \
--hash=sha256:1dfd2aa30174d36a3ef1dae4ee4c89710c2d65cac52ce6e13f17c710edbd61cf \
--hash=sha256:1fac1def9e9073f1c80198c99f0ec39c2528236c8912d96d7fd3b0237f4c523a \
--hash=sha256:286fb275267f0293364ba579f6354452599161f1902ad411061c7f744ab88328 \
--hash=sha256:34e4993ae78be56f9e27a141168a1ab78253576fa3e893fa335a719ce204c3ef \
--hash=sha256:375765ec81b1f0a26d08928afea0c3dff897c36080a090be53fc7b70cc51d497 \
--hash=sha256:3a846423c4535428f69a90a1451df3718bc59f0c4ab685b9e96d3071951e0be4 \
--hash=sha256:42c19d2b094cdd0ead7dbb38860bbe8268c140334ce55d8b39204ddb4ebd4904 \
--hash=sha256:4327c0d9bd616b8289691360f2d4a09a72fe35479795832eae0d4ff78af53923 \
--hash=sha256:432ad395d2233056b042ccc73234e7136aa65d944d6bd8b5138394bd38aaff79 \
--hash=sha256:47b4896544095d172c366dd4d4ea1da6b0ab1a77d8416897cc1801e2421b1e67 \
--hash=sha256:4cddb51cead9700c4dccc916952bc0321b8d766bf782d374bfa0e93ef47c1d20 \
--hash=sha256:4d1b959a3dda0775d9111622ee47ad47772aed3a9da2e7d5f2f513fa68175dea \
--hash=sha256:51dbc6251c6783dfcc7d657c346986d8bad7210989b2fe15de16db5204a8e7ae \
--hash=sha256:56877cfcdf7dfc5c6408e4551ec0d6d65ebbca4d744a0bc90400f09ef6bbcc8a \
--hash=sha256:679b8d55854da7c7fdb82aa5e092ab4de0144daf6758defed8ab00ff9ce05360 \
--hash=sha256:687cf70e096381bc65b4273a6a9319617618f7ace65caffc356e1099c4a68511 \
--hash=sha256:6bb3d5282278594753089dc7da48bfae4a7f337a2dd4d397eabb591c649e58d0 \
--hash=sha256:75d5974f874acdb2f125bdbe785045b23a39ecce1d3143dd5712800c7b6d25eb \
--hash=sha256:7f962d74201c772555f7a78792fed820a5ea76db5c7ee6cf43748e411b44e430 \
--hash=sha256:8089003a99127f917bdbeec177d41cef019cda8ec70534c1018cb60aacd23c2a \
--hash=sha256:8b632e01617f2608880f7b9926f54a5f5ebb51631996e0540fff7fc7980663c9 \
--hash=sha256:8f0d5258bc85a4e6b5bcae8160628168e71ec4625a58ceb53327c3280a0b6914 \
--hash=sha256:91b1a92214c3912af5467f77c2f6435cd76f6de64c70cba7bb4ee43eba7f459e \
--hash=sha256:95418e334629440f70fe5ceeefc6cbbd50defb566901c8d68179ffbaec8d5f01 \
--hash=sha256:96462fb2175f740701d229f52018ea6e4adc4148c4112e6628bb359dd534a3df \
--hash=sha256:99b611ff75b5d9e17183dcf9584a7b04f9db07e51a162f23ea05e485e0735c0a \
--hash=sha256:9d78adf25967c06298c7e488f4cfab79a390fc32c2b1d428613976f99031603d \
--hash=sha256:9fbe9fad27619ac4cfda5df0ade26a99906da7dfe7b01deddc25997eb1804e4c \
--hash=sha256:a0b10cf51ec14a487c94709d294c00e1fb6a0a4c38cdc3acfb2ced5ef60972a0 \
--hash=sha256:a2b12c74cfd90147babb77f9728646bcedfdbd2bd2a5b4130a00e3a0af1a3d34 \
--hash=sha256:a40ea8bc9cffb61c5c9c426c430d22235e085e610ee81ae075ddf51f12f76236 \
--hash=sha256:a7689da1d1b444284e4ea9ab2eb64a15307b6b795918c0f3cd7774dd1d8a7556 \
--hash=sha256:aa4493f304b33c5d2ecee3055c98889ac6724d56f5f922d47420a45d0d4099c9 \
--hash=sha256:b23211c031b45d0f32de83ab7d77f9c26f1025c2d2c91463a5d8594a16103655 \
--hash=sha256:b347052d510989d1f52b8553b31297f21cf74bd9f6aed71ee84e563492f4ff17 \
--hash=sha256:b4c793db8457c856f333f396798470b9bfe405e17c307d581532c74cec70150c \
--hash=sha256:b7f2d34390acf60e229c30037d1473fcf69f4536cd7f48f6f78c0c931c61c505 \
--hash=sha256:c4204fad54830a3173a5c939cd052d0561fba03dba7e0ff6852fd631f3314aa4 \
--hash=sha256:d476d91a5c9e6c37bc8ec3fb294e1c01d95736ccf01a59bb1540fe2f710f826e \
--hash=sha256:db5b299e11284f8d82ce2983d8e19fcc28f98f902a179709ef1982b4cca6f8b8 \
--hash=sha256:dc3d070d746ab79e9b393a5c236df20e56607389af2b79bf1bfe9a841117558e \
--hash=sha256:dd3352eaf578f8e9bdea7a5692910eedad1e8680f60726fc70e99c8af51a5449 \
--hash=sha256:e02b03e3815b80a63e773e4c32aed3cf5633d406f376477be74550295c211256 \
--hash=sha256:e1f346811d4a2369f88ab7a6f886fa9c3bbc9ed4e4f4a3becca8717a73d465cb \
--hash=sha256:e3645aff8419ca60f9ccd08966b2f6b0d78053f9f98a814d025426f1d874c19a \
--hash=sha256:ea3f0196e7c311b9944a609ac175bd91ab97952164a1246716fdd38d53ca3bcc \
--hash=sha256:f05e34d401be871d7c87cb10727d49315444e4ded07ff876a595e4c23b7436da \
--hash=sha256:f23a046531030318622414f21198e232cf93c5640da9a80b45596a059c8cc090 \
--hash=sha256:f838f613e74b4dad8ace0d90f42346005bece4eda5bf6d389cfadb8322d39316 \
--hash=sha256:f8e8b8deba6a4bff3dd5421071083219521c74d2acae0322de5c06f1a66c56af \
--hash=sha256:fbb1c7dfcf6c44e9e1928290631c7603817991cdf570691c9e15fca594918435 \
--hash=sha256:fe709d05654c12fc513617c8d5c8d05b7e9cf1d5d94ada68add4e89530c867d2
# via
# -c lock/requirements-dev.txt
# motor
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
"Intended Audience :: Developers",
]
name = "nos"
version = "2.0.1"
version = "2.1.0"
description = "The Notification Orchestration Service controls the creation of notification events."
dependencies = [
"typer >= 0.9.0",
Expand Down
11 changes: 11 additions & 0 deletions src/nos/core/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ def formatted(self, **kwargs) -> "Notification":
""",
)

IVA_UNVERIFIED_TO_USER = Notification(
"Contact Address Invalidation",
"""
One of your contact addresses has been invalidated due to failed verification.
To see each of your current contact addresses alongside its verification status, please visit your account page.
If you have any questions, please contact the GHGA Helpdesk: {helpdesk_email}
""",
)

IVA_UNVERIFIED_TO_DS = Notification(
"IVA Unverified",
"""
Expand Down
13 changes: 12 additions & 1 deletion src/nos/core/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,19 @@ async def _iva_unverified(
):
"""Send notifications for IVAs set to 'unverified'.
This happens when the user exceeds the allotted time to submit their IVA code.
This usually happens when the user exceeds the allotted time to submit their IVA
code or exhausts all the allotted verification attempts.
"""
# send a notification to the user
await self._notification_emitter.notify(
email=user.email,
full_name=user.name,
notification=notifications.IVA_UNVERIFIED_TO_USER.formatted(
helpdesk_email=self._config.helpdesk_email
),
)

# send a notification to the data steward
await self._notification_emitter.notify(
email=self._config.central_data_stewardship_email,
full_name=DATA_STEWARD_NAME,
Expand Down
6 changes: 4 additions & 2 deletions tests/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ async def test_file_registered(joint_fixture: JointFixture):
),
(
event_schemas.IvaState.UNVERIFIED,
None,
notifications.IVA_UNVERIFIED_TO_USER,
notifications.IVA_UNVERIFIED_TO_DS,
),
],
Expand Down Expand Up @@ -348,7 +348,9 @@ async def test_iva_state_change(
recipient_email=TEST_USER.email,
subject=expected_user_notification.subject,
recipient_name=TEST_USER.name,
plaintext_body=expected_user_notification.text,
plaintext_body=expected_user_notification.text.format(
helpdesk_email=joint_fixture.config.helpdesk_email,
),
)
if expected_user_notification
else None
Expand Down

0 comments on commit ba69185

Please sign in to comment.