Queries
components.payment_gateway.subcomponents.parties.protected.business_logic.queries.financial_instrument_provider_mapping_queries ¶
FinancialInstrumentProviderMappingQueries ¶
Queries for financial instrument provider mapping operations.
get_mapping_by_financial_instrument_and_workspace
classmethod
¶
get_mapping_by_financial_instrument_and_workspace(
session, /, financial_instrument_id, workspace_key
)
Get provider mapping by financial instrument ID and workspace key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
financial_instrument_id
|
FinancialInstrumentId
|
Financial instrument ID |
required |
workspace_key
|
str
|
Provider workspace key |
required |
Returns:
| Type | Description |
|---|---|
FinancialInstrumentProviderMapping | None
|
The provider mapping or None |
Source code in components/payment_gateway/subcomponents/parties/protected/business_logic/queries/financial_instrument_provider_mapping_queries.py
components.payment_gateway.subcomponents.parties.protected.business_logic.queries.financial_instrument_queries ¶
FinancialInstrumentQueries ¶
Queries for financial instrument operations.
get_financial_instrument
classmethod
¶
Get a financial instrument by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
financial_instrument_id
|
FinancialInstrumentId
|
Financial instrument ID |
required |
with_legal_entity
|
bool
|
Whether to eager load the legal entity relationship |
False
|
Returns:
| Type | Description |
|---|---|
FinancialInstrument
|
The financial instrument |
Raises:
| Type | Description |
|---|---|
FinancialInstrumentNotFoundException
|
If the financial instrument is not found |
Source code in components/payment_gateway/subcomponents/parties/protected/business_logic/queries/financial_instrument_queries.py
components.payment_gateway.subcomponents.parties.protected.business_logic.queries.financial_instrument_reveal_queries ¶
FinancialInstrumentRevealQueries ¶
Queries for revealing encrypted financial instrument data.
Implements a two-step reveal flow with cache-based key registration: 1. Consumer registers an ephemeral RSA public key with reason/actor 2. Consumer calls reveal with the key ID to get JWE-encrypted data
Implements the Nullable pattern: - Nullables: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#nullables ⧉ - Parameterless instantiation: https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#instantiation ⧉
Source code in components/payment_gateway/subcomponents/parties/protected/business_logic/queries/financial_instrument_reveal_queries.py
create
classmethod
¶
create_null
classmethod
¶
Null factory for testing.
register_reveal_key ¶
Register an ephemeral RSA public key for a reveal operation.
The key is stored in cache with a short TTL and will be consumed (deleted) on the first reveal call that uses it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
public_key_pem
|
str
|
RSA public key in PEM format. |
required |
reason
|
str
|
Why the reveal is needed (free-form). |
required |
actor
|
str
|
Who is requesting the reveal (e.g. "component:banking_documents"). |
required |
Returns:
| Type | Description |
|---|---|
str
|
A unique reveal_key_id to use in the subsequent reveal call. |
Source code in components/payment_gateway/subcomponents/parties/protected/business_logic/queries/financial_instrument_reveal_queries.py
reveal_ca_local_account_details ¶
Reveal Canadian local account details as a JWE token.
Fetches and deletes the registered public key from cache (single-use), decrypts the CA local account data from the database, and re-encrypts it as a JWE token using the consumer's public key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
id
|
FinancialInstrumentId
|
Financial instrument ID. |
required |
reveal_key_id
|
str
|
Key ID returned by register_reveal_key. |
required |
Returns:
| Type | Description |
|---|---|
str
|
JWE token string containing the encrypted CALocalAccountDetails. |
Raises:
| Type | Description |
|---|---|
RevealKeyNotFoundException
|
If the key ID is not found (expired or used). |
FinancialInstrumentNotFoundException
|
If the FI doesn't exist. |
FinancialInstrumentTypeNotSupportedException
|
If the FI is not a CA local account. |
Source code in components/payment_gateway/subcomponents/parties/protected/business_logic/queries/financial_instrument_reveal_queries.py
reveal_iban_account_details ¶
Reveal IBAN account details as a JWE token.
Fetches and deletes the registered public key from cache (single-use), decrypts the IBAN data from the database, and re-encrypts it as a JWE token using the consumer's public key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
id
|
FinancialInstrumentId
|
Financial instrument ID. |
required |
reveal_key_id
|
str
|
Key ID returned by register_reveal_key. |
required |
Returns:
| Type | Description |
|---|---|
str
|
JWE token string containing the encrypted IBANAccountDetails. |
Raises:
| Type | Description |
|---|---|
RevealKeyNotFoundException
|
If the key ID is not found (expired or used). |
FinancialInstrumentNotFoundException
|
If the FI doesn't exist. |
FinancialInstrumentTypeNotSupportedException
|
If the FI is not an IBAN account. |