-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added enterprise subsidy events. OEP-49 (#333)
- Loading branch information
1 parent
197690d
commit 8cc090e
Showing
7 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
more information about the project. | ||
""" | ||
|
||
__version__ = "9.6.0" | ||
__version__ = "9.7.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
Package where events related to the enterprise subdomain are implemented. | ||
The enterprise subdomain corresponds to {Architecture Subdomain} defined in | ||
the OEP-41. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Data attributes for events within the architecture subdomain ``enterprise``. | ||
These attributes follow the form of attr objects specified in OEP-49 data | ||
pattern. | ||
""" | ||
|
||
import attr | ||
|
||
|
||
@attr.s(frozen=True) | ||
class SubsidyRedemption: | ||
""" | ||
Attributes for a Subsidy Redemption object. | ||
Arguments: | ||
subsidy_identifier (str): unique identifier to fetch the applied subsidy | ||
content_key (str): content id where subsidy is utilized | ||
lms_user_id (str): lms user id of subsidy beneficiary | ||
""" | ||
|
||
subsidy_identifier = attr.ib(type=str) | ||
content_key = attr.ib(type=str) | ||
lms_user_id = attr.ib(type=int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
Standardized signals definitions for events within the architecture subdomain ``enterprise``. | ||
All signals defined in this module must follow the name and versioning | ||
conventions specified in OEP-41. | ||
They also must comply with the payload definition specified in | ||
docs/decisions/0003-events-payload.rst | ||
""" | ||
|
||
from openedx_events.enterprise.data import SubsidyRedemption | ||
from openedx_events.tooling import OpenEdxPublicSignal | ||
|
||
# .. event_type: org.openedx.enterprise.subsidy.redeemed.v1 | ||
# .. event_name: SUBSIDY_REDEEMED | ||
# .. event_description: emitted when an enterprise subsidy is utilized. | ||
# .. event_data: SubsidyRedemption | ||
SUBSIDY_REDEEMED = OpenEdxPublicSignal( | ||
event_type="org.openedx.enterprise.subsidy.redeemed.v1", | ||
data={ | ||
"redemption": SubsidyRedemption, | ||
} | ||
) | ||
|
||
# .. event_type: org.openedx.enterprise.subsidy.redemption-reversed.v1 | ||
# .. event_name: SUBSIDY_REDEMPTION_REVERSED | ||
# .. event_description: emitted when an enterprise subsidy is reversed. | ||
# .. event_data: SubsidyRedemption | ||
SUBSIDY_REDEMPTION_REVERSED = OpenEdxPublicSignal( | ||
event_type="org.openedx.enterprise.subsidy.redemption-reversed.v1", | ||
data={ | ||
"redemption": SubsidyRedemption, | ||
} | ||
) |
29 changes: 29 additions & 0 deletions
29
...vents/event_bus/avro/tests/schemas/org+openedx+enterprise+subsidy+redeemed+v1_schema.avsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "CloudEvent", | ||
"type": "record", | ||
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema", | ||
"fields": [ | ||
{ | ||
"name": "redemption", | ||
"type": { | ||
"name": "SubsidyRedemption", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "subsidy_identifier", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "content_key", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "lms_user_id", | ||
"type": "long" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"namespace": "org.openedx.enterprise.subsidy.redeemed.v1" | ||
} |
29 changes: 29 additions & 0 deletions
29
..._bus/avro/tests/schemas/org+openedx+enterprise+subsidy+redemption-reversed+v1_schema.avsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "CloudEvent", | ||
"type": "record", | ||
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema", | ||
"fields": [ | ||
{ | ||
"name": "redemption", | ||
"type": { | ||
"name": "SubsidyRedemption", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "subsidy_identifier", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "content_key", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "lms_user_id", | ||
"type": "long" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"namespace": "org.openedx.enterprise.subsidy.redemption-reversed.v1" | ||
} |