-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(recon): add recon APIs #3345
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
Conversation
crates/api_models/src/recon.rs
Outdated
|
||
#[derive(Debug, serde::Serialize)] | ||
pub struct ReconTokenResponse { | ||
pub token: String, |
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.
If this contains sensitive information, let's use a Secret<String>
instead.
crates/router/src/routes/recon.rs
Outdated
.await | ||
.change_context(UserErrors::InternalServerError) | ||
.map_err(|error| { | ||
logger::error!(?error); |
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 include more information about the error? That we were unable to send recon email, for example?
crates/router/src/routes/recon.rs
Outdated
.update_merchant(merchant_account, updated_merchant_account, &key_store) | ||
.await | ||
.change_context(errors::ApiErrorResponse::InternalServerError) | ||
.attach_printable_lazy(|| format!("Failed while updating merchant: {merchant_id}"))?; |
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.
.attach_printable_lazy(|| format!("Failed while updating merchant: {merchant_id}"))?; | |
.attach_printable_lazy(|| format!("Failed while updating recon status for merchant: {merchant_id}"))?; |
Please make the same change elsewhere in this file.
crates/router/src/routes/recon.rs
Outdated
.await | ||
.change_context(UserErrors::InternalServerError) | ||
.map_err(|error| { | ||
logger::error!(?error); |
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's include more information about the error for better debugging.
let user_from_db = db | ||
.find_user_by_id(&user.user_id) | ||
.await | ||
.change_context(errors::ApiErrorResponse::InternalServerError)?; |
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.
Even if the user is not found we raise this error?
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.
Yes, if the control reaches till here, that means the auth token was verified, but user does not exist in DB
Probably that's why this is InternalServerError, should never reach here if the auth token was verified.
* 'main' of github.com:juspay/hyperswitch: chore(version): 2024.01.17.0 feat(connector): [BANKOFAMERICA] Implement 3DS flow for cards (#3343) ci(s3): fetch connector creds from s3 for added security (#3323) feat(recon): add recon APIs (#3345) fix(payment_link): added expires_on in payment response (#3332) fix(connector_onboarding): Check if connector exists for the merchant account and add reset tracking id API (#3229)
Type of Change
Description
This PR adds recon APIs for activating recon as a feature on HyperSwitch dashboard and generating tokens for Recon dashboard.
Issue - #3359
Additional Changes
Motivation and Context
How did you test it?
Tested below endpoints for Recon service using the attached postman collection.
Postman collection - https://galactic-capsule-229427.postman.co/workspace/My-Workspace~2b563e0d-bad3-420f-8c0b-0fd5b278a4fe/collection/9906252-4ef01bc4-53d4-40c0-a3e7-c84c8e32f105?action=share&creator=9906252
Endpoints
/recon/update_merchant
- admin API call for updating any recon related field for a given merchant./recon/token
- request a token for an user which is used for logging into Recon's dashboard./recon/request
- let's user send a mail to HS team for enabling recon for their merchant's account./recon/verify_token
- validate a generated token.Checklist
cargo +nightly fmt --all
cargo clippy