# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from importlib import import_module
from typing import Union
from typing_extensions import TYPE_CHECKING
from stripe.v2.core._event import UnknownEventNotification
from stripe._stripe_object import StripeObject
if TYPE_CHECKING:
from stripe.events._v1_billing_meter_error_report_triggered_event import (
V1BillingMeterErrorReportTriggeredEventNotification,
)
from stripe.events._v1_billing_meter_no_meter_found_event import (
V1BillingMeterNoMeterFoundEventNotification,
)
from stripe.events._v2_commerce_product_catalog_imports_failed_event import (
V2CommerceProductCatalogImportsFailedEventNotification,
)
from stripe.events._v2_commerce_product_catalog_imports_processing_event import (
V2CommerceProductCatalogImportsProcessingEventNotification,
)
from stripe.events._v2_commerce_product_catalog_imports_succeeded_event import (
V2CommerceProductCatalogImportsSucceededEventNotification,
)
from stripe.events._v2_commerce_product_catalog_imports_succeeded_with_errors_event import (
V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification,
)
from stripe.events._v2_core_account_closed_event import (
V2CoreAccountClosedEventNotification,
)
from stripe.events._v2_core_account_created_event import (
V2CoreAccountCreatedEventNotification,
)
from stripe.events._v2_core_account_including_configuration_customer_capability_status_updated_event import (
V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_configuration_customer_updated_event import (
V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_configuration_merchant_capability_status_updated_event import (
V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_configuration_merchant_updated_event import (
V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_configuration_recipient_capability_status_updated_event import (
V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_configuration_recipient_updated_event import (
V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_defaults_updated_event import (
V2CoreAccountIncludingDefaultsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_future_requirements_updated_event import (
V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_identity_updated_event import (
V2CoreAccountIncludingIdentityUpdatedEventNotification,
)
from stripe.events._v2_core_account_including_requirements_updated_event import (
V2CoreAccountIncludingRequirementsUpdatedEventNotification,
)
from stripe.events._v2_core_account_link_returned_event import (
V2CoreAccountLinkReturnedEventNotification,
)
from stripe.events._v2_core_account_person_created_event import (
V2CoreAccountPersonCreatedEventNotification,
)
from stripe.events._v2_core_account_person_deleted_event import (
V2CoreAccountPersonDeletedEventNotification,
)
from stripe.events._v2_core_account_person_updated_event import (
V2CoreAccountPersonUpdatedEventNotification,
)
from stripe.events._v2_core_account_updated_event import (
V2CoreAccountUpdatedEventNotification,
)
from stripe.events._v2_core_event_destination_ping_event import (
V2CoreEventDestinationPingEventNotification,
)
_V2_EVENT_CLASS_LOOKUP = {
"v1.billing.meter.error_report_triggered": (
"stripe.events._v1_billing_meter_error_report_triggered_event",
"V1BillingMeterErrorReportTriggeredEvent",
),
"v1.billing.meter.no_meter_found": (
"stripe.events._v1_billing_meter_no_meter_found_event",
"V1BillingMeterNoMeterFoundEvent",
),
"v2.commerce.product_catalog.imports.failed": (
"stripe.events._v2_commerce_product_catalog_imports_failed_event",
"V2CommerceProductCatalogImportsFailedEvent",
),
"v2.commerce.product_catalog.imports.processing": (
"stripe.events._v2_commerce_product_catalog_imports_processing_event",
"V2CommerceProductCatalogImportsProcessingEvent",
),
"v2.commerce.product_catalog.imports.succeeded": (
"stripe.events._v2_commerce_product_catalog_imports_succeeded_event",
"V2CommerceProductCatalogImportsSucceededEvent",
),
"v2.commerce.product_catalog.imports.succeeded_with_errors": (
"stripe.events._v2_commerce_product_catalog_imports_succeeded_with_errors_event",
"V2CommerceProductCatalogImportsSucceededWithErrorsEvent",
),
"v2.core.account.closed": (
"stripe.events._v2_core_account_closed_event",
"V2CoreAccountClosedEvent",
),
"v2.core.account.created": (
"stripe.events._v2_core_account_created_event",
"V2CoreAccountCreatedEvent",
),
"v2.core.account[configuration.customer].capability_status_updated": (
"stripe.events._v2_core_account_including_configuration_customer_capability_status_updated_event",
"V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEvent",
),
"v2.core.account[configuration.customer].updated": (
"stripe.events._v2_core_account_including_configuration_customer_updated_event",
"V2CoreAccountIncludingConfigurationCustomerUpdatedEvent",
),
"v2.core.account[configuration.merchant].capability_status_updated": (
"stripe.events._v2_core_account_including_configuration_merchant_capability_status_updated_event",
"V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEvent",
),
"v2.core.account[configuration.merchant].updated": (
"stripe.events._v2_core_account_including_configuration_merchant_updated_event",
"V2CoreAccountIncludingConfigurationMerchantUpdatedEvent",
),
"v2.core.account[configuration.recipient].capability_status_updated": (
"stripe.events._v2_core_account_including_configuration_recipient_capability_status_updated_event",
"V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEvent",
),
"v2.core.account[configuration.recipient].updated": (
"stripe.events._v2_core_account_including_configuration_recipient_updated_event",
"V2CoreAccountIncludingConfigurationRecipientUpdatedEvent",
),
"v2.core.account[defaults].updated": (
"stripe.events._v2_core_account_including_defaults_updated_event",
"V2CoreAccountIncludingDefaultsUpdatedEvent",
),
"v2.core.account[future_requirements].updated": (
"stripe.events._v2_core_account_including_future_requirements_updated_event",
"V2CoreAccountIncludingFutureRequirementsUpdatedEvent",
),
"v2.core.account[identity].updated": (
"stripe.events._v2_core_account_including_identity_updated_event",
"V2CoreAccountIncludingIdentityUpdatedEvent",
),
"v2.core.account[requirements].updated": (
"stripe.events._v2_core_account_including_requirements_updated_event",
"V2CoreAccountIncludingRequirementsUpdatedEvent",
),
"v2.core.account_link.returned": (
"stripe.events._v2_core_account_link_returned_event",
"V2CoreAccountLinkReturnedEvent",
),
"v2.core.account_person.created": (
"stripe.events._v2_core_account_person_created_event",
"V2CoreAccountPersonCreatedEvent",
),
"v2.core.account_person.deleted": (
"stripe.events._v2_core_account_person_deleted_event",
"V2CoreAccountPersonDeletedEvent",
),
"v2.core.account_person.updated": (
"stripe.events._v2_core_account_person_updated_event",
"V2CoreAccountPersonUpdatedEvent",
),
"v2.core.account.updated": (
"stripe.events._v2_core_account_updated_event",
"V2CoreAccountUpdatedEvent",
),
"v2.core.event_destination.ping": (
"stripe.events._v2_core_event_destination_ping_event",
"V2CoreEventDestinationPingEvent",
),
}
def get_v2_event_class(type_: str):
if type_ not in _V2_EVENT_CLASS_LOOKUP:
return StripeObject
import_path, class_name = _V2_EVENT_CLASS_LOOKUP[type_]
return getattr(
import_module(import_path),
class_name,
)
_V2_EVENT_NOTIFICATION_CLASS_LOOKUP = {
"v1.billing.meter.error_report_triggered": (
"stripe.events._v1_billing_meter_error_report_triggered_event",
"V1BillingMeterErrorReportTriggeredEventNotification",
),
"v1.billing.meter.no_meter_found": (
"stripe.events._v1_billing_meter_no_meter_found_event",
"V1BillingMeterNoMeterFoundEventNotification",
),
"v2.commerce.product_catalog.imports.failed": (
"stripe.events._v2_commerce_product_catalog_imports_failed_event",
"V2CommerceProductCatalogImportsFailedEventNotification",
),
"v2.commerce.product_catalog.imports.processing": (
"stripe.events._v2_commerce_product_catalog_imports_processing_event",
"V2CommerceProductCatalogImportsProcessingEventNotification",
),
"v2.commerce.product_catalog.imports.succeeded": (
"stripe.events._v2_commerce_product_catalog_imports_succeeded_event",
"V2CommerceProductCatalogImportsSucceededEventNotification",
),
"v2.commerce.product_catalog.imports.succeeded_with_errors": (
"stripe.events._v2_commerce_product_catalog_imports_succeeded_with_errors_event",
"V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification",
),
"v2.core.account.closed": (
"stripe.events._v2_core_account_closed_event",
"V2CoreAccountClosedEventNotification",
),
"v2.core.account.created": (
"stripe.events._v2_core_account_created_event",
"V2CoreAccountCreatedEventNotification",
),
"v2.core.account[configuration.customer].capability_status_updated": (
"stripe.events._v2_core_account_including_configuration_customer_capability_status_updated_event",
"V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification",
),
"v2.core.account[configuration.customer].updated": (
"stripe.events._v2_core_account_including_configuration_customer_updated_event",
"V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification",
),
"v2.core.account[configuration.merchant].capability_status_updated": (
"stripe.events._v2_core_account_including_configuration_merchant_capability_status_updated_event",
"V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification",
),
"v2.core.account[configuration.merchant].updated": (
"stripe.events._v2_core_account_including_configuration_merchant_updated_event",
"V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification",
),
"v2.core.account[configuration.recipient].capability_status_updated": (
"stripe.events._v2_core_account_including_configuration_recipient_capability_status_updated_event",
"V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification",
),
"v2.core.account[configuration.recipient].updated": (
"stripe.events._v2_core_account_including_configuration_recipient_updated_event",
"V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification",
),
"v2.core.account[defaults].updated": (
"stripe.events._v2_core_account_including_defaults_updated_event",
"V2CoreAccountIncludingDefaultsUpdatedEventNotification",
),
"v2.core.account[future_requirements].updated": (
"stripe.events._v2_core_account_including_future_requirements_updated_event",
"V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification",
),
"v2.core.account[identity].updated": (
"stripe.events._v2_core_account_including_identity_updated_event",
"V2CoreAccountIncludingIdentityUpdatedEventNotification",
),
"v2.core.account[requirements].updated": (
"stripe.events._v2_core_account_including_requirements_updated_event",
"V2CoreAccountIncludingRequirementsUpdatedEventNotification",
),
"v2.core.account_link.returned": (
"stripe.events._v2_core_account_link_returned_event",
"V2CoreAccountLinkReturnedEventNotification",
),
"v2.core.account_person.created": (
"stripe.events._v2_core_account_person_created_event",
"V2CoreAccountPersonCreatedEventNotification",
),
"v2.core.account_person.deleted": (
"stripe.events._v2_core_account_person_deleted_event",
"V2CoreAccountPersonDeletedEventNotification",
),
"v2.core.account_person.updated": (
"stripe.events._v2_core_account_person_updated_event",
"V2CoreAccountPersonUpdatedEventNotification",
),
"v2.core.account.updated": (
"stripe.events._v2_core_account_updated_event",
"V2CoreAccountUpdatedEventNotification",
),
"v2.core.event_destination.ping": (
"stripe.events._v2_core_event_destination_ping_event",
"V2CoreEventDestinationPingEventNotification",
),
}
def get_v2_event_notification_class(type_: str):
if type_ not in _V2_EVENT_NOTIFICATION_CLASS_LOOKUP:
return UnknownEventNotification
import_path, class_name = _V2_EVENT_NOTIFICATION_CLASS_LOOKUP[type_]
return getattr(
import_module(import_path),
class_name,
)
ALL_EVENT_NOTIFICATIONS = Union[
"V1BillingMeterErrorReportTriggeredEventNotification",
"V1BillingMeterNoMeterFoundEventNotification",
"V2CommerceProductCatalogImportsFailedEventNotification",
"V2CommerceProductCatalogImportsProcessingEventNotification",
"V2CommerceProductCatalogImportsSucceededEventNotification",
"V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification",
"V2CoreAccountClosedEventNotification",
"V2CoreAccountCreatedEventNotification",
"V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification",
"V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification",
"V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification",
"V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification",
"V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification",
"V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification",
"V2CoreAccountIncludingDefaultsUpdatedEventNotification",
"V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification",
"V2CoreAccountIncludingIdentityUpdatedEventNotification",
"V2CoreAccountIncludingRequirementsUpdatedEventNotification",
"V2CoreAccountLinkReturnedEventNotification",
"V2CoreAccountPersonCreatedEventNotification",
"V2CoreAccountPersonDeletedEventNotification",
"V2CoreAccountPersonUpdatedEventNotification",
"V2CoreAccountUpdatedEventNotification",
"V2CoreEventDestinationPingEventNotification",
]