exception worldline.connect.sdk.webhooks.api_version_mismatch_exception.ApiVersionMismatchException(event_api_version: str, sdk_api_version: str)[source]

Bases: RuntimeError

Represents an error because a webhooks event has an API version that this version of the SDK does not support.

property event_api_version: str
Returns:

The API version from the webhooks event.

property sdk_api_version: str
Returns:

The API version that this version of the SDK supports.

class worldline.connect.sdk.webhooks.in_memory_secret_key_store.InMemorySecretKeyStore[source]

Bases: SecretKeyStore

An in-memory secret key store. This implementation can be used in applications where secret keys can be specified at application startup.

__abstractmethods__ = frozenset({})
__annotations__ = {}
clear() None[source]

Removes all stored secret keys.

get_secret_key(key_id: str) str[source]
Returns:

The secret key for the given key ID. Never None.

Raises:

SecretKeyNotAvailableException – If the secret key for the given key ID is not available.

static instance() InMemorySecretKeyStore[source]
remove_secret_key(key_id: str) None[source]

Removes the secret key for the given key ID.

store_secret_key(key_id: str, secret_key: str) None[source]

Stores the given secret key for the given key ID.

exception worldline.connect.sdk.webhooks.secret_key_not_available_exception.SecretKeyNotAvailableException(key_id: str, message: str | None = None, cause: Exception | None = None)[source]

Bases: SignatureValidationException

Represents an error that causes a secret key to not be available.

property key_id: str
class worldline.connect.sdk.webhooks.secret_key_store.SecretKeyStore[source]

Bases: ABC

A store of secret keys. Implementations could store secret keys in a database, on disk, etc.

__abstractmethods__ = frozenset({'get_secret_key'})
__annotations__ = {}
abstractmethod get_secret_key(key_id: str) str[source]
Returns:

The secret key for the given key ID. Never None.

Raises:

SecretKeyNotAvailableException – If the secret key for the given key ID is not available.

exception worldline.connect.sdk.webhooks.signature_validation_exception.SignatureValidationException(message: str | None = None, cause: Exception | None = None)[source]

Bases: RuntimeError

Represents an error while validating webhooks signatures.

__annotations__ = {}
class worldline.connect.sdk.webhooks.signature_validator.SignatureValidator(secret_key_store: SecretKeyStore)[source]

Bases: object

Validator for webhooks signatures.

property secret_key_store: SecretKeyStore
validate(body: str | bytes, request_headers: Sequence[RequestHeader]) None[source]

Validates the given body using the given request headers.

Raises:

SignatureValidationException – If the body could not be validated successfully.

class worldline.connect.sdk.webhooks.webhooks.Webhooks[source]

Bases: object

Worldline Global Collect platform factory for several webhooks components.

static v1() V1WebhooksFactory[source]