woob.capabilities.bank.transfer

exception AddRecipientBankError(description=None, message=None)[source]

Bases: AddRecipientError

The new recipient was rejected by the bank with a message.

code = 'bankMessage'
exception AddRecipientError(description=None, message=None)[source]

Bases: UserError

Failed trying to add a recipient.

Parameters:
  • description (str) – technical description of the error (default: None)

  • message (str) – error message from the bank, if any, to display to the user (default: None)

code = 'AddRecipientError'
exception AddRecipientStep(recipient, *values)[source]

Bases: BrowserQuestion

exception AddRecipientTimeout(description=None, message=None)[source]

Bases: AddRecipientError

Add new recipient request has timeout

code = 'timeout'
class BeneficiaryType(*args, **kwargs)[source]

Bases: Enum

Type of the Transfer.beneficiary_number property.

IBAN = 'iban'

beneficiary number is an IBAN as defined in ISO 13616

SORT_CODE_ACCOUNT_NUMBER = 'sort_code_account_number'

account number is a national UK/Ireland number including sortcode

PHONE_NUMBER = 'phone_number'

beneficiary number is an E.164 encoded phone number

RECIPIENT = 'recipient'

beneficiary number is a beneficiary identifier as returned by the iter_transfer_recipients method.

class CapBankTransfer[source]

Bases: CapBank, CapTransfer

can_do_transfer_without_emitter = False

The module can do transfer without giving the emitter, for example: when there is only, and will be only, one account like wallet or when the module can initiate transfer without emitter and the emitter is chosen afterwards like for PSD2 modules

transfer_with_debtor_account = 'mandatory'
account_to_emitter(account)[source]
Return type:

Emitter

class CapBankTransferAddRecipient[source]

Bases: CapBankTransfer

new_recipient(recipient, **params)[source]
add_recipient(recipient, **params)[source]

Add a recipient to the connection.

Parameters:

recipient (Recipient) – recipient to add, need to contain a valid IBAN and a label.

Raises:

BrowserQuestion

Raises:

AddRecipientError

Return type:

Recipient

class CapTransfer[source]

Bases: Capability

can_do_transfer_to_untrusted_beneficiary = False

The module can do transfer to untrusted beneficiary, for example: when module can’t add new beneficiary without doing a transfer like n26 or when module can do transfer to a beneficiary not listed in iter_transfer_recipients like for PSD2 modules

can_do_transfer_without_emitter = True

The module can do transfer without giving the emitter, for example: when there is only, and will be only, one account like wallet or when the module can initiate transfer without emitter and the emitter is chosen afterwards like for PSD2 modules

can_do_transfer_cancellation = False
sca_required_for_transfer_cancellation = False

The default behavior is that we don’t need to validate a payment cancellation through a SCA. If a SCA is required after sending a transfer cancellation request to validate it, the module should set this to True.

accepted_beneficiary_types = ('recipient',)
accepted_execution_date_types = ('first_open_day', 'deferred')
accepted_execution_frequencies = {'biannual', 'bimonthly', 'daily', 'four-monthly', 'monthly', 'quarterly', 'semiannually', 'two-monthly', 'two-weekly', 'weekly', 'yearly'}
maximum_number_of_instructions = 1
transfer_with_debtor_account = 'not_used'
partial_transfer_status_tracking = ()
is_app_to_app_used_for_transfer: dict[Platform, bool | None] = {Platform.ANDROID: None, Platform.IOS: None}

Is an App2App flow used for the payment if the PSU has the bank’s app installed. None means unknown

bank_provides_payer_account: bool | None = None

Once the payment is initiated, does the bank return the payer’s account identifier? None means unknown

bank_provides_payer_label: bool | None = None

Once the payment is initiated, does the bank return the payer’s label? None means unknown

transfer_date_types_where_trusted_beneficiary_required: Iterable[TransferDateType] = {}

Set of TransferDateType where the beneficiary must be trusted or registered on the payer’s banking service. If iter_transfer_recipients is implemented, such beneficiaries may be found.

iter_transfer_recipients(account)[source]

Iter recipients availables for a transfer from a specific account.

Parameters:

account (Account) – account which initiate the transfer

Return type:

iter[Recipient]

Raises:

AccountNotFound

init_transfer(transfer, **params)[source]

Initiate a transfer.

:param Transfer :rtype: Transfer :raises: TransferError

execute_transfer(transfer, **params)[source]

Execute a transfer.

:param Transfer :rtype: Transfer :raises: TransferError

confirm_transfer(transfer, **params)[source]

Transfer confirmation after multiple SCA from the Emitter. This method is only used for PSD2 purpose. Return the transfer with the new status.

:param Transfer :rtype: Transfer :raises: TransferError

confirm_transfer_cancellation(transfer, **params)[source]

Confirm transfer cancellation after a redirect flow.

:param Transfer :rtype: Transfer :raises: AssertionError: If the payment is not actually cancelled after the whole process

optional_confirm_transfer_cancellation(transfer, **params)[source]

Proceed with the actual cancellation confirmation.

This method MUST NOT be called by any external caller. Said caller should actually call confirm_transfer_cancellation which may call the current method if it sees fit.

The default implementation does not run an explicit confirmation step, it only fetches the up-to-date transfer.

Modules requiring an explicit cancellation confirmation should overwrite this method, returning the up-to-date transfer at the end.

Return type:

Transfer

transfer(transfer, **params)[source]

Do a transfer from an account to a recipient.

:param Transfer :rtype: Transfer :raises: TransferError

transfer_check_label(old, new)[source]
Return type:

bool

iter_transfers(account=None)[source]

Iter transfer transactions.

Parameters:

account (Account) – account to get transfer history (or None for all accounts) (default: None)

Return type:

iter[Transfer]

Raises:

AccountNotFound

get_transfer(id)[source]

Get a transfer from its id.

Parameters:

id (str) – ID of the Transfer

Return type:

Transfer

iter_emitters()[source]

Iter transfer emitter accounts.

Return type:

iter[Emitter]

cancel_transfer(transfer, **params)[source]

Ask for the cancellation of a transfer.

This function is exposed as part of Woob API and should not be overriden by children modules.

Parameters:

transfer (Transfer) – the transfer that should be cancelled

Return type:

Transfer

do_transfer_cancellation(transfer, **params)[source]

Send a cancellation request for the given transfer.

This function should be implemented by the children modules.

Parameters:

transfer (Transfer) – the transfer that should be cancelled

Return type:

Transfer

class Emitter(id='0', url=NotLoaded)[source]

Bases: BaseAccount

Transfer emitter account.

Variables:
  • url – (str) url

  • label – (str) Pretty label

  • currency – (str) Currency (default: None)

  • bank_name – (str) Bank Name

  • number_type – (str) Account number type (default: unknown)

  • number – (str) Account number value

  • balance – (Decimal) Balance of emitter account

class EmitterNumberType(*args, **kwargs)[source]

Bases: Enum

UNKNOWN = 'unknown'
IBAN = 'iban'
BBAN = 'bban'
class Recipient(id='0', url=NotLoaded)[source]

Bases: BaseAccount

Recipient of a transfer.

Variables:
  • url – (str) url

  • label – (str) Pretty label

  • currency – (str) Currency (default: None)

  • bank_name – (str) Bank Name

  • enabled_at – (date, datetime) Date of availability

  • category – (str) Recipient category

  • iban – (str) International Bank Account Number

  • origin_account_id – (str) Account id which recipient belong to

  • origin_account_iban – (str) Account iban which recipient belong to

exception RecipientInvalidIban(description=None, message=None)[source]

Bases: AddRecipientError

code = 'invalidIban'
exception RecipientInvalidLabel(description=None, message=None)[source]

Bases: AddRecipientError

code = 'invalidLabel'
exception RecipientInvalidOTP(description=None, message=None)[source]

Bases: AddRecipientError

code = 'invalidOTP'
exception RecipientNotFound(msg='Recipient not found')[source]

Bases: ObjectNotFound

Raised when a recipient is not found.

class Transfer(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject, Currency

Transfer from an account to a recipient.

Variables:
  • url – (str) url

  • amount – (Decimal) Amount to transfer

  • currency – (str) Currency (default: None)

  • fees – (Decimal) Fees (default: None)

  • exec_date – (date, datetime) Date of transfer

  • label – (str) Reason

  • account_id – (str) ID of origin account

  • account_iban – (str) International Bank Account Number

  • account_label – (str) Label of origin account

  • account_balance – (Decimal) Balance of origin account before transfer

  • recipient_id – (str) ID of recipient account

  • recipient_iban – (str) International Bank Account Number

  • recipient_label – (str) Label of recipient account

  • beneficiary_type – (str) Transfer creditor number type (default: recipient)

  • beneficiary_number – (str) Transfer creditor number

  • beneficiary_label – (str) Transfer creditor label

  • beneficiary_bic – (str) Transfer creditor BIC

  • date_type – (str) Transfer execution date type

  • frequency – (str) Frequency of periodic transfer

  • first_due_date – (date, datetime) Date of first transfer of periodic transfer

  • last_due_date – (date, datetime) Date of last transfer of periodic transfer

  • creation_date – (date, datetime) Creation date of transfer

  • status – (str) Transfer status

  • cancelled_exception – (TransferError) Transfer cancelled reason

  • reference_id – (str) End to end ID given by client

exception TransferBankError(description=None, message=None)[source]

Bases: TransferError

The transfer was rejected by the bank with a message.

code = 'bankMessage'
exception TransferCancelledByUser(description=None, message=None)[source]

Bases: TransferError

The transfer is cancelled by the emitter or an authorized user

code = 'cancelledByUser'
class TransferDateType(*args, **kwargs)[source]

Bases: Enum

FIRST_OPEN_DAY = 'first_open_day'

Transfer to execute when possible (accounting opening days)

INSTANT = 'instant'

Transfer to execute immediately (not accounting opening days)

DEFERRED = 'deferred'

Transfer to execute on a chosen date

PERIODIC = 'periodic'

Transfer to execute periodically

exception TransferError(description=None, message=None)[source]

Bases: UserError

A transfer has failed.

Parameters:
  • description (str) – technical description of the error (default: None)

  • message (str) – error message from the bank, if any, to display to the user (default: None)

code = 'transferError'
class TransferFrequency(*args, **kwargs)[source]

Bases: Enum

UNKNOWN = 'unknown'
DAILY = 'daily'
WEEKLY = 'weekly'
TWOWEEKLY = 'two-weekly'
MONTHLY = 'monthly'
TWOMONTHLY = 'two-monthly'
QUARTERLY = 'quarterly'
FOURMONTHLY = 'four-monthly'
SEMIANNUALLY = 'semiannually'
YEARLY = 'yearly'
BIMONTHLY = 'bimonthly'
BIANNUAL = 'biannual'
exception TransferInsufficientFunds(description=None, message=None)[source]

Bases: TransferInvalidAmount

Not enough funds on emitter account.

code = 'insufficientFunds'
exception TransferInvalidAmount(description=None, message=None)[source]

Bases: TransferError

This amount is not allowed.

code = 'invalidAmount'
exception TransferInvalidCurrency(description=None, message=None)[source]

Bases: TransferInvalidAmount

The transfer currency is invalid.

code = 'invalidCurrency'
exception TransferInvalidDate(description=None, message=None)[source]

Bases: TransferError

This execution date cannot be used.

code = 'invalidDate'
exception TransferInvalidEmitter(description=None, message=None)[source]

Bases: TransferError

The emitter account cannot be used for transfers.

code = 'invalidEmitter'
exception TransferInvalidLabel(description=None, message=None)[source]

Bases: TransferError

The transfer label is invalid.

code = 'invalidLabel'
exception TransferTimeout(description=None, message=None)[source]

Bases: TransferError

The transfer request timed out

code = 'timeout'
exception TransferInvalidOTP(description=None, message=None)[source]

Bases: TransferError

code = 'invalidOTP'
exception TransferInvalidRecipient(description=None, message=None)[source]

Bases: TransferError

The emitter cannot transfer to this recipient.

code = 'invalidRecipient'
exception TransferNotFound(msg='Transfer not found')[source]

Bases: ObjectNotFound

class TransferStatus(*args, **kwargs)[source]

Bases: Enum

UNKNOWN = 'unknown'
INTERMEDIATE = 'intermediate'

Transfer is not validated yet

SCHEDULED = 'scheduled'

Transfer to be executed later

ACTIVE = 'active'

Periodic transfer is still active

DONE = 'done'

Transfer was executed

CANCELLED = 'cancelled'

Transfer was cancelled by the bank or by the user

ACCEPTED_NO_BANK_STATUS = 'accepted_no_bank_status'

Transfer was sent to the bank but we will not get more information after that. This is used for banks that do not give us final states after pending.

exception TransferStep(transfer, *values)[source]

Bases: BrowserQuestion