Adapters
Transfer adapters package.
This package contains adapters for converting between different data formats in the transfers subcomponent.
components.payment_gateway.subcomponents.transfers.adapters.adyen ¶
helpers ¶
associate_account_transfer_events ¶
Associate account transfer with its events, reordering them if needed. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
associate_bank_transfer_events ¶
Associate bank transfer with its events, reordering them if needed. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
associate_card_transfer_events ¶
Associate card transfer with its events, reordering them if needed. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
compute_transfer_update_amount_from_account_transfer_data ¶
Compute the amount and currency for an account transfer from an Adyen TransferData webhook payload.
Warning
This function is critical for client code that relies on the amount and currency of transfers (for example payroll or billing). If you have to change it, you need to do the following, in this order:
- Call it from
transfer_update_model_to_dataclassontransfer_type=TransferUpdateTransferType.ACCOUNTto override the stored values of existing transfers; newly recorded transfers will always use the new values (note that this will induce a performance hit because of the need to rehydrate the original payload) - Backfill ALL the old account transfer updates
- Remove it from
transfer_update_model_to_dataclassonce the backfill is done.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
compute_transfer_update_amount_from_bank_transfer_data ¶
Compute the amount and currency for a bank transfer from an Adyen TransferData webhook payload.
Warning
This function is critical for client code that relies on the amount and currency of transfers (for example payroll or billing). If you have to change it, you need to do the following, in this order:
- Call it from
transfer_update_model_to_dataclassontransfer_type=TransferUpdateTransferType.BANKto override the stored values of existing transfers; newly recorded transfers will always use the new values (note that this will induce a performance hit because of the need to rehydrate the original payload) - Backfill ALL the old bank transfer updates
- Remove it from
transfer_update_model_to_dataclassonce the backfill is done.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
compute_transfer_update_amount_from_card_transfer_data ¶
Compute the amount and currency for a card transfer from an Adyen TransferData webhook payload.
Warning
This function is critical for client code that relies on the amount and currency of transfers (for example payroll or billing). If you have to change it, you need to do the following, in this order:
- Call it from
transfer_update_model_to_dataclassontransfer_type=TransferUpdateTransferType.CARDto override the stored values of existing transfers; newly recorded transfers will always use the new values (note that this will induce a performance hit because of the need to rehydrate the original payload) - Backfill ALL the old card transfer updates
- Remove it from
transfer_update_model_to_dataclassonce the backfill is done.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_account_transfer_from_account_transfer_data ¶
record_account_transfer_from_account_transfer_data(
session, /, data, account_id, transfer_history_id
)
Record an account transfer from an Adyen TransferData webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_bank_transfer_from_bank_transfer_data ¶
Record a bank transfer from an Adyen TransferData webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_card_transfer_from_card_transfer_data ¶
record_card_transfer_from_card_transfer_data(
session,
/,
data,
card_id,
account_id,
transfer_history_id,
merchant_info,
)
Record a card transfer from an Adyen TransferData webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_transfer_event_from_transfer_data ¶
Record a transfer event from an Adyen TransferEvent webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_transfer_update_from_account_transfer_data ¶
Record a transfer update from an Adyen TransferData webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_transfer_update_from_bank_transfer_data ¶
Record a transfer update from an Adyen TransferData webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
record_transfer_update_from_card_transfer_data ¶
Record a transfer update from an Adyen TransferData webhook payload. Idempotent.
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/helpers.py
topic_subscribers ¶
TransferTopicSubscriber ¶
TransferTopicSubscriber(
*,
card_transfer_processor_policy,
bank_transfer_processor_policy,
account_transfer_processor_policy
)
Bases: Subscriber
This class subscribes to the Adyen transfer notification topic messages and dispatch them to application-provided processors
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/topic_subscribers.py
account_transfer_processor_policy
instance-attribute
¶
bank_transfer_processor_policy
instance-attribute
¶
card_transfer_processor_policy
instance-attribute
¶
receive ¶
Source code in components/payment_gateway/subcomponents/transfers/adapters/adyen/topic_subscribers.py
components.payment_gateway.subcomponents.transfers.adapters.jpmorgan ¶
jpmorgan_payout_service_provider ¶
JPMorganPayoutServiceProvider ¶
Bases: PayoutServiceProvider
Source code in components/payment_gateway/subcomponents/transfers/adapters/jpmorgan/jpmorgan_payout_service_provider.py
create
classmethod
¶
create_null
classmethod
¶
pay ¶
Source code in components/payment_gateway/subcomponents/transfers/adapters/jpmorgan/jpmorgan_payout_service_provider.py
policies ¶
bank_transfer_processor ¶
JPMorganBankTransferProcessorPolicy ¶
on_bank_transfer_received ¶
Source code in components/payment_gateway/subcomponents/transfers/adapters/jpmorgan/policies/bank_transfer_processor.py
topic_subscribers ¶
JPMorganBankTransferTopicSubscriber ¶
Bases: Subscriber
Source code in components/payment_gateway/subcomponents/transfers/adapters/jpmorgan/topic_subscribers.py
bank_transfer_processor_policy
instance-attribute
¶
receive ¶
Source code in components/payment_gateway/subcomponents/transfers/adapters/jpmorgan/topic_subscribers.py
components.payment_gateway.subcomponents.transfers.adapters.messaging ¶
PayoutBankTransferTopicSubscriber ¶
Bases: Subscriber
This class is an adapter between shared pub/sub (used only by payment gateway) and shared messaging (use for inter-component communication).
receive ¶
Source code in components/payment_gateway/subcomponents/transfers/adapters/messaging.py
components.payment_gateway.subcomponents.transfers.adapters.models ¶
mappers ¶
account_transfer_model_to_dataclass ¶
Convert an AccountTransfer model to AccountTransfer dataclass.
Source code in components/payment_gateway/subcomponents/transfers/adapters/models/mappers.py
bank_transfer_model_to_dataclass ¶
Convert a BankTransfer model to BankTransfer dataclass.
Source code in components/payment_gateway/subcomponents/transfers/adapters/models/mappers.py
card_transfer_model_to_dataclass ¶
Convert a CardTransfer model to CardTransfer dataclass.
Source code in components/payment_gateway/subcomponents/transfers/adapters/models/mappers.py
internal_transfer_model_to_dataclass ¶
Convert an InternalTransfer model to InternalTransfer dataclass.
Source code in components/payment_gateway/subcomponents/transfers/adapters/models/mappers.py
transfer_event_model_to_dataclass ¶
Convert a TransferEvent model to TransferEvent dataclass.
Source code in components/payment_gateway/subcomponents/transfers/adapters/models/mappers.py
transfer_update_model_to_dataclass ¶
Convert a TransferUpdate model to TransferUpdate dataclass.
Source code in components/payment_gateway/subcomponents/transfers/adapters/models/mappers.py
components.payment_gateway.subcomponents.transfers.adapters.payout_service_provider ¶
PayoutServiceProvider ¶
Bases: ABC
pay
abstractmethod
¶
Initiate a payout to a bank account. :param request_id: Unique identifier for the payout request. :param amount_in_cents: Amount to be paid in cents. :param currency: Currency code (e.g., 'USD', 'EUR'). :param recipient_bank_account: Bank account details of the recipient. :param recipient: Recipient details, either a user or a company. :param description: Optional description for the payment. :return: TransactionId - Unique identifier of the transaction generated by the payment provider.