Skip to content

Reference

shared.services.payment_providers.swan.client

swan_client

SwanClient

SwanClient()
Source code in shared/services/payment_providers/swan/client/swan_client.py
def __init__(self) -> None:
    config = SwanClientConfiguration()
    self.queries: SwanQueryClient = SwanQueryClient(config=config)
    self.mutations: SwanMutationClient = SwanMutationClient(config=config)
mutations instance-attribute
mutations = SwanMutationClient(config=config)
queries instance-attribute
queries = SwanQueryClient(config=config)

swan_client_configuration

SwanClientConfiguration

SwanClientConfiguration()
Source code in shared/services/payment_providers/swan/client/swan_client_configuration.py
def __init__(self) -> None:
    credentials = mandatory(
        json_secret_from_config("SWAN__CREDENTIALS_SECRET_NAME")
    )

    # OAuth URLs
    self.oauth_token_endpoint_url = credentials["oauth_token_endpoint_url"]

    # OAuth app credentials
    self.oauth_client_id = credentials["oauth_client_id"]
    self.oauth_client_secret = credentials["oauth_client_secret"]

    # GraphQL URLs
    self.graphql_endpoint_url = credentials["graphql_endpoint_url"]

    # Swan specific IDs - Main bank account
    self.swan_account_id = credentials["swan_account_id"]
    # Swan specific IDs - Card product ID (design, default spending limits, etc)
    self.swan_card_product_id = credentials["swan_card_product_id"]
    # Swan specific IDs - SEPA Direct Debit payment method ID
    self.swan_sdd_payment_method_id = credentials["swan_sdd_payment_method_id"]
    # Swan specific IDs - Admin user ID, used for impersonation on admin mutations
    self.swan_admin_user_id = credentials["swan_admin_user_id"]

    # Private key used for server-to-server consent
    # If you need to rotate keys:
    # - Generate a new couple (public/private) following doc here https://docs.swan.io/topics/users/consent/guide-implement-s2s/#generate
    # - Update the public key in Swan's admin interface
    # - Update the private key in AWS Secrets Manager (the `server_consent_private_key` below)
    self.server_consent_private_key = credentials["server_consent_private_key"]
graphql_endpoint_url instance-attribute
graphql_endpoint_url = credentials['graphql_endpoint_url']
oauth_client_id instance-attribute
oauth_client_id = credentials['oauth_client_id']
oauth_client_secret instance-attribute
oauth_client_secret = credentials['oauth_client_secret']
oauth_token_endpoint_url instance-attribute
oauth_token_endpoint_url = credentials[
    "oauth_token_endpoint_url"
]
project_access_token property
project_access_token

Fetch a new project access token to be used with Swan's API.

Tokens are valid for 1h, we might need to refresh them at some point, but it's definitely enough time for now.

server_consent_private_key = credentials[
    "server_consent_private_key"
]
swan_account_id instance-attribute
swan_account_id = credentials['swan_account_id']
swan_admin_user_id instance-attribute
swan_admin_user_id = credentials['swan_admin_user_id']
swan_card_product_id instance-attribute
swan_card_product_id = credentials['swan_card_product_id']
swan_sdd_payment_method_id instance-attribute
swan_sdd_payment_method_id = credentials[
    "swan_sdd_payment_method_id"
]

swan_mutation_client

SwanMutationClient

SwanMutationClient(config)

Bases: Client

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def __init__(self, config: SwanClientConfiguration) -> None:
    super().__init__(
        transport=AIOHTTPTransport(
            url=config.graphql_endpoint_url,
            headers={"Authorization": f"Bearer {config.project_access_token}"},
        ),
        fetch_schema_from_transport=False,
    )
    self.config = config
accept_consent(consent_id, impersonated_user_id)

See https://api-reference.swan.io/mutations/accept-consent ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def accept_consent(
    self,
    consent_id: str,
    impersonated_user_id: str,
) -> Consent:
    """
    See https://api-reference.swan.io/mutations/accept-consent
    """

    return self._execute_mutation(
        mutation=AcceptConsentMutation(
            consent_id=consent_id,
        ),
        impersonated_user_id=impersonated_user_id,
    )
add_account_membership
add_account_membership(
    first_name,
    last_name,
    phone_number,
    birth_date,
    email,
    language,
)

Add a new account membership to an account.

See https://api-reference.swan.io/mutations/add-account-membership ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def add_account_membership(
    self,
    first_name: str,
    last_name: str,
    phone_number: str,
    birth_date: date,
    email: str,
    language: AccountLanguage,
) -> AccountMembership:
    """
    Add a new account membership to an account.

    See https://api-reference.swan.io/mutations/add-account-membership
    """

    return self._execute_mutation(
        mutation=AddAccountMembershipMutation(
            account_id=self.config.swan_account_id,
            first_name=first_name,
            last_name=last_name,
            phone_number=phone_number,
            birth_date=birth_date,
            email=email,
            language=language,
        ),
        impersonated_user_id=self.config.swan_admin_user_id,
    )
add_card
add_card(account_membership_id)

Add a new card to an account membership.

https://api-reference.swan.io/mutations/add-card ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def add_card(self, account_membership_id: str):  # type: ignore[no-untyped-def]
    """
    Add a new card to an account membership.

    https://api-reference.swan.io/mutations/add-card
    """

    return self._execute_mutation(
        mutation=AddCardMutation(
            account_membership_id=account_membership_id,
            card_product_id=self.config.swan_card_product_id,
        ),
        impersonated_user_id=self.config.swan_admin_user_id,
    )
add_sepa_direct_debit_payment_mandate
add_sepa_direct_debit_payment_mandate(
    debtor_name,
    debtor_iban,
    debtor_country,
    reference,
    signature_date,
    mandate_name,
)

See https://api-reference.swan.io/mutations/add-sepa-direct-debit-payment-mandate ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def add_sepa_direct_debit_payment_mandate(
    self,
    debtor_name: str,
    debtor_iban: str,
    debtor_country: str,
    reference: str,
    signature_date: date,
    mandate_name: str,
) -> SepaPaymentDirectDebitMandate:
    """
    See https://api-reference.swan.io/mutations/add-sepa-direct-debit-payment-mandate
    """

    mutation = AddSepaDirectDebitPaymentMandateMutation(
        payment_method_id=self.config.swan_sdd_payment_method_id,
        signature_date=signature_date,
        debtor_name=debtor_name,
        debtor_iban=debtor_iban,
        debtor_country=debtor_country,
        reference=reference,
        mandate_name=mandate_name,
    )

    # Cast the result to SEPA Direct Debit mandate as this is the sole type of mandate we are supporting right now
    return cast(
        "SepaPaymentDirectDebitMandate", self._execute_mutation(mutation=mutation)
    )
add_trusted_sepa_beneficiary
add_trusted_sepa_beneficiary(iban, name)

Add a trusted SEPA beneficiary to an account.

See https://api-reference.swan.io/mutations/add-trusted-sepa-beneficiary ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def add_trusted_sepa_beneficiary(
    self,
    iban: str,
    name: str,
) -> TrustedBeneficiary:
    """
    Add a trusted SEPA beneficiary to an account.

    See https://api-reference.swan.io/mutations/add-trusted-sepa-beneficiary
    """

    return self._execute_mutation(
        mutation=AddTrustedSepaBeneficiaryMutation(
            account_id=self.config.swan_account_id,
            iban=iban,
            name=name,
        ),
        impersonated_user_id=self.config.swan_admin_user_id,
    )
bind_account_membership
bind_account_membership(account_membership_id, user_id)

Bind a user to an account membership.

https://api-reference.swan.io/mutations/bind-account-membership ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def bind_account_membership(
    self,
    account_membership_id: str,
    user_id: str,
) -> AccountMembership:
    """
    Bind a user to an account membership.

    https://api-reference.swan.io/mutations/bind-account-membership
    """

    return self._execute_mutation(
        mutation=BindAccountMembershipMutation(
            account_membership_id=account_membership_id
        ),
        impersonated_user_id=user_id,
    )
cancel_card
cancel_card(card_id)

See https://api-reference.swan.io/mutations/cancel-card ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def cancel_card(
    self,
    card_id: str,
) -> Card:
    """
    See https://api-reference.swan.io/mutations/cancel-card
    """

    return self._execute_mutation(mutation=CancelCardMutation(card_id=card_id))
complete_user_creation
complete_user_creation(
    request_id, code, first_name, last_name, birth_date
)

See https://api-reference.swan.io/mutations/complete-user-creation ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def complete_user_creation(
    self,
    request_id: str,
    code: str,
    first_name: str,
    last_name: str,
    birth_date: date,
) -> User:
    """
    See https://api-reference.swan.io/mutations/complete-user-creation
    """

    return self._execute_mutation(
        mutation=CompleteUserCreationMutation(
            request_id=request_id,
            code=code,
            first_name=first_name,
            last_name=last_name,
            birth_date=birth_date,
        )
    )
config instance-attribute
config = config
disable_account_membership
disable_account_membership(account_membership_id)

See https://api-reference.swan.io/mutations/disable-account-membership ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def disable_account_membership(
    self, account_membership_id: str
) -> AccountMembership:
    """
    See https://api-reference.swan.io/mutations/disable-account-membership
    """

    return self._execute_mutation(
        mutation=DisableAccountMembershipMutation(
            account_membership_id=account_membership_id,
        ),
    )
grant_consent_with_server_signature(consent_id, challenge)

Grant consent with a server signature.

See https://api-reference.swan.io/mutations/grant-consent-with-server-signature ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def grant_consent_with_server_signature(
    self, consent_id: str, challenge: str
) -> Consent:
    """
    Grant consent with a server signature.

    See https://api-reference.swan.io/mutations/grant-consent-with-server-signature
    """

    return self._execute_mutation(
        mutation=GrantConsentWithServerSignatureMutation(
            consent_id=consent_id,
            signature=self._sign_consent_challenge(
                challenge=challenge,
                private_key=self.config.server_consent_private_key,
            ),
        ),
        impersonated_user_id=self.config.swan_admin_user_id,
    )
initiate_credit_transfers
initiate_credit_transfers(
    amount_in_cents, trusted_beneficiary_id, label
)

Initiates a credit transfer to an other Swan account or to an IBAN

See https://api-reference.swan.io/mutations/initiate-credit-transfers ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def initiate_credit_transfers(
    self,
    amount_in_cents: int,
    trusted_beneficiary_id: str,
    label: str,
) -> Payment:
    """
    Initiates a credit transfer to an other Swan account or to an IBAN

    See https://api-reference.swan.io/mutations/initiate-credit-transfers
    """

    return self._execute_mutation(
        mutation=InitiateCreditTransfersMutation(
            account_id=self.config.swan_account_id,
            amount_in_cents=amount_in_cents,
            trusted_beneficiary_id=trusted_beneficiary_id,
            label=label,
        ),
        impersonated_user_id=self.config.swan_admin_user_id,
    )
initiate_merchant_payment_collection
initiate_merchant_payment_collection(
    mandate_id, amount_in_cents, label
)

See https://api-reference.swan.io/mutations/initiate-merchant-payment-collection ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def initiate_merchant_payment_collection(
    self,
    mandate_id: str,
    amount_in_cents: int,
    label: str,
) -> Payment:
    """
    See https://api-reference.swan.io/mutations/initiate-merchant-payment-collection
    """

    return self._execute_mutation(
        mutation=InitiateMerchantPaymentCollectionMutation(
            mandate_id=mandate_id,
            amount_in_cents=amount_in_cents,
            label=label,
        )
    )
start_user_creation
start_user_creation(phone_number, locale)

https://api-reference.swan.io/mutations/start-user-creation ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def start_user_creation(
    self,
    phone_number: str,
    locale: OtpLocale,
) -> StartUserCreationPayload:
    """
    https://api-reference.swan.io/mutations/start-user-creation
    """

    return self._execute_mutation(
        mutation=StartUserCreationMutation(
            mobile_phone_number=phone_number, locale=locale
        )
    )
view_card_numbers
view_card_numbers(card_id, impersonated_user_id)

Reveal the card numbers in the consent page once consent has been given by the cardholder.

See https://api-reference.swan.io/mutations/view-card-numbers ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def view_card_numbers(
    self,
    card_id: str,
    impersonated_user_id: str,
) -> Consent:
    """
    Reveal the card numbers in the consent page once consent has been given by the cardholder.

    See https://api-reference.swan.io/mutations/view-card-numbers
    """

    return self._execute_mutation(
        mutation=ViewCardNumbersMutation(
            card_id=card_id,
        ),
        impersonated_user_id=impersonated_user_id,
    )
view_card_numbers_with_consent(
    consent_id, impersonated_user_id
)

Obtain individual iframes containing sensitive card information from an accepted consent.

See https://api-reference.swan.io/mutations/view-card-numbers-with-consent ⧉

Source code in shared/services/payment_providers/swan/client/swan_mutation_client.py
def view_card_numbers_with_consent(
    self, consent_id: str, impersonated_user_id: str
) -> CardNumbers:
    """
    Obtain individual iframes containing sensitive card information from an accepted consent.

    See https://api-reference.swan.io/mutations/view-card-numbers-with-consent
    """

    return self._execute_mutation(
        mutation=ViewCardNumbersWithConsentMutation(
            consent_id=consent_id,
        ),
        impersonated_user_id=impersonated_user_id,
    )

T module-attribute

T = TypeVar('T', bound=SwanEntity)

swan_query_client

SwanQueryClient

SwanQueryClient(config)

Bases: Client

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def __init__(self, config: SwanClientConfiguration) -> None:
    super().__init__(
        transport=AIOHTTPTransport(
            url=config.graphql_endpoint_url,
            headers={"Authorization": f"Bearer {config.project_access_token}"},
        ),
        fetch_schema_from_transport=False,
    )
    self.config = config
account_membership
account_membership(account_membership_id)

Returns an account membership from its id.

See https://api-reference.swan.io/queries/account-membership ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def account_membership(self, account_membership_id: str) -> AccountMembership:
    """
    Returns an account membership from its id.

    See https://api-reference.swan.io/queries/account-membership
    """

    return self._get_resource(
        resource_name="accountMembership",
        resource_id=account_membership_id,
        target_type=AccountMembership,
    )
account_memberships
account_memberships()

The list of account memberships

See https://api-reference.swan.io/queries/account-memberships ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def account_memberships(self) -> Iterable[AccountMembership]:
    """
    The list of account memberships

    See https://api-reference.swan.io/queries/account-memberships
    """

    return self._get_resources(
        resources_name="accountMemberships", target_type=AccountMembership
    )
accounts
accounts()

Returns the list of accounts.

See https://api-reference.swan.io/queries/accounts ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def accounts(self) -> Iterable[Account]:
    """
    Returns the list of accounts.

    See https://api-reference.swan.io/queries/accounts
    """

    return self._get_resources(resources_name="accounts", target_type=Account)
card
card(card_id)

Returns a card from its id.

See https://api-reference.swan.io/queries/card ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def card(self, card_id: str) -> Card:
    """
    Returns a card from its id.

    See https://api-reference.swan.io/queries/card
    """

    return self._get_resource(
        resource_name="card",
        resource_id=card_id,
        target_type=Card,
        resource_identifier="cardId",
    )
cards
cards()

Returns the list of cards.

See https://api-reference.swan.io/queries/cards ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def cards(self) -> Iterable[Card]:
    """
    Returns the list of cards.

    See https://api-reference.swan.io/queries/cards
    """

    return self._get_resources(resources_name="cards", target_type=Card)
config instance-attribute
config = config
payment
payment(payment_id)

Returns a payment from its id.

See https://api-reference.swan.io/queries/payment ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def payment(self, payment_id: str) -> Payment:
    """
    Returns a payment from its id.

    See https://api-reference.swan.io/queries/payment
    """

    return self._get_resource(
        resource_name="payment", resource_id=payment_id, target_type=Payment
    )
payment_mandates
payment_mandates(account_holder_id)

Returns the list of all the payment mandates for the given account holder.

This method is a custom one, going through the accountHolder resource from Swan's API.

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def payment_mandates(self, account_holder_id: str) -> Iterable[PaymentMandate]:
    """
    Returns the list of all the payment mandates for the given account holder.

    This method is a custom one, going through the accountHolder resource from Swan's API.
    """

    return self._get_sub_resources(
        main_resource_name="accountHolder",
        main_resource_id=account_holder_id,
        sub_resources_name="paymentMandates",
        target_type=PaymentMandate,
    )
transaction
transaction(transaction_id)

Returns a transaction from its id.

See https://api-reference.swan.io/queries/transaction ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def transaction(self, transaction_id: str) -> Transaction:
    """
    Returns a transaction from its id.

    See https://api-reference.swan.io/queries/transaction
    """

    return self._get_resource(
        resource_name="transaction",
        resource_id=transaction_id,
        target_type=Transaction,
    )
transactions
transactions()

List of transactions of a project.

See https://api-reference.swan.io/queries/transactions ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def transactions(self) -> Iterable[Transaction]:
    """
    List of transactions of a project.

    See https://api-reference.swan.io/queries/transactions
    """

    return self._get_resources(
        resources_name="transactions", target_type=Transaction
    )
trusted_beneficiary
trusted_beneficiary(trusted_beneficiary_id)

Returns a trusted beneficiary from its ID.

See https://api-reference.swan.io/queries/trusted-beneficiary ⧉

Source code in shared/services/payment_providers/swan/client/swan_query_client.py
def trusted_beneficiary(self, trusted_beneficiary_id: str) -> TrustedBeneficiary:
    """
    Returns a trusted beneficiary from its ID.

    See https://api-reference.swan.io/queries/trusted-beneficiary
    """

    return self._get_resource(
        resource_name="trustedBeneficiary",
        resource_id=trusted_beneficiary_id,
        target_type=TrustedBeneficiary,
        impersonated_user_id=self.config.swan_admin_user_id,
    )

T module-attribute

T = TypeVar('T', bound=SwanEntity)

shared.services.payment_providers.swan.decorators

enable_custom_deserialization

enable_custom_deserialization(cls)

Decorator to be used to override the default deserialization from DataclassJsonMixin.

Basically, it replaces the DataclassJsonMixin.from_dict method with the YourClass.deserialize method.

Source code in shared/services/payment_providers/swan/decorators.py
def enable_custom_deserialization(cls: type[_T]) -> type[_T]:
    """
    Decorator to be used to override the default deserialization from DataclassJsonMixin.

    Basically, it replaces the `DataclassJsonMixin.from_dict` method with the `YourClass.deserialize` method.
    """

    method_name = "deserialize"

    if not hasattr(cls, method_name):
        raise Exception(f"Class must have a `{method_name}` method")

    cls.from_dict = cls.deserialize  # type: ignore[attr-defined]
    return cls

shared.services.payment_providers.swan.entities

account

Account dataclass

Account(id, name, status_info, holder)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/account.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        name
        statusInfo {AccountStatusInfo.get_graphql_schema()}
        holder {AccountHolder.get_graphql_schema()}
    }}
    """
holder instance-attribute
holder
id instance-attribute
id
name instance-attribute
name
status_info instance-attribute
status_info

account_holder

AccountHolder dataclass

AccountHolder(id, info)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/account_holder.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        info {AccountHolderInfo.get_graphql_schema()}
    }}
    """
id instance-attribute
id
info instance-attribute
info

account_holder_info

AccountHolderInfo dataclass

AccountHolderInfo(type, name)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/account_holder_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        type
        name
    }
    """
name instance-attribute
name
type instance-attribute
type

account_membership

AccountMembership dataclass

AccountMembership(
    id, account_id, email, user, status_info, language
)

Bases: SwanEntity

account_id instance-attribute
account_id
email instance-attribute
email
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/account_membership.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        accountId
        email
        user {User.get_graphql_schema()}
        statusInfo {AccountMembershipStatusInfo.get_graphql_schema()}
        language
    }}
    """
id instance-attribute
id
language instance-attribute
language
status_info instance-attribute
status_info
user instance-attribute
user

account_membership_status_info

AccountMembershipStatusInfo dataclass

AccountMembershipStatusInfo(status)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/account_membership_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        status
    }
    """
status instance-attribute
status

account_status_info

AccountStatusInfo dataclass

AccountStatusInfo(status)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/account_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        status
    }
    """
status instance-attribute
status

amount

Amount dataclass

Amount(currency, value)

Bases: SwanEntity

currency instance-attribute
currency
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/amount.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        currency
        value
    }
    """
value instance-attribute
value

basic_physical_card_info

BasicPhysicalCardInfo dataclass

BasicPhysicalCardInfo(is_expired)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/basic_physical_card_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        isExpired
    }
    """
is_expired instance-attribute
is_expired

beneficiary

Beneficiary dataclass

Beneficiary(
    name, iban, id=None, status_info=None, created_at=None
)

Bases: SwanEntity

created_at class-attribute instance-attribute
created_at = None
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/beneficiary.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        ... on TrustedBeneficiary {TrustedBeneficiary.get_graphql_schema()}
        ... on UnsavedSepaBeneficiary {{
            name
            iban
        }}
    }}
    """
iban instance-attribute
iban
id class-attribute instance-attribute
id = None
name instance-attribute
name
status_info class-attribute instance-attribute
status_info = None

TrustedBeneficiary dataclass

TrustedBeneficiary(name, iban, id, status_info, created_at)

Bases: Beneficiary

created_at instance-attribute
created_at
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/beneficiary.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        statusInfo {TrustedBeneficiaryStatusInfo.get_graphql_schema()}
        name
        createdAt
        ... on TrustedSepaBeneficiary {{
          iban
        }}
    }}
    """
id instance-attribute
id
status_info instance-attribute
status_info

card

Card dataclass

Card(
    id,
    name,
    card_masked_number,
    expiry_date,
    status_info,
    spending_limits,
    account_membership,
    physical_card,
    created_at,
    digital_cards,
)

Bases: SwanEntity

account_membership instance-attribute
account_membership
card_masked_number instance-attribute
card_masked_number
created_at instance-attribute
created_at
digital_cards instance-attribute
digital_cards
expiry_date instance-attribute
expiry_date
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/card.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        name
        cardMaskedNumber
        expiryDate
        statusInfo {CardStatusInfo.get_graphql_schema()}
        spendingLimits {SpendingLimit.get_graphql_schema()}
        accountMembership {AccountMembership.get_graphql_schema()}
        physicalCard {PhysicalCard.get_graphql_schema()}
        createdAt
        digitalCards {DigitalCardsConnection.get_graphql_schema()}
    }}
    """
id instance-attribute
id
name instance-attribute
name
physical_card instance-attribute
physical_card
spending_limits instance-attribute
spending_limits
status_info instance-attribute
status_info

card_details

CardDetails dataclass

CardDetails(card, masked_pan)

Bases: SwanEntity

card instance-attribute
card
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/card_details.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        ... on CardOutDetails {{
            card {Card.get_graphql_schema()}
            maskedPan
        }}
    }}
    """
masked_pan instance-attribute
masked_pan

card_merchant

CardMerchant dataclass

CardMerchant(
    merchant_id,
    merchant_name,
    merchant_postal_code,
    merchant_city,
    merchant_country,
    merchant_category_code,
    merchant_category_description,
)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/card_merchant.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        ... on CardOutMerchant {
            merchantId
            merchantName
            merchantPostalCode
            merchantCity
            merchantCountry
            merchantCategoryCode
            merchantCategoryDescription
        }
    }
    """
merchant_category_code instance-attribute
merchant_category_code
merchant_category_description instance-attribute
merchant_category_description
merchant_city instance-attribute
merchant_city
merchant_country instance-attribute
merchant_country
merchant_id instance-attribute
merchant_id
merchant_name instance-attribute
merchant_name
merchant_postal_code instance-attribute
merchant_postal_code

card_numbers

CardNumbers dataclass

CardNumbers(
    pan_iframe_url,
    expiry_date_iframe_url,
    cvv_iframe_url,
    cardholder_name,
)

Bases: SwanEntity

cardholder_name instance-attribute
cardholder_name
cvv_iframe_url instance-attribute
cvv_iframe_url
expiry_date_iframe_url instance-attribute
expiry_date_iframe_url
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/card_numbers.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        panIframeUrl
        expiryDateIframeUrl
        cvvIframeUrl
        cardholderName
    }
    """
pan_iframe_url instance-attribute
pan_iframe_url

card_status_info

CardStatusInfo dataclass

CardStatusInfo(status, consent=None)

Bases: SwanEntity

consent class-attribute instance-attribute
consent = None
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/card_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        status
        ... on CardConsentPendingStatusInfo {{
            consent {Consent.get_graphql_schema()}
        }}
    }}
    """
status instance-attribute
status

consent

Consent dataclass

Consent(id, status, purpose, user, challenge, createdAt)

Bases: SwanEntity

challenge instance-attribute
challenge
createdAt instance-attribute
createdAt
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/consent.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        status
        purpose
        user {User.get_graphql_schema()}
        challenge
        createdAt
    }}
    """
id instance-attribute
id
purpose instance-attribute
purpose
status instance-attribute
status
user instance-attribute
user

digital_card

DigitalCard dataclass

DigitalCard(id, type, created_at, wallet_provider)

Bases: SwanEntity

created_at instance-attribute
created_at
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/digital_card.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        type
        createdAt
        walletProvider {WalletProvider.get_graphql_schema()}
    }}"""
id instance-attribute
id
type instance-attribute
type
wallet_provider instance-attribute
wallet_provider

digital_cards_connection

DigitalCardsConnection dataclass

DigitalCardsConnection(total_count, page_info, edges)

Bases: SwanEntity

Edge dataclass
Edge(cursor, node)

Bases: SwanEntity

cursor instance-attribute
cursor
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/digital_cards_connection.py
@classmethod
def get_graphql_schema(cls) -> str:
    # We don't use this method as we need to access the target generic type from the Connection class.
    # If you need to update the schema, update the Connection.get_graphql_schema() method.
    raise NotImplementedError("Not used!")
node instance-attribute
node
edges instance-attribute
edges
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/digital_cards_connection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        totalCount
        pageInfo {PageInfo.get_graphql_schema()}
        edges {{
            cursor
            node {DigitalCard.get_graphql_schema()}
        }}
    }}"""
page_info instance-attribute
page_info
total_count instance-attribute
total_count

mutation_rejection

AcceptConsentNotAllowedForConsentPurposeRejection dataclass

AcceptConsentNotAllowedForConsentPurposeRejection(message)

AccountMembershipNotAllowedRejection dataclass

AccountMembershipNotAllowedRejection(message)

BaseMutationRejection dataclass

BaseMutationRejection(message)

Bases: SwanEntity, ABC

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/mutation_rejection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        message
    }
    """
message instance-attribute
message

BlacklistedPhoneNumberRejection dataclass

BlacklistedPhoneNumberRejection(message)

CalledByABotRejection dataclass

CalledByABotRejection(message)

CardNotFoundRejection dataclass

CardNotFoundRejection(message, id)

Bases: BaseMutationRejection

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/mutation_rejection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        message
        id
    }
    """
id instance-attribute
id

CardProductDisabledRejection dataclass

CardProductDisabledRejection(message)

CardProductSuspendedRejection dataclass

CardProductSuspendedRejection(message)

CardSensitiveInfoNoLongerAvailableRejection dataclass

CardSensitiveInfoNoLongerAvailableRejection(message)

ConsentNotFoundRejection dataclass

ConsentNotFoundRejection(message, consent_id)

Bases: BaseMutationRejection

consent_id instance-attribute
consent_id
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/mutation_rejection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        message
        consentId
    }
    """

DebtorAccountClosedRejection dataclass

DebtorAccountClosedRejection(message)

DebtorAccountNotAllowedRejection dataclass

DebtorAccountNotAllowedRejection(message)

EnabledCardDesignNotFoundRejection dataclass

EnabledCardDesignNotFoundRejection(message)

ForbiddenRejection dataclass

ForbiddenRejection(message)

IdentityAlreadyBindToAccountMembershipRejection dataclass

IdentityAlreadyBindToAccountMembershipRejection(message)

InternalErrorRejection dataclass

InternalErrorRejection(message)

NotAllowedUserStatusRejection dataclass

NotAllowedUserStatusRejection(message)

NotFoundRejection dataclass

NotFoundRejection(message, id)

Bases: BaseMutationRejection

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/mutation_rejection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        message
        id
    }
    """
id instance-attribute
id

NotReachableConsentStatusRejection dataclass

NotReachableConsentStatusRejection(
    message, current_status, unreachable_status
)

Bases: BaseMutationRejection

current_status instance-attribute
current_status
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/mutation_rejection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        message
        currentStatus
        unreachableStatus
    }
    """
unreachable_status instance-attribute
unreachable_status

OperationNotAllowedRejection dataclass

OperationNotAllowedRejection(message)

PaymentMandateReferenceAlreadyUsedRejection dataclass

PaymentMandateReferenceAlreadyUsedRejection(message)

PaymentMethodNotCompatibleRejection dataclass

PaymentMethodNotCompatibleRejection(message)

SchemeWrongRejection dataclass

SchemeWrongRejection(message)

ServerConsentSignatureNotValidRejection dataclass

ServerConsentSignatureNotValidRejection(message)

SmsProviderRejection dataclass

SmsProviderRejection(message)

UserBlockedRejection dataclass

UserBlockedRejection(message)

UserNotCardHolderRejection dataclass

UserNotCardHolderRejection(message)

ValidationRejection dataclass

ValidationRejection(message, fields)

Bases: BaseMutationRejection

ValidationFieldError dataclass
ValidationFieldError(code, message, path)
code instance-attribute
code
message instance-attribute
message
path instance-attribute
path
fields instance-attribute
fields
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/mutation_rejection.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        message
        fields {
            code
            message
            path
        }
    }
    """

WrongCodeRejection dataclass

WrongCodeRejection(message)

page_info

PageInfo dataclass

PageInfo(
    has_next_page,
    has_previous_page,
    start_cursor,
    end_cursor,
)

Bases: SwanEntity

__post_init__
__post_init__()
Source code in shared/services/payment_providers/swan/entities/page_info.py
def __post_init__(self):  # type: ignore[no-untyped-def]
    if self.has_next_page:
        raise Exception("Connection has not been paginated! Fix code.")
end_cursor instance-attribute
end_cursor
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/page_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
    }
    """
has_next_page instance-attribute
has_next_page
has_previous_page instance-attribute
has_previous_page
start_cursor instance-attribute
start_cursor

payment

Payment dataclass

Payment(id, status_info, transactions)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/payment.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        statusInfo {PaymentStatusInfo.get_graphql_schema()}
        transactions {{
            edges {{
                node {{
                    id
                }}
            }}
        }}
    }}
    """
id instance-attribute
id
status_info instance-attribute
status_info
transaction_ids property
transaction_ids
transactions instance-attribute
transactions

payment_mandate

PaymentMandate dataclass

PaymentMandate(id, status_info, account_holder, created_at)

Bases: SwanEntity

account_holder instance-attribute
account_holder
created_at instance-attribute
created_at
deserialize classmethod
deserialize(kvs, infer_missing=False)
Source code in shared/services/payment_providers/swan/entities/payment_mandate.py
@classmethod
def deserialize(cls, kvs: dict, infer_missing: bool = False):  # type: ignore[type-arg,no-untyped-def]
    from dataclasses_json.core import _decode_dataclass

    # We do not support other types of payment mandates at the moment
    return _decode_dataclass(  # type: ignore[no-untyped-call]
        cls=SepaPaymentDirectDebitMandate, kvs=kvs, infer_missing=infer_missing
    )
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/payment_mandate.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        statusInfo {PaymentMandateStatusInfo.get_graphql_schema()}
        accountHolder {AccountHolder.get_graphql_schema()}
        createdAt
        ... on SEPAPaymentDirectDebitMandate {SepaPaymentDirectDebitMandate.get_graphql_schema()}
    }}
    """
id instance-attribute
id
status_info instance-attribute
status_info

SepaPaymentDirectDebitMandate dataclass

SepaPaymentDirectDebitMandate(
    id,
    status_info,
    account_holder,
    created_at,
    reference,
    debtor,
    creditor,
)

Bases: PaymentMandate

creditor instance-attribute
creditor
debtor instance-attribute
debtor
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/payment_mandate.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        reference
        debtor {SepaPaymentMandateDebtor.get_graphql_schema()}
        creditor {SepaPaymentMandateCreditor.get_graphql_schema()}
    }}
    """
reference instance-attribute
reference

payment_mandate_status_info

PaymentMandateStatusInfo dataclass

PaymentMandateStatusInfo(status)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/payment_mandate_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        status
    }
    """
status instance-attribute
status

payment_status_info

PaymentStatusInfo dataclass

PaymentStatusInfo(status, consent=None)

Bases: SwanEntity

consent class-attribute instance-attribute
consent = None
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/payment_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        status
        ... on PaymentConsentPending {{
            consent {Consent.get_graphql_schema()}
        }}
    }}
    """
status instance-attribute
status

physical_card

PhysicalCard dataclass

PhysicalCard(
    status_info,
    expiry_date,
    card_masked_number,
    previous_physical_cards,
)

Bases: SwanEntity

card_masked_number instance-attribute
card_masked_number
expiry_date instance-attribute
expiry_date
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/physical_card.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        statusInfo {PhysicalCardStatusInfo.get_graphql_schema()}
        expiryDate
        cardMaskedNumber
        previousPhysicalCards {BasicPhysicalCardInfo.get_graphql_schema()}
    }}
    """
previous_physical_cards instance-attribute
previous_physical_cards
status_info instance-attribute
status_info

physical_card_status_info

PhysicalCardStatusInfo dataclass

PhysicalCardStatusInfo(status)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/physical_card_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        status
    }
    """
status instance-attribute
status

sepa_direct_debit_mandate

SepaDirectDebitMandate dataclass

SepaDirectDebitMandate(id)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/sepa_direct_debit_mandate.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        id
    }
    """
id instance-attribute
id

sepa_payment_mandate_creditor

SepaPaymentMandateCreditor dataclass

SepaPaymentMandateCreditor(id, identifier, name)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/sepa_payment_mandate_creditor.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        id
        identifier
        name
    }
    """
id instance-attribute
id
identifier instance-attribute
identifier
name instance-attribute
name

sepa_payment_mandate_debtor

SepaPaymentMandateDebtor dataclass

SepaPaymentMandateDebtor(name, iban, country)

Bases: SwanEntity

country instance-attribute
country
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/sepa_payment_mandate_debtor.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        name
        iban
        country
    }
    """
iban instance-attribute
iban
name instance-attribute
name

spending_limit

SpendingLimit dataclass

SpendingLimit(type, period, amount)

Bases: SwanEntity

amount instance-attribute
amount
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/spending_limit.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        type
        period
        amount {Amount.get_graphql_schema()}
    }}
    """
period instance-attribute
period
type instance-attribute
type

start_user_creation_payload

StartUserCreationPayload dataclass

StartUserCreationPayload(request_id)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/start_user_creation_payload.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        requestId
    }
    """
request_id instance-attribute
request_id

swan_datetime

SwanDatetime

Bases: str

Custom datetime implementation for Swan API.

Avoids: - The need to declare the serialization/deserialization config everytime we have a datetime field - The need to init the dataclass field with this config (and then the need to put the field at the end of the dataclass)

as_date
as_date()
Source code in shared/services/payment_providers/swan/entities/swan_datetime.py
def as_date(self) -> date:
    return self.as_datetime().date()
as_datetime
as_datetime()
Source code in shared/services/payment_providers/swan/entities/swan_datetime.py
def as_datetime(self) -> datetime:
    # We recreate a new datetime from the parsed one, to remove the timezone info and build a offset-naive datetime, so it can be compared with other datetime objects.
    # See https://alanhealth.slack.com/archives/C19FZEB41/p1726143724298549
    return datetime.fromtimestamp(datetime.fromisoformat(self).timestamp())

swan_entity

SwanEntity

Bases: DataClassJsonMixin, ABC

dataclass_json_config class-attribute instance-attribute
dataclass_json_config = config(letter_case=CAMEL)[
    "dataclasses_json"
]
get_graphql_schema abstractmethod classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/swan_entity.py
@classmethod
@abstractmethod
def get_graphql_schema(cls) -> str:
    pass

transaction

CardTransaction dataclass

CardTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
    original_amount,
    merchant,
    card_details,
)

Bases: Transaction

card_details instance-attribute
card_details
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        originalAmount {Amount.get_graphql_schema()}
        merchant {CardMerchant.get_graphql_schema()}
        cardDetails {CardDetails.get_graphql_schema()}
    }}
    """
merchant instance-attribute
merchant
original_amount instance-attribute
original_amount

CheckTransaction dataclass

CheckTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
)

Bases: Transaction

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    raise NotImplementedError()

FeeTransaction dataclass

FeeTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
    counterparty,
)

Bases: Transaction

counterparty instance-attribute
counterparty
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        counterparty
    }
    """

InternalCreditTransferTransaction dataclass

InternalCreditTransferTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
)

Bases: Transaction

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    raise NotImplementedError()

InternalDirectDebitTransaction dataclass

InternalDirectDebitTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
)

Bases: Transaction

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    raise NotImplementedError()

SepaCreditTransferTransaction dataclass

SepaCreditTransferTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
    counterparty,
    beneficiary,
)

Bases: Transaction

beneficiary instance-attribute
beneficiary
counterparty instance-attribute
counterparty
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        counterparty
        beneficiary {Beneficiary.get_graphql_schema()}
    }}
    """

SepaDirectDebitTransaction dataclass

SepaDirectDebitTransaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
    counterparty,
    mandate,
    return_reason,
)

Bases: Transaction

counterparty instance-attribute
counterparty
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        counterparty
        mandate {SepaDirectDebitMandate.get_graphql_schema()}
        returnReason
    }}
    """
mandate instance-attribute
mandate
return_reason instance-attribute
return_reason

Transaction dataclass

Transaction(
    id,
    type,
    payment_product,
    account,
    side,
    amount,
    execution_date,
    status_info,
    payment_id,
    origin_transaction,
    created_at,
)

Bases: SwanEntity

OriginTransaction dataclass
OriginTransaction(id, execution_date)

Bases: SwanEntity

execution_date instance-attribute
execution_date
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        id
        executionDate
    }
    """
id instance-attribute
id
account instance-attribute
account
amount instance-attribute
amount
created_at instance-attribute
created_at
deserialize classmethod
deserialize(kvs, infer_missing=False)
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def deserialize(cls, kvs: dict, infer_missing: bool = False) -> Transaction:  # type: ignore[type-arg]
    from dataclasses_json.core import _decode_dataclass

    mappings = {
        PaymentProduct.card: CardTransaction,
        PaymentProduct.check: CheckTransaction,
        PaymentProduct.fees: FeeTransaction,
        PaymentProduct.internal_credit_transfer: InternalCreditTransferTransaction,
        PaymentProduct.internal_direct_debit: InternalDirectDebitTransaction,
        PaymentProduct.sepa_credit_transfer: SepaCreditTransferTransaction,
        PaymentProduct.sepa_direct_debit: SepaDirectDebitTransaction,
    }
    payment_product = kvs["paymentProduct"]

    if payment_product not in mappings:
        raise ValueError(f"Unexpected payment product [{payment_product}]")

    target_type = mappings[payment_product]
    return _decode_dataclass(cls=target_type, kvs=kvs, infer_missing=infer_missing)  # type: ignore[no-any-return,no-untyped-call]
execution_date instance-attribute
execution_date
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        id
        type
        paymentProduct
        account {Account.get_graphql_schema()}
        side
        amount {Amount.get_graphql_schema()}
        executionDate
        statusInfo {TransactionStatusInfo.get_graphql_schema()}
        paymentId
        originTransaction {Transaction.OriginTransaction.get_graphql_schema()}
        createdAt
        ... on CardTransaction {CardTransaction.get_graphql_schema()}
        ... on SEPACreditTransferTransaction {SepaCreditTransferTransaction.get_graphql_schema()}
        ... on SEPADirectDebitTransaction {SepaDirectDebitTransaction.get_graphql_schema()}
        ... on FeeTransaction {FeeTransaction.get_graphql_schema()}
    }}
    """
id instance-attribute
id
origin_transaction instance-attribute
origin_transaction
payment_id instance-attribute
payment_id
payment_product instance-attribute
payment_product
side instance-attribute
side
status_info instance-attribute
status_info
type instance-attribute
type

transaction_status_info

TransactionStatusInfo dataclass

TransactionStatusInfo(
    status, release_date=None, reason=None
)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/transaction_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        status
        ... on ReleasedTransactionStatusInfo {
            releaseDate
        }
        ... on RejectedTransactionStatusInfo {
            reason
        }
    }
    """
reason class-attribute instance-attribute
reason = None
release_date class-attribute instance-attribute
release_date = None
status instance-attribute
status

trusted_beneficiary_status_info

TrustedBeneficiaryStatusInfo dataclass

TrustedBeneficiaryStatusInfo(status, consent=None)

Bases: SwanEntity

consent class-attribute instance-attribute
consent = None
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/trusted_beneficiary_status_info.py
@classmethod
def get_graphql_schema(cls) -> str:
    return f"""{{
        status
        ... on TrustedBeneficiaryConsentPendingStatusInfo {{
            consent {Consent.get_graphql_schema()}
        }}
    }}
    """
status instance-attribute
status

user

User dataclass

User(
    id,
    first_name,
    last_name,
    birth_date,
    mobile_phone_number,
)

Bases: SwanEntity

birth_date instance-attribute
birth_date
first_name instance-attribute
first_name
get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/user.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
        id
        firstName
        lastName
        birthDate
        mobilePhoneNumber
    }
    """
id instance-attribute
id
last_name instance-attribute
last_name
mobile_phone_number instance-attribute
mobile_phone_number

wallet_provider

WalletProvider dataclass

WalletProvider(id, name)

Bases: SwanEntity

get_graphql_schema classmethod
get_graphql_schema()
Source code in shared/services/payment_providers/swan/entities/wallet_provider.py
@classmethod
def get_graphql_schema(cls) -> str:
    return """{
       id
       name
    }
    """
id instance-attribute
id
name instance-attribute
name

shared.services.payment_providers.swan.enums

account_holder_type

AccountHolderType

Bases: AlanBaseEnum

company class-attribute instance-attribute
company = 'Company'
individual class-attribute instance-attribute
individual = 'Individual'

account_language

AccountLanguage

Bases: AlanBaseEnum

de class-attribute instance-attribute
de = 'de'
en class-attribute instance-attribute
en = 'en'
es class-attribute instance-attribute
es = 'es'
fr class-attribute instance-attribute
fr = 'fr'
it class-attribute instance-attribute
it = 'it'
nl class-attribute instance-attribute
nl = 'nl'
pt class-attribute instance-attribute
pt = 'pt'

account_membership_status

AccountMembershipStatus

Bases: AlanBaseEnum

binding_user_error class-attribute instance-attribute
binding_user_error = 'BindingUserError'
consent_pending class-attribute instance-attribute
consent_pending = 'ConsentPending'
disabled class-attribute instance-attribute
disabled = 'Disabled'
enabled class-attribute instance-attribute
enabled = 'Enabled'
invitation_sent class-attribute instance-attribute
invitation_sent = 'InvitationSent'
suspended class-attribute instance-attribute
suspended = 'Suspended'

account_status

AccountStatus

Bases: AlanBaseEnum

closed class-attribute instance-attribute
closed = 'Closed'
closing class-attribute instance-attribute
closing = 'Closing'
opened class-attribute instance-attribute
opened = 'Opened'
suspended class-attribute instance-attribute
suspended = 'Suspended'

card_status

CardStatus

Bases: AlanBaseEnum

canceled class-attribute instance-attribute
canceled = 'Canceled'
canceling class-attribute instance-attribute
canceling = 'Canceling'
consent_pending class-attribute instance-attribute
consent_pending = 'ConsentPending'
enabled class-attribute instance-attribute
enabled = 'Enabled'
processing class-attribute instance-attribute
processing = 'Processing'

consent_purpose

ConsentPurpose

Bases: AlanBaseEnum

accept_partnership_conditions class-attribute instance-attribute
accept_partnership_conditions = (
    "AcceptPartnershipConditions"
)
activate_physical_card class-attribute instance-attribute
activate_physical_card = 'ActivatePhysicalCard'
add_account_membership class-attribute instance-attribute
add_account_membership = 'AddAccountMembership'
add_account_memberships class-attribute instance-attribute
add_account_memberships = 'AddAccountMemberships'
add_beneficiary class-attribute instance-attribute
add_beneficiary = 'AddBeneficiary'
add_card class-attribute instance-attribute
add_card = 'AddCard'
add_cards class-attribute instance-attribute
add_cards = 'AddCards'
add_digital_card class-attribute instance-attribute
add_digital_card = 'AddDigitalCard'
add_direct_debit_payment_mandate class-attribute instance-attribute
add_direct_debit_payment_mandate = (
    "AddDirectDebitPaymentMandate"
)
close_account class-attribute instance-attribute
close_account = 'CloseAccount'
consent_to_multiple_consents class-attribute instance-attribute
consent_to_multiple_consents = 'ConsentToMultipleConsents'
enable_mandate class-attribute instance-attribute
enable_mandate = 'EnableMandate'
init_payment class-attribute instance-attribute
init_payment = 'InitPayment'
initiate_funding_request class-attribute instance-attribute
initiate_funding_request = 'InitiateFundingRequest'
initiate_instant_funding_request class-attribute instance-attribute
initiate_instant_funding_request = (
    "InitiateInstantFundingRequest"
)
initiate_international_credit_transfer class-attribute instance-attribute
initiate_international_credit_transfer = (
    "InitiateInternationalCreditTransfer"
)
print_physical_card class-attribute instance-attribute
print_physical_card = 'PrintPhysicalCard'
resume_account_membership class-attribute instance-attribute
resume_account_membership = 'ResumeAccountMembership'
resume_physical_card class-attribute instance-attribute
resume_physical_card = 'ResumePhysicalCard'
return_transaction_for_direct_debit class-attribute instance-attribute
return_transaction_for_direct_debit = (
    "ReturnTransactionForDirectDebit"
)
schedule_standing_order class-attribute instance-attribute
schedule_standing_order = 'ScheduleStandingOrder'
update_account_membership class-attribute instance-attribute
update_account_membership = 'UpdateAccountMembership'
update_card class-attribute instance-attribute
update_card = 'UpdateCard'
update_server_consent_project_settings = (
    "UpdateServerConsentProjectSettings"
)
view_card_numbers class-attribute instance-attribute
view_card_numbers = 'ViewCardNumbers'
view_physical_card_pin class-attribute instance-attribute
view_physical_card_pin = 'ViewPhysicalCardPin'

consent_status

ConsentStatus

Bases: AlanBaseEnum

accepted class-attribute instance-attribute
accepted = 'Accepted'
canceled class-attribute instance-attribute
canceled = 'Canceled'
created class-attribute instance-attribute
created = 'Created'
customer_refused class-attribute instance-attribute
customer_refused = 'CustomerRefused'
expired class-attribute instance-attribute
expired = 'Expired'
failed class-attribute instance-attribute
failed = 'Failed'
operation_committing class-attribute instance-attribute
operation_committing = 'OperationCommitting'
started class-attribute instance-attribute
started = 'Started'

otp_locale

OtpLocale

Bases: AlanBaseEnum

af class-attribute instance-attribute
af = 'af'
ar class-attribute instance-attribute
ar = 'ar'
ca class-attribute instance-attribute
ca = 'ca'
cs class-attribute instance-attribute
cs = 'cs'
da class-attribute instance-attribute
da = 'da'
de class-attribute instance-attribute
de = 'de'
el class-attribute instance-attribute
el = 'el'
en class-attribute instance-attribute
en = 'en'
es class-attribute instance-attribute
es = 'es'
et class-attribute instance-attribute
et = 'et'
fi class-attribute instance-attribute
fi = 'fi'
fr class-attribute instance-attribute
fr = 'fr'
he class-attribute instance-attribute
he = 'he'
hi class-attribute instance-attribute
hi = 'hi'
hr class-attribute instance-attribute
hr = 'hr'
hu class-attribute instance-attribute
hu = 'hu'
id class-attribute instance-attribute
id = 'id'
it class-attribute instance-attribute
it = 'it'
ja class-attribute instance-attribute
ja = 'ja'
kn class-attribute instance-attribute
kn = 'kn'
ko class-attribute instance-attribute
ko = 'ko'
lt class-attribute instance-attribute
lt = 'lt'
mr class-attribute instance-attribute
mr = 'mr'
ms class-attribute instance-attribute
ms = 'ms'
nb class-attribute instance-attribute
nb = 'nb'
nl class-attribute instance-attribute
nl = 'nl'
pl class-attribute instance-attribute
pl = 'pl'
pt class-attribute instance-attribute
pt = 'pt'
ro class-attribute instance-attribute
ro = 'ro'
ru class-attribute instance-attribute
ru = 'ru'
sk class-attribute instance-attribute
sk = 'sk'
sv class-attribute instance-attribute
sv = 'sv'
te class-attribute instance-attribute
te = 'te'
th class-attribute instance-attribute
th = 'th'
tl class-attribute instance-attribute
tl = 'tl'
tr class-attribute instance-attribute
tr = 'tr'
uk class-attribute instance-attribute
uk = 'uk'
vi class-attribute instance-attribute
vi = 'vi'
zh class-attribute instance-attribute
zh = 'zh'

payment_mandate_status

PaymentMandateStatus

Bases: AlanBaseEnum

canceled class-attribute instance-attribute
canceled = 'Canceled'
consent_pending class-attribute instance-attribute
consent_pending = 'ConsentPending'
enabled class-attribute instance-attribute
enabled = 'Enabled'
rejected class-attribute instance-attribute
rejected = 'Rejected'

payment_product

PaymentProduct

Bases: AlanBaseEnum

card class-attribute instance-attribute
card = 'Card'
check class-attribute instance-attribute
check = 'Check'
fees class-attribute instance-attribute
fees = 'Fees'
internal_credit_transfer class-attribute instance-attribute
internal_credit_transfer = 'InternalCreditTransfer'
internal_direct_debit class-attribute instance-attribute
internal_direct_debit = 'InternalDirectDebit'
international_credit_transfer class-attribute instance-attribute
international_credit_transfer = (
    "InternationalCreditTransfer"
)
sepa_credit_transfer class-attribute instance-attribute
sepa_credit_transfer = 'SEPACreditTransfer'
sepa_direct_debit class-attribute instance-attribute
sepa_direct_debit = 'SEPADirectDebit'

payment_status

PaymentStatus

Bases: AlanBaseEnum

consent_pending class-attribute instance-attribute
consent_pending = 'ConsentPending'
initiated class-attribute instance-attribute
initiated = 'Initiated'
rejected class-attribute instance-attribute
rejected = 'Rejected'

physical_card_status

PhysicalCardStatus

Bases: AlanBaseEnum

activated class-attribute instance-attribute
activated = 'Activated'
canceled class-attribute instance-attribute
canceled = 'Canceled'
canceling class-attribute instance-attribute
canceling = 'Canceling'
consent_pending class-attribute instance-attribute
consent_pending = 'ConsentPending'
processing class-attribute instance-attribute
processing = 'Processing'
renewed class-attribute instance-attribute
renewed = 'Renewed'
suspended class-attribute instance-attribute
suspended = 'Suspended'
to_activate class-attribute instance-attribute
to_activate = 'ToActivate'
to_renew class-attribute instance-attribute
to_renew = 'ToRenew'

provisioning_type

ProvisioningType

Bases: AlanBaseEnum

Enum representing the source of digital card creation.

Attributes:

Name Type Description
manual

Created by direct input of the PAN into a wallet application, possibly using the device camera.

card_on_file

Created based on a PAN stored in a merchant application (e.g., iTunes).

in_app

Created by in-app provisioning.

unknown

The source of digitalization could not be determined.

card_on_file class-attribute instance-attribute
card_on_file = 'CardOnFile'
in_app class-attribute instance-attribute
in_app = 'InApp'
manual class-attribute instance-attribute
manual = 'Manual'
unknown class-attribute instance-attribute
unknown = 'Unknown'

rejected_reason_code

RejectedReasonCode

Bases: AlanBaseEnum

account_closed class-attribute instance-attribute
account_closed = 'AccountClosed'
account_holder_deceased class-attribute instance-attribute
account_holder_deceased = 'AccountHolderDeceased'
account_membership_refused class-attribute instance-attribute
account_membership_refused = 'AccountMembershipRefused'
account_suspended class-attribute instance-attribute
account_suspended = 'AccountSuspended'
account_unknown class-attribute instance-attribute
account_unknown = 'AccountUnknown'
amount_mismatch class-attribute instance-attribute
amount_mismatch = 'AmountMismatch'
bank_refused class-attribute instance-attribute
bank_refused = 'BankRefused'
beneficiary_bank_not_reachable class-attribute instance-attribute
beneficiary_bank_not_reachable = (
    "BeneficiaryBankNotReachable"
)
beneficiary_mismatch class-attribute instance-attribute
beneficiary_mismatch = 'BeneficiaryMismatch'
beneficiary_missing_or_incorrect class-attribute instance-attribute
beneficiary_missing_or_incorrect = (
    "BeneficiaryMissingOrIncorrect"
)
canceled_by_card_holder class-attribute instance-attribute
canceled_by_card_holder = 'CanceledByCardHolder'
card_expired class-attribute instance-attribute
card_expired = 'CardExpired'
card_not_activated class-attribute instance-attribute
card_not_activated = 'CardNotActivated'
card_number_invalid class-attribute instance-attribute
card_number_invalid = 'CardNumberInvalid'
card_out_of_order class-attribute instance-attribute
card_out_of_order = 'CardOutOfOrder'
card_permanently_blocked class-attribute instance-attribute
card_permanently_blocked = 'CardPermanentlyBlocked'
card_suspended class-attribute instance-attribute
card_suspended = 'CardSuspended'
card_unknown class-attribute instance-attribute
card_unknown = 'CardUnknown'
cardholder_cancellation class-attribute instance-attribute
cardholder_cancellation = 'CardholderCancellation'
check_not_received class-attribute instance-attribute
check_not_received = 'CheckNotReceived'
check_received_late class-attribute instance-attribute
check_received_late = 'CheckReceivedLate'
creditor_bank_offline class-attribute instance-attribute
creditor_bank_offline = 'CreditorBankOffline'
creditor_bank_technical_error_occurred class-attribute instance-attribute
creditor_bank_technical_error_occurred = (
    "CreditorBankTechnicalErrorOccurred"
)
creditor_bank_timeout class-attribute instance-attribute
creditor_bank_timeout = 'CreditorBankTimeout'
date_invalid class-attribute instance-attribute
date_invalid = 'DateInvalid'
date_missing class-attribute instance-attribute
date_missing = 'DateMissing'
debtor_account_closed class-attribute instance-attribute
debtor_account_closed = 'DebtorAccountClosed'
debtor_account_consumer class-attribute instance-attribute
debtor_account_consumer = 'DebtorAccountConsumer'
debtor_account_unknown class-attribute instance-attribute
debtor_account_unknown = 'DebtorAccountUnknown'
debtor_bank_offline class-attribute instance-attribute
debtor_bank_offline = 'DebtorBankOffline'
debtor_bank_technical_error_occurred class-attribute instance-attribute
debtor_bank_technical_error_occurred = (
    "DebtorBankTechnicalErrorOccurred"
)
debtor_bank_timeout class-attribute instance-attribute
debtor_bank_timeout = 'DebtorBankTimeout'
debtor_deceased class-attribute instance-attribute
debtor_deceased = 'DebtorDeceased'
debtor_name_missing class-attribute instance-attribute
debtor_name_missing = 'DebtorNameMissing'
digital_card_deactivated class-attribute instance-attribute
digital_card_deactivated = 'DigitalCardDeactivated'
digital_card_enrollment_invalid class-attribute instance-attribute
digital_card_enrollment_invalid = (
    "DigitalCardEnrollmentInvalid"
)
digital_card_refusal class-attribute instance-attribute
digital_card_refusal = 'DigitalCardRefusal'
digital_card_suspended class-attribute instance-attribute
digital_card_suspended = 'DigitalCardSuspended'
digital_card_token_invalid class-attribute instance-attribute
digital_card_token_invalid = 'DigitalCardTokenInvalid'
digital_wallet_deactivated class-attribute instance-attribute
digital_wallet_deactivated = 'DigitalWalletDeactivated'
digital_wallet_enrolment_invalid class-attribute instance-attribute
digital_wallet_enrolment_invalid = (
    "DigitalWalletEnrolmentInvalid"
)
digital_wallet_refusal class-attribute instance-attribute
digital_wallet_refusal = 'DigitalWalletRefusal'
digital_wallet_suspended class-attribute instance-attribute
digital_wallet_suspended = 'DigitalWalletSuspended'
digital_wallet_token_invalid class-attribute instance-attribute
digital_wallet_token_invalid = 'DigitalWalletTokenInvalid'
do_not_honor class-attribute instance-attribute
do_not_honor = 'DoNotHonor'
endorsement_missing class-attribute instance-attribute
endorsement_missing = 'EndorsementMissing'
fraud_suspected class-attribute instance-attribute
fraud_suspected = 'FraudSuspected'
iban_invalid class-attribute instance-attribute
iban_invalid = 'IbanInvalid'
iban_suspended class-attribute instance-attribute
iban_suspended = 'IbanSuspended'
in_person_transactions_not_authorized class-attribute instance-attribute
in_person_transactions_not_authorized = (
    "InPersonTransactionsNotAuthorized"
)
insufficient_funds class-attribute instance-attribute
insufficient_funds = 'InsufficientFunds'
invalid_amount class-attribute instance-attribute
invalid_amount = 'InvalidAmount'
invalid_expiration_date class-attribute instance-attribute
invalid_expiration_date = 'InvalidExpirationDate'
invalid_or_missing_amount class-attribute instance-attribute
invalid_or_missing_amount = 'InvalidOrMissingAmount'
invalid_pin class-attribute instance-attribute
invalid_pin = 'InvalidPin'
invalid_pin_attempts_exceeded class-attribute instance-attribute
invalid_pin_attempts_exceeded = "InvalidPinAttemptsExceeded"
invalid_security_number class-attribute instance-attribute
invalid_security_number = 'InvalidSecurityNumber'
invalid_transfer_date class-attribute instance-attribute
invalid_transfer_date = 'InvalidTransferDate'
magstripe_not_supported class-attribute instance-attribute
magstripe_not_supported = 'MagstripeNotSupported'
mandate_invalid class-attribute instance-attribute
mandate_invalid = 'MandateInvalid'
merchant_not_found class-attribute instance-attribute
merchant_not_found = 'MerchantNotFound'
merchant_should_resubmit_authorization class-attribute instance-attribute
merchant_should_resubmit_authorization = (
    "MerchantShouldResubmitAuthorization"
)
missing_expiration_date class-attribute instance-attribute
missing_expiration_date = 'MissingExpirationDate'
missing_pin class-attribute instance-attribute
missing_pin = 'MissingPin'
no_mandate class-attribute instance-attribute
no_mandate = 'NoMandate'
partner_refused class-attribute instance-attribute
partner_refused = 'PartnerRefused'
partner_technical_error_occurred class-attribute instance-attribute
partner_technical_error_occurred = (
    "PartnerTechnicalErrorOccurred"
)
period_amount_limit_exceeded class-attribute instance-attribute
period_amount_limit_exceeded = 'PeriodAmountLimitExceeded'
period_nb_transaction_limit_exceeded class-attribute instance-attribute
period_nb_transaction_limit_exceeded = (
    "PeriodNbTransactionLimitExceeded"
)
period_transaction_number_limit_exceeded class-attribute instance-attribute
period_transaction_number_limit_exceeded = (
    "PeriodTransactionNumberLimitExceeded"
)
pin_invalid class-attribute instance-attribute
pin_invalid = 'PinInvalid'
pin_required class-attribute instance-attribute
pin_required = 'PinRequired'
pin_required_for_further_transaction class-attribute instance-attribute
pin_required_for_further_transaction = (
    "PinRequiredForFurtherTransaction"
)
reason_not_specified_by_bank class-attribute instance-attribute
reason_not_specified_by_bank = 'ReasonNotSpecifiedByBank'
reason_not_specified_by_debtor class-attribute instance-attribute
reason_not_specified_by_debtor = (
    "ReasonNotSpecifiedByDebtor"
)
regulatory_reason class-attribute instance-attribute
regulatory_reason = 'RegulatoryReason'
retry_with_chip_and_pin class-attribute instance-attribute
retry_with_chip_and_pin = 'RetryWithChipAndPin'
signature_missing class-attribute instance-attribute
signature_missing = 'SignatureMissing'
suspicious_check class-attribute instance-attribute
suspicious_check = 'SuspiciousCheck'
swan_offline class-attribute instance-attribute
swan_offline = 'SwanOffline'
swan_refused class-attribute instance-attribute
swan_refused = 'SwanRefused'
swan_technical_error_occurred class-attribute instance-attribute
swan_technical_error_occurred = "SwanTechnicalErrorOccurred"
swan_timeout class-attribute instance-attribute
swan_timeout = 'SwanTimeout'
terms_and_conditions_limit_exceeded class-attribute instance-attribute
terms_and_conditions_limit_exceeded = (
    "TermsAndConditionsLimitExceeded"
)
three_ds_error class-attribute instance-attribute
three_ds_error = 'ThreeDsError'
transaction_amount_limit_exceeded class-attribute instance-attribute
transaction_amount_limit_exceeded = (
    "TransactionAmountLimitExceeded"
)
transaction_currency_incorrect class-attribute instance-attribute
transaction_currency_incorrect = (
    "TransactionCurrencyIncorrect"
)
transaction_duplicated class-attribute instance-attribute
transaction_duplicated = 'TransactionDuplicated'
transaction_on_account_type_not_allowed class-attribute instance-attribute
transaction_on_account_type_not_allowed = (
    "TransactionOnAccountTypeNotAllowed"
)
transaction_type_not_allowed class-attribute instance-attribute
transaction_type_not_allowed = 'TransactionTypeNotAllowed'

spending_limit_period

SpendingLimitPeriod

Bases: AlanBaseEnum

always class-attribute instance-attribute
always = 'Always'
daily class-attribute instance-attribute
daily = 'Daily'
monthly class-attribute instance-attribute
monthly = 'Monthly'
weekly class-attribute instance-attribute
weekly = 'Weekly'

spending_limit_type

SpendingLimitType

Bases: AlanBaseEnum

account_holder class-attribute instance-attribute
account_holder = 'AccountHolder'
partner class-attribute instance-attribute
partner = 'Partner'

transaction_reason_code

TransactionReasonCode

Bases: AlanBaseEnum

account_closed class-attribute instance-attribute
account_closed = 'AccountClosed'
account_holder_deceased class-attribute instance-attribute
account_holder_deceased = 'AccountHolderDeceased'
account_limited class-attribute instance-attribute
account_limited = 'AccountLimited'
account_suspended class-attribute instance-attribute
account_suspended = 'AccountSuspended'
account_unknown class-attribute instance-attribute
account_unknown = 'AccountUnknown'
bank_refused class-attribute instance-attribute
bank_refused = 'BankRefused'
beneficiary_account_blocked class-attribute instance-attribute
beneficiary_account_blocked = 'BeneficiaryAccountBlocked'
beneficiary_account_closed class-attribute instance-attribute
beneficiary_account_closed = 'BeneficiaryAccountClosed'
beneficiary_account_incorrect class-attribute instance-attribute
beneficiary_account_incorrect = (
    "BeneficiaryAccountIncorrect"
)
beneficiary_account_unknown class-attribute instance-attribute
beneficiary_account_unknown = 'BeneficiaryAccountUnknown'
beneficiary_bank_bic_invalid class-attribute instance-attribute
beneficiary_bank_bic_invalid = 'BeneficiaryBankBicInvalid'
beneficiary_bank_not_reachable class-attribute instance-attribute
beneficiary_bank_not_reachable = (
    "BeneficiaryBankNotReachable"
)
beneficiary_branch_code_invalid class-attribute instance-attribute
beneficiary_branch_code_invalid = (
    "BeneficiaryBranchCodeInvalid"
)
beneficiary_currency_invalid class-attribute instance-attribute
beneficiary_currency_invalid = 'BeneficiaryCurrencyInvalid'
beneficiary_deceased class-attribute instance-attribute
beneficiary_deceased = 'BeneficiaryDeceased'
beneficiary_id_number_invalid class-attribute instance-attribute
beneficiary_id_number_invalid = "BeneficiaryIdNumberInvalid"
beneficiary_phone_number_invalid class-attribute instance-attribute
beneficiary_phone_number_invalid = (
    "BeneficiaryPhoneNumberInvalid"
)
beneficiary_rut_number_invalid class-attribute instance-attribute
beneficiary_rut_number_invalid = (
    "BeneficiaryRutNumberInvalid"
)
beneficiary_tax_id_invalid class-attribute instance-attribute
beneficiary_tax_id_invalid = 'BeneficiaryTaxIdInvalid'
beneficiary_tax_id_suspended class-attribute instance-attribute
beneficiary_tax_id_suspended = 'BeneficiaryTaxIdSuspended'
card_expired class-attribute instance-attribute
card_expired = 'CardExpired'
card_not_activated class-attribute instance-attribute
card_not_activated = 'CardNotActivated'
card_permanently_blocked class-attribute instance-attribute
card_permanently_blocked = 'CardPermanentlyBlocked'
card_suspended class-attribute instance-attribute
card_suspended = 'CardSuspended'
check_blocked class-attribute instance-attribute
check_blocked = 'CheckBlocked'
check_invalid class-attribute instance-attribute
check_invalid = 'CheckInvalid'
check_number_invalid class-attribute instance-attribute
check_number_invalid = 'CheckNumberInvalid'
check_outdated class-attribute instance-attribute
check_outdated = 'CheckOutdated'
creditor_bank_offline class-attribute instance-attribute
creditor_bank_offline = 'CreditorBankOffline'
creditor_bank_technical_error_occurred class-attribute instance-attribute
creditor_bank_technical_error_occurred = (
    "CreditorBankTechnicalErrorOccurred"
)
creditor_bank_timeout class-attribute instance-attribute
creditor_bank_timeout = 'CreditorBankTimeout'
debtor_account_blocked class-attribute instance-attribute
debtor_account_blocked = 'DebtorAccountBlocked'
debtor_account_closed class-attribute instance-attribute
debtor_account_closed = 'DebtorAccountClosed'
debtor_account_consumer class-attribute instance-attribute
debtor_account_consumer = 'DebtorAccountConsumer'
debtor_account_unknown class-attribute instance-attribute
debtor_account_unknown = 'DebtorAccountUnknown'
debtor_bank_offline class-attribute instance-attribute
debtor_bank_offline = 'DebtorBankOffline'
debtor_bank_technical_error_occurred class-attribute instance-attribute
debtor_bank_technical_error_occurred = (
    "DebtorBankTechnicalErrorOccurred"
)
debtor_bank_timeout class-attribute instance-attribute
debtor_bank_timeout = 'DebtorBankTimeout'
debtor_deceased class-attribute instance-attribute
debtor_deceased = 'DebtorDeceased'
endorsement_missing_or_invalid class-attribute instance-attribute
endorsement_missing_or_invalid = (
    "EndorsementMissingOrInvalid"
)
fraudulent class-attribute instance-attribute
fraudulent = 'Fraudulent'
funds_already_transferred_back class-attribute instance-attribute
funds_already_transferred_back = (
    "FundsAlreadyTransferredBack"
)
insufficient_funds class-attribute instance-attribute
insufficient_funds = 'InsufficientFunds'
invalid_creditor_name class-attribute instance-attribute
invalid_creditor_name = 'InvalidCreditorName'
invalid_expiration_date class-attribute instance-attribute
invalid_expiration_date = 'InvalidExpirationDate'
invalid_pin class-attribute instance-attribute
invalid_pin = 'InvalidPin'
invalid_pin_attempts_exceeded class-attribute instance-attribute
invalid_pin_attempts_exceeded = "InvalidPinAttemptsExceeded"
invalid_security_number class-attribute instance-attribute
invalid_security_number = 'InvalidSecurityNumber'
legal_or_bank_decision class-attribute instance-attribute
legal_or_bank_decision = 'LegalOrBankDecision'
mandate_invalid class-attribute instance-attribute
mandate_invalid = 'MandateInvalid'
mandatory_reference_missing_on_check class-attribute instance-attribute
mandatory_reference_missing_on_check = (
    "MandatoryReferenceMissingOnCheck"
)
merchant_should_resubmit_authorization class-attribute instance-attribute
merchant_should_resubmit_authorization = (
    "MerchantShouldResubmitAuthorization"
)
no_answer_from_beneficiary class-attribute instance-attribute
no_answer_from_beneficiary = 'NoAnswerFromBeneficiary'
no_original_transaction_received class-attribute instance-attribute
no_original_transaction_received = (
    "NoOriginalTransactionReceived"
)
partner_refused class-attribute instance-attribute
partner_refused = 'PartnerRefused'
partner_technical_error_occurred class-attribute instance-attribute
partner_technical_error_occurred = (
    "PartnerTechnicalErrorOccurred"
)
period_amount_limit_exceeded class-attribute instance-attribute
period_amount_limit_exceeded = 'PeriodAmountLimitExceeded'
period_nb_transaction_limit_exceeded class-attribute instance-attribute
period_nb_transaction_limit_exceeded = (
    "PeriodNbTransactionLimitExceeded"
)
pin_required_for_further_transaction class-attribute instance-attribute
pin_required_for_further_transaction = (
    "PinRequiredForFurtherTransaction"
)
reason_not_specified_by_bank class-attribute instance-attribute
reason_not_specified_by_bank = 'ReasonNotSpecifiedByBank'
reason_not_specified_by_beneficiary class-attribute instance-attribute
reason_not_specified_by_beneficiary = (
    "ReasonNotSpecifiedByBeneficiary"
)
reason_not_specified_by_debtor class-attribute instance-attribute
reason_not_specified_by_debtor = (
    "ReasonNotSpecifiedByDebtor"
)
reason_not_specified_by_originator class-attribute instance-attribute
reason_not_specified_by_originator = (
    "ReasonNotSpecifiedByOriginator"
)
recall_accepted class-attribute instance-attribute
recall_accepted = 'RecallAccepted'
refund_requested_by_creditor class-attribute instance-attribute
refund_requested_by_creditor = 'RefundRequestedByCreditor'
refund_requested_by_debtor class-attribute instance-attribute
refund_requested_by_debtor = 'RefundRequestedByDebtor'
regulatory_reason class-attribute instance-attribute
regulatory_reason = 'RegulatoryReason'
rlmc_key_invalid class-attribute instance-attribute
rlmc_key_invalid = 'RlmcKeyInvalid'
signature_invalid class-attribute instance-attribute
signature_invalid = 'SignatureInvalid'
swan_offline class-attribute instance-attribute
swan_offline = 'SwanOffline'
swan_refused class-attribute instance-attribute
swan_refused = 'SwanRefused'
swan_technical_error_occurred class-attribute instance-attribute
swan_technical_error_occurred = "SwanTechnicalErrorOccurred"
swan_timeout class-attribute instance-attribute
swan_timeout = 'SwanTimeout'
target_currency_not_available class-attribute instance-attribute
target_currency_not_available = "TargetCurrencyNotAvailable"
technical_issue class-attribute instance-attribute
technical_issue = 'TechnicalIssue'
terms_and_conditions_limit_exceeded class-attribute instance-attribute
terms_and_conditions_limit_exceeded = (
    "TermsAndConditionsLimitExceeded"
)
transaction_amount_incorrect class-attribute instance-attribute
transaction_amount_incorrect = 'TransactionAmountIncorrect'
transaction_amount_limit_exceeded class-attribute instance-attribute
transaction_amount_limit_exceeded = (
    "TransactionAmountLimitExceeded"
)
transaction_duplicated class-attribute instance-attribute
transaction_duplicated = 'TransactionDuplicated'
transaction_on_account_type_not_allowed class-attribute instance-attribute
transaction_on_account_type_not_allowed = (
    "TransactionOnAccountTypeNotAllowed"
)
transaction_on_card_type_not_allowed class-attribute instance-attribute
transaction_on_card_type_not_allowed = (
    "TransactionOnCardTypeNotAllowed"
)
transaction_purpose_invalid class-attribute instance-attribute
transaction_purpose_invalid = 'TransactionPurposeInvalid'
transaction_reference_invalid class-attribute instance-attribute
transaction_reference_invalid = (
    "TransactionReferenceInvalid"
)
transaction_type_not_allowed class-attribute instance-attribute
transaction_type_not_allowed = 'TransactionTypeNotAllowed'

transaction_side

TransactionSide

Bases: AlanBaseEnum

credit class-attribute instance-attribute
credit = 'Credit'
debit class-attribute instance-attribute
debit = 'Debit'

transaction_status

TransactionStatus

Bases: AlanBaseEnum

booked class-attribute instance-attribute
booked = 'Booked'
canceled class-attribute instance-attribute
canceled = 'Canceled'
pending class-attribute instance-attribute
pending = 'Pending'
rejected class-attribute instance-attribute
rejected = 'Rejected'
released class-attribute instance-attribute
released = 'Released'
upcoming class-attribute instance-attribute
upcoming = 'Upcoming'

transaction_type

TransactionType

Bases: AlanBaseEnum

card_out_authorization class-attribute instance-attribute
card_out_authorization = 'CardOutAuthorization'
card_out_credit class-attribute instance-attribute
card_out_credit = 'CardOutCredit'
card_out_credit_reversal class-attribute instance-attribute
card_out_credit_reversal = 'CardOutCreditReversal'
card_out_debit class-attribute instance-attribute
card_out_debit = 'CardOutDebit'
card_out_debit_reversal class-attribute instance-attribute
card_out_debit_reversal = 'CardOutDebitReversal'
check_in class-attribute instance-attribute
check_in = 'CheckIn'
check_in_return class-attribute instance-attribute
check_in_return = 'CheckInReturn'
fees_in class-attribute instance-attribute
fees_in = 'FeesIn'
fees_out class-attribute instance-attribute
fees_out = 'FeesOut'
internal_credit_transfer_in class-attribute instance-attribute
internal_credit_transfer_in = 'InternalCreditTransferIn'
internal_credit_transfer_in_recall class-attribute instance-attribute
internal_credit_transfer_in_recall = (
    "InternalCreditTransferInRecall"
)
internal_credit_transfer_in_return class-attribute instance-attribute
internal_credit_transfer_in_return = (
    "InternalCreditTransferInReturn"
)
internal_credit_transfer_out class-attribute instance-attribute
internal_credit_transfer_out = 'InternalCreditTransferOut'
internal_credit_transfer_out_recall class-attribute instance-attribute
internal_credit_transfer_out_recall = (
    "InternalCreditTransferOutRecall"
)
internal_credit_transfer_out_return class-attribute instance-attribute
internal_credit_transfer_out_return = (
    "InternalCreditTransferOutReturn"
)
internal_direct_debit_in class-attribute instance-attribute
internal_direct_debit_in = 'InternalDirectDebitIn'
internal_direct_debit_in_return class-attribute instance-attribute
internal_direct_debit_in_return = (
    "InternalDirectDebitInReturn"
)
internal_direct_debit_out class-attribute instance-attribute
internal_direct_debit_out = 'InternalDirectDebitOut'
internal_direct_debit_out_return class-attribute instance-attribute
internal_direct_debit_out_return = (
    "InternalDirectDebitOutReturn"
)
international_credit_transfer_in class-attribute instance-attribute
international_credit_transfer_in = (
    "InternationalCreditTransferIn"
)
international_credit_transfer_in_return class-attribute instance-attribute
international_credit_transfer_in_return = (
    "InternationalCreditTransferInReturn"
)
international_credit_transfer_out class-attribute instance-attribute
international_credit_transfer_out = (
    "InternationalCreditTransferOut"
)
international_credit_transfer_out_return class-attribute instance-attribute
international_credit_transfer_out_return = (
    "InternationalCreditTransferOutReturn"
)
sepa_credit_transfer_in class-attribute instance-attribute
sepa_credit_transfer_in = 'SepaCreditTransferIn'
sepa_credit_transfer_in_recall class-attribute instance-attribute
sepa_credit_transfer_in_recall = (
    "SepaCreditTransferInRecall"
)
sepa_credit_transfer_in_return class-attribute instance-attribute
sepa_credit_transfer_in_return = (
    "SepaCreditTransferInReturn"
)
sepa_credit_transfer_out class-attribute instance-attribute
sepa_credit_transfer_out = 'SepaCreditTransferOut'
sepa_credit_transfer_out_recall class-attribute instance-attribute
sepa_credit_transfer_out_recall = (
    "SepaCreditTransferOutRecall"
)
sepa_credit_transfer_out_return class-attribute instance-attribute
sepa_credit_transfer_out_return = (
    "SepaCreditTransferOutReturn"
)
sepa_direct_debit_in class-attribute instance-attribute
sepa_direct_debit_in = 'SepaDirectDebitIn'
sepa_direct_debit_in_return class-attribute instance-attribute
sepa_direct_debit_in_return = 'SepaDirectDebitInReturn'
sepa_direct_debit_in_reversal class-attribute instance-attribute
sepa_direct_debit_in_reversal = 'SepaDirectDebitInReversal'
sepa_direct_debit_out class-attribute instance-attribute
sepa_direct_debit_out = 'SepaDirectDebitOut'
sepa_direct_debit_out_return class-attribute instance-attribute
sepa_direct_debit_out_return = 'SepaDirectDebitOutReturn'
sepa_direct_debit_out_reversal class-attribute instance-attribute
sepa_direct_debit_out_reversal = (
    "SepaDirectDebitOutReversal"
)
sepa_instant_credit_transfer_in class-attribute instance-attribute
sepa_instant_credit_transfer_in = (
    "SepaInstantCreditTransferIn"
)
sepa_instant_credit_transfer_in_recall class-attribute instance-attribute
sepa_instant_credit_transfer_in_recall = (
    "SepaInstantCreditTransferInRecall"
)
sepa_instant_credit_transfer_out class-attribute instance-attribute
sepa_instant_credit_transfer_out = (
    "SepaInstantCreditTransferOut"
)
sepa_instant_credit_transfer_out_recall class-attribute instance-attribute
sepa_instant_credit_transfer_out_recall = (
    "SepaInstantCreditTransferOutRecall"
)

trusted_beneficiary_status

TrustedBeneficiaryStatus

Bases: AlanBaseEnum

canceled class-attribute instance-attribute
canceled = 'Canceled'
consent_pending class-attribute instance-attribute
consent_pending = 'ConsentPending'
enabled class-attribute instance-attribute
enabled = 'Enabled'

shared.services.payment_providers.swan.exceptions

swan_mutation_exception

SwanMutationException

SwanMutationException(arg)

Bases: Exception

Source code in shared/services/payment_providers/swan/exceptions/swan_mutation_exception.py
7
8
9
def __init__(self, arg: BaseMutationRejection | str) -> None:
    super().__init__(arg if isinstance(arg, str) else str(arg))
    self.rejection = arg if isinstance(arg, BaseMutationRejection) else None
rejection instance-attribute
rejection = (
    arg if isinstance(arg, BaseMutationRejection) else None
)

unexpected_swan_transaction_amount

UnexpectedSwanTransactionAmount

UnexpectedSwanTransactionAmount(transaction)

Bases: Exception

Source code in shared/services/payment_providers/swan/exceptions/unexpected_swan_transaction_amount.py
def __init__(self, transaction: Transaction) -> None:
    id = transaction.id
    amount = transaction.amount.value
    status = transaction.status_info.status

    super().__init__(f"Unexpected amount {amount} € from {status} transaction {id}")

shared.services.payment_providers.swan.helpers

SWAN_WORKSPACE_KEY module-attribute

SWAN_WORKSPACE_KEY = 'fr_swan_pay'

get_swan_transaction_amount_in_cents

get_swan_transaction_amount_in_cents(transaction)

Extract the amount of the given transaction in cents.

Amount is positive if the transaction is a credit, negative if it is a debit.

Source code in shared/services/payment_providers/swan/helpers.py
def get_swan_transaction_amount_in_cents(transaction: Transaction) -> int:
    """
    Extract the amount of the given transaction in cents.

    Amount is positive if the transaction is a credit, negative if it is a debit.
    """

    # Assert amount is positive
    if transaction.amount.value < 0:
        raise ValueError(
            f"Invalid amount {transaction.amount.value}{transaction.amount.currency} for transaction [{transaction.id}]"
        )

    # We do NOT support non € transactions... but we don't need to 👇
    #
    # Payments made in other currencies
    # - Are converted to € using the daily conversion rate
    # - Their original amount + currency are stored in the `original_amount` field
    if transaction.amount.currency != "EUR":
        raise ValueError(
            f"Unsupported currency [{transaction.amount.currency}] for transaction [{transaction.id}]"
        )

    if transaction.side == TransactionSide.credit:
        return round(transaction.amount.value * 100)
    elif transaction.side == TransactionSide.debit:
        return -round(transaction.amount.value * 100)

    raise ValueError(f"Invalid transaction side: {transaction.side}")

shared.services.payment_providers.swan.mutations

AcceptConsentMutation(consent_id)

Bases: SwanMutation[Consent]

Source code in shared/services/payment_providers/swan/mutations/accept_consent_mutation.py
def __init__(self, consent_id: str) -> None:
    self.consent_id = consent_id
consent_id = consent_id
input_params
mutation_name
rejection_types
response_type
success_payload_property

add_account_membership_mutation

AddAccountMembershipMutation

AddAccountMembershipMutation(
    account_id,
    first_name,
    last_name,
    phone_number,
    birth_date,
    email,
    language,
)

Bases: SwanMutation[AccountMembership]

Source code in shared/services/payment_providers/swan/mutations/add_account_membership_mutation.py
def __init__(
    self,
    account_id: str,
    first_name: str,
    last_name: str,
    phone_number: str,
    birth_date: date,
    email: str,
    language: AccountLanguage,
) -> None:
    self.account_id = account_id
    self.first_name = first_name
    self.last_name = last_name
    self.phone_number = phone_number
    self.birth_date = birth_date
    self.email = email
    self.language = language
account_id instance-attribute
account_id = account_id
birth_date instance-attribute
birth_date = birth_date
email instance-attribute
email = email
first_name instance-attribute
first_name = first_name
input_params property
input_params
language instance-attribute
language = language
last_name instance-attribute
last_name = last_name
mutation_name property
mutation_name
phone_number instance-attribute
phone_number = phone_number
rejection_types property
rejection_types
response_type property
response_type

add_card_mutation

AddCardMutation

AddCardMutation(account_membership_id, card_product_id)

Bases: SwanMutation[Card]

Source code in shared/services/payment_providers/swan/mutations/add_card_mutation.py
def __init__(self, account_membership_id: str, card_product_id: str) -> None:
    self.account_membership_id = account_membership_id
    self.card_product_id = card_product_id
account_membership_id instance-attribute
account_membership_id = account_membership_id
card_product_id instance-attribute
card_product_id = card_product_id
input_params property
input_params
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property

add_sepa_direct_debit_payment_mandate_mutation

AddSepaDirectDebitPaymentMandateMutation

AddSepaDirectDebitPaymentMandateMutation(
    payment_method_id,
    signature_date,
    debtor_name,
    debtor_iban,
    debtor_country,
    reference,
    mandate_name,
)

Bases: SwanMutation[PaymentMandate]

Source code in shared/services/payment_providers/swan/mutations/add_sepa_direct_debit_payment_mandate_mutation.py
def __init__(
    self,
    payment_method_id: str,
    signature_date: date,
    debtor_name: str,
    debtor_iban: str,
    debtor_country: str,
    reference: str,
    mandate_name: str,
) -> None:
    self.payment_method_id = payment_method_id
    self.signature_date = signature_date
    self.debtor_name = debtor_name
    self.debtor_iban = debtor_iban
    self.debtor_country = debtor_country
    self.reference = reference
    self.mandate_name = mandate_name
debtor_country instance-attribute
debtor_country = debtor_country
debtor_iban instance-attribute
debtor_iban = debtor_iban
debtor_name instance-attribute
debtor_name = debtor_name
input_params property
input_params
mandate_name instance-attribute
mandate_name = mandate_name
mutation_name property
mutation_name
payment_method_id instance-attribute
payment_method_id = payment_method_id
reference instance-attribute
reference = reference
rejection_types property
rejection_types
response_type property
response_type
signature_date instance-attribute
signature_date = signature_date

add_trusted_sepa_beneficiary_mutation

AddTrustedSepaBeneficiaryMutation

AddTrustedSepaBeneficiaryMutation(account_id, iban, name)

Bases: SwanMutation[TrustedBeneficiary]

Source code in shared/services/payment_providers/swan/mutations/add_trusted_sepa_beneficiary_mutation.py
def __init__(
    self,
    account_id: str,
    iban: str,
    name: str,
) -> None:
    self.account_id = account_id
    self.iban = iban
    self.name = name
account_id instance-attribute
account_id = account_id
iban instance-attribute
iban = iban
input_params property
input_params
mutation_name property
mutation_name
name instance-attribute
name = name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property

bind_account_membership_mutation

BindAccountMembershipMutation

BindAccountMembershipMutation(account_membership_id)

Bases: SwanMutation[AccountMembership]

Source code in shared/services/payment_providers/swan/mutations/bind_account_membership_mutation.py
def __init__(self, account_membership_id: str) -> None:
    self.account_membership_id = account_membership_id
account_membership_id instance-attribute
account_membership_id = account_membership_id
input_params property
input_params
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type

cancel_card_mutation

CancelCardMutation

CancelCardMutation(card_id)

Bases: SwanMutation[Card]

Source code in shared/services/payment_providers/swan/mutations/cancel_card_mutation.py
def __init__(self, card_id: str) -> None:
    self.card_id = card_id
card_id instance-attribute
card_id = card_id
input_params property
input_params
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type

complete_user_creation_mutation

CompleteUserCreationMutation

CompleteUserCreationMutation(
    request_id, code, first_name, last_name, birth_date
)

Bases: SwanMutation[User]

Source code in shared/services/payment_providers/swan/mutations/complete_user_creation_mutation.py
def __init__(
    self,
    request_id: str,
    code: str,
    first_name: str,
    last_name: str,
    birth_date: date,
) -> None:
    self.request_id = request_id
    self.code = code
    self.first_name = first_name
    self.last_name = last_name
    self.birth_date = birth_date
birth_date instance-attribute
birth_date = birth_date
code instance-attribute
code = code
first_name instance-attribute
first_name = first_name
input_params property
input_params
last_name instance-attribute
last_name = last_name
mutation_name property
mutation_name
rejection_types property
rejection_types
request_id instance-attribute
request_id = request_id
response_type property
response_type
success_payload_property property
success_payload_property

disable_account_membership_mutation

DisableAccountMembershipMutation

DisableAccountMembershipMutation(account_membership_id)

Bases: SwanMutation[AccountMembership]

Source code in shared/services/payment_providers/swan/mutations/disable_account_membership_mutation.py
def __init__(self, account_membership_id: str) -> None:
    self.account_membership_id = account_membership_id
account_membership_id instance-attribute
account_membership_id = account_membership_id
input_params property
input_params
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property
GrantConsentWithServerSignatureMutation(
    consent_id, signature
)

Bases: SwanMutation[Consent]

Source code in shared/services/payment_providers/swan/mutations/grant_consent_with_server_signature_mutation.py
def __init__(self, consent_id: str, signature: str) -> None:
    self.consent_id = consent_id
    self.signature = signature
consent_id = consent_id
input_params
mutation_name
rejection_types
response_type
signature = signature
success_payload_property

initiate_credit_transfers_mutation

InitiateCreditTransfersMutation

InitiateCreditTransfersMutation(
    account_id,
    amount_in_cents,
    trusted_beneficiary_id,
    label,
)

Bases: SwanMutation[Payment]

Source code in shared/services/payment_providers/swan/mutations/initiate_credit_transfers_mutation.py
def __init__(
    self,
    account_id: str,
    amount_in_cents: int,
    trusted_beneficiary_id: str,
    label: str,
) -> None:
    self.account_id = account_id
    self.amount_in_cents = amount_in_cents
    self.trusted_beneficiary_id = trusted_beneficiary_id
    self.label = label
account_id instance-attribute
account_id = account_id
amount_in_cents instance-attribute
amount_in_cents = amount_in_cents
input_params property
input_params
label instance-attribute
label = label
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property
trusted_beneficiary_id instance-attribute
trusted_beneficiary_id = trusted_beneficiary_id

initiate_merchant_payment_collection_mutation

InitiateMerchantPaymentCollectionMutation

InitiateMerchantPaymentCollectionMutation(
    mandate_id, amount_in_cents, label
)

Bases: SwanMutation[Payment]

Source code in shared/services/payment_providers/swan/mutations/initiate_merchant_payment_collection_mutation.py
def __init__(
    self,
    mandate_id: str,
    amount_in_cents: int,
    label: str,
) -> None:
    self.mandate_id = mandate_id
    self.amount_in_cents = amount_in_cents
    self.label = label
amount_in_cents instance-attribute
amount_in_cents = amount_in_cents
input_params property
input_params
label instance-attribute
label = label
mandate_id instance-attribute
mandate_id = mandate_id
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property

start_user_creation_mutation

StartUserCreationMutation

StartUserCreationMutation(mobile_phone_number, locale)

Bases: SwanMutation[StartUserCreationPayload]

Source code in shared/services/payment_providers/swan/mutations/start_user_creation_mutation.py
def __init__(self, mobile_phone_number: str, locale: OtpLocale) -> None:
    self.mobile_phone_number = mobile_phone_number
    self.locale = locale
input_params property
input_params
locale instance-attribute
locale = locale
mobile_phone_number instance-attribute
mobile_phone_number = mobile_phone_number
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property
success_payload_type property
success_payload_type

swan_mutation

SwanMutation

Bases: DataClassJsonMixin, ABC, Generic[T]

input_params abstractmethod property
input_params

The mutation's input parameters - to be used in the GraphQL query.

mutation_name abstractmethod property
mutation_name

The name of the mutation - to be used in the GraphQL query.

rejection_types abstractmethod property
rejection_types

The list of possible rejections for this mutation.

response_type abstractmethod property
response_type
success_payload_property property
success_payload_property

The name of the property representing the target object in the success payload.

Default to the target object type, with the first letter in lowercase. Ex: "MyType" -> "myType"

In case the returned value is None, the client will parse the payload without looking for a specific property.

success_payload_type property
success_payload_type

The type of the payload for a success response.

Default to the mutation name, with the first letter capitalized, suffixed with "SuccessPayload". Ex: "myMutation" -> "MyMutationSuccessPayload"

T module-attribute

T = TypeVar('T', bound=SwanEntity)

view_card_numbers_mutation

ViewCardNumbersMutation

ViewCardNumbersMutation(card_id)

Bases: SwanMutation[Consent]

Source code in shared/services/payment_providers/swan/mutations/view_card_numbers_mutation.py
def __init__(self, card_id: str) -> None:
    self.card_id = card_id
card_id instance-attribute
card_id = card_id
input_params property
input_params
mutation_name property
mutation_name
rejection_types property
rejection_types
response_type property
response_type
success_payload_property property
success_payload_property
ViewCardNumbersWithConsentMutation(consent_id)

Bases: SwanMutation[CardNumbers]

Source code in shared/services/payment_providers/swan/mutations/view_card_numbers_with_consent_mutation.py
def __init__(self, consent_id: str) -> None:
    self.consent_id = consent_id
consent_id = consent_id
input_params
mutation_name
rejection_types
response_type
success_payload_property