diff --git a/unit/models/event.py b/unit/models/event.py index 1eeaf28c..6265aa69 100644 --- a/unit/models/event.py +++ b/unit/models/event.py @@ -197,43 +197,60 @@ class CheckPaymentPendingEvent(BaseEvent): def from_json_api(_id, _type, attributes, relationships): return CheckPaymentPendingEvent(_id, _type, attributes, relationships) -class CheckPaymentProcessedEvent(BaseEvent): + +class CheckPaymentRejectedEvent(BaseEvent): @staticmethod def from_json_api(_id, _type, attributes, relationships): - return CheckPaymentProcessedEvent(_id, _type, attributes, relationships) + return CheckPaymentRejectedEvent(_id, _type, attributes, relationships) -class CheckPaymentReturnedEvent(BaseEvent): +class CheckPaymentInProductionEvent(BaseEvent): @staticmethod def from_json_api(_id, _type, attributes, relationships): - return CheckPaymentReturnedEvent(_id, _type, attributes, relationships) + return CheckPaymentInProductionEvent(_id, _type, attributes, relationships) -class CheckPaymentPendingEvent(BaseEvent): +class CheckPaymentInDeliveryEvent(BaseEvent): @staticmethod def from_json_api(_id, _type, attributes, relationships): - return CheckPaymentPendingEvent(_id, _type, attributes, relationships) + return CheckPaymentInDeliveryEvent(_id, _type, attributes, relationships) -EventDTO = Union[AccountClosedEvent, AccountFrozenEvent, ApplicationDeniedEvent, ApplicationPendingReviewEvent, - ApplicationAwaitingDocumentsEvent, AuthorizationCreatedEvent, AuthorizationRequestApprovedEvent, - AuthorizationRequestDeclinedEvent, AuthorizationRequestPendingEvent, CardActivatedEvent, - CardStatusChangedEvent, CheckDepositCreatedEvent, CheckDepositClearingEvent, CheckDepositSentEvent, - CheckDepositReturnedEvent, CustomerCreatedEvent, DocumentApprovedEvent, DocumentRejectedEvent, - PaymentClearingEvent, PaymentSentEvent, PaymentReturnedEvent, StatementsCreatedEvent, - TransactionCreatedEvent, AccountReopenedEvent, CheckPaymentCreatedEvent, - CheckPaymentMarkedForReturnEvent, CheckPaymentProcessedEvent, CheckPaymentReturnedEvent, - CheckPaymentPendingEvent] +class CheckPaymentDeliveredEvent(BaseEvent): + @staticmethod + def from_json_api(_id, _type, attributes, relationships): + return CheckPaymentDeliveredEvent(_id, _type, attributes, relationships) -def events_mapper(_id, _type, attributes, relationships): - c = globals() - dot = _type.index(".") - c_name = _type[0].upper() + _type[1:dot] + _type[dot+1].upper() + _type[dot+2:] + "Event" - if c_name in c.keys(): - return c[c_name].from_json_api(_id, _type, attributes, relationships) - else: - return RawUnitObject(_id, _type, attributes, relationships) +class CheckPaymentReturnToSenderEvent(BaseEvent): + @staticmethod + def from_json_api(_id, _type, attributes, relationships): + return CheckPaymentReturnToSenderEvent(_id, _type, attributes, relationships) + + +class CheckPaymentCanceledEvent(BaseEvent): + @staticmethod + def from_json_api(_id, _type, attributes, relationships): + return CheckPaymentCanceledEvent(_id, _type, attributes, relationships) + + +class CheckPaymentDeliveryStatusChangedEvent(BaseEvent): + @staticmethod + def from_json_api(_id, _type, attributes, relationships): + return CheckPaymentDeliveryStatusChangedEvent(_id, _type, attributes, relationships) + + +class CheckPaymentAdditionalVerificationRequiredEvent(BaseEvent): + @staticmethod + def from_json_api(_id, _type, attributes, relationships): + return CheckPaymentAdditionalVerificationRequiredEvent(_id, _type, attributes, relationships) + + +class CheckPaymentAdditionalVerificationApprovedRequiredEvent(BaseEvent): + @staticmethod + def from_json_api(_id, _type, attributes, relationships): + return CheckPaymentAdditionalVerificationApprovedRequiredEvent(_id, _type, attributes, relationships) + class TaxFormCreatedEvent(BaseEvent): @staticmethod @@ -255,7 +272,11 @@ def from_json_api(_id, _type, attributes, relationships): PaymentClearingEvent, PaymentSentEvent, PaymentReturnedEvent, StatementsCreatedEvent, TransactionCreatedEvent, AccountReopenedEvent, CheckPaymentCreatedEvent, CheckPaymentMarkedForReturnEvent, CheckPaymentProcessedEvent, CheckPaymentReturnedEvent, - CheckPaymentPendingEvent, TaxFormCreatedEvent, TaxFormUpdatedEvent] + CheckPaymentRejectedEvent, CheckPaymentInProductionEvent, CheckPaymentInDeliveryEvent, + CheckPaymentDeliveredEvent, CheckPaymentReturnToSenderEvent, CheckPaymentCanceledEvent, + CheckPaymentDeliveryStatusChangedEvent, CheckPaymentAdditionalVerificationRequiredEvent, + CheckPaymentAdditionalVerificationApprovedRequiredEvent, CheckPaymentPendingEvent, + TaxFormCreatedEvent, TaxFormUpdatedEvent] def events_mapper(_id, _type, attributes, relationships):