Model brokers
components.payment_gateway.subcomponents.banking_documents.models.brokers.payment_mandate ¶
PaymentMandateModelBroker ¶
Bases: BaseModelBroker
Centralized data access for PaymentMandate model (polymorphic parent).
get_payment_mandate
classmethod
¶
Get a payment mandate by ID.
Returns the concrete subtype (SepaPaymentMandate, PadPaymentMandate, ...) via SQLAlchemy joined-inheritance polymorphic loading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
id
|
UUID
|
The payment mandate ID. |
required |
Returns:
| Type | Description |
|---|---|
PaymentMandate
|
The payment mandate. |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no mandate exists with the given ID. |
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/payment_mandate.py
set_status
classmethod
¶
Append a status log entry, no-op if current status already matches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
payment_mandate_id
|
PaymentMandateId
|
ID of the payment mandate. |
required |
status
|
PaymentMandateStatus
|
Target status. |
required |
reason
|
str | None
|
Optional free-text comment. |
None
|
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no mandate exists with the given ID. |
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/payment_mandate.py
components.payment_gateway.subcomponents.banking_documents.models.brokers.sepa_mandate ¶
SepaMandateModelBroker ¶
Bases: BaseModelBroker
create_sepa_mandate
classmethod
¶
create_sepa_mandate(
session,
/,
*,
workspace_key,
external_id,
sepa_creditor_identifier,
debtor_name,
debtor_iban,
debtor_country,
unique_mandate_reference,
issued_at,
account_holder_id=None,
status,
)
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/sepa_mandate.py
get_sepa_mandate
classmethod
¶
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/sepa_mandate.py
get_sepa_mandate_by_external_id
classmethod
¶
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/sepa_mandate.py
set_sepa_mandate_status
classmethod
¶
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/sepa_mandate.py
components.payment_gateway.subcomponents.banking_documents.models.brokers.sepa_payment_mandate ¶
SEPA_MANDATE_VALIDITY_MONTHS
module-attribute
¶
SEPA mandates expire if not used for 36 months (SEPA scheme rule).
SepaPaymentMandateModelBroker ¶
Bases: BaseModelBroker
Centralized data access for SepaPaymentMandate model.
create_sepa_payment_mandate
classmethod
¶
create_sepa_payment_mandate(
session,
/,
*,
unique_key,
debtor_financial_instrument_id,
creditor_legal_entity_id,
payment_type,
umr,
scheme,
status,
valid_until=None,
consent_captured_at=None,
)
Create a SEPA payment mandate together with its initial status log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
unique_key
|
str
|
Namespaced unique identifier |
required |
debtor_financial_instrument_id
|
FinancialInstrumentId
|
ID of the financial instrument to debit from. |
required |
creditor_legal_entity_id
|
LegalEntityId
|
ID of the legal entity authorized to collect. |
required |
payment_type
|
PaymentMandatePaymentType
|
Recurring vs one-off payment authorization. |
required |
umr
|
str
|
Unique Mandate Reference (max 35 chars, Latin only). |
required |
scheme
|
SepaPaymentMandateScheme
|
SEPA scheme (CORE or B2B). |
required |
status
|
PaymentMandateStatus
|
Initial lifecycle status (logged via PaymentMandateStatusLog). |
required |
valid_until
|
datetime | None
|
Mandate validity end date. Defaults to
|
None
|
consent_captured_at
|
datetime | None
|
Timestamp of signature or explicit consent. |
None
|
Returns:
| Type | Description |
|---|---|
SepaPaymentMandate
|
The newly created SEPA payment mandate. |
Source code in components/payment_gateway/subcomponents/banking_documents/models/brokers/sepa_payment_mandate.py
find_by_umr_and_creditor
classmethod
¶
Find a SEPA payment mandate by its (umr, creditor) pair. This is unique per SEPA definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
umr
|
str
|
Unique Mandate Reference. |
required |
creditor_legal_entity_id
|
LegalEntityId
|
ID of the creditor legal entity. |
required |
Returns:
| Type | Description |
|---|---|
SepaPaymentMandate | None
|
The mandate, or None if not found. |