Models
components.payment_gateway.subcomponents.banking_documents.models.helpers ¶
load_all_models ¶
Source code in components/payment_gateway/subcomponents/banking_documents/models/helpers.py
components.payment_gateway.subcomponents.banking_documents.models.pad_payment_mandate ¶
PadPaymentMandate ¶
Bases: PaymentMandate
Pre-Authorized Debit (Canada) payment mandate.
components.payment_gateway.subcomponents.banking_documents.models.payment_mandate ¶
PaymentMandate ¶
Bases: BaseModel
A formal, revocable authorization given by a Grantor to a Grantee, allowing the Grantee to initiate Payments from a specified Financial Instrument belonging to the Grantor (acting as a Debtor), for a defined purpose and payment method, subject to agreed limitations and backed by a Proof of Consent.
__mapper_args__
class-attribute
instance-attribute
¶
__table_args__
class-attribute
instance-attribute
¶
consent_captured_at
class-attribute
instance-attribute
¶
Timestamp of signature or explicit consent.
creditor_legal_entity
class-attribute
instance-attribute
¶
creditor_legal_entity_id
class-attribute
instance-attribute
¶
creditor_legal_entity_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
nullable=False,
index=True,
)
The legal entity authorized to collect.
current_status_log
class-attribute
instance-attribute
¶
current_status_log = relationship(
"PaymentMandateStatusLog",
uselist=False,
viewonly=True,
primaryjoin="and_( PaymentMandateStatusLog.payment_mandate_id == PaymentMandate.id, PaymentMandateStatusLog.created_at == ( select(func.max(PaymentMandateStatusLog.created_at)) .where(PaymentMandateStatusLog.payment_mandate_id == PaymentMandate.id) .correlate(PaymentMandate) .scalar_subquery() ))",
)
Most recent status log for this mandate.
debtor_financial_instrument
class-attribute
instance-attribute
¶
debtor_financial_instrument = relationship(
FinancialInstrument,
foreign_keys=[debtor_financial_instrument_id],
)
debtor_financial_instrument_id
class-attribute
instance-attribute
¶
debtor_financial_instrument_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
nullable=False,
index=True,
)
The financial instrument to debit from.
mandate_type
class-attribute
instance-attribute
¶
Discriminator: sepa | pad.
payment_type
class-attribute
instance-attribute
¶
payment_type = mapped_column(
AlanBaseEnumTypeDecorator(PaymentMandatePaymentType),
nullable=False,
)
Whether the mandate authorizes recurring or one-off payments.
status_history
class-attribute
instance-attribute
¶
status_history = relationship(
"PaymentMandateStatusLog",
back_populates="payment_mandate",
order_by="PaymentMandateStatusLog.created_at.desc()",
uselist=True,
viewonly=True,
)
All status logs for this mandate, most recent first.
unique_key
class-attribute
instance-attribute
¶
Namespaced unique identifier {country}:{model}:{id} for deduplication and idempotency.
components.payment_gateway.subcomponents.banking_documents.models.payment_mandate_provider_mapping ¶
PaymentMandateProviderMapping ¶
Bases: ProviderEntityMixin, BaseModel
Maps a PaymentMandate to its identifier on a given PSP workspace.
__table_args__ ¶
Source code in components/payment_gateway/subcomponents/banking_documents/models/payment_mandate_provider_mapping.py
__tablename__
class-attribute
instance-attribute
¶
payment_mandate
class-attribute
instance-attribute
¶
payment_mandate_id
class-attribute
instance-attribute
¶
payment_mandate_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
nullable=False,
index=True,
)
components.payment_gateway.subcomponents.banking_documents.models.payment_mandate_status_log ¶
PaymentMandateStatusLog ¶
Bases: BaseModel
Status history entry for a PaymentMandate.
__repr__ ¶
__table_args__
class-attribute
instance-attribute
¶
payment_mandate
class-attribute
instance-attribute
¶
payment_mandate = relationship(
PaymentMandate,
foreign_keys=[payment_mandate_id],
back_populates="status_history",
)
payment_mandate_id
class-attribute
instance-attribute
¶
payment_mandate_id = mapped_column(
UUID(as_uuid=True),
ForeignKey(id),
nullable=False,
index=True,
)
reason
class-attribute
instance-attribute
¶
Optional free-text comment on what happened.
status
class-attribute
instance-attribute
¶
components.payment_gateway.subcomponents.banking_documents.models.sepa_mandate ¶
SepaMandate ¶
Bases: ProviderEntityMixin, BaseModel
__table_args__ ¶
account_holder
class-attribute
instance-attribute
¶
account_holder = relationship(
AccountHolder,
foreign_keys=account_holder_id,
back_populates="sepa_mandates",
)
account_holder_id
class-attribute
instance-attribute
¶
bank_transfers
class-attribute
instance-attribute
¶
bank_transfers = relationship(
"BankTransfer",
back_populates="sepa_mandate",
order_by="BankTransfer.created_at.desc()",
uselist=True,
viewonly=True,
)
current_status_log
class-attribute
instance-attribute
¶
current_status_log = relationship(
"SepaMandateStatusLog",
uselist=False,
viewonly=True,
primaryjoin="and_( SepaMandateStatusLog.sepa_mandate_id == SepaMandate.id, SepaMandateStatusLog.created_at == ( select(func.max(SepaMandateStatusLog.created_at)) .where(SepaMandateStatusLog.sepa_mandate_id == SepaMandate.id) .correlate(SepaMandate) .scalar_subquery() ))",
)
debtor_country
class-attribute
instance-attribute
¶
The country of residence of the debtor as specified in the mandate.
debtor_iban
class-attribute
instance-attribute
¶
debtor_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 the mandate is issued for.
debtor_name
class-attribute
instance-attribute
¶
The name of the debtor as specified in the mandate.
sepa_creditor_identifier
class-attribute
instance-attribute
¶
SCI (ICS in French - Identifiant Créancier SEPA).
status_history
class-attribute
instance-attribute
¶
status_history = relationship(
"SepaMandateStatusLog",
back_populates="sepa_mandate",
order_by="SepaMandateStatusLog.created_at.desc()",
uselist=True,
viewonly=True,
)
unique_mandate_reference
class-attribute
instance-attribute
¶
Unique mandate reference (known as RUM in French - Référence Unique de Mandat)
SepaMandateStatusLog ¶
Bases: BaseModel
__repr__ ¶
__table_args__
class-attribute
instance-attribute
¶
sepa_mandate
class-attribute
instance-attribute
¶
sepa_mandate = relationship(
SepaMandate,
foreign_keys=sepa_mandate_id,
back_populates="status_history",
)
sepa_mandate_id
class-attribute
instance-attribute
¶
status
class-attribute
instance-attribute
¶
components.payment_gateway.subcomponents.banking_documents.models.sepa_payment_mandate ¶
SepaPaymentMandate ¶
Bases: PaymentMandate
SEPA payment mandate is a type of payment mandate identified by its UMR.
__mapper_args__
class-attribute
instance-attribute
¶
__table_args__
class-attribute
instance-attribute
¶
__table_args__ = (
Index("ix_sepa_payment_mandate_umr_creditor", "umr"),
{"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)
id
class-attribute
instance-attribute
¶
scheme
class-attribute
instance-attribute
¶
SEPA scheme: core | b2b.
umr
class-attribute
instance-attribute
¶
Unique Mandate Reference. Max 35 chars, Latin only. Unique per (Creditor Identifier + UMR) combination.
valid_until
class-attribute
instance-attribute
¶
Mandate is valid for 36 months since creation or last collection.