feat(merchant_context): add struct merchant_context
and replace all instances of merchant_account
and key_store
in core
#7875
Labels
A-core
Area: Core flows
C-feature
Category: Feature request or enhancement
C-refactor
Category: Refactor
E-medium
Effort: Requires a fair amount of work
enhancement
New feature or request
Introduction of MerchantContext: Unified Merchant Operation Context
Challenge
Currently, merchant account and key store information are passed separately throughout the codebase, leading to scattered merchant context handling and reduced maintainability. Functions individually manage these components, making it difficult to implement platform-wide features or connected account capabilities.
Proposed Changes
Introducing
MerchantContext
, a new type that encapsulates both merchant account and key store information:The type provides controlled access through methods:
get_merchant_account()
: Access merchant account detailsget_merchant_key_store()
: Access cryptographic key storeWhy
How
The implementation follows a tree-like flow where the
MerchantContext
is:This creates a clear, traceable flow of merchant context through the entire operation chain, making it easier to understand and maintain merchant-related operations.
Future Objectives
Operational Context extension: The enum structure allows adding new variants for different operations, enabling:
Granular Context Control:
This architectural change sets the foundation for future platform features while maintaining current functionality and improving code organization.
The text was updated successfully, but these errors were encountered: