Skip to content

Commit

Permalink
Merge pull request #49 from edx/bseverino/idv-signal
Browse files Browse the repository at this point in the history
[MST-1025] Update IDV signal handler field names
  • Loading branch information
bseverino authored Sep 8, 2021
2 parents eecdabe + 946b1f3 commit fc79b6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[0.9.2] - 2021-09-07
~~~~~~~~~~~~~~~~~~~~
* Update IDV signal handler field names to be more explicit about the received names.

[0.9.1] - 2021-09-07
~~~~~~~~~~~~~~~~~~~~
* Add extra validation for the VerifiedName serializer, throwing a 400 error if
Expand Down
2 changes: 1 addition & 1 deletion edx_name_affirmation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Django app housing name affirmation logic.
"""

__version__ = '0.9.1'
__version__ = '0.9.2'

default_app_config = 'edx_name_affirmation.apps.EdxNameAffirmationConfig' # pylint: disable=invalid-name
12 changes: 6 additions & 6 deletions edx_name_affirmation/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ def verified_name_approved(sender, instance, **kwargs): # pylint: disable=unuse
)


def idv_attempt_handler(attempt_id, user_id, status, full_name, profile_name, **kwargs):
def idv_attempt_handler(attempt_id, user_id, status, photo_id_name, full_name, **kwargs):
"""
Receiver for IDV attempt updates
Args:
attempt_id(int): ID associated with the IDV attempt
user_id(int): ID associated with the IDV attempt's user
status(str): status in IDV language for the IDV attempt
full_name(str): name to be used as verified name
profile_name(str): user's current profile name
photo_id_name(str): name to be used as verified name
full_name(str): user's pending name change or current profile name
"""
if not is_verified_name_enabled():
return

trigger_status = VerifiedNameStatus.trigger_state_change_from_idv(status)
verified_names = VerifiedName.objects.filter(user__id=user_id, verified_name=full_name).order_by('-created')
verified_names = VerifiedName.objects.filter(user__id=user_id, verified_name=photo_id_name).order_by('-created')
if verified_names:
# if there are VerifiedName objects, we want to update existing entries
# for each attempt with no attempt id (either proctoring or idv), update attempt id
Expand Down Expand Up @@ -89,8 +89,8 @@ def idv_attempt_handler(attempt_id, user_id, status, full_name, profile_name, **
user = User.objects.get(id=user_id)
verified_name = VerifiedName.objects.create(
user=user,
verified_name=full_name,
profile_name=profile_name,
verified_name=photo_id_name,
profile_name=full_name,
verification_attempt_id=attempt_id,
status=(trigger_status if trigger_status else VerifiedNameStatus.PENDING),
)
Expand Down

0 comments on commit fc79b6c

Please sign in to comment.