Models
components.payment_gateway.subcomponents.transfers.models.account_transfer ¶
AccountTransfer ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="account_transfer__unique_external_id_per_provider",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
account
class-attribute
instance-attribute
¶
account_id
class-attribute
instance-attribute
¶
direction
class-attribute
instance-attribute
¶
effective_date
class-attribute
instance-attribute
¶
events
class-attribute
instance-attribute
¶
events = relationship(
"TransferEvent",
secondary=f"{PAYMENT_GATEWAY_SCHEMA_NAME}.{__tablename__}",
order_by=sequence,
uselist=True,
viewonly=True,
)
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the transfer.
provider
class-attribute
instance-attribute
¶
The payment service provider the bank transfer happened with.
raw
class-attribute
instance-attribute
¶
reference
class-attribute
instance-attribute
¶
transfer_history
class-attribute
instance-attribute
¶
transfer_history = relationship(
TransferHistory,
foreign_keys=[transfer_history_id],
back_populates="account_transfers",
)
transfer_history_id
class-attribute
instance-attribute
¶
transfer_history_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
index=True,
nullable=False,
)
updates
class-attribute
instance-attribute
¶
updates = relationship(
"TransferUpdate",
primaryjoin="AccountTransfer.id == foreign(TransferUpdate.transfer_id)",
order_by="TransferUpdate.sequence_number",
uselist=True,
viewonly=True,
)
validate_provider
class-attribute
instance-attribute
¶
AccountTransferTransferEventAssociation ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"account_transfer_id",
"sequence",
name="account_transfer_transfer_event_sequence_unique_constraint",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
__tablename__
class-attribute
instance-attribute
¶
account_transfer
class-attribute
instance-attribute
¶
account_transfer_id
class-attribute
instance-attribute
¶
account_transfer_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(
f"{PAYMENT_GATEWAY_SCHEMA_NAME}.account_transfer.id"
),
index=True,
nullable=False,
)
transfer_event_id
class-attribute
instance-attribute
¶
transfer_event_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(
f"{PAYMENT_GATEWAY_SCHEMA_NAME}.transfer_event.id"
),
index=True,
unique=True,
nullable=False,
)
components.payment_gateway.subcomponents.transfers.models.bank_transfer ¶
BankTransfer ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="bank_transfer__unique_external_id_per_provider",
),
CheckConstraint(
"sepa_mandate_id IS NULL OR sepa_beneficiary_id IS NULL",
name="bank_transfer__no_sepa_mandate_and_sepa_beneficiary",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
account
class-attribute
instance-attribute
¶
account_id
class-attribute
instance-attribute
¶
direction
class-attribute
instance-attribute
¶
effective_date
class-attribute
instance-attribute
¶
events
class-attribute
instance-attribute
¶
events = relationship(
"TransferEvent",
secondary=f"{PAYMENT_GATEWAY_SCHEMA_NAME}.{__tablename__}",
order_by=sequence,
uselist=True,
viewonly=True,
)
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the transfer.
provider
class-attribute
instance-attribute
¶
The payment service provider the bank transfer happened with.
raw
class-attribute
instance-attribute
¶
sepa_beneficiary
class-attribute
instance-attribute
¶
sepa_beneficiary = relationship(
SepaBeneficiary,
foreign_keys=[sepa_beneficiary_id],
back_populates="bank_transfers",
)
sepa_beneficiary_id
class-attribute
instance-attribute
¶
sepa_mandate
class-attribute
instance-attribute
¶
sepa_mandate = relationship(
SepaMandate,
foreign_keys=[sepa_mandate_id],
back_populates="bank_transfers",
)
sepa_mandate_id
class-attribute
instance-attribute
¶
transfer_history
class-attribute
instance-attribute
¶
transfer_history = relationship(
TransferHistory,
foreign_keys=[transfer_history_id],
back_populates="bank_transfers",
)
transfer_history_id
class-attribute
instance-attribute
¶
transfer_history_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
index=True,
nullable=False,
)
updates
class-attribute
instance-attribute
¶
updates = relationship(
"TransferUpdate",
primaryjoin="BankTransfer.id == foreign(TransferUpdate.transfer_id)",
order_by="TransferUpdate.sequence_number",
uselist=True,
viewonly=True,
)
validate_provider
class-attribute
instance-attribute
¶
BankTransferTransferEventAssociation ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"bank_transfer_id",
"sequence",
name="bank_transfer_transfer_event_sequence_unique_constraint",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
__tablename__
class-attribute
instance-attribute
¶
bank_transfer_id
class-attribute
instance-attribute
¶
bank_transfer_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(
f"{PAYMENT_GATEWAY_SCHEMA_NAME}.bank_transfer.id"
),
index=True,
nullable=False,
)
transfer_event_id
class-attribute
instance-attribute
¶
transfer_event_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(
f"{PAYMENT_GATEWAY_SCHEMA_NAME}.transfer_event.id"
),
index=True,
unique=True,
nullable=False,
)
components.payment_gateway.subcomponents.transfers.models.card_transfer ¶
CardTransfer ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="card_payment__unique_external_id_per_provider",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
account
class-attribute
instance-attribute
¶
account_id
class-attribute
instance-attribute
¶
card
class-attribute
instance-attribute
¶
card_id
class-attribute
instance-attribute
¶
city
class-attribute
instance-attribute
¶
Merchant city name
country
class-attribute
instance-attribute
¶
Merchant english country name
effective_date
class-attribute
instance-attribute
¶
Date and time when the card payment happened (not when it was ingested in our system).
events
class-attribute
instance-attribute
¶
events = relationship(
"TransferEvent",
secondary=f"{PAYMENT_GATEWAY_SCHEMA_NAME}.{__tablename__}",
order_by=sequence,
uselist=True,
viewonly=True,
)
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the card payment.
mcc
class-attribute
instance-attribute
¶
Merchant Category Code (MCC)
merchant_id
class-attribute
instance-attribute
¶
Merchant ID
name
class-attribute
instance-attribute
¶
Merchant name
postal_code
class-attribute
instance-attribute
¶
Merchant postal code
provider
class-attribute
instance-attribute
¶
The payment service provider the card payment happened with.
raw
class-attribute
instance-attribute
¶
transfer_history
class-attribute
instance-attribute
¶
transfer_history = relationship(
TransferHistory,
foreign_keys=[transfer_history_id],
back_populates="card_payments",
)
transfer_history_id
class-attribute
instance-attribute
¶
transfer_history_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
index=True,
nullable=False,
)
updates
class-attribute
instance-attribute
¶
updates = relationship(
"TransferUpdate",
primaryjoin="CardTransfer.id == foreign(TransferUpdate.transfer_id)",
order_by="TransferUpdate.sequence_number",
uselist=True,
viewonly=True,
)
validate_provider
class-attribute
instance-attribute
¶
CardTransferTransferEventAssociation ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"card_payment_id",
"sequence",
name="card_payment_transfer_event_sequence_unique_constraint",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
__tablename__
class-attribute
instance-attribute
¶
card_payment_id
class-attribute
instance-attribute
¶
card_payment_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(
f"{PAYMENT_GATEWAY_SCHEMA_NAME}.card_payment.id"
),
index=True,
nullable=False,
)
transfer_event_id
class-attribute
instance-attribute
¶
transfer_event_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(
f"{PAYMENT_GATEWAY_SCHEMA_NAME}.transfer_event.id"
),
index=True,
unique=True,
nullable=False,
)
components.payment_gateway.subcomponents.transfers.models.helpers ¶
load_all_models ¶
Source code in components/payment_gateway/subcomponents/transfers/models/helpers.py
components.payment_gateway.subcomponents.transfers.models.internal_transfer ¶
InternalTransfer ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
effective_date
class-attribute
instance-attribute
¶
transfer_history
class-attribute
instance-attribute
¶
transfer_history = relationship(
TransferHistory,
foreign_keys=[transfer_history_id],
back_populates="internal_transfers",
)
transfer_history_id
class-attribute
instance-attribute
¶
transfer_history_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
index=True,
nullable=False,
)
components.payment_gateway.subcomponents.transfers.models.transfer_event ¶
TransferEvent ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="transfer_event__unique_external_id_per_provider",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
balance
class-attribute
instance-attribute
¶
effective_date
class-attribute
instance-attribute
¶
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the transfer event.
provider
class-attribute
instance-attribute
¶
The payment service provider the transfer event happened with.
raw
class-attribute
instance-attribute
¶
received
class-attribute
instance-attribute
¶
reserved
class-attribute
instance-attribute
¶
validate_provider
class-attribute
instance-attribute
¶
components.payment_gateway.subcomponents.transfers.models.transfer_history ¶
TransferHistory ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"private_type",
"private_ref",
name="transfer_history_private_key_and_ref_unique_constraint",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
account_transfers
class-attribute
instance-attribute
¶
account_transfers = relationship(
"AccountTransfer",
back_populates="transfer_history",
order_by="AccountTransfer.created_at.asc()",
uselist=True,
)
bank_transfers
class-attribute
instance-attribute
¶
bank_transfers = relationship(
"BankTransfer",
back_populates="transfer_history",
order_by="BankTransfer.created_at.asc()",
uselist=True,
)
card_payments
class-attribute
instance-attribute
¶
card_payments = relationship(
"CardTransfer",
back_populates="transfer_history",
order_by="CardTransfer.created_at.asc()",
uselist=True,
)
internal_transfers
class-attribute
instance-attribute
¶
internal_transfers = relationship(
"InternalTransfer",
back_populates="transfer_history",
order_by="InternalTransfer.created_at.asc()",
uselist=True,
)
private_ref
class-attribute
instance-attribute
¶
private_type
class-attribute
instance-attribute
¶
components.payment_gateway.subcomponents.transfers.models.transfer_update ¶
TransferUpdate ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_transfer_id",
"sequence_number",
name="transfer_update__unique_provider_specific_ids",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
amount
class-attribute
instance-attribute
¶
Amount of the transfer update (in minor units).
currency
class-attribute
instance-attribute
¶
Currency of the transfer update, represented as a 3-letter ISO 4217 code.
direction
class-attribute
instance-attribute
¶
Direction of the transfer. Same for all updates in the sequence but denormalized here for convenience.
external_transaction_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the transaction.
There can be several transactions within the same transfer update sequence, each having one or several updates.
external_transfer_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the transfer.
occurred_at
class-attribute
instance-attribute
¶
Date and time when the transfer update occurred.
provider
class-attribute
instance-attribute
¶
The payment service provider the transfer happened with.
raw
class-attribute
instance-attribute
¶
sequence_number
class-attribute
instance-attribute
¶
Sequence number of the update within the transfer update sequence.
transfer_id
class-attribute
instance-attribute
¶
ID of the transfer this update belongs to (any kind of transfer type, e.g. card/bank/account).
Note: we don't use a foreign key here because we have several transfer types having their own transfer model.
transfer_type
class-attribute
instance-attribute
¶
transfer_type = mapped_column(
AlanBaseEnumTypeDecorator(TransferUpdateTransferType),
nullable=False,
)
Type of the transfer this update belongs to.