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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(core): add client_auth auth type for list_blocked_payment_methods (#9475)
Swangi Kumari4005a749edad
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 55640e8191..64a8751993 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -17178,6 +17178,10 @@"type": "integer","format": "int32","minimum": 0+ },+ "client_secret": {+ "type": "string",+ "nullable": true}}},diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 7daec2c55b..8c768053eb 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -13421,6 +13421,10 @@"type": "integer","format": "int32","minimum": 0+ },+ "client_secret": {+ "type": "string",+ "nullable": true}}},diff --git a/crates/api_models/src/blocklist.rs b/crates/api_models/src/blocklist.rsindex 2afeb2db4f..9fb537b226 100644--- a/crates/api_models/src/blocklist.rs+++ b/crates/api_models/src/blocklist.rs@@ -53,6 +53,7 @@ pub struct ListBlocklistQuery {pub limit: u16,#[serde(default)]pub offset: u16,+ pub client_secret: Option<String>,}fn default_list_limit() -> u16 {diff --git a/crates/router/src/routes/blocklist.rs b/crates/router/src/routes/blocklist.rsindex 9e6a7eca30..be4e81afc3 100644--- a/crates/router/src/routes/blocklist.rs+++ b/crates/router/src/routes/blocklist.rs@@ -1,5 +1,6 @@use actix_web::{web, HttpRequest, HttpResponse};use api_models::blocklist as api_blocklist;+use error_stack::report;use router_env::Flow;use crate::{@@ -117,11 +118,24 @@ pub async fn list_blocked_payment_methods(query_payload: web::Query<api_blocklist::ListBlocklistQuery>,) -> HttpResponse {let flow = Flow::ListBlocklist;+ let payload = query_payload.into_inner();++ let api_auth = auth::ApiKeyAuth {+ is_connected_allowed: false,+ is_platform_allowed: false,+ };++ let (auth_type, _) =+ match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) {+ Ok(auth) => auth,+ Err(err) => return api::log_and_return_error_response(report!(err)),+ };+Box::pin(api::server_wrap(flow,state,&req,- query_payload.into_inner(),+ payload,|state, auth: auth::AuthenticationData, query, _| {let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(domain::Context(auth.merchant_account, auth.key_store),@@ -129,10 +143,7 @@ pub async fn list_blocked_payment_methods(blocklist::list_blocklist_entries(state, merchant_context, query)},auth::auth_type(- &auth::HeaderAuth(auth::ApiKeyAuth {- is_connected_allowed: false,- is_platform_allowed: false,- }),+ &*auth_type,&auth::JWTAuth {permission: Permission::MerchantAccountRead,},diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rsindex 1e48e9e52b..851c2cf21b 100644--- a/crates/router/src/services/authentication.rs+++ b/crates/router/src/services/authentication.rs@@ -4161,6 +4161,13 @@ impl ClientSecretFetch for payments::PaymentsRequest {}}+#[cfg(feature = "v1")]+impl ClientSecretFetch for api_models::blocklist::ListBlocklistQuery {+ fn get_client_secret(&self) -> Option<&String> {+ self.client_secret.as_ref()+ }+}+#[cfg(feature = "v1")]impl ClientSecretFetch for payments::PaymentsRetrieveRequest {fn get_client_secret(&self) -> Option<&String> {