Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add livemode to ThinEvent #1409

Merged
merged 3 commits into from
Oct 3, 2024
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/_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class ThinEvent:
"""
created: str
"""
Livemode indicates if the event is from a production(true) or test(false) account.
"""
livemode: bool
"""
Time at which the object was created.
"""
context: Optional[str] = None
Expand All @@ -132,6 +136,7 @@ def __init__(self, payload: str) -> None:
self.id = parsed["id"]
self.type = parsed["type"]
self.created = parsed["created"]
self.livemode = parsed.get("livemode")
self.context = parsed.get("context")
if parsed.get("related_object"):
self.related_object = RelatedObject(parsed["related_object"])
Expand Down
2 changes: 2 additions & 0 deletions tests/test_v2_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def v2_payload_no_data(self):
"id": "evt_234",
"object": "v2.core.event",
"type": "financial_account.balance.opened",
"livemode": True,
"created": "2022-02-15T00:27:45.330Z",
"related_object": {
"id": "fa_123",
Expand All @@ -39,6 +40,7 @@ def v2_payload_with_data(self):
"id": "evt_234",
"object": "v2.core.event",
"type": "financial_account.balance.opened",
"livemode": False,
"created": "2022-02-15T00:27:45.330Z",
"related_object": {
"id": "fa_123",
Expand Down
Loading