Skip to content
Merged
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
5 changes: 5 additions & 0 deletions stripe/v2/core/_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ class EventNotification:
"""
Livemode indicates if the event is from a production(true) or test(false) account.
"""
object: str
"""
String representing the object's type. Objects of the same type share the same value.
"""
context: Optional[StripeContext] = None
"""
[Optional] Authentication context needed to fetch the event or related object.
Expand All @@ -156,6 +160,7 @@ def __init__(
self, parsed_body: Dict[str, Any], client: "StripeClient"
) -> None:
self.id = parsed_body["id"]
self.object = parsed_body["object"]
self.type = parsed_body["type"]
self.created = parsed_body["created"]
self.livemode = bool(parsed_body.get("livemode"))
Expand Down
3 changes: 3 additions & 0 deletions tests/test_stripe_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def test_event_notification_parsing(self):
mock_client = Mock()
parsed_body = {
"id": "evt_123",
"object": "v2.core.event",
"type": "test.event",
"created": "2023-01-01T00:00:00Z",
"livemode": False,
Expand All @@ -171,6 +172,7 @@ def test_event_notification_no_context(self):
mock_client = Mock()
parsed_body = {
"id": "evt_123",
"object": "v2.core.event",
"type": "test.event",
"created": "2023-01-01T00:00:00Z",
"livemode": False,
Expand All @@ -184,6 +186,7 @@ def test_event_notification_empty_context(self):
mock_client = Mock()
parsed_body = {
"id": "evt_123",
"object": "v2.core.event",
"type": "test.event",
"created": "2023-01-01T00:00:00Z",
"livemode": False,
Expand Down
1 change: 1 addition & 0 deletions tests/test_v2_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_parses_event_notif(
notif, V1BillingMeterErrorReportTriggeredEventNotification
)
assert notif.id == "evt_234"
assert notif.object == "v2.core.event"

assert notif.related_object
assert notif.related_object.id == "mtr_123"
Expand Down
Loading