Resolvers
ExpenseCategoryResolver ¶
Bases: ABC
This abstract class defines the interface responsible for resolving the expense categories for a pending transaction.
Warning
Implementations of this class should be stateless and fail-safe, as they are used for critical idempotent operations in a real-time context.
resolve_expense_categories
abstractmethod
¶
Resolve the expense category codes for a pending transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pending_transaction
|
PendingTransaction
|
The pending transaction to resolve the expense categories for. |
required |
Returns:
| Type | Description |
|---|---|
set[str] | None
|
The matching expense category codes, or None if no expense category could be resolved. |
Source code in components/payment_gateway/subcomponents/authorizations/protected/resolvers.py
LineOfCreditResolver ¶
Bases: ABC
This abstract class defines the interface responsible for resolving the lines of credit for a pending transaction.
Warning
Implementations of this class should be stateless and fail-safe, as they are used for critical idempotent operations in a real-time context.
resolve_lines_of_credit
abstractmethod
¶
Resolve the line of credit IDs for a pending transaction and expense categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expense_category_ids
|
set[ExpenseCategoryId]
|
The expense categories for the pending transaction. |
required |
pending_transaction
|
PendingTransaction
|
The pending transaction to resolve the lines of credit for. |
required |
Returns:
| Type | Description |
|---|---|
set[LineOfCreditId] | None
|
The matching lines of credit IDs, or None if at least one could not be resolved. |
Invariant
There is a one-to-one relationship between input expense categories and output lines of credit.
Note
We don't need to return the entities themselves, because the authorization process only depends on their ID.