Skip to content

Commit

Permalink
feat: Add IDV attempt events
Browse files Browse the repository at this point in the history
  • Loading branch information
ilee2u committed Aug 22, 2024
1 parent 0e47ee1 commit 6237850
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs/decisions/0016
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
16. Event definitions for ID Verification
#########################################

NOTE: This decision doc is still a work in progress.

Status
******

**Draft** 2024-08-19

Context
*******

IDV Change:
===========
* We're changing it b/c software secure no longer supports IDV

The IDV Vendor:
===============
* Persona


Decision
********

Where these events will be produced/consumed:
=============================================

* `persona-integration` will produce these events.
<!-- TODO: Is this line below correct? -->
* NOTE: There is no plan to have the legacy backend in `edx-platform`, produce these events.
<!-- This is based off the special exam decision doc, lmk if this is wrong -->
* `edx-platform` will consume these events in order to handle all behavior as it pertains to the state of an ID Verification.

Event Definitions:
==================
<!-- NOTE: do we have to do this? -->
* We will define the events that as planned in `the ADR for events in persona_integration <insert url here>`_.

Consequences
************

* `persona_integration` will emit events via the event bus to send information without needing a response.
* These events are dynamic, in that they can also be consumed by other services/applications as needed in the future.

16 changes: 16 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,19 @@ class BadgeData:
uuid = attr.ib(type=str)
user = attr.ib(type=UserData)
template = attr.ib(type=BadgeTemplateData)


@attr.s(frozen=True)
class VerificationAttemptData:
"""
Attributes defined for the persona-integration IDV attempt data object.
Arguments:
asdf (type): description
"""

user = attr.ib(type=UserData)
name = attr.ib(type=str)
status = attr.ib(type=str)
expiration_date = attr.ib(type=datetime)
inquiry_id = attr.ib(type=str)
49 changes: 49 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ProgramCertificateData,
UserData,
UserNotificationData,
VerificationAttemptData,
XBlockSkillVerificationData,
)
from openedx_events.tooling import OpenEdxPublicSignal
Expand Down Expand Up @@ -401,3 +402,51 @@
"badge": BadgeData,
}
)


# .. event_type: org.openedx.learning.idv_attempt.created.v1
# .. event_name: IDV_ATTEMPT_CREATED
# .. event_description: Emitted when a IDV attempt is created by an IDV vendor
# .. event_data: VerificationAttemptData
IDV_ATTEMPT_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.learning.idv_attempt.created.v1",
data={
"idv_attempt": VerificationAttemptData,
}
)


# .. event_type: org.openedx.learning.idv_attempt.pending.v1
# .. event_name: IDV_ATTEMPT_PENDING
# .. event_description: Emitted when a IDV attempt is marked as pending by an IDV vendor
# .. event_data: VerificationAttemptData
IDV_ATTEMPT_PENDING = OpenEdxPublicSignal(
event_type="org.openedx.learning.idv_attempt.pending.v1",
data={
"idv_attempt": VerificationAttemptData,
}
)


# .. event_type: org.openedx.learning.idv_attempt.approved.v1
# .. event_name: IDV_ATTEMPT_APPROVED
# .. event_description: Emitted when a IDV attempt is approved by an IDV vendor
# .. event_data: VerificationAttemptData
IDV_ATTEMPT_APPROVED = OpenEdxPublicSignal(
event_type="org.openedx.learning.idv_attempt.approved.v1",
data={
"idv_attempt": VerificationAttemptData,
}
)


# .. event_type: org.openedx.learning.idv_attempt.denied.v1
# .. event_name: IDV_ATTEMPT_DENIED
# .. event_description: Emitted when a IDV attempt is denied by an IDV vendor
# .. event_data: VerificationAttemptData
IDV_ATTEMPT_DENIED = OpenEdxPublicSignal(
event_type="org.openedx.learning.idv_attempt.denied.v1",
data={
"idv_attempt": VerificationAttemptData,
}
)

0 comments on commit 6237850

Please sign in to comment.