Models
components.payment_gateway.subcomponents.accounts.models.account ¶
Account ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="account__unique_external_id_per_provider",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
account_holder
class-attribute
instance-attribute
¶
account_holder = relationship(
AccountHolder,
foreign_keys=account_holder_id,
back_populates="accounts",
)
account_holder_id
class-attribute
instance-attribute
¶
account_transfers
class-attribute
instance-attribute
¶
account_transfers = relationship(
"AccountTransfer",
back_populates="account",
order_by="AccountTransfer.created_at.desc()",
uselist=True,
viewonly=True,
)
bank_transfers
class-attribute
instance-attribute
¶
bank_transfers = relationship(
"BankTransfer",
back_populates="account",
order_by="BankTransfer.created_at.desc()",
uselist=True,
viewonly=True,
)
card_payments
class-attribute
instance-attribute
¶
card_payments = relationship(
"CardTransfer",
back_populates="account",
order_by="CardTransfer.created_at.desc()",
uselist=True,
viewonly=True,
)
current_status_log
class-attribute
instance-attribute
¶
current_status_log = relationship(
"AccountStatusLog",
uselist=False,
viewonly=True,
primaryjoin=f"and_( AccountStatusLog.account_id == {ACCOUNT_MODEL}.id, AccountStatusLog.created_at == ( select(func.max(AccountStatusLog.created_at)) .where(AccountStatusLog.account_id == {ACCOUNT_MODEL}.id) .correlate({ACCOUNT_MODEL}) .scalar_subquery() ))",
)
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the account.
provider
class-attribute
instance-attribute
¶
The payment service provider that manages the account.
sepa_beneficiaries
class-attribute
instance-attribute
¶
sepa_beneficiaries = relationship(
"SepaBeneficiary",
back_populates="account",
order_by="SepaBeneficiary.created_at.desc()",
uselist=True,
viewonly=True,
)
status_history
class-attribute
instance-attribute
¶
status_history = relationship(
"AccountStatusLog",
back_populates="account",
order_by="AccountStatusLog.created_at.desc()",
uselist=True,
viewonly=True,
)
terminated_at
class-attribute
instance-attribute
¶
Termination is done at the initiative of the business layer. Accounts in terminal state cannot be modified or used anymore.
validate_provider
class-attribute
instance-attribute
¶
components.payment_gateway.subcomponents.accounts.models.account_holder ¶
AccountHolder ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="account_holder__unique_external_id_per_provider",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
accounts
class-attribute
instance-attribute
¶
accounts = relationship(
ACCOUNT_MODEL,
back_populates="account_holder",
order_by=ACCOUNT_MODEL + ".created_at.desc()",
uselist=True,
)
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the account holder.
provider
class-attribute
instance-attribute
¶
The payment service provider the account holder id declared to.
sepa_mandates
class-attribute
instance-attribute
¶
sepa_mandates = relationship(
"SepaMandate",
back_populates="account_holder",
order_by="SepaMandate.created_at.desc()",
uselist=True,
viewonly=True,
)
terminated_at
class-attribute
instance-attribute
¶
Termination is done at the initiative of the business layer. Account holders in terminal state cannot be modified or used anymore.
validate_provider
class-attribute
instance-attribute
¶
components.payment_gateway.subcomponents.accounts.models.helpers ¶
load_all_models ¶
Source code in components/payment_gateway/subcomponents/accounts/models/helpers.py
components.payment_gateway.subcomponents.accounts.models.sepa_beneficiary ¶
SepaBeneficiary ¶
Bases: BaseModel
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
UniqueConstraint(
"provider",
"external_id",
name="sepa_beneficiary__unique_external_id_per_provider",
),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
account
class-attribute
instance-attribute
¶
account_id
class-attribute
instance-attribute
¶
bank_transfers
class-attribute
instance-attribute
¶
bank_transfers = relationship(
"BankTransfer",
back_populates="sepa_beneficiary",
order_by="BankTransfer.created_at.desc()",
uselist=True,
viewonly=True,
)
current_status_log
class-attribute
instance-attribute
¶
current_status_log = relationship(
"SepaBeneficiaryStatusLog",
uselist=False,
viewonly=True,
primaryjoin="and_( SepaBeneficiaryStatusLog.sepa_beneficiary_id == SepaBeneficiary.id, SepaBeneficiaryStatusLog.created_at == ( select(func.max(SepaBeneficiaryStatusLog.created_at)) .where(SepaBeneficiaryStatusLog.sepa_beneficiary_id == SepaBeneficiary.id) .correlate(SepaBeneficiary) .scalar_subquery() ))",
)
external_id
class-attribute
instance-attribute
¶
ID used by the external payment service provider to identify the SEPA beneficiary.
iban
class-attribute
instance-attribute
¶
iban = mapped_column_with_privacy(
String(34),
nullable=False,
privacy_properties=PrivacyProperties(
other,
NoneOrPrefixRedactedHashed(keep_prefix_length=9),
NoneOrPrefixRedactedHashed(keep_prefix_length=9),
CustomSQL(IBAN_CUSTOM_SQL),
PassThrough(),
),
)
The IBAN of the SEPA beneficiary.
name
class-attribute
instance-attribute
¶
The name of the SEPA beneficiary.
provider
class-attribute
instance-attribute
¶
The payment service provider the SEPA beneficiary is issued for.
status_history
class-attribute
instance-attribute
¶
status_history = relationship(
"SepaBeneficiaryStatusLog",
back_populates="sepa_beneficiary",
order_by="SepaBeneficiaryStatusLog.created_at.desc()",
uselist=True,
viewonly=True,
)
validate_provider
class-attribute
instance-attribute
¶
SepaBeneficiaryStatusLog ¶
Bases: BaseModel
__repr__ ¶
__table_args__
class-attribute
instance-attribute
¶
sepa_beneficiary
class-attribute
instance-attribute
¶
sepa_beneficiary = relationship(
SepaBeneficiary,
foreign_keys=sepa_beneficiary_id,
back_populates="status_history",
)
sepa_beneficiary_id
class-attribute
instance-attribute
¶
sepa_beneficiary_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
nullable=False,
index=True,
)