fix(recovery): Populate connector request reference id in revenue recovery record attempt flow.#8434
Merged
Gnanasundari24 merged 7 commits intomainfrom Jun 26, 2025
Merged
fix(recovery): Populate connector request reference id in revenue recovery record attempt flow.#8434Gnanasundari24 merged 7 commits intomainfrom
Gnanasundari24 merged 7 commits intomainfrom
Conversation
Changed Files
|
| where | ||
| { | ||
| if let Ok(val) = HeaderMapStruct::new(headers).get_auth_string_from_header() { | ||
| if val.trim().starts_with("api-key=") { |
Contributor
There was a problem hiding this comment.
nit: "api-key=" can be a const.
hrithikesh026
approved these changes
Jun 25, 2025
tsdk02
reviewed
Jun 25, 2025
Comment on lines
+2701
to
+2721
| #[cfg(feature = "v2")] | ||
| pub fn api_or_client_or_jwt_auth<'a, T, A>( | ||
| api_auth: &'a dyn AuthenticateAndFetch<T, A>, | ||
| client_auth: &'a dyn AuthenticateAndFetch<T, A>, | ||
| jwt_auth: &'a dyn AuthenticateAndFetch<T, A>, | ||
| headers: &HeaderMap, | ||
| ) -> &'a dyn AuthenticateAndFetch<T, A> | ||
| where | ||
| { | ||
| if let Ok(val) = HeaderMapStruct::new(headers).get_auth_string_from_header() { | ||
| if val.trim().starts_with("api-key=") { | ||
| api_auth | ||
| } else if is_jwt_auth(headers) { | ||
| jwt_auth | ||
| } else { | ||
| client_auth | ||
| } | ||
| } else { | ||
| api_auth | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Are you giving the highest priority to api-key?
What if both JWT and api-key headers are present in the request body? Which authentication type should be considered in that case?
Or is it the same header used for all authentications in v2?
Contributor
There was a problem hiding this comment.
This can never happen right.
Value for Authorization header cannot start with Both Bearer_ and api-key=
Contributor
There was a problem hiding this comment.
Got it, so unlike v1, where there are different headers for different authentication types, in v2 there is just one Authorization header with different values for different types of authentication, correct?
tsdk02
approved these changes
Jun 25, 2025
ShankarSinghC
approved these changes
Jun 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Previously there was no restriction in confirmData to connector request reference id to be mandatory. Recovery internally uses proxy flow, which internally uses confirmData where connector request reference id was hardcoded to none. This Pr adds supports to generate connector request reference to merchant reference id.
This Pr also has changes of adding support for jwt auth to payment get for dashboard use case. Previously payment sync was used in dashboard to retrieve payment details, but this would fail now in v2 because if there are no attempts created payment get would return 4xx since active attempt is mandotory. To solve this now dashboard is relying on payment get and payment get attempt list api's .
Additional Changes
Motivation and Context
How did you test it?
Test case 1 :
step 1 : create a profile in hyperswitch and wait for 8 mins to move it from monitering to cascading , this would only get updated when webhooks are triggered .
step 2 : create payment mca
**step 4 : ** configure stripe billing connector.
step 5 : Trigger failed invoice from stripe billing by creating new subscription and move the test clock to 1 week.
This would trigger few external payments. once it exhausts retry threshold it will create process tracker entry. Follwed by 2 mins it would create all retries by hyperswitch as shown below.
Checklist
cargo +nightly fmt --allcargo clippy