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
fix(blocklist): update management API handling (#14985)
Ayush Anand78e8fbf63e26
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex a92c9562aa..e2c6c99c4b 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -7277,7 +7277,7 @@{"name": "X-Profile-Id","in": "header",- "description": "Restricts the listing to entries belonging to this business profile, plus entries with no profile. When no profile can be resolved - as with publishable-key authentication - all of the merchant's entries are returned, as before.",+ "description": "Restricts the listing to entries belonging to this business profile, plus entries with no profile. Ignored when authenticating with a JWT, which carries its own profile. If no profile is resolved for an API key, all of the merchant's entries are returned.","required": false,"schema": {"type": "string",@@ -7317,9 +7317,6 @@},{"jwt_key": []- },- {- "publishable_key": []}]},@@ -27371,10 +27368,6 @@"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 cede71ab50..31ed9c1fed 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -18575,10 +18575,6 @@"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 72fce16621..cc2daea3f2 100644--- a/crates/api_models/src/blocklist.rs+++ b/crates/api_models/src/blocklist.rs@@ -90,7 +90,6 @@ 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/openapi/src/routes/blocklist.rs b/crates/openapi/src/routes/blocklist.rsindex f5bbe7e2db..d647a89f1d 100644--- a/crates/openapi/src/routes/blocklist.rs+++ b/crates/openapi/src/routes/blocklist.rs@@ -139,9 +139,9 @@ pub async fn remove_entry_from_blocklist() {}("data_kind" = BlocklistDataKind, Query, description = "Kind of the fingerprint list requested"),("transaction_type" = Option<BlocklistTransactionType>, Query, description = "Blocklist flow: payment (default) or payout."),("X-Profile-Id" = Option<String>, Header, description = "Restricts the listing to entries \- belonging to this business profile, plus entries with no profile. When no profile can be \- resolved - as with publishable-key authentication - all of the merchant's entries are \- returned, as before."),+ belonging to this business profile, plus entries with no profile. Ignored when \+ authenticating with a JWT, which carries its own profile. If no profile is resolved \+ for an API key, all of the merchant's entries are returned."),("X-Connected-Merchant-Id" = Option<String>, Header,description = "Merchant ID of the connected merchant on whose behalf the operation is performed. \@@ -156,7 +156,7 @@ pub async fn remove_entry_from_blocklist() {}),tag = "Blocklist",operation_id = "List Blocked fingerprints of a particular kind",- security(("api_key" = []), ("jwt_key" = []), ("publishable_key" = []))+ security(("api_key" = []), ("jwt_key" = [])))]pub async fn list_blocked_payment_methods() {}diff --git a/crates/router/src/routes/blocklist.rs b/crates/router/src/routes/blocklist.rsindex 781867e622..d1fbf309d6 100644--- a/crates/router/src/routes/blocklist.rs+++ b/crates/router/src/routes/blocklist.rs@@ -1,7 +1,6 @@use actix_multipart::form::{bytes::Bytes as MultipartBytes, MultipartForm};use actix_web::{web, HttpRequest, HttpResponse};use api_models::blocklist as api_blocklist;-use error_stack::report;use router_env::Flow;use crate::{@@ -134,9 +133,9 @@ pub async fn remove_entry_from_blocklist(("data_kind" = BlocklistDataKind, Query, description = "Kind of the fingerprint list requested"),("transaction_type" = Option<BlocklistTransactionType>, Query, description = "Blocklist flow: payment (default) or payout."),("X-Profile-Id" = Option<String>, Header, description = "Restricts the listing to entries \- belonging to this business profile, plus entries with no profile. When no profile can be \- resolved - as with publishable-key authentication - all of the merchant's entries are \- returned, as before."),+ belonging to this business profile, plus entries with no profile. Ignored when \+ authenticating with a JWT, which carries its own profile. If no profile is resolved \+ for an API key, all of the merchant's entries are returned."),),responses((status = 200, description = "Blocked Fingerprints", body = ListBlocklistResponse),@@ -144,7 +143,7 @@ pub async fn remove_entry_from_blocklist(),tag = "Blocklist",operation_id = "List Blocked fingerprints of a particular kind",- security(("api_key" = []), ("jwt_key" = []), ("publishable_key" = []))+ security(("api_key" = []), ("jwt_key" = [])))]pub async fn list_blocked_payment_methods(state: web::Data<AppState>,@@ -154,29 +153,13 @@ pub async fn list_blocked_payment_methods(let flow = Flow::ListBlocklist;let payload = query_payload.into_inner();- let api_auth = auth::ApiKeyAuth {- allow_connected_scope_operation: true,- allow_platform_self_operation: false,- };-- let (auth_type, _) = match auth::check_sdk_auth_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,payload,- |state, auth, mut query, _| {- if let Some(client_secret) = auth.client_secret {- query.client_secret = Some(client_secret);- }-- // None whenever no profile is resolved - SDK/publishable-key auth, or an API key sent- // without X-Profile-Id - which keeps the listing merchant-wide+ |state, auth: auth::AuthenticationData, query, _| {+ // An API key without a resolved profile keeps the listing merchant-wide.let profile_id = auth.profile.map(|profile| profile.get_id().clone());blocklist::list_blocklist_entries(state,@@ -186,7 +169,10 @@ pub async fn list_blocked_payment_methods()},auth::auth_type(- &*auth_type,+ &auth::HeaderAuth(auth::ApiKeyAuth {+ allow_connected_scope_operation: true,+ allow_platform_self_operation: false,+ }),&auth::JWTAuth {permission: Permission::ProfileAccountRead,allow_connected: true,diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rsindex 127173ca3f..a6d41c3799 100644--- a/crates/router/src/services/authentication.rs+++ b/crates/router/src/services/authentication.rs@@ -5886,13 +5886,6 @@ impl ClientSecretFetch for payments::PaymentsEligibilityRequest {}}-#[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> {