Skip to content

Commit a3d8e1e

Browse files
committed
feat: add card fraud case event models
Add support for 5 new card fraud case event types: - CardFraudCaseCreatedEvent (card.fraudCase.created) - CardFraudCaseActivatedEvent (card.fraudCase.activated) - CardFraudCaseExpiredEvent (card.fraudCase.expired) - CardFraudCaseFraudEvent (card.fraudCase.fraud) - CardFraudCaseNoFraudEvent (card.fraudCase.noFraud) Each event includes status, decision, activityType, and expiresAt attributes to support comprehensive fraud case handling.
1 parent f4ae236 commit a3d8e1e

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

unit/models/event.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,96 @@ def from_json_api(_id, _type, attributes, relationships):
232232
attributes["previousStatus"], attributes.get("tags"), relationships)
233233

234234

235+
class CardFraudCaseCreatedEvent(BaseEvent):
236+
def __init__(self, id: str, created_at: datetime, status: str, decision: str, activity_type: str,
237+
expires_at: datetime, tags: Optional[Dict[str, str]], relationships: Optional[Dict[str, Relationship]]):
238+
BaseEvent.__init__(self, id, created_at, tags, relationships)
239+
self.type = 'card.fraudCase.created'
240+
self.attributes["status"] = status
241+
self.attributes["decision"] = decision
242+
self.attributes["activityType"] = activity_type
243+
self.attributes["expiresAt"] = expires_at
244+
245+
@staticmethod
246+
def from_json_api(_id, _type, attributes, relationships):
247+
return CardFraudCaseCreatedEvent(_id, date_utils.to_datetime(attributes["createdAt"]),
248+
attributes["status"], attributes["decision"], attributes["activityType"],
249+
date_utils.to_datetime(attributes["expiresAt"]), attributes.get("tags"),
250+
relationships)
251+
252+
253+
class CardFraudCaseActivatedEvent(BaseEvent):
254+
def __init__(self, id: str, created_at: datetime, status: str, decision: str, activity_type: str,
255+
expires_at: datetime, tags: Optional[Dict[str, str]], relationships: Optional[Dict[str, Relationship]]):
256+
BaseEvent.__init__(self, id, created_at, tags, relationships)
257+
self.type = 'card.fraudCase.activated'
258+
self.attributes["status"] = status
259+
self.attributes["decision"] = decision
260+
self.attributes["activityType"] = activity_type
261+
self.attributes["expiresAt"] = expires_at
262+
263+
@staticmethod
264+
def from_json_api(_id, _type, attributes, relationships):
265+
return CardFraudCaseActivatedEvent(_id, date_utils.to_datetime(attributes["createdAt"]),
266+
attributes["status"], attributes["decision"], attributes["activityType"],
267+
date_utils.to_datetime(attributes["expiresAt"]), attributes.get("tags"),
268+
relationships)
269+
270+
271+
class CardFraudCaseExpiredEvent(BaseEvent):
272+
def __init__(self, id: str, created_at: datetime, status: str, decision: str, activity_type: str,
273+
expires_at: datetime, tags: Optional[Dict[str, str]], relationships: Optional[Dict[str, Relationship]]):
274+
BaseEvent.__init__(self, id, created_at, tags, relationships)
275+
self.type = 'card.fraudCase.expired'
276+
self.attributes["status"] = status
277+
self.attributes["decision"] = decision
278+
self.attributes["activityType"] = activity_type
279+
self.attributes["expiresAt"] = expires_at
280+
281+
@staticmethod
282+
def from_json_api(_id, _type, attributes, relationships):
283+
return CardFraudCaseExpiredEvent(_id, date_utils.to_datetime(attributes["createdAt"]),
284+
attributes["status"], attributes["decision"], attributes["activityType"],
285+
date_utils.to_datetime(attributes["expiresAt"]), attributes.get("tags"),
286+
relationships)
287+
288+
289+
class CardFraudCaseFraudEvent(BaseEvent):
290+
def __init__(self, id: str, created_at: datetime, status: str, decision: str, activity_type: str,
291+
expires_at: datetime, tags: Optional[Dict[str, str]], relationships: Optional[Dict[str, Relationship]]):
292+
BaseEvent.__init__(self, id, created_at, tags, relationships)
293+
self.type = 'card.fraudCase.fraud'
294+
self.attributes["status"] = status
295+
self.attributes["decision"] = decision
296+
self.attributes["activityType"] = activity_type
297+
self.attributes["expiresAt"] = expires_at
298+
299+
@staticmethod
300+
def from_json_api(_id, _type, attributes, relationships):
301+
return CardFraudCaseFraudEvent(_id, date_utils.to_datetime(attributes["createdAt"]),
302+
attributes["status"], attributes["decision"], attributes["activityType"],
303+
date_utils.to_datetime(attributes["expiresAt"]), attributes.get("tags"),
304+
relationships)
305+
306+
307+
class CardFraudCaseNoFraudEvent(BaseEvent):
308+
def __init__(self, id: str, created_at: datetime, status: str, decision: str, activity_type: str,
309+
expires_at: datetime, tags: Optional[Dict[str, str]], relationships: Optional[Dict[str, Relationship]]):
310+
BaseEvent.__init__(self, id, created_at, tags, relationships)
311+
self.type = 'card.fraudCase.noFraud'
312+
self.attributes["status"] = status
313+
self.attributes["decision"] = decision
314+
self.attributes["activityType"] = activity_type
315+
self.attributes["expiresAt"] = expires_at
316+
317+
@staticmethod
318+
def from_json_api(_id, _type, attributes, relationships):
319+
return CardFraudCaseNoFraudEvent(_id, date_utils.to_datetime(attributes["createdAt"]),
320+
attributes["status"], attributes["decision"], attributes["activityType"],
321+
date_utils.to_datetime(attributes["expiresAt"]), attributes.get("tags"),
322+
relationships)
323+
324+
235325
class CheckDepositCreatedEvent(BaseEvent):
236326
def __init__(self, id: str, created_at: datetime, status: str, tags: Optional[Dict[str, str]],
237327
relationships: Optional[Dict[str, Relationship]]):
@@ -807,6 +897,8 @@ def from_json_api(_id, _type, attributes, relationships):
807897
EventDTO = Union[
808898
AccountClosedEvent, AccountFrozenEvent, ApplicationDeniedEvent, ApplicationAwaitingDocumentsEvent,
809899
ApplicationPendingReviewEvent, CardActivatedEvent, CardStatusChangedEvent,
900+
CardFraudCaseCreatedEvent, CardFraudCaseActivatedEvent, CardFraudCaseExpiredEvent,
901+
CardFraudCaseFraudEvent, CardFraudCaseNoFraudEvent,
810902
AuthorizationCreatedEvent, AuthorizationCanceledEvent, AuthorizationDeclinedEvent,
811903
AuthorizationRequestDeclinedEvent, AuthorizationRequestPendingEvent,
812904
AuthorizationRequestApprovedEvent, DocumentApprovedEvent, DocumentRejectedEvent,

0 commit comments

Comments
 (0)