-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(user): fetch profile_id for sample data #3358
Conversation
let business_profile = match state | ||
.store | ||
.list_business_profile_by_merchant_id(&merchant_id) | ||
.await | ||
.change_context(SampleDataError::InternalServerError) | ||
.attach_printable("Failed to get business profile") | ||
.map(|profiles| profiles.first().cloned())? | ||
{ | ||
Some(profile) => profile, | ||
None => return Err(SampleDataError::InternalServerError.into()), | ||
}; |
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.
let the previous logic be there, add this logic of listing business profiles on top of that.
If profile_id cannot be found by the previous logic, then apply the list logic
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.
This is because, let's have the option of passing the profile_id in the request, we might need it later on.
.attach_printable("Failed to get business profile")?; | ||
{ | ||
Ok(id) => id.clone(), | ||
Err(_) => { |
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.
log this error
* 'main' of github.com:juspay/hyperswitch: feat(users): Added get role from jwt api (#3385) feat(users): Add `preferred_merchant_id` column and update user details API (#3373) chore(version): 2024.01.18.1 refactor(core): add locker config to enable or disable locker (#3352) fix(connector): [Cashtocode] update amount from i64 to f64 in webhook payload (#3382) fix(metrics): Add TASKS_ADDED_COUNT and TASKS_RESET_COUNT metrics in router scheduler flow (#3189) fix(connector): Trustpay zen error mapping (#3255) fix(user): fetch profile_id for sample data (#3358) refactor(connector): [Volt] Refactor Payments and Refunds Webhooks (#3377) chore(version): 2024.01.18.0
Type of Change
Description
Currently for user with multiple business profiles. We are getting 500 if the profile id is not passed in the payload. Therefore, need to fetch the profile_id (the first one) from list of business profiles, for the sample data generation.
Additional Changes
Motivation and Context
Getting 500, for users with multiple business profiles for sample data generation.
How did you test it?
Singup
Creating New business profile:
pass current merchant_id for the endpoint
Generate Sample Data:
Response will be 200
Checklist
cargo +nightly fmt --all
cargo clippy