-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(router): add retrieve poll status api #4358
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
…nto add-poll-status-api
crates/router/src/core/poll.rs
Outdated
.parse_enum("PollStatus") | ||
.map_err(|err| logger::warn!("error while parsing PollStatus: {err}")) | ||
.ok() | ||
.unwrap_or(PollStatus::NotFound) |
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 should be InternalServerError
crates/router/src/core/poll.rs
Outdated
.ok() | ||
.unwrap_or(PollStatus::NotFound) | ||
}) | ||
.unwrap_or(PollStatus::NotFound); |
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.
we should return a 4xx in this case because we have poll id in the request path, so if the resource is not found then a 404 should be returned
crates/router/src/core/poll.rs
Outdated
.attach_printable("Failed to get redis connection")?; | ||
let request_poll_id = req.poll_id; | ||
// prepend 'poll_' to restrict access to only fetching Poll IDs, as this is a freely passed string in the request | ||
let poll_id = format!("poll_{}", request_poll_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.
how are we restricting access control for poll ids? A merchant with a publishable key can access poll status of other merchants?
…en-capture-status-handle * 'main' of github.com:juspay/hyperswitch: feat(router): add retrieve poll status api (#4358)
Type of Change
Description
add retrieve poll status api
This is a generic poll status retrieve API, which can be used in any polling flows. application will set a poll_id in backend as pending, and sends back a poll_id to client to keep polling until the status is completed. once it turns to completed, client will do the required action. This is a light weight alternative to actually polling with the payment status or similar heavy apis.
Additional Changes
Motivation and Context
How did you test it?
Tested Manually
Expected 200 response
Checklist
cargo +nightly fmt --all
cargo clippy