Skip to content

Commit 9668c90

Browse files
refactor(payments): update authentication logic for global_payment_id in V2ClientAuth
1 parent 72e260a commit 9668c90

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

crates/router/src/core/payments/operations/payment_confirm_intent.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
169169
// TODO (#7195): Add platform merchant account validation once publishable key auth is solved
170170

171171
self.validate_status_for_operation(payment_intent.status)?;
172-
let client_secret = header_payload
173-
.client_secret
174-
.as_ref()
175-
.get_required_value("client_secret header")?;
172+
// let client_secret = header_payload
173+
// .client_secret
174+
// .as_ref()
175+
// .get_required_value("client_secret header")?;
176176
// payment_intent.validate_client_secret(client_secret)?;
177177

178178
let cell_id = state.conf.cell_information.id.clone();

crates/router/src/core/payments/payment_methods.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ pub async fn list_payment_methods(
3636

3737
validate_payment_status_for_payment_method_list(payment_intent.status)?;
3838

39-
let client_secret = header_payload
40-
.client_secret
41-
.as_ref()
42-
.get_required_value("client_secret header")
43-
.change_context(errors::ApiErrorResponse::MissingRequiredField {
44-
field_name: "client_secret header",
45-
})?;
39+
// let client_secret = header_payload
40+
// .client_secret
41+
// .as_ref()
42+
// .get_required_value("client_secret header")
43+
// .change_context(errors::ApiErrorResponse::MissingRequiredField {
44+
// field_name: "client_secret header",
45+
// })?;
4646

4747
// payment_intent.validate_client_secret(client_secret)?;
4848

crates/router/src/services/authentication.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1971,8 +1971,12 @@ where
19711971
.get_required_value(headers::X_PROFILE_ID)?;
19721972

19731973
match db_client_secret.resource_id {
1974-
common_utils::types::authentication::ResourceId::Payment(global_payment_id) => {
1975-
return Err(errors::ApiErrorResponse::Unauthorized.into())
1974+
common_utils::types::authentication::ResourceId::Payment(
1975+
global_payment_id
1976+
) => {
1977+
if global_payment_id.get_string_repr() != self.0.to_str() {
1978+
return Err(errors::ApiErrorResponse::Unauthorized.into())
1979+
}
19761980
}
19771981
common_utils::types::authentication::ResourceId::Customer(global_customer_id) => {
19781982
if global_customer_id.get_string_repr() != self.0.to_str() {

0 commit comments

Comments
 (0)