components.payment_gateway.public.accounts ¶
This module defines the public API for the accounts subcomponent.
Only business logic is exposed here. Basic entities and enums are exposed in separate modules to avoid loading the entire subcomponent with its models and dependencies when they are not needed.
Classes¶
AccountActions ¶
This class contains all the actions used to manage the lifecycle of an account.
Implements the following Nullable patterns: - Nullables: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#nullables ⧉ - Parameterless instantiation: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#instantiation ⧉
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
Attributes¶
Functions¶
activate_account ¶
Activate an account.
Note
This operation is currently only supported for Adyen.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
create
classmethod
¶
Normal factory
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
create_account ¶
Create an account for an account holder.
This will create a new account on the PSP workspace linked to the given account holder.
Note
This operation is currently only supported for Adyen.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
create_null
classmethod
¶
Null factory
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
deactivate_account ¶
Deactivate an account.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
declare_account ¶
Declare an account for an account holder.
The account must exist in the PSP workspace.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
terminate_account ¶
Terminate an account.
The operation is idempotent, i.e. it has no effect on already terminated entities.
Accounts in terminal state cannot be modified or used anymore. Any
attempt to use or retrieve a terminated account will raise an
AccountTerminatedException.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
update_account ¶
Update the balance account description and reference.
New description/name for the account will be truncated to 300 characters. New optional reference for the account will be truncated to 150 characters.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_actions.py
AccountBalance
dataclass
¶
AccountBalanceQueries ¶
Public queries for fetching account balances across PSPs.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_balance_queries.py
Attributes¶
Functions¶
create
classmethod
¶
create_null
classmethod
¶
create_null(
*,
track_jpmorgan_requests=None,
jpmorgan_responses=None,
track_revolut_requests=None,
revolut_responses=None,
revolut_simulator=None
)
Null factory for tests.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_balance_queries.py
list_account_balances ¶
Return all balances exposed by the PSP backing workspace_key.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_balance_queries.py
AccountHolderActions ¶
This class contains all the actions related to account holders.
Implements the following Nullable patterns: - Nullables: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#nullables ⧉ - Parameterless instantiation: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#instantiation ⧉
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_holder_actions.py
Attributes¶
adyen_account_holders_client
property
¶
Ensures the Adyen client is available when accessing it.
adyen_legal_entities_client
property
¶
Ensures the Adyen client is available when accessing it.
Functions¶
create
classmethod
¶
Normal factory
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_holder_actions.py
create_null
classmethod
¶
Null factory
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_holder_actions.py
declare_account_holder ¶
Declare an account holder.
The account holder must exist in the PSP workspace.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_holder_actions.py
terminate_account_holder ¶
Terminate an account holder.
The operation is idempotent, i.e. it has no effect on already terminated entities.
Account holders in terminal state cannot be modified or used anymore.
Any attempt to use or retrieve a terminated account holder will raise an
AccountHolderTerminatedException.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_holder_actions.py
update_account_holder_legal_name ¶
Update the legal name of an account holder.
This method updates the legal name of an account holder in both the database and the third party API.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/actions/account_holder_actions.py
AccountHolderNotFoundException ¶
Bases: PaymentAccountException
Exception raised when trying to use a non-existing Account Holder.
AccountHolderQueries ¶
This class contains all the queries related to account holders.
Functions¶
get_account_holder ¶
Get an account holder entity from its ID.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_holder_queries.py
get_account_holder_id_by_external_id ¶
Get an account holder entity from its external ID.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_holder_queries.py
AccountHolderTerminatedException ¶
Bases: PaymentAccountException
Exception raised when trying to use a terminated Account Holder.
AccountNotFoundException ¶
Bases: PaymentAccountException
Exception raised when trying to use a non-existing Account.
AccountNotFoundOnProviderException ¶
Bases: PaymentAccountException
Exception raised when the PSP does not know the account.
Distinct from AccountNotFoundException (account unknown to Alan): here
Alan knows the account but its PSP id is not (or no longer) found at the
provider.
Source code in components/payment_gateway/subcomponents/accounts/protected/exceptions.py
AccountQueries ¶
This class contains all the queries related to accounts.
Functions¶
get_account ¶
Get an account entity from its ID.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_queries.py
get_account_id_by_external_id ¶
Get an account ID by its external ID.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_queries.py
get_account_ids_by_workspace ¶
Get all active account IDs for a workspace.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_queries.py
get_account_ids_for_account_holder ¶
Get all the account IDs for an account holder.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_queries.py
get_account_including_terminated ¶
Get an account entity from its ID, including terminated ones.
Use this for read-only contexts (eg admin/marmot pages) where seeing a terminated account's data is a legitimate use case.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_queries.py
get_accounts_for_account_holder ¶
Get all the accounts for an account holder.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/account_queries.py
AccountTerminatedException ¶
Bases: PaymentAccountException
Exception raised when trying to use a terminated Account.
InvalidAccountStatusTransitionException ¶
Bases: PaymentAccountException, ValueError
Exception raised when attempting an invalid Account status transition.
PaymentAccountException ¶
Bases: PaymentGatewayException
Base class for all Account exceptions.
ProviderAccount
dataclass
¶
Bases: DataClassJsonMixin
A single provider account, with the balances it currently holds.
Attributes¶
ProviderAccountQueries ¶
Public queries for fetching a single provider account, with its live balances.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/provider_account_queries.py
Attributes¶
Functions¶
create
classmethod
¶
Normal factory.
create_null
classmethod
¶
Null factory for tests.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/provider_account_queries.py
get_account ¶
Return the provider account, with its live balances, backing account_id.
Resolves the PSP workspace and the account's external id from the local
Account (terminated accounts included, so a closed Flex company
account still exposes its balance), then fetches the account live from
the PSP.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/queries/provider_account_queries.py
SepaBeneficiaryLogic ¶
This class is the public interface to the SEPA beneficiaries logic.
Functions¶
declare_sepa_beneficiary ¶
declare_sepa_beneficiary(
session,
/,
account_id,
external_id,
issued_at,
name,
iban,
status=SepaBeneficiaryStatus.enabled,
)
Declare a new SEPA beneficiary on the given account.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/sepa_beneficiaries.py
get_sepa_beneficiary ¶
Get a SEPA beneficiary entity from its ID.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/sepa_beneficiaries.py
get_sepa_beneficiary_by_external_id ¶
Find a SEPA beneficiary by its external ID.
Source code in components/payment_gateway/subcomponents/accounts/protected/business_logic/sepa_beneficiaries.py
set_sepa_beneficiary_status ¶
Update the status of the given SEPA beneficiary.