Skip to content
Closed
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
3 changes: 3 additions & 0 deletions unit/models/codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@
"account.frozen": lambda _id, _type, attributes, relationships:
AccountFrozenEvent.from_json_api(_id, _type, attributes, relationships),

"application.approved": lambda _id, _type, attributes, relationships:
ApplicationApprovedEvent.from_json_api(_id, _type, attributes, relationships),

"application.awaitingDocuments": lambda _id, _type, attributes, relationships:
ApplicationAwaitingDocumentsEvent.from_json_api(_id, _type, attributes, relationships),

Expand Down
12 changes: 11 additions & 1 deletion unit/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ def __init__(self, id: str, created_at: datetime, freeze_reason: str, tags: Opti
def from_json_api(_id, _type, attributes, relationships):
return AccountFrozenEvent(_id, date_utils.to_datetime(attributes["createdAt"]), attributes["freezeReason"],
attributes.get("tags"), relationships)

class ApplicationApprovedEvent(BaseEvent):
def __init__(self, id: str, created_at: datetime, tags: Optional[Dict[str, str]],
relationships: Optional[Dict[str, Relationship]]):
BaseEvent.__init__(self, id, created_at, tags, relationships)
self.type = 'application.approved'

@staticmethod
def from_json_api(_id, _type, attributes, relationships):
return ApplicationApprovedEvent(_id, date_utils.to_datetime(attributes["createdAt"]), attributes.get("tags"),
relationships)

class ApplicationDeniedEvent(BaseEvent):
def __init__(self, id: str, created_at: datetime, tags: Optional[Dict[str, str]],
Expand Down Expand Up @@ -895,7 +905,7 @@ def from_json_api(_id, _type, attributes, relationships):


EventDTO = Union[
AccountClosedEvent, AccountFrozenEvent, ApplicationDeniedEvent, ApplicationAwaitingDocumentsEvent,
AccountClosedEvent, AccountFrozenEvent, ApplicationApprovedEvent, ApplicationDeniedEvent, ApplicationAwaitingDocumentsEvent,
ApplicationPendingReviewEvent, CardActivatedEvent, CardStatusChangedEvent,
CardFraudCaseCreatedEvent, CardFraudCaseActivatedEvent, CardFraudCaseExpiredEvent,
CardFraudCaseFraudEvent, CardFraudCaseNoFraudEvent,
Expand Down
Loading