Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(customers): add missing JWTAuth from customer PML in v2 (#11337)

Kashif3aba0af8dee8
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 0fb285168e..9894452f03 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -81,19 +81,14 @@ pub async fn create_payment_method_api(
allow_connected_scope_operation: true,
allow_platform_self_operation: true,
};
- let jwt_auth = auth::JWTAuth {
- permission: Permission::MerchantCustomerRead,
+ let (auth_type, _api_key_type) = match auth::check_internal_api_key_auth_no_client_secret(
+ req.headers(),
+ api_auth,
+ state.conf.internal_merchant_id_profile_id_auth.clone(),
+ ) {
+ Ok(auth) => auth,
+ Err(err) => return api::log_and_return_error_response(error_stack::report!(err)),
};
- let (auth_type, _api_key_type) =
- match auth::check_internal_api_key_or_dashboard_auth_no_client_secret(
- req.headers(),
- api_auth,
- jwt_auth,
- state.conf.internal_merchant_id_profile_id_auth.clone(),
- ) {
- Ok(auth) => auth,
- Err(err) => return api::log_and_return_error_response(error_stack::report!(err)),
- };
Box::pin(api::server_wrap(
flow,
@@ -851,15 +846,19 @@ pub async fn list_customer_payment_method_api(
allow_connected_scope_operation: true,
allow_platform_self_operation: true,
};
-
- let (auth_type, api_key_type) = match auth::check_internal_api_key_auth_no_client_secret(
- req.headers(),
- api_auth,
- state.conf.internal_merchant_id_profile_id_auth.clone(),
- ) {
- Ok(auth) => auth,
- Err(err) => return api::log_and_return_error_response(error_stack::report!(err)),
+ let jwt_auth = auth::JWTAuth {
+ permission: Permission::MerchantCustomerRead,
};
+ let (auth_type, api_key_type) =
+ match auth::check_internal_api_key_or_dashboard_auth_no_client_secret(
+ req.headers(),
+ api_auth,
+ jwt_auth,
+ state.conf.internal_merchant_id_profile_id_auth.clone(),
+ ) {
+ Ok(auth) => auth,
+ Err(err) => return api::log_and_return_error_response(error_stack::report!(err)),
+ };
Box::pin(api::server_wrap(
flow,