Skip to content

Routers

AccountTransferRouter

Bases: ABC

Router for the account transfer processor to route the account transfers (a.k.a. Adyen's "internalTransfer") to the appropriate entities

Note: the source or the destination account must be a known account to the Payment Gateway

route abstractmethod

route(direction, reference, account_id, effective_date)

Route an account transfer to the appropriate entities.

Parameters:

Name Type Description Default
direction TransferDirection

The transfer direction

required
reference str

The transfer reference; this is mostly used for tracking and reconciliation

required
account_id AccountId

The ID of the account involved in the transfer

required
effective_date datetime

The effective date at which the transfer occurred

required

Returns:

Type Description
AccountTransferRoutingResult

The entities with which the transfer should be associated.

Source code in components/payment_gateway/subcomponents/transfers/protected/routers.py
@abstractmethod
def route(
    self,
    direction: TransferDirection,
    reference: str,
    account_id: AccountId,
    effective_date: datetime,
) -> AccountTransferRoutingResult:
    """Route an account transfer to the appropriate entities.

    Args:
        direction: The transfer direction
        reference: The transfer reference; this is mostly used for tracking and reconciliation
        account_id: The ID of the account involved in the transfer
        effective_date: The effective date at which the transfer occurred

    Returns:
        The entities with which the transfer should be associated.
    """
    raise NotImplementedError

AccountTransferRoutingResult dataclass

AccountTransferRoutingResult(
    transfer_history_id, ledger_id=None
)

Result of the account transfer routing.

ledger_id class-attribute instance-attribute

ledger_id = None

transfer_history_id instance-attribute

transfer_history_id

BankTransferRouter

Bases: ABC

Router for the bank transfer processor to route the bank transfers (a.k.a. Adyen's "bankTransfer") to the appropriate entities

route abstractmethod

route(direction, account_id, effective_date)

Route a bank transfer to the appropriate entities.

Parameters:

Name Type Description Default
direction TransferDirection

The transfer direction

required
account_id AccountId

The ID of the account involved in the transfer

required
effective_date datetime

The effective date at which the transfer occurred

required

Returns:

Type Description
BankTransferRoutingResult

The entities with which the transfer should be associated.

Source code in components/payment_gateway/subcomponents/transfers/protected/routers.py
@abstractmethod
def route(
    self,
    direction: TransferDirection,
    account_id: AccountId,
    effective_date: datetime,
) -> BankTransferRoutingResult:
    """Route a bank transfer to the appropriate entities.

    Args:
        direction: The transfer direction
        account_id: The ID of the account involved in the transfer
        effective_date: The effective date at which the transfer occurred

    Returns:
        The entities with which the transfer should be associated.
    """
    raise NotImplementedError

BankTransferRoutingResult dataclass

BankTransferRoutingResult(
    transfer_history_id, ledger_id=None
)

Result of the bank transfer routing.

ledger_id class-attribute instance-attribute

ledger_id = None

Ledger ID the transfer should affect.

Can be None if the transfer does not affect a Ledger, or if the Transfer History is not associated with a Ledger.

transfer_history_id instance-attribute

transfer_history_id

Transfer History ID the transfer should belong to.

CardTransferRouter

Bases: ABC

Router for the card transfer processor to route the card transfers (a.k.a. Adyen's "payment") to the appropriate entities

route abstractmethod

route(
    card_id,
    merchant_info,
    effective_date,
    transfer_status,
    transfer_external_id,
)

Route a card transfer to the appropriate entities.

Parameters:

Name Type Description Default
card_id CardId

The ID of the card involved in the transfer

required
merchant_info MerchantInfo

Info about the merchant involved in the transfer

required
effective_date datetime

The effective date at which the transfer occurred

required
transfer_status str

The status of the transfer

required
transfer_external_id str

The external ID of the transfer

required

Returns:

Type Description
CardTransferRoutingResult

The entities with which the transfer should be associated.

Source code in components/payment_gateway/subcomponents/transfers/protected/routers.py
@abstractmethod
def route(
    self,
    card_id: CardId,
    merchant_info: MerchantInfo,
    effective_date: datetime,
    transfer_status: str,
    transfer_external_id: str,
) -> CardTransferRoutingResult:
    """Route a card transfer to the appropriate entities.

    Args:
        card_id: The ID of the card involved in the transfer
        merchant_info: Info about the merchant involved in the transfer
        effective_date: The effective date at which the transfer occurred
        transfer_status: The status of the transfer
        transfer_external_id: The external ID of the transfer

    Returns:
        The entities with which the transfer should be associated.
    """
    raise NotImplementedError

CardTransferRoutingResult dataclass

CardTransferRoutingResult(
    transfer_history_id,
    ledger_id=None,
    expense_category_ids=None,
    line_of_credit_ids=None,
)

Result of the card transfer routing.

expense_category_ids class-attribute instance-attribute

expense_category_ids = None

Expense Category IDs the transfer should match.

Can be None if the transfer does not belong to any Expense Category, which can happen for declined or refused transfer.

ledger_id class-attribute instance-attribute

ledger_id = None

Ledger ID the transfer should affect.

Can be None if the transfer does not affect a Ledger, or if the Transfer History is not associated with a Ledger.

line_of_credit_ids class-attribute instance-attribute

line_of_credit_ids = None

Line of Credit IDs the transfer should affect.

Can be None if the transfer does not match any Line of Credit, which can happen for unknown cards or unsupported Expense Categories.

transfer_history_id instance-attribute

transfer_history_id

Transfer History ID the transfer should belong to.