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(platform): add processor_merchant_id, created_by columns to blocklist table and query update (#11951)
Ankit Kumar Gupta858c30fe9f0b
diff --git a/crates/diesel_models/src/blocklist.rs b/crates/diesel_models/src/blocklist.rsindex c4a5b48bad..153b57e2c4 100644--- a/crates/diesel_models/src/blocklist.rs+++ b/crates/diesel_models/src/blocklist.rs@@ -11,6 +11,8 @@ pub struct BlocklistNew {pub data_kind: common_enums::BlocklistDataKind,pub metadata: Option<serde_json::Value>,pub created_at: time::PrimitiveDateTime,+ pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,+ pub created_by: Option<String>,}#[derive(@@ -23,4 +25,6 @@ pub struct Blocklist {pub data_kind: common_enums::BlocklistDataKind,pub metadata: Option<serde_json::Value>,pub created_at: time::PrimitiveDateTime,+ pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,+ pub created_by: Option<String>,}diff --git a/crates/diesel_models/src/query/blocklist.rs b/crates/diesel_models/src/query/blocklist.rsindex 62c4b3d9c7..9db63dca89 100644--- a/crates/diesel_models/src/query/blocklist.rs+++ b/crates/diesel_models/src/query/blocklist.rs@@ -21,7 +21,7 @@ impl BlocklistNew {) -> StorageResult<usize> {let query = diesel::insert_into(<Blocklist as HasTable>::table()).values(entries)- .on_conflict((dsl::merchant_id, dsl::fingerprint_id))+ .on_conflict((dsl::processor_merchant_id, dsl::fingerprint_id)).do_nothing();generics::db_metrics::track_database_call::<<Blocklist as HasTable>::Table, _, _>(@@ -36,31 +36,49 @@ impl BlocklistNew {}impl Blocklist {+ pub async fn find_by_processor_merchant_id_fingerprint_id(+ conn: &PgPooledConn,+ processor_merchant_id: &common_utils::id_type::MerchantId,+ fingerprint_id: &str,+ ) -> StorageResult<Self> {+ generics::generic_find_one::<<Self as HasTable>::Table, _, _>(+ conn,+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned())+ .and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())),+ )+ .await+ }++ // Fallback function for stagger release - finds by merchant_id when processor_merchant_id is NULLpub async fn find_by_merchant_id_fingerprint_id(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,fingerprint_id: &str,) -> StorageResult<Self> {generics::generic_find_one::<<Self as HasTable>::Table, _, _>(conn,dsl::merchant_id- .eq(merchant_id.to_owned())+ .eq(processor_merchant_id.to_owned()).and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())),).await}- pub async fn list_by_merchant_id_data_kind(+ pub async fn list_by_processor_merchant_id_data_kind(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,limit: i64,offset: i64,) -> StorageResult<Vec<Self>> {generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(conn,- dsl::merchant_id- .eq(merchant_id.to_owned())+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned())+ .or(dsl::processor_merchant_id+ .is_null()+ .and(dsl::merchant_id.eq(processor_merchant_id.to_owned()))).and(dsl::data_kind.eq(data_kind.to_owned())),Some(limit),Some(offset),@@ -69,27 +87,34 @@ impl Blocklist {.await}- pub async fn get_count_by_merchant_id_data_kind(+ pub async fn get_count_by_processor_merchant_id_data_kind(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,) -> StorageResult<usize> {generics::generic_count::<<Self as HasTable>::Table, _>(conn,- dsl::merchant_id- .eq(merchant_id.to_owned())+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned())+ .or(dsl::processor_merchant_id+ .is_null()+ .and(dsl::merchant_id.eq(processor_merchant_id.to_owned()))).and(dsl::data_kind.eq(data_kind.to_owned())),).await}- pub async fn list_by_merchant_id(+ pub async fn list_by_processor_merchant_id(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,) -> StorageResult<Vec<Self>> {generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(conn,- dsl::merchant_id.eq(merchant_id.to_owned()),+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned())+ .or(dsl::processor_merchant_id+ .is_null()+ .and(dsl::merchant_id.eq(processor_merchant_id.to_owned()))),None,None,Some(dsl::created_at.desc()),@@ -97,15 +122,30 @@ impl Blocklist {.await}+ pub async fn delete_by_processor_merchant_id_fingerprint_id(+ conn: &PgPooledConn,+ processor_merchant_id: &common_utils::id_type::MerchantId,+ fingerprint_id: &str,+ ) -> StorageResult<Self> {+ generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(+ conn,+ dsl::processor_merchant_id+ .eq(processor_merchant_id.to_owned())+ .and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())),+ )+ .await+ }++ // Fallback function for stagger release - deletes by merchant_id when processor_merchant_id is NULLpub async fn delete_by_merchant_id_fingerprint_id(conn: &PgPooledConn,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,fingerprint_id: &str,) -> StorageResult<Self> {generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(conn,dsl::merchant_id- .eq(merchant_id.to_owned())+ .eq(processor_merchant_id.to_owned()).and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())),).awaitdiff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex d1239ea990..bab95c54b0 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -215,6 +215,10 @@ diesel::table! {data_kind -> BlocklistDataKind,metadata -> Nullable<Jsonb>,created_at -> Timestamp,+ #[max_length = 64]+ processor_merchant_id -> Nullable<Varchar>,+ #[max_length = 255]+ created_by -> Nullable<Varchar>,}}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex 451298730d..5ce322ae29 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -215,6 +215,10 @@ diesel::table! {data_kind -> BlocklistDataKind,metadata -> Nullable<Jsonb>,created_at -> Timestamp,+ #[max_length = 64]+ processor_merchant_id -> Nullable<Varchar>,+ #[max_length = 255]+ created_by -> Nullable<Varchar>,}}diff --git a/crates/router/src/core/blocklist.rs b/crates/router/src/core/blocklist.rsindex 67d5ef3a88..25738e7264 100644--- a/crates/router/src/core/blocklist.rs+++ b/crates/router/src/core/blocklist.rs@@ -16,55 +16,39 @@ pub async fn add_entry_to_blocklist(platform: domain::Platform,body: api_blocklist::AddToBlocklistRequest,) -> RouterResponse<api_blocklist::AddToBlocklistResponse> {- utils::insert_entry_into_blocklist(- &state,- platform.get_processor().get_account().get_id(),- body,- )- .await- .map(services::ApplicationResponse::Json)+ utils::insert_entry_into_blocklist(&state, &platform, body)+ .await+ .map(services::ApplicationResponse::Json)}pub async fn remove_entry_from_blocklist(state: SessionState,- platform: domain::Platform,+ processor: domain::Processor,body: api_blocklist::DeleteFromBlocklistRequest,) -> RouterResponse<api_blocklist::DeleteFromBlocklistResponse> {- utils::delete_entry_from_blocklist(- &state,- platform.get_processor().get_account().get_id(),- body,- )- .await- .map(services::ApplicationResponse::Json)+ utils::delete_entry_from_blocklist(&state, processor.get_account().get_id(), body)+ .await+ .map(services::ApplicationResponse::Json)}pub async fn list_blocklist_entries(state: SessionState,- platform: domain::Platform,+ processor: domain::Processor,query: api_blocklist::ListBlocklistQuery,) -> RouterResponse<api_blocklist::ListBlocklistResponse> {- utils::list_blocklist_entries_for_merchant(- &state,- platform.get_processor().get_account().get_id(),- query,- )- .await- .map(services::ApplicationResponse::Json)+ utils::list_blocklist_entries_for_merchant(&state, processor.get_account().get_id(), query)+ .await+ .map(services::ApplicationResponse::Json)}pub async fn toggle_blocklist_guard(state: SessionState,- platform: domain::Platform,+ processor: domain::Processor,query: api_blocklist::ToggleBlocklistQuery,) -> RouterResponse<api_blocklist::ToggleBlocklistResponse> {- utils::toggle_blocklist_guard_for_merchant(- &state,- platform.get_processor().get_account().get_id(),- query,- )- .await- .map(services::ApplicationResponse::Json)+ utils::toggle_blocklist_guard_for_merchant(&state, processor.get_account().get_id(), query)+ .await+ .map(services::ApplicationResponse::Json)}pub async fn upload_batch_blocklist(@@ -72,13 +56,9 @@ pub async fn upload_batch_blocklist(platform: domain::Platform,csv_bytes: bytes::Bytes,) -> RouterResponse<api_blocklist::BatchBlocklistUploadResponse> {- batch::initiate_batch_blocklist_upload(- &state,- platform.get_processor().get_account().get_id(),- csv_bytes,- )- .await- .map(services::ApplicationResponse::Json)+ batch::initiate_batch_blocklist_upload(&state, &platform, csv_bytes)+ .await+ .map(services::ApplicationResponse::Json)}pub async fn get_batch_blocklist_job_status(diff --git a/crates/router/src/core/blocklist/batch.rs b/crates/router/src/core/blocklist/batch.rsindex c56133f8de..212905ba98 100644--- a/crates/router/src/core/blocklist/batch.rs+++ b/crates/router/src/core/blocklist/batch.rs@@ -12,7 +12,7 @@ use crate::{core::errors::{self, RouterResult, StorageErrorExt},logger,routes::SessionState,- types::storage,+ types::{domain, storage},};const CHUNK_SIZE: usize = 2_000;@@ -304,13 +304,19 @@ fn validate_csv(csv_bytes: &[u8]) -> RouterResult<Vec<BlocklistRow>> {#[instrument(skip_all, fields(flow = ?router_env::Flow::BatchBlocklistUpload))]pub async fn initiate_batch_blocklist_upload(state: &SessionState,- merchant_id: &id_type::MerchantId,+ platform: &domain::Platform,csv_bytes: bytes::Bytes,) -> RouterResult<api_blocklist::BatchBlocklistUploadResponse> {+ let processor_merchant_id = platform.get_processor().get_account().get_id();+ let created_by = platform+ .get_initiator()+ .and_then(|initiator| initiator.to_created_by())+ .map(|created_by| created_by.to_string());+let rows = validate_csv(&csv_bytes)?;let total_rows = rows.len();let job_id = common_utils::generate_id(crate::consts::ID_LENGTH, "blkbatch");- let mid_str = merchant_id.get_string_repr().to_owned();+ let mid_str = processor_merchant_id.get_string_repr().to_owned();let original_key = original_input_key(&mid_str, &job_id);let chunks: Vec<&[BlocklistRow]> = rows.chunks(CHUNK_SIZE).collect();let chunk_total_count = u32::try_from(chunks.len())@@ -368,7 +374,7 @@ pub async fn initiate_batch_blocklist_upload(let job_new = storage::BatchBlocklistJobNew {id: job_id.clone(),- merchant_id: merchant_id.clone(),+ merchant_id: processor_merchant_id.clone(),status: common_enums::BatchBlocklistJobStatus::Initiated,total_rows: total_rows_i32,succeeded_rows: 0,@@ -385,14 +391,20 @@ pub async fn initiate_batch_blocklist_upload(let tracking_data = storage::BatchBlocklistTrackingData {job_id: job_id.clone(),- merchant_id: merchant_id.clone(),+ merchant_id: platform.get_provider().get_account().get_id().clone(),+ processor_merchant_id: Some(processor_merchant_id.clone()),chunk_total_count,completed_chunks: Vec::new(),+ created_by: created_by.clone(),};let runner = storage::ProcessTrackerRunner::BatchBlocklistUpload;- let process_tracker_id =- pt_utils::get_process_tracker_id(runner, BATCH_BLOCKLIST_TASK, &job_id, merchant_id);+ let process_tracker_id = pt_utils::get_process_tracker_id(+ runner,+ BATCH_BLOCKLIST_TASK,+ &job_id,+ processor_merchant_id,+ );let process_tracker_entry = storage::ProcessTrackerNew::new(process_tracker_id,@@ -434,8 +446,10 @@ pub async fn initiate_batch_blocklist_upload(pub(crate) async fn process_chunk(state: &SessionState,merchant_id: &id_type::MerchantId,+ processor_merchant_id: Option<&id_type::MerchantId>,chunk_idx: u32,chunk_rows: Vec<BlocklistRow>,+ created_by: Option<String>,) -> RouterResult<i32> {let now = date_time::now();let entries: Vec<storage::BlocklistNew> = chunk_rows@@ -446,6 +460,8 @@ pub(crate) async fn process_chunk(data_kind: row.data_kind,metadata: row.metadata.clone(),created_at: now,+ processor_merchant_id: processor_merchant_id.map(|id| id.to_owned()),+ created_by: created_by.clone(),}).collect();diff --git a/crates/router/src/core/blocklist/utils.rs b/crates/router/src/core/blocklist/utils.rsindex 68ccfa2817..c5a79400b5 100644--- a/crates/router/src/core/blocklist/utils.rs+++ b/crates/router/src/core/blocklist/utils.rs@@ -18,21 +18,24 @@ use crate::{pub async fn delete_entry_from_blocklist(state: &SessionState,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,request: api_blocklist::DeleteFromBlocklistRequest,) -> RouterResult<api_blocklist::DeleteFromBlocklistResponse> {let blocklist_entry = match request {api_blocklist::DeleteFromBlocklistRequest::CardBin(bin) => {- delete_card_bin_blocklist_entry(state, &bin, merchant_id).await?+ delete_card_bin_blocklist_entry(state, &bin, processor_merchant_id).await?}api_blocklist::DeleteFromBlocklistRequest::ExtendedCardBin(xbin) => {- delete_card_bin_blocklist_entry(state, &xbin, merchant_id).await?+ delete_card_bin_blocklist_entry(state, &xbin, processor_merchant_id).await?}api_blocklist::DeleteFromBlocklistRequest::Fingerprint(fingerprint_id) => state.store- .delete_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, &fingerprint_id)+ .delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,+ &fingerprint_id,+ ).await.to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {message: "no blocklist record for the given fingerprint id was found".to_string(),@@ -44,10 +47,10 @@ pub async fn delete_entry_from_blocklist(pub async fn toggle_blocklist_guard_for_merchant(state: &SessionState,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,query: api_blocklist::ToggleBlocklistQuery,) -> CustomResult<api_blocklist::ToggleBlocklistResponse, errors::ApiErrorResponse> {- let key = merchant_id.get_blocklist_guard_key();+ let key = processor_merchant_id.get_blocklist_guard_key();let maybe_guard = state.store.find_config_by_key_from_db(&key).await;let new_config = configs::ConfigNew {key: key.clone(),@@ -88,13 +91,13 @@ pub async fn toggle_blocklist_guard_for_merchant(pub async fn list_blocklist_entries_for_merchant(state: &SessionState,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,query: api_blocklist::ListBlocklistQuery,) -> RouterResult<api_blocklist::ListBlocklistResponse> {let entries = state.store- .list_blocklist_entries_by_merchant_id_data_kind(- merchant_id,+ .list_blocklist_entries_by_processor_merchant_id_data_kind(+ processor_merchant_id,query.data_kind,query.limit.into(),query.offset.into(),@@ -106,7 +109,10 @@ pub async fn list_blocklist_entries_for_merchant(let total_count = state.store- .get_blocklist_entries_count_by_merchant_id_data_kind(merchant_id, query.data_kind)+ .get_blocklist_entries_count_by_processor_merchant_id_data_kind(+ processor_merchant_id,+ query.data_kind,+ ).await.to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {message: "no blocklist records found".to_string(),@@ -148,16 +154,18 @@ fn validate_extended_card_bin(bin: &str) -> RouterResult<()> {pub async fn insert_entry_into_blocklist(state: &SessionState,- merchant_id: &common_utils::id_type::MerchantId,+ platform: &domain::Platform,to_block: api_blocklist::AddToBlocklistRequest,) -> RouterResult<api_blocklist::AddToBlocklistResponse> {+ let processor_merchant_id = platform.get_processor().get_account().get_id();+let blocklist_entry = match &to_block {api_blocklist::AddToBlocklistRequest::CardBin(bin) => {validate_card_bin(bin)?;duplicate_check_insert_bin(bin,state,- merchant_id,+ platform,common_enums::BlocklistDataKind::CardBin,).await?@@ -168,7 +176,7 @@ pub async fn insert_entry_into_blocklist(duplicate_check_insert_bin(bin,state,- merchant_id,+ platform,common_enums::BlocklistDataKind::ExtendedCardBin,).await?@@ -177,7 +185,10 @@ pub async fn insert_entry_into_blocklist(api_blocklist::AddToBlocklistRequest::Fingerprint(fingerprint_id) => {let blocklist_entry_result = state.store- .find_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, fingerprint_id)+ .find_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,+ fingerprint_id,+ ).await;match blocklist_entry_result {@@ -201,11 +212,16 @@ pub async fn insert_entry_into_blocklist(state.store.insert_blocklist_entry(storage::BlocklistNew {- merchant_id: merchant_id.to_owned(),+ merchant_id: platform.get_provider().get_account().get_id().clone(),fingerprint_id: fingerprint_id.clone(),data_kind: api_models::enums::enums::BlocklistDataKind::PaymentMethod,metadata: None,created_at: common_utils::date_time::now(),+ processor_merchant_id: Some(processor_merchant_id.to_owned()),+ created_by: platform+ .get_initiator()+ .and_then(|initiator| initiator.to_created_by())+ .map(|created_by| created_by.to_string()),}).await.change_context(errors::ApiErrorResponse::InternalServerError)@@ -238,12 +254,14 @@ pub async fn get_merchant_fingerprint_secret(async fn duplicate_check_insert_bin(bin: &str,state: &SessionState,- merchant_id: &common_utils::id_type::MerchantId,+ platform: &domain::Platform,data_kind: common_enums::BlocklistDataKind,) -> RouterResult<storage::Blocklist> {+ let processor_merchant_id = platform.get_processor().get_account().get_id();+let blocklist_entry_result = state.store- .find_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, bin)+ .find_blocklist_entry_by_processor_merchant_id_fingerprint_id(processor_merchant_id, bin).await;match blocklist_entry_result {@@ -266,11 +284,16 @@ async fn duplicate_check_insert_bin(state.store.insert_blocklist_entry(storage::BlocklistNew {- merchant_id: merchant_id.to_owned(),+ merchant_id: platform.get_provider().get_account().get_id().clone(),fingerprint_id: bin.to_string(),data_kind,metadata: None,created_at: common_utils::date_time::now(),+ processor_merchant_id: Some(processor_merchant_id.to_owned()),+ created_by: platform+ .get_initiator()+ .and_then(|initiator| initiator.to_created_by())+ .map(|created_by| created_by.to_string()),}).await.change_context(errors::ApiErrorResponse::InternalServerError)@@ -280,11 +303,11 @@ async fn duplicate_check_insert_bin(async fn delete_card_bin_blocklist_entry(state: &SessionState,bin: &str,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,) -> RouterResult<storage::Blocklist> {state.store- .delete_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, bin)+ .delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(processor_merchant_id, bin).await.to_not_found_response(errors::ApiErrorResponse::GenericNotFoundError {message: "could not find a blocklist entry for the given bin".to_string(),@@ -299,7 +322,7 @@ pub async fn should_payment_be_blocked(business_profile: &domain::Profile,) -> CustomResult<Option<BlockReason>, errors::ApiErrorResponse> {let db = &state.store;- let merchant_id = processor.get_account().get_id();+ let processor_merchant_id = processor.get_account().get_id();let processor_dimensions = dimensions.without_provider_merchant_id();let merchant_fingerprint_secret =get_merchant_fingerprint_secret(state, &processor_dimensions).await?;@@ -350,26 +373,30 @@ pub async fn should_payment_be_blocked(//validating the payment method.let mut blocklist_futures = Vec::new();if let Some(card_number_fingerprint) = card_number_fingerprint.as_ref() {- blocklist_futures.push(db.find_blocklist_entry_by_merchant_id_fingerprint_id(- merchant_id,- card_number_fingerprint,- ));+ blocklist_futures.push(+ db.find_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,+ card_number_fingerprint,+ ),+ );}if let Some(card_bin_fingerprint) = card_bin_fingerprint.as_ref() {blocklist_futures.push(- db.find_blocklist_entry_by_merchant_id_fingerprint_id(- merchant_id,+ db.find_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,card_bin_fingerprint,),);}if let Some(extended_card_bin_fingerprint) = extended_card_bin_fingerprint.as_ref() {- blocklist_futures.push(db.find_blocklist_entry_by_merchant_id_fingerprint_id(- merchant_id,- extended_card_bin_fingerprint,- ));+ blocklist_futures.push(+ db.find_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,+ extended_card_bin_fingerprint,+ ),+ );}let blocklist_lookups = futures::future::join_all(blocklist_futures).await;diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex daadafe690..e9846c849b 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -6964,8 +6964,8 @@ whereF: Send + Clone + Sync,D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,{- let merchant_id = processor.get_account().get_id();- let blocklist_enabled_key = merchant_id.get_blocklist_guard_key();+ let processor_merchant_id = processor.get_account().get_id();+ let blocklist_enabled_key = processor_merchant_id.get_blocklist_guard_key();let blocklist_guard_enabled = state.store.find_config_by_key_unwrap_or(&blocklist_enabled_key, Some("false".to_string()))diff --git a/crates/router/src/db/blocklist.rs b/crates/router/src/db/blocklist.rsindex c19ac099c5..ceb69563b3 100644--- a/crates/router/src/db/blocklist.rs+++ b/crates/router/src/db/blocklist.rs@@ -17,34 +17,34 @@ pub trait BlocklistInterface {pm_blocklist_new: storage::BlocklistNew,) -> CustomResult<storage::Blocklist, errors::StorageError>;- async fn find_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn find_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError>;- async fn delete_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError>;- async fn list_blocklist_entries_by_merchant_id(+ async fn list_blocklist_entries_by_processor_merchant_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError>;- async fn list_blocklist_entries_by_merchant_id_data_kind(+ async fn list_blocklist_entries_by_processor_merchant_id_data_kind(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,limit: i64,offset: i64,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError>;- async fn get_blocklist_entries_count_by_merchant_id_data_kind(+ async fn get_blocklist_entries_count_by_processor_merchant_id_data_kind(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,) -> CustomResult<usize, errors::StorageError>;@@ -72,40 +72,65 @@ impl BlocklistInterface for Store {}#[instrument(skip_all)]- async fn find_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn find_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError> {- let conn = connection::pg_connection_write(self).await?;- storage::Blocklist::find_by_merchant_id_fingerprint_id(&conn, merchant_id, fingerprint_id)- .await- .map_err(|error| report!(errors::StorageError::from(error)))+ let conn = connection::pg_connection_read(self).await?;+ // Stagger release fallback: first try processor_merchant_id, if not found fallback to merchant_id+ // For old records processor_merchant_id is NULL, so we use merchant_id (which has the same value)+ let result = storage::Blocklist::find_by_processor_merchant_id_fingerprint_id(+ &conn,+ processor_merchant_id,+ fingerprint_id,+ )+ .await;++ match result {+ Ok(blocklist_entry) => Ok(blocklist_entry),+ Err(error) => {+ if matches!(+ error.current_context(),+ diesel_models::errors::DatabaseError::NotFound+ ) {+ storage::Blocklist::find_by_merchant_id_fingerprint_id(+ &conn,+ processor_merchant_id,+ fingerprint_id,+ )+ .await+ .map_err(|error| report!(errors::StorageError::from(error)))+ } else {+ Err(report!(errors::StorageError::from(error)))+ }+ }+ }}#[instrument(skip_all)]- async fn list_blocklist_entries_by_merchant_id(+ async fn list_blocklist_entries_by_processor_merchant_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError> {- let conn = connection::pg_connection_write(self).await?;- storage::Blocklist::list_by_merchant_id(&conn, merchant_id)+ let conn = connection::pg_connection_read(self).await?;+ storage::Blocklist::list_by_processor_merchant_id(&conn, processor_merchant_id).await.map_err(|error| report!(errors::StorageError::from(error)))}#[instrument(skip_all)]- async fn list_blocklist_entries_by_merchant_id_data_kind(+ async fn list_blocklist_entries_by_processor_merchant_id_data_kind(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,limit: i64,offset: i64,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError> {let conn = connection::pg_connection_read(self).await?;- storage::Blocklist::list_by_merchant_id_data_kind(+ storage::Blocklist::list_by_processor_merchant_id_data_kind(&conn,- merchant_id,+ processor_merchant_id,data_kind,limit,offset,@@ -117,29 +142,58 @@ impl BlocklistInterface for Store {}#[instrument(skip_all)]- async fn get_blocklist_entries_count_by_merchant_id_data_kind(+ async fn get_blocklist_entries_count_by_processor_merchant_id_data_kind(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,) -> CustomResult<usize, errors::StorageError> {let conn = connection::pg_connection_read(self).await?;- storage::Blocklist::get_count_by_merchant_id_data_kind(&conn, merchant_id, data_kind)- .await- .change_context(errors::StorageError::DatabaseError(report!(- diesel_models::errors::DatabaseError::Others- )))+ storage::Blocklist::get_count_by_processor_merchant_id_data_kind(+ &conn,+ processor_merchant_id,+ data_kind,+ )+ .await+ .change_context(errors::StorageError::DatabaseError(report!(+ diesel_models::errors::DatabaseError::Others+ )))}#[instrument(skip_all)]- async fn delete_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError> {let conn = connection::pg_connection_write(self).await?;- storage::Blocklist::delete_by_merchant_id_fingerprint_id(&conn, merchant_id, fingerprint_id)- .await- .map_err(|error| report!(errors::StorageError::from(error)))+ // Stagger release fallback: first try processor_merchant_id, if not found fallback to merchant_id+ // For old records processor_merchant_id is NULL, so we delete by merchant_id (which has the same value)+ let result = storage::Blocklist::delete_by_processor_merchant_id_fingerprint_id(+ &conn,+ processor_merchant_id,+ fingerprint_id,+ )+ .await;++ match result {+ Ok(blocklist) => Ok(blocklist),+ Err(error) => {+ if matches!(+ error.current_context(),+ diesel_models::errors::DatabaseError::NotFound+ ) {+ storage::Blocklist::delete_by_merchant_id_fingerprint_id(+ &conn,+ processor_merchant_id,+ fingerprint_id,+ )+ .await+ .map_err(|error| report!(errors::StorageError::from(error)))+ } else {+ Err(report!(errors::StorageError::from(error)))+ }+ }+ }}#[instrument(skip_all)]@@ -164,24 +218,24 @@ impl BlocklistInterface for MockDb {Err(errors::StorageError::MockDbError)?}- async fn find_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn find_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,_fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError> {Err(errors::StorageError::MockDbError)?}- async fn list_blocklist_entries_by_merchant_id(+ async fn list_blocklist_entries_by_processor_merchant_id(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError> {Err(errors::StorageError::MockDbError)?}- async fn list_blocklist_entries_by_merchant_id_data_kind(+ async fn list_blocklist_entries_by_processor_merchant_id_data_kind(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,_data_kind: common_enums::BlocklistDataKind,_limit: i64,_offset: i64,@@ -189,17 +243,17 @@ impl BlocklistInterface for MockDb {Err(errors::StorageError::MockDbError)?}- async fn get_blocklist_entries_count_by_merchant_id_data_kind(+ async fn get_blocklist_entries_count_by_processor_merchant_id_data_kind(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,_data_kind: common_enums::BlocklistDataKind,) -> CustomResult<usize, errors::StorageError> {Err(errors::StorageError::MockDbError)?}- async fn delete_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- _merchant_id: &common_utils::id_type::MerchantId,+ _processor_merchant_id: &common_utils::id_type::MerchantId,_fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError> {Err(errors::StorageError::MockDbError)?@@ -213,7 +267,8 @@ impl BlocklistInterface for MockDb {let mut inserted = 0usize;for entry in entries {let already_exists = blocklists.iter().any(|b| {- b.merchant_id == entry.merchant_id && b.fingerprint_id == entry.fingerprint_id+ b.processor_merchant_id == entry.processor_merchant_id+ && b.fingerprint_id == entry.fingerprint_id});if !already_exists {blocklists.push(storage::Blocklist {@@ -222,6 +277,8 @@ impl BlocklistInterface for MockDb {data_kind: entry.data_kind,metadata: entry.metadata,created_at: entry.created_at,+ processor_merchant_id: entry.processor_merchant_id,+ created_by: entry.created_by,});inserted += 1;}@@ -241,58 +298,72 @@ impl BlocklistInterface for KafkaStore {}#[instrument(skip_all)]- async fn find_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn find_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- merchant_id: &common_utils::id_type::MerchantId,- fingerprint: &str,+ processor_merchant_id: &common_utils::id_type::MerchantId,+ fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError> {self.diesel_store- .find_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, fingerprint)+ .find_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,+ fingerprint_id,+ ).await}#[instrument(skip_all)]- async fn delete_blocklist_entry_by_merchant_id_fingerprint_id(+ async fn delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(&self,- merchant_id: &common_utils::id_type::MerchantId,- fingerprint: &str,+ processor_merchant_id: &common_utils::id_type::MerchantId,+ fingerprint_id: &str,) -> CustomResult<storage::Blocklist, errors::StorageError> {self.diesel_store- .delete_blocklist_entry_by_merchant_id_fingerprint_id(merchant_id, fingerprint)+ .delete_blocklist_entry_by_processor_merchant_id_fingerprint_id(+ processor_merchant_id,+ fingerprint_id,+ ).await}#[instrument(skip_all)]- async fn list_blocklist_entries_by_merchant_id_data_kind(+ async fn list_blocklist_entries_by_processor_merchant_id_data_kind(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,limit: i64,offset: i64,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError> {self.diesel_store- .list_blocklist_entries_by_merchant_id_data_kind(merchant_id, data_kind, limit, offset)+ .list_blocklist_entries_by_processor_merchant_id_data_kind(+ processor_merchant_id,+ data_kind,+ limit,+ offset,+ ).await}#[instrument(skip_all)]- async fn get_blocklist_entries_count_by_merchant_id_data_kind(+ async fn get_blocklist_entries_count_by_processor_merchant_id_data_kind(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,data_kind: common_enums::BlocklistDataKind,) -> CustomResult<usize, errors::StorageError> {self.diesel_store- .get_blocklist_entries_count_by_merchant_id_data_kind(merchant_id, data_kind)+ .get_blocklist_entries_count_by_processor_merchant_id_data_kind(+ processor_merchant_id,+ data_kind,+ ).await}#[instrument(skip_all)]- async fn list_blocklist_entries_by_merchant_id(+ async fn list_blocklist_entries_by_processor_merchant_id(&self,- merchant_id: &common_utils::id_type::MerchantId,+ processor_merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<Vec<storage::Blocklist>, errors::StorageError> {self.diesel_store- .list_blocklist_entries_by_merchant_id(merchant_id)+ .list_blocklist_entries_by_processor_merchant_id(processor_merchant_id).await}diff --git a/crates/router/src/routes/blocklist.rs b/crates/router/src/routes/blocklist.rsindex 564cc0a7f1..84c15c398b 100644--- a/crates/router/src/routes/blocklist.rs+++ b/crates/router/src/routes/blocklist.rs@@ -38,12 +38,12 @@ pub async fn add_entry_to_blocklist(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::MerchantAccountWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -77,16 +77,20 @@ pub async fn remove_entry_from_blocklist(&req,json_payload.into_inner(),|state, auth: auth::AuthenticationData, body, _| {- blocklist::remove_entry_from_blocklist(state, auth.platform, body)+ blocklist::remove_entry_from_blocklist(+ state,+ auth.platform.get_processor().clone(),+ body,+ )},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::MerchantAccountWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -119,7 +123,7 @@ pub async fn list_blocked_payment_methods(let payload = query_payload.into_inner();let api_auth = auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,};@@ -139,13 +143,13 @@ pub async fn list_blocked_payment_methods(query.client_secret = Some(client_secret);}- blocklist::list_blocklist_entries(state, auth.platform, query)+ blocklist::list_blocklist_entries(state, auth.platform.get_processor().clone(), query)},auth::auth_type(&*auth_type,&auth::JWTAuth {permission: Permission::MerchantAccountRead,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -181,16 +185,16 @@ pub async fn toggle_blocklist_guard(&req,query_payload.into_inner(),|state, auth: auth::AuthenticationData, query, _| {- blocklist::toggle_blocklist_guard(state, auth.platform, query)+ blocklist::toggle_blocklist_guard(state, auth.platform.get_processor().clone(), query)},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::MerchantAccountWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -247,12 +251,12 @@ pub async fn upload_batch_blocklist(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::MerchantAccountWrite,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -293,12 +297,12 @@ pub async fn get_batch_blocklist_job_status(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::MerchantAccountRead,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),@@ -338,12 +342,12 @@ pub async fn list_batch_blocklist_jobs(},auth::auth_type(&auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: false,+ allow_connected_scope_operation: true,allow_platform_self_operation: false,}),&auth::JWTAuth {permission: Permission::MerchantAccountRead,- allow_connected: false,+ allow_connected: true,allow_platform: false,},req.headers(),diff --git a/crates/router/src/types/storage/batch_blocklist_job.rs b/crates/router/src/types/storage/batch_blocklist_job.rsindex 7804df53a4..26fea7d467 100644--- a/crates/router/src/types/storage/batch_blocklist_job.rs+++ b/crates/router/src/types/storage/batch_blocklist_job.rs@@ -7,6 +7,8 @@ pub use diesel_models::batch_blocklist_job::{pub struct BatchBlocklistTrackingData {pub job_id: String,pub merchant_id: id_type::MerchantId,+ pub processor_merchant_id: Option<id_type::MerchantId>,pub chunk_total_count: u32,pub completed_chunks: Vec<u32>,+ pub created_by: Option<String>,}diff --git a/crates/router/src/workflows/batch_blocklist_upload.rs b/crates/router/src/workflows/batch_blocklist_upload.rsindex 93d8525635..a6f1f6090b 100644--- a/crates/router/src/workflows/batch_blocklist_upload.rs+++ b/crates/router/src/workflows/batch_blocklist_upload.rs@@ -57,8 +57,15 @@ async fn run_batch_job(let chunk_rows = batch::parse_chunk_csv(&chunk_bytes)?;- let chunk_succeeded =- batch::process_chunk(state, merchant_id_obj, chunk_idx, chunk_rows).await?;+ let chunk_succeeded = batch::process_chunk(+ state,+ merchant_id_obj,+ tracking_data.processor_merchant_id.as_ref(),+ chunk_idx,+ chunk_rows,+ tracking_data.created_by.clone(),+ )+ .await?;total_succeeded += chunk_succeeded;tracking_data.completed_chunks.push(chunk_idx);@@ -156,7 +163,10 @@ impl ProcessTrackerWorkflow<SessionState> for BatchBlocklistUploadWorkflow {let job_id = tracking_data.job_id.clone();let chunk_total_count = tracking_data.chunk_total_count;- let merchant_id = tracking_data.merchant_id.clone();+ let merchant_id = tracking_data+ .processor_merchant_id+ .clone()+ .unwrap_or_else(|| tracking_data.merchant_id.clone());let merchant_id_str = merchant_id.get_string_repr();if tracking_data.completed_chunks.is_empty() {diff --git a/migrations/2026-04-22-073445_add_processor_merchant_id_created_by_to_blocklist/down.sql b/migrations/2026-04-22-073445_add_processor_merchant_id_created_by_to_blocklist/down.sqlnew file mode 100644index 0000000000..885fa21706--- /dev/null+++ b/migrations/2026-04-22-073445_add_processor_merchant_id_created_by_to_blocklist/down.sql@@ -0,0 +1,3 @@+-- This file should undo anything in `up.sql`+ALTER TABLE blocklist DROP COLUMN IF EXISTS processor_merchant_id;+ALTER TABLE blocklist DROP COLUMN IF EXISTS created_by;diff --git a/migrations/2026-04-22-073445_add_processor_merchant_id_created_by_to_blocklist/up.sql b/migrations/2026-04-22-073445_add_processor_merchant_id_created_by_to_blocklist/up.sqlnew file mode 100644index 0000000000..fcf464bf66--- /dev/null+++ b/migrations/2026-04-22-073445_add_processor_merchant_id_created_by_to_blocklist/up.sql@@ -0,0 +1,6 @@+-- Your SQL goes here+ALTER TABLE blocklist ADD COLUMN IF NOT EXISTS processor_merchant_id VARCHAR(64);+ALTER TABLE blocklist ADD COLUMN IF NOT EXISTS created_by VARCHAR(255);++-- This backfill should be executed after deployment is complete.+UPDATE blocklist SET processor_merchant_id = merchant_id WHERE processor_merchant_id IS NULL;diff --git a/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/down.sql b/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/down.sqlnew file mode 100644index 0000000000..428f8c2d5a--- /dev/null+++ b/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+DROP INDEX CONCURRENTLY IF EXISTS blocklist_processor_merchant_id_fingerprint_id_index;diff --git a/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/metadata.toml b/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/metadata.tomlnew file mode 100644index 0000000000..79e9221c1f--- /dev/null+++ b/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/metadata.toml@@ -0,0 +1 @@+run_in_transaction = falsediff --git a/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/up.sql b/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/up.sqlnew file mode 100644index 0000000000..0dd9039fc2--- /dev/null+++ b/migrations/2026-04-23-103109_add_index_processor_merchant_id_fingerprint_id_for_blocklist/up.sql@@ -0,0 +1,2 @@+-- Your SQL goes here+CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS blocklist_processor_merchant_id_fingerprint_id_index ON blocklist (processor_merchant_id, fingerprint_id);diff --git a/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/down.sql b/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/down.sqlnew file mode 100644index 0000000000..efa9c1dbb6--- /dev/null+++ b/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS blocklist_unique_fingerprint_id_index ON blocklist (merchant_id, fingerprint_id);diff --git a/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/metadata.toml b/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/metadata.tomlnew file mode 100644index 0000000000..79e9221c1f--- /dev/null+++ b/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/metadata.toml@@ -0,0 +1 @@+run_in_transaction = falsediff --git a/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/up.sql b/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/up.sqlnew file mode 100644index 0000000000..6a57c8a0f9--- /dev/null+++ b/migrations/2026-05-27-095024_drop_blocklist_unique_fingerprint_id_index/up.sql@@ -0,0 +1,2 @@+-- Your SQL goes here+DROP INDEX CONCURRENTLY IF EXISTS blocklist_unique_fingerprint_id_index;