-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(users): Add V2 User APIs to Support Modularity for Merchant Accounts #7386
base: main
Are you sure you want to change the base?
Conversation
Changed Files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#[default] | ||
Legacy, | ||
Orchestration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure data for legacy
is not inserted in DB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked integ and sandbox db, no entry with product_type = legacy
present
let key_manager_state = &(&state).into(); | ||
let merchant_key_store = state | ||
.store | ||
.get_merchant_key_store_by_merchant_id( | ||
key_manager_state, | ||
&merchant_account_response.merchant_id, | ||
&state.store.get_master_key().to_vec().into(), | ||
) | ||
.await | ||
.change_context(UserErrors::InternalServerError) | ||
.attach_printable("Failed to retrieve merchant key store by merchant_id")?; | ||
|
||
let merchant_account = state | ||
.store | ||
.find_merchant_account_by_merchant_id( | ||
key_manager_state, | ||
&merchant_account_response.merchant_id, | ||
&merchant_key_store, | ||
) | ||
.await | ||
.change_context(UserErrors::InternalServerError) | ||
.attach_printable("Failed to retrieve merchant account by merchant_id")?; | ||
Ok(merchant_account) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we skip these two queries and use create merchant account response ?
user_api::UserMerchantAccountResponse { | ||
merchant_id: domain_merchant_account.get_id().to_owned(), | ||
merchant_name: domain_merchant_account.merchant_name, | ||
product_type: domain_merchant_account.product_type, | ||
version: domain_merchant_account.version, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can implement From
/Into
implementation for these types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will take this up in a separate PR
78134dd
Type of Change
Description
As part of the modularity effort, we are introducing user support to enable dashboard interactions with v2 merchant accounts. This allows users to create, list, and switch between merchant accounts within their organization.
Key Changes
1. User Support for v2 Merchant Accounts
Introduced APIs to facilitate user interactions with v2 merchant accounts:
2. Modified Response Structure
StatusOk (200)
. The response object includes:merchant_id
merchant_name
product_type
version
3. Request Structure Update
product_type
field.4. Recon
Additional Changes
Motivation and Context
With the modularization of the payments solution, managing multiple merchant accounts becomes essential. This update ensures a seamless user experience for handling v1 and v2 merchant accounts within an organization.
How did you test it?
The flow looks like this:
Testing V2 Flow:
Sign In to a V1 merchant account
Create v2 Merchant Account:
Sample Output:
List V2 Merchant Accounts for User in Org:
Sample Output:
Switch to V2 merchant Account:
Sample Output:
Testing V1 flow:
Sign in to V1 merchant account
Create V1 merchant Account:
Sample Output:
List V1 Merchant Accounts for User in Org:
Sample Output:
Switch to V1 Merchant Account:
Sample Output:
Checklist
cargo +nightly fmt --all
cargo clippy