Skip to content

Models

components.payment_gateway.subcomponents.banking_documents.models.helpers

load_all_models

load_all_models()
Source code in components/payment_gateway/subcomponents/banking_documents/models/helpers.py
def load_all_models() -> list[type[DbModel]]:
    from components.payment_gateway.subcomponents.banking_documents.models.sepa_mandate import (
        SepaMandate,
        SepaMandateStatusLog,
    )

    return [SepaMandate, SepaMandateStatusLog]

components.payment_gateway.subcomponents.banking_documents.models.sepa_mandate

SepaMandate

Bases: BaseModel

__table_args__ class-attribute instance-attribute

__table_args__ = (
    UniqueConstraint(
        "provider",
        "external_id",
        name="sepa_mandate__unique_external_id_per_provider",
    ),
    {"schema": PAYMENT_GATEWAY_SCHEMA_NAME},
)

__tablename__ class-attribute instance-attribute

__tablename__ = 'sepa_mandate'

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

account_holder_id = mapped_column(
    UUID(as_uuid=True),
    ForeignKey(id),
    index=True,
    nullable=True,
)

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

debtor_country = mapped_column(String(3), nullable=False)

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

debtor_name = mapped_column(String(255), nullable=False)

The name of the debtor as specified in the mandate.

external_id class-attribute instance-attribute

external_id = mapped_column(
    String(255), nullable=False, index=True
)

ID used by the external payment service provider to identify the SEPA mandate.

issued_at class-attribute instance-attribute

issued_at = mapped_column(DateTime, nullable=False)

provider class-attribute instance-attribute

provider = mapped_column(
    AlanBaseEnumTypeDecorator(PaymentServiceProvider),
    nullable=False,
)

The payment service provider the SEPA mandate is issued for.

sepa_creditor_identifier class-attribute instance-attribute

sepa_creditor_identifier = mapped_column(
    String(255), nullable=False
)

SCI (ICS in French - Identifiant CrΓ©ancier SEPA).

status property

status

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 = mapped_column(
    String(255), nullable=False
)

Unique mandate reference (known as RUM in French - RΓ©fΓ©rence Unique de Mandat)

validate_provider class-attribute instance-attribute

validate_provider = create_validator('provider')

SepaMandateStatusLog

Bases: BaseModel

__repr__

__repr__()
Source code in components/payment_gateway/subcomponents/banking_documents/models/sepa_mandate.py
def __repr__(self) -> str:
    return f"<SepaMandateStatusLog [{self.id}]: {self.status}>"

__table_args__ class-attribute instance-attribute

__table_args__ = {'schema': PAYMENT_GATEWAY_SCHEMA_NAME}

__tablename__ class-attribute instance-attribute

__tablename__ = 'sepa_mandate_status_log'

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

sepa_mandate_id = mapped_column(
    UUID(as_uuid=True),
    ForeignKey(id),
    nullable=False,
    index=True,
)

status class-attribute instance-attribute

status = mapped_column(
    AlanBaseEnumTypeDecorator(SepaMandateStatus),
    nullable=False,
)