-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix(recovery): Populate connector request reference id in revenue recovery record attempt flow. #8434
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
Changed Files
|
where | ||
{ | ||
if let Ok(val) = HeaderMapStruct::new(headers).get_auth_string_from_header() { | ||
if val.trim().starts_with("api-key=") { |
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.
nit: "api-key="
can be a const.
#[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 | ||
} | ||
} |
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.
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?
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 can never happen right.
Value for Authorization
header cannot start with Both Bearer_
and api-key=
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.
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?
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 --all
cargo clippy