Model brokers
components.payment_gateway.subcomponents.parties.models.brokers.ca_local_account_financial_instrument ¶
CALocalAccountFinancialInstrumentModelBroker ¶
Bases: BaseModelBroker
Centralized data access for CALocalAccountFinancialInstrument model.
create_ca_local_account_financial_instrument
classmethod
¶
create_ca_local_account_financial_instrument(
session,
/,
*,
legal_entity_id,
institution_number,
transit_number,
account_number,
)
Create a CA local account financial instrument for the given legal entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQLAlchemy session to use for DB operations. |
required |
legal_entity_id
|
LegalEntityId
|
ID of the legal entity owning the financial instrument. |
required |
institution_number
|
str
|
Institution number of the bank account. |
required |
transit_number
|
str
|
Transit number of the bank account. |
required |
account_number
|
str
|
Account number of the bank account. |
required |
Source code in components/payment_gateway/subcomponents/parties/models/brokers/ca_local_account_financial_instrument.py
components.payment_gateway.subcomponents.parties.models.brokers.financial_instrument ¶
FinancialInstrumentModelBroker ¶
Bases: BaseModelBroker
Centralized data access for FinancialInstrument model.
get_financial_instrument
classmethod
¶
Source code in components/payment_gateway/subcomponents/parties/models/brokers/financial_instrument.py
terminate_financial_instrument
classmethod
¶
Source code in components/payment_gateway/subcomponents/parties/models/brokers/financial_instrument.py
components.payment_gateway.subcomponents.parties.models.brokers.iban_account_financial_instrument ¶
IBANAccountFinancialInstrumentModelBroker ¶
Bases: BaseModelBroker
Centralized data access for IBANAccountFinancialInstrument model.
create_iban_account_financial_instrument
classmethod
¶
create_iban_account_financial_instrument(
session,
/,
*,
legal_entity_id,
iban,
bank_country_code,
bic,
)
Create an IBAN account financial instrument for the given legal entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQLAlchemy session to use for DB operations. |
required |
legal_entity_id
|
LegalEntityId
|
ID of the legal entity owning the financial instrument. |
required |
iban
|
str
|
IBAN of the bank account. |
required |
bank_country_code
|
str
|
Country code of the bank in ISO 3166-1 alpha-2 format. |
required |
bic
|
str | None
|
BIC/SWIFT code of the bank. |
required |
Source code in components/payment_gateway/subcomponents/parties/models/brokers/iban_account_financial_instrument.py
components.payment_gateway.subcomponents.parties.models.brokers.legal_entity ¶
LegalEntityModelBroker ¶
Bases: BaseModelBroker
Centralized data access for LegalEntity model.
get_legal_entity
classmethod
¶
Get a legal entity by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
id
|
UUID
|
The legal entity ID |
required |
Returns:
| Type | Description |
|---|---|
LegalEntity
|
The legal entity |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no legal entity exists with the given ID |
Source code in components/payment_gateway/subcomponents/parties/models/brokers/legal_entity.py
terminate_legal_entity
classmethod
¶
Terminate a legal entity by setting its terminated_at timestamp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
id
|
UUID
|
The ID of the legal entity to terminate |
required |
Source code in components/payment_gateway/subcomponents/parties/models/brokers/legal_entity.py
upsert_legal_entity
classmethod
¶
Create or update a legal entity using the unique_key for deduplication.
If a legal entity with the given unique_key exists, updates only the provided fields (partial update supported). If it doesn't exist, creates a new legal entity with the provided data.
Note: When creating a new entity, the NOT NULL fields (entity_type, legal_name, legal_country_code, address_country_code) must be provided or the database will raise an IntegrityError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
unique_key
|
str
|
The namespaced unique identifier for deduplication |
required |
**data
|
Unpack[LegalEntityUpdate]
|
Fields to set/update (see LegalEntityUpdate) |
{}
|
Returns:
| Type | Description |
|---|---|
LegalEntity
|
The created or updated legal entity |
Raises:
| Type | Description |
|---|---|
IntegrityError
|
If creating a new entity without required NOT NULL fields |
Source code in components/payment_gateway/subcomponents/parties/models/brokers/legal_entity.py
LegalEntityUpdate ¶
Bases: TypedDict
Optional fields for updating a LegalEntity via upsert.
All fields are optional to support partial updates. When creating a new entity, the NOT NULL fields (entity_type, legal_name, legal_country_code, address_country_code) must be provided or the database will raise an error.