Skip to content
Open
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/backend/src/couchers/email/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,10 @@ def get_body_blocks(self, loc_context: LocalizationContext) -> list[EmailBlock]:
match self.reason:
case notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE_OR_GENDER:
reason_string_key = ".reason_wrong_birthdate_or_gender"
case notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE:
reason_string_key = ".reason_wrong_birthdate"
case notification_data_pb2.SV_FAIL_REASON_WRONG_GENDER:
reason_string_key = ".reason_wrong_gender"
case notification_data_pb2.SV_FAIL_REASON_NOT_A_PASSPORT:
reason_string_key = ".reason_not_a_passport"
case notification_data_pb2.SV_FAIL_REASON_DUPLICATE:
Expand All @@ -1951,6 +1955,8 @@ def test_instances(cls) -> list[Self]:
)
return [
replace(prototype, reason=notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE_OR_GENDER),
replace(prototype, reason=notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE),
replace(prototype, reason=notification_data_pb2.SV_FAIL_REASON_WRONG_GENDER),
replace(prototype, reason=notification_data_pb2.SV_FAIL_REASON_NOT_A_PASSPORT),
replace(prototype, reason=notification_data_pb2.SV_FAIL_REASON_DUPLICATE),
]
Expand Down
2 changes: 2 additions & 0 deletions app/backend/src/couchers/email/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@
"failed": {
"subject": "Strong Verification failed",
"reason_wrong_birthdate_or_gender": "The date of birth or gender on your profile does not match the date of birth or sex on your passport. Please contact the support team to update your date of birth or gender, or if your passport sex does not match your gender identity.",
"reason_wrong_birthdate": "The date of birth on your profile does not match the date of birth on your passport. Please contact the support team to update your date of birth.",
"reason_wrong_gender": "The gender on your profile does not match the sex on your passport. Please contact the support team to update your gender, or if your passport sex does not match your gender identity.",
"reason_not_a_passport": "You tried to verify with a document that is not a passport. You can only use a passport for Strong Verification.",
"reason_duplicate": "You tried to verify with a passport that has already been used for verification. Please use another passport."
}
Expand Down
12 changes: 9 additions & 3 deletions app/backend/src/couchers/jobs/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,14 +1011,20 @@ def finalize_strong_verification(payload: jobs_pb2.FinalizeStrongVerificationPay
key="",
)
else:
birthdate_ok = verification_attempt.matches_birthdate(user)
gender_ok = verification_attempt.matches_gender(user)
if not birthdate_ok and not gender_ok:
reason = notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE_OR_GENDER
elif not birthdate_ok:
reason = notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE
else:
reason = notification_data_pb2.SV_FAIL_REASON_WRONG_GENDER
notify(
session,
user_id=verification_attempt.user_id,
topic_action=NotificationTopicAction.verification__sv_fail,
key="",
data=notification_data_pb2.VerificationSVFail(
reason=notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE_OR_GENDER
),
data=notification_data_pb2.VerificationSVFail(reason=reason),
)


Expand Down
2 changes: 2 additions & 0 deletions app/backend/src/couchers/notifications/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@
"title": "Strong Verification failed",
"ios_title": "Strong Verification Failed",
"body_wrong_birthdate_gender": "The date of birth or gender on your profile does not match the date of birth or sex on your passport. Please contact the support team to update your date of birth or gender, or if your passport sex does not match your gender identity.",
"body_wrong_birthdate": "The date of birth on your profile does not match the date of birth on your passport. Please contact the support team to update your date of birth.",
"body_wrong_gender": "The gender on your profile does not match the sex on your passport. Please contact the support team to update your gender, or if your passport sex does not match your gender identity.",
"body_not_a_passport": "You used a document other than a passport. You can only use a passport for Strong Verification.",
"body_duplicate": "You used a passport that has already been used for verification. Please use another passport."
}
Expand Down
4 changes: 4 additions & 0 deletions app/backend/src/couchers/notifications/render_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,10 @@ def _render_verification__sv_fail(
match data.reason:
case notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE_OR_GENDER:
body_key = "body_wrong_birthdate_gender"
case notification_data_pb2.SV_FAIL_REASON_WRONG_BIRTHDATE:
body_key = "body_wrong_birthdate"
case notification_data_pb2.SV_FAIL_REASON_WRONG_GENDER:
body_key = "body_wrong_gender"
case notification_data_pb2.SV_FAIL_REASON_NOT_A_PASSPORT:
body_key = "body_not_a_passport"
case notification_data_pb2.SV_FAIL_REASON_DUPLICATE:
Expand Down
1 change: 1 addition & 0 deletions app/backend/src/couchers/servicers/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ def GetStrongVerificationAttemptStatus(
StrongVerificationAttemptStatus.in_progress_waiting_on_user_in_app: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_IN_PROGRESS_WAITING_ON_USER_IN_APP,
StrongVerificationAttemptStatus.in_progress_waiting_on_backend: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_IN_PROGRESS_WAITING_ON_BACKEND,
StrongVerificationAttemptStatus.failed: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_FAILED,
StrongVerificationAttemptStatus.duplicate: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_FAILED,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API was returning UNKNOWN as the status in this case. In the test I expected FAILED. It seemed like an oversight?

The semantics are not super clear as to whether it's querying that the verification attempt succeeded (they provided a legit passport), in which case this api should return SUCCESS, or that it resulted in obtaining a strong verification, in this case it makes sense to return FAILED.

}
return account_pb2.GetStrongVerificationAttemptStatusRes(
status=status_to_pb.get(
Expand Down
Loading
Loading