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

feat(platform): support 3ds payments for platform (#11011)

Apoorv Dixit5599ae563576
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index b1934ae5ab..f2a18bb1f1 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -46,7 +46,7 @@ impl PaymentAttempt {
conn,
dsl::attempt_id
.eq(self.attempt_id.to_owned())
- .and(dsl::merchant_id.eq(self.merchant_id.to_owned())),
+ .and(dsl::processor_merchant_id.eq(self.processor_merchant_id.to_owned())),
PaymentAttemptUpdateInternal::from(payment_attempt).populate_derived_fields(&self),
)
.await
@@ -82,49 +82,49 @@ impl PaymentAttempt {
}
#[cfg(feature = "v1")]
- pub async fn find_optional_by_payment_id_merchant_id(
+ pub async fn find_optional_by_payment_id_processor_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Option<Self>> {
generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
)
.await
}
#[cfg(feature = "v1")]
- pub async fn find_by_connector_transaction_id_payment_id_merchant_id(
+ pub async fn find_by_connector_transaction_id_payment_id_processor_merchant_id(
conn: &PgPooledConn,
connector_transaction_id: &common_utils::types::ConnectorTransactionId,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::connector_transaction_id
.eq(connector_transaction_id.get_id().to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned()))
- .and(dsl::merchant_id.eq(merchant_id.to_owned())),
+ .and(dsl::processor_merchant_id.eq(processor_merchant_id.to_owned())),
)
.await
}
#[cfg(feature = "v1")]
- pub async fn find_last_successful_attempt_by_payment_id_merchant_id(
+ pub async fn find_last_successful_attempt_by_payment_id_processor_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
// perform ordering on the application level instead of database level
generics::generic_filter::<<Self as HasTable>::Table, _, _, Self>(
conn,
dsl::payment_id
.eq(payment_id.to_owned())
- .and(dsl::merchant_id.eq(merchant_id.to_owned()))
+ .and(dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.and(dsl::status.eq(enums::AttemptStatus::Charged)),
Some(1),
None,
@@ -137,17 +137,17 @@ impl PaymentAttempt {
}
#[cfg(feature = "v1")]
- pub async fn find_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ pub async fn find_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
// perform ordering on the application level instead of database level
generics::generic_filter::<<Self as HasTable>::Table, _, _, Self>(
conn,
dsl::payment_id
.eq(payment_id.to_owned())
- .and(dsl::merchant_id.eq(merchant_id.to_owned()))
+ .and(dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.and(
dsl::status
.eq(enums::AttemptStatus::Charged)
@@ -187,9 +187,9 @@ impl PaymentAttempt {
}
#[cfg(feature = "v1")]
- pub async fn find_by_merchant_id_connector_txn_id(
+ pub async fn find_by_processor_merchant_id_connector_txn_id(
conn: &PgPooledConn,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
connector_txn_id: &str,
) -> StorageResult<Self> {
let (txn_id, txn_data) = common_utils::types::ConnectorTransactionId::form_id_and_data(
@@ -203,8 +203,8 @@ impl PaymentAttempt {
})?;
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::connector_transaction_id.eq(connector_transaction_id.to_owned())),
)
.await
@@ -235,15 +235,15 @@ impl PaymentAttempt {
}
#[cfg(feature = "v1")]
- pub async fn find_by_merchant_id_attempt_id(
+ pub async fn find_by_processor_merchant_id_attempt_id(
conn: &PgPooledConn,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
attempt_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::attempt_id.eq(attempt_id.to_owned())),
)
.await
@@ -277,32 +277,32 @@ impl PaymentAttempt {
}
#[cfg(feature = "v1")]
- pub async fn find_by_merchant_id_preprocessing_id(
+ pub async fn find_by_processor_merchant_id_preprocessing_id(
conn: &PgPooledConn,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
preprocessing_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::preprocessing_step_id.eq(preprocessing_id.to_owned())),
)
.await
}
#[cfg(feature = "v1")]
- pub async fn find_by_payment_id_merchant_id_attempt_id(
+ pub async fn find_by_payment_id_processor_merchant_id_attempt_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
attempt_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::payment_id.eq(payment_id.to_owned()).and(
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::attempt_id.eq(attempt_id.to_owned())),
),
)
@@ -310,9 +310,9 @@ impl PaymentAttempt {
}
#[cfg(feature = "v1")]
- pub async fn find_by_merchant_id_payment_id(
+ pub async fn find_by_processor_merchant_id_payment_id(
conn: &PgPooledConn,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
@@ -322,8 +322,8 @@ impl PaymentAttempt {
_,
>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
None,
None,
@@ -336,7 +336,7 @@ impl PaymentAttempt {
pub async fn get_filters_for_payments(
conn: &PgPooledConn,
pi: &[PaymentIntent],
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<(
Vec<String>,
Vec<enums::Currency>,
@@ -351,7 +351,7 @@ impl PaymentAttempt {
.collect();
let filter = <Self as HasTable>::table()
- .filter(dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.filter(dsl::attempt_id.eq_any(active_attempts));
let intent_status: Vec<IntentStatus> = pi
@@ -493,7 +493,7 @@ impl PaymentAttempt {
#[allow(clippy::too_many_arguments)]
pub async fn get_total_count_of_attempts(
conn: &PgPooledConn,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<String>>,
payment_method: Option<Vec<enums::PaymentMethod>>,
@@ -505,7 +505,7 @@ impl PaymentAttempt {
) -> StorageResult<i64> {
let mut filter = <Self as HasTable>::table()
.count()
- .filter(dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.filter(dsl::attempt_id.eq_any(active_attempt_ids.to_owned()))
.into_boxed();
diff --git a/crates/diesel_models/src/query/payment_intent.rs b/crates/diesel_models/src/query/payment_intent.rs
index 3778de3688..f5312f4588 100644
--- a/crates/diesel_models/src/query/payment_intent.rs
+++ b/crates/diesel_models/src/query/payment_intent.rs
@@ -57,7 +57,7 @@ impl PaymentIntent {
conn,
dsl::payment_id
.eq(self.payment_id.to_owned())
- .and(dsl::merchant_id.eq(self.merchant_id.to_owned())),
+ .and(dsl::processor_merchant_id.eq(self.processor_merchant_id.to_owned())),
payment_intent::PaymentIntentUpdateInternal::from(payment_intent),
)
.await
@@ -105,15 +105,15 @@ impl PaymentIntent {
}
#[cfg(feature = "v1")]
- pub async fn find_by_payment_id_merchant_id(
+ pub async fn find_by_payment_id_processor_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
)
.await
@@ -135,15 +135,15 @@ impl PaymentIntent {
}
#[cfg(feature = "v1")]
- pub async fn find_optional_by_payment_id_merchant_id(
+ pub async fn find_optional_by_payment_id_processor_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Option<Self>> {
generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
conn,
- dsl::merchant_id
- .eq(merchant_id.to_owned())
+ dsl::processor_merchant_id
+ .eq(processor_merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
)
.await
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 598f2975b6..3d607d89af 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -98,29 +98,29 @@ pub trait PaymentAttemptInterface {
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ async fn find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&self,
connector_transaction_id: &ConnectorTransactionId,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
@@ -134,9 +134,9 @@ pub trait PaymentAttemptInterface {
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_merchant_id_connector_txn_id(
+ async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
connector_txn_id: &str,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -152,20 +152,20 @@ pub trait PaymentAttemptInterface {
) -> CustomResult<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
attempt_id: &str,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_attempt_id_merchant_id(
+ async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
@@ -187,18 +187,18 @@ pub trait PaymentAttemptInterface {
) -> error_stack::Result<Vec<PaymentAttempt>, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_preprocessing_id_merchant_id(
+ async fn find_payment_attempt_by_preprocessing_id_processor_merchant_id(
&self,
preprocessing_id: &str,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_attempts_by_merchant_id_payment_id(
+ async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
storage_scheme: storage_enums::MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -208,7 +208,7 @@ pub trait PaymentAttemptInterface {
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<PaymentListFilters, Self::Error>;
@@ -216,7 +216,7 @@ pub trait PaymentAttemptInterface {
#[allow(clippy::too_many_arguments)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<Connector>>,
payment_method: Option<Vec<storage_enums::PaymentMethod>>,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 28f58635b5..7754f1194a 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -62,10 +62,10 @@ pub trait PaymentIntentInterface {
) -> error_stack::Result<PaymentIntent, Self::Error>;
#[cfg(feature = "v1")]
- async fn find_payment_intent_by_payment_id_merchant_id(
+ async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
merchant_key_store: &MerchantKeyStore,
storage_scheme: common_enums::MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, Self::Error>;
@@ -89,7 +89,7 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intent_by_constraints(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
filters: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: common_enums::MerchantStorageScheme,
@@ -98,7 +98,7 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
time_range: &common_utils::types::TimeRange,
merchant_key_store: &MerchantKeyStore,
storage_scheme: common_enums::MerchantStorageScheme,
@@ -107,7 +107,7 @@ pub trait PaymentIntentInterface {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
profile_id_list: Option<Vec<id_type::ProfileId>>,
constraints: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, Self::Error>;
@@ -115,7 +115,7 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: common_enums::MerchantStorageScheme,
@@ -147,7 +147,7 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
storage_scheme: common_enums::MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, Self::Error>;
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index 14bcb113d2..a9e3f57ab7 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -70,7 +70,7 @@ pub async fn retrieve_dispute(
let db = &state.store;
#[cfg(feature = "v1")]
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -85,7 +85,7 @@ pub async fn retrieve_dispute(
core_utils::validate_profile_id_from_auth_layer(profile_id.clone(), &dispute)?;
let payment_attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&dispute.attempt_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -204,7 +204,7 @@ pub async fn retrieve_disputes_list(
for dispute_response in &mut disputes_list {
let payment_intent = state
.store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&dispute_response.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -328,7 +328,7 @@ pub async fn accept_dispute(
)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -338,7 +338,7 @@ pub async fn accept_dispute(
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&dispute.attempt_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -452,7 +452,7 @@ pub async fn submit_evidence(
transformers::get_evidence_request_data(&state, &platform, req, &dispute).await?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -462,7 +462,7 @@ pub async fn submit_evidence(
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&dispute.attempt_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rs
index fd767fc066..b85d16fc7b 100644
--- a/crates/router/src/core/files/helpers.rs
+++ b/crates/router/src/core/files/helpers.rs
@@ -319,7 +319,7 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(
if connector_data.connector_name.supports_file_storage_module() {
let payment_intent = state
.store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -330,7 +330,7 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(
let payment_attempt = state
.store
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&dispute.attempt_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index fa1ac7080f..76d5b4cf21 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -776,7 +776,7 @@ pub async fn frm_fulfillment_core(
) -> RouterResponse<frm_types::FraudCheckResponseData> {
let db = &*state.clone().store;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&req.payment_id.clone(),
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -837,7 +837,7 @@ pub async fn make_fulfillment_api_call(
req: frm_core_types::FrmFulfillmentRequest,
) -> RouterResponse<frm_types::FraudCheckResponseData> {
let payment_attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&payment_intent.active_attempt.get_id(),
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
diff --git a/crates/router/src/core/mandate/helpers.rs b/crates/router/src/core/mandate/helpers.rs
index ace6443443..2146b05cee 100644
--- a/crates/router/src/core/mandate/helpers.rs
+++ b/crates/router/src/core/mandate/helpers.rs
@@ -21,7 +21,7 @@ pub async fn get_profile_id_for_mandate(
let profile_id = if let Some(ref payment_id) = mandate.original_payment_id {
let pi = state
.store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index 613379e5e4..b7c849963d 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -77,15 +77,15 @@ pub async fn form_payment_link_data(
pub async fn form_payment_link_data(
state: &SessionState,
platform: domain::Platform,
- merchant_id: common_utils::id_type::MerchantId,
+ processor_merchant_id: common_utils::id_type::MerchantId,
payment_id: common_utils::id_type::PaymentId,
) -> RouterResult<(PaymentLink, PaymentLinkData, PaymentLinkConfig)> {
let db = &*state.store;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- &merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
)
@@ -211,9 +211,9 @@ pub async fn form_payment_link_data(
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &merchant_id,
+ &processor_merchant_id,
&attempt_id.clone(),
platform.get_processor().get_account().storage_scheme,
platform.get_processor().get_key_store(),
@@ -245,9 +245,9 @@ pub async fn form_payment_link_data(
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &merchant_id,
+ &processor_merchant_id,
&attempt_id.clone(),
platform.get_processor().get_account().storage_scheme,
platform.get_processor().get_key_store(),
@@ -792,15 +792,15 @@ pub async fn get_payment_link_status(
pub async fn get_payment_link_status(
state: SessionState,
platform: domain::Platform,
- merchant_id: common_utils::id_type::MerchantId,
+ processor_merchant_id: common_utils::id_type::MerchantId,
payment_id: common_utils::id_type::PaymentId,
) -> RouterResponse<services::PaymentLinkFormData> {
let db = &*state.store;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- &merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
)
@@ -809,9 +809,9 @@ pub async fn get_payment_link_status(
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &merchant_id,
+ &processor_merchant_id,
&attempt_id.clone(),
platform.get_processor().get_account().storage_scheme,
platform.get_processor().get_key_store(),
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index ff61bacfe7..f46086884a 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2765,12 +2765,12 @@ pub async fn list_payment_methods(
let payment_attempt = payment_intent
.as_ref()
.async_map(|pi| async {
- db.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ db.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&pi.payment_id,
- &pi.merchant_id,
+ &pi.processor_merchant_id,
&pi.active_attempt.get_id(),
- platform.get_provider().get_account().storage_scheme,
- platform.get_provider().get_key_store(),
+ platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_key_store(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)
@@ -4585,12 +4585,12 @@ async fn perform_surcharge_ops(
.async_map(|payment_intent| async {
state
.store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
payment_intent.get_id(),
- platform.get_provider().get_account().get_id(),
+ platform.get_processor().get_account().get_id(),
&payment_intent.active_attempt.get_id(),
- platform.get_provider().get_account().storage_scheme,
- platform.get_provider().get_key_store(),
+ platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 71e5da8f0a..b1d01300ca 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3827,7 +3827,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
) -> RouterResult<Self::PaymentFlowResponse> {
let payment_intent = state
.store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -3837,7 +3837,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_attempt = state
.store
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&payment_intent.active_attempt.get_id(),
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -7987,7 +7987,7 @@ impl PaymentEligibilityData {
.map(pii::SecretSerdeValue::new);
let payment_intent = state
.store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payments_eligibility_request.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -8214,12 +8214,12 @@ pub async fn list_payments(
constraints: api::PaymentListConstraints,
) -> RouterResponse<api::PaymentListResponse> {
helpers::validate_payment_list_request(&constraints)?;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let db = state.store.as_ref();
let payment_intents = helpers::filter_by_constraints(
&state,
&(constraints, profile_id_list).try_into()?,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
)
@@ -8229,9 +8229,9 @@ pub async fn list_payments(
let collected_futures = payment_intents.into_iter().map(|pi| {
async {
match db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&pi.payment_id,
- merchant_id,
+ processor_merchant_id,
&pi.active_attempt.get_id(),
// since OLAP doesn't have KV. Force to get the data from PSQL.
storage_enums::MerchantStorageScheme::PostgresOnly,
@@ -10682,13 +10682,13 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
let db = &*state.store;
let key_manager_state = &(&(state)).into();
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = req.payment_id;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -10696,9 +10696,9 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
&attempt_id.clone(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -10748,7 +10748,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
&state,
None,
payment_intent.shipping_address_id.as_deref(),
- merchant_id,
+ processor_merchant_id,
payment_intent.customer_id.as_ref(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
@@ -10762,7 +10762,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
.payment_method_billing_address_id
.as_deref()
.or(payment_intent.billing_address_id.as_deref()),
- merchant_id,
+ processor_merchant_id,
payment_intent.customer_id.as_ref(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
@@ -10786,7 +10786,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
let authentication = db
.find_authentication_by_merchant_id_authentication_id(
- merchant_id,
+ processor_merchant_id,
&payment_attempt
.authentication_id
.clone()
@@ -10843,7 +10843,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
let webhook_url = helpers::create_webhook_url(
&state.base_url,
- merchant_id,
+ processor_merchant_id,
merchant_connector_account_id_or_connector_name,
);
@@ -10861,7 +10861,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
{
let routing_region = uas_utils::fetch_routing_region_for_uas(
&state,
- merchant_id.clone(),
+ processor_merchant_id.clone(),
platform
.get_processor()
.get_account()
@@ -11087,7 +11087,7 @@ pub async fn payments_manual_update(
.attach_printable("Error while fetching the merchant_account by merchant_id")?;
let payment_attempt = state
.store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
&merchant_id,
&attempt_id.clone(),
@@ -11113,7 +11113,7 @@ pub async fn payments_manual_update(
let payment_intent = state
.store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
merchant_account.get_id(),
&key_store,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index aae3d665dd..6d2a2cf41c 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -760,7 +760,7 @@ pub async fn get_token_for_recurring_mandate(
.original_payment_id
.as_ref()
.async_map(|payment_id| async {
- db.find_payment_intent_by_payment_id_merchant_id(
+ db.find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
&mandate.merchant_id,
platform.get_processor().get_key_store(),
@@ -777,7 +777,7 @@ pub async fn get_token_for_recurring_mandate(
let original_payment_attempt = original_payment_intent
.as_ref()
.async_map(|payment_intent| async {
- db.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ db.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
&mandate.merchant_id,
payment_intent.active_attempt.get_id().as_str(),
@@ -1247,7 +1247,7 @@ pub fn create_startpay_url(
"{}/payments/redirect/{}/{}/{}",
base_url,
payment_intent.get_id().get_string_repr(),
- payment_intent.merchant_id.get_string_repr(),
+ payment_intent.processor_merchant_id.get_string_repr(),
payment_attempt.attempt_id
)
}
@@ -1263,7 +1263,7 @@ pub fn create_redirect_url(
"{}/payments/{}/{}/redirect/response/{}",
router_base_url,
payment_attempt.payment_id.get_string_repr(),
- payment_attempt.merchant_id.get_string_repr(),
+ payment_attempt.processor_merchant_id.get_string_repr(),
connector_name,
) + creds_identifier_path.as_ref()
}
@@ -1287,7 +1287,7 @@ pub fn create_authorize_url(
"{}/payments/{}/{}/authorize/{}",
router_base_url,
payment_attempt.payment_id.get_string_repr(),
- payment_attempt.merchant_id.get_string_repr(),
+ payment_attempt.processor_merchant_id.get_string_repr(),
connector_name
)
}
@@ -1318,7 +1318,7 @@ pub fn create_complete_authorize_url(
"{}/payments/{}/{}/redirect/complete/{}{}",
router_base_url,
payment_attempt.payment_id.get_string_repr(),
- payment_attempt.merchant_id.get_string_repr(),
+ payment_attempt.processor_merchant_id.get_string_repr(),
connector_name,
creds_identifier
)
@@ -4107,7 +4107,7 @@ pub async fn verify_payment_intent_time_and_client_secret(
#[cfg(feature = "v1")]
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index cc9f9036b2..b39e58b99a 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -46,7 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
operations::GetTrackerResponse<'a, F, api::PaymentsCaptureRequest, PaymentData<F>>,
> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let (mut payment_intent, payment_attempt, currency, amount);
@@ -55,9 +55,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -90,9 +90,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
let attempt_id = payment_intent.active_attempt.get_id().clone();
payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
&attempt_id.clone(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -108,7 +108,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -118,7 +118,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -128,7 +128,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 3bbced935c..c7881f1d4b 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -49,16 +49,16 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -78,9 +78,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
)?;
let mut payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -93,7 +93,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -103,7 +103,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -113,7 +113,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
index bf870a9e96..cf5801ce35 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
@@ -52,16 +52,16 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -79,9 +79,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
)?;
let mut payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -94,7 +94,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -104,7 +104,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -114,7 +114,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index ec1df9ee70..71a631f25b 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -54,7 +54,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let (payment_intent, mut payment_attempt, currency, amount);
@@ -63,9 +63,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -73,9 +73,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -156,7 +156,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -166,7 +166,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -176,7 +176,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index a29db6ba66..2c0655ca5c 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -48,7 +48,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
{
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let (mut payment_intent, mut payment_attempt, currency, amount);
@@ -57,9 +57,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -96,9 +96,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
let recurring_details = request.recurring_details.clone();
payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
&payment_intent.active_attempt.get_id(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -207,7 +207,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
state,
request.shipping.as_ref(),
payment_intent.shipping_address_id.clone().as_deref(),
- merchant_id,
+ processor_merchant_id,
payment_intent.customer_id.as_ref(),
platform.get_processor().get_key_store(),
&payment_id,
@@ -224,7 +224,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -234,7 +234,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 41d1f9a421..092eb6e3b6 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -80,7 +80,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>
{
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let (currency, amount);
@@ -90,11 +90,11 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
// Stage 1
let store = &*state.store;
- let m_merchant_id = merchant_id.clone();
+ let m_merchant_id = processor_merchant_id.clone();
// Parallel calls - level 0
let mut payment_intent = store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
&m_merchant_id,
platform.get_processor().get_key_store(),
@@ -182,13 +182,13 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
let store = state.store.clone();
let m_payment_id = payment_intent.payment_id.clone();
- let m_merchant_id = merchant_id.clone();
+ let m_merchant_id = processor_merchant_id.clone();
let merchant_key_store = platform.get_processor().get_key_store().clone();
let payment_attempt_fut = tokio::spawn(
async move {
store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&m_payment_id,
&m_merchant_id,
attempt_id.as_str(),
@@ -201,7 +201,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.in_current_span(),
);
- let m_merchant_id = merchant_id.clone();
+ let m_merchant_id = processor_merchant_id.clone();
let m_request_shipping = request.shipping.clone();
let m_payment_intent_shipping_address_id = payment_intent.shipping_address_id.clone();
let m_payment_intent_payment_id = payment_intent.payment_id.clone();
@@ -229,7 +229,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.in_current_span(),
);
- let m_merchant_id = merchant_id.clone();
+ let m_merchant_id = processor_merchant_id.clone();
let m_request_billing = request.billing.clone();
let m_customer_details_customer_id = customer_details.customer_id.clone();
let m_payment_intent_customer_id = payment_intent.customer_id.clone();
@@ -511,7 +511,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
let m_payment_intent_payment_id = payment_intent.payment_id.clone();
let m_key_store = platform.get_processor().get_key_store().clone();
let m_customer_details_customer_id = customer_details.customer_id.clone();
- let m_merchant_id = merchant_id.clone();
+ let m_merchant_id = processor_merchant_id.clone();
let session_state = state.clone();
let payment_method_billing_future = tokio::spawn(
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index cb5006ca7c..5713f18a81 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -56,12 +56,12 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -72,9 +72,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
helpers::authenticate_client_secret(Some(request.client_secret.peek()), &payment_intent)?;
let mut payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -106,7 +106,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -116,7 +116,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 60b0984a40..767a36cf9c 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -45,16 +45,16 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
{
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -74,9 +74,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
attempt_id.clone().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -89,7 +89,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -99,7 +99,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -109,7 +109,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 5ba79011a9..f92ad1ab72 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -51,13 +51,13 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let mut payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -78,9 +78,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
helpers::authenticate_client_secret(Some(&request.client_secret), &payment_intent)?;
let mut payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -99,7 +99,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -109,7 +109,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -119,7 +119,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 90e635e7cb..fd86d6276a 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -48,16 +48,16 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
let (mut payment_intent, payment_attempt, currency, amount);
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -81,9 +81,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
)?;
payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -99,7 +99,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -109,7 +109,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -119,7 +119,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 35fdf112d2..404d56525a 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -341,7 +341,7 @@ async fn get_tracker_for_sync<
let attempts = match request.expand_attempts {
Some(true) => {
Some(db
- .find_attempts_by_merchant_id_payment_id(platform.get_processor().get_account().get_id(), &payment_id, storage_scheme, platform.get_processor().get_key_store())
+ .find_attempts_by_processor_merchant_id_payment_id(platform.get_processor().get_account().get_id(), &payment_id, storage_scheme, platform.get_processor().get_key_store())
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)
.attach_printable_lazy(|| {
@@ -627,7 +627,7 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRetrieveRequest, Pa
pub async fn get_payment_intent_payment_attempt(
state: &SessionState,
payment_id: &api::PaymentIdType,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
) -> RouterResult<(storage::PaymentIntent, storage::PaymentAttempt)> {
@@ -637,17 +637,17 @@ pub async fn get_payment_intent_payment_attempt(
match payment_id {
api_models::payments::PaymentIdType::PaymentIntentId(ref id) => {
pi = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
id,
- merchant_id,
+ processor_merchant_id,
key_store,
storage_scheme,
)
.await?;
pa = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&pi.payment_id,
- merchant_id,
+ processor_merchant_id,
pi.active_attempt.get_id().as_str(),
storage_scheme,
key_store,
@@ -656,17 +656,17 @@ pub async fn get_payment_intent_payment_attempt(
}
api_models::payments::PaymentIdType::ConnectorTransactionId(ref id) => {
pa = db
- .find_payment_attempt_by_merchant_id_connector_txn_id(
- merchant_id,
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
+ processor_merchant_id,
id,
storage_scheme,
key_store,
)
.await?;
pi = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&pa.payment_id,
- merchant_id,
+ processor_merchant_id,
key_store,
storage_scheme,
)
@@ -674,17 +674,17 @@ pub async fn get_payment_intent_payment_attempt(
}
api_models::payments::PaymentIdType::PaymentAttemptId(ref id) => {
pa = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
.await?;
pi = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&pa.payment_id,
- merchant_id,
+ processor_merchant_id,
key_store,
storage_scheme,
)
@@ -692,18 +692,18 @@ pub async fn get_payment_intent_payment_attempt(
}
api_models::payments::PaymentIdType::PreprocessingId(ref id) => {
pa = db
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
.await?;
pi = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&pa.payment_id,
- merchant_id,
+ processor_merchant_id,
key_store,
storage_scheme,
)
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 74908ce785..8e676a85a6 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -61,16 +61,20 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let db = &*state.store;
- helpers::allow_payment_update_enabled_for_client_auth(merchant_id, state, auth_flow)
- .await?;
+ helpers::allow_payment_update_enabled_for_client_auth(
+ processor_merchant_id,
+ state,
+ auth_flow,
+ )
+ .await?;
payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -117,9 +121,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.or(payment_intent.order_details);
payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -201,7 +205,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
state,
request.shipping.as_ref(),
payment_intent.shipping_address_id.as_deref(),
- merchant_id,
+ processor_merchant_id,
payment_intent
.customer_id
.as_ref()
@@ -215,7 +219,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
state,
request.billing.as_ref(),
payment_intent.billing_address_id.as_deref(),
- merchant_id,
+ processor_merchant_id,
payment_intent
.customer_id
.as_ref()
@@ -233,7 +237,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.as_ref()
.and_then(|pmd| pmd.billing.as_ref()),
payment_attempt.payment_method_billing_address_id.as_deref(),
- merchant_id,
+ processor_merchant_id,
payment_intent
.customer_id
.as_ref()
@@ -309,7 +313,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
})
.async_and_then(|mandate_id| async {
let mandate = db
- .find_mandate_by_merchant_id_mandate_id(merchant_id, mandate_id, platform.get_processor().get_account().storage_scheme)
+ .find_mandate_by_merchant_id_mandate_id(processor_merchant_id, mandate_id, platform.get_processor().get_account().storage_scheme)
.await
.change_context(errors::ApiErrorResponse::MandateNotFound);
Some(mandate.and_then(|mandate_obj| {
diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rs
index d23ec5171d..6287ce2227 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -51,12 +51,12 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsUpdateMe
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let mut payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -76,9 +76,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsUpdateMe
)?;
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
index 7c3331ae8e..2d968017cc 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -52,16 +52,16 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -78,9 +78,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
)?;
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -103,7 +103,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -113,7 +113,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -123,7 +123,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index 19045fbbbd..1f729fa2e7 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -57,16 +57,16 @@ impl<F: Send + Clone + Sync>
> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -88,9 +88,9 @@ impl<F: Send + Clone + Sync>
let attempt_id = payment_intent.active_attempt.get_id().clone();
let payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
attempt_id.clone().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 8728382e7c..36035fbd48 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -62,13 +62,13 @@ impl<F: Send + Clone + Sync>
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -89,9 +89,9 @@ impl<F: Send + Clone + Sync>
helpers::authenticate_client_secret(Some(request.client_secret.peek()), &payment_intent)?;
let mut payment_attempt = db
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -110,7 +110,7 @@ impl<F: Send + Clone + Sync>
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -420,7 +420,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCa
state,
shipping_address.map(From::from).as_ref(),
payment_data.payment_intent.shipping_address_id.as_deref(),
- &payment_data.payment_intent.merchant_id,
+ &payment_data.payment_intent.processor_merchant_id,
payment_data.payment_intent.customer_id.as_ref(),
key_store,
&payment_data.payment_intent.payment_id,
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index bf2bae528a..28455a0d88 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -324,7 +324,7 @@ async fn store_bank_details_in_payment_methods(
let (connector_name, access_token) = connector_details;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payload.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index dafccfa824..1c402e3806 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -59,14 +59,14 @@ pub async fn refund_create_core(
req: refunds::RefundRequest,
) -> RouterResponse<refunds::RefundResponse> {
let db = &*state.store;
- let (merchant_id, payment_intent, payment_attempt, amount);
+ let (processor_merchant_id, payment_intent, payment_attempt, amount);
- merchant_id = platform.get_processor().get_account().get_id();
+ processor_merchant_id = platform.get_processor().get_account().get_id();
payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&req.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
)
@@ -111,9 +111,9 @@ pub async fn refund_create_core(
})?;
payment_attempt = db
- .find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ .find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&req.payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
platform.get_processor().get_key_store()
).await
@@ -693,13 +693,13 @@ pub async fn refund_retrieve_core(
refund: diesel_refund::Refund,
) -> RouterResult<(diesel_refund::Refund, Option<masking::Secret<String>>)> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_account().get_id();
core_utils::validate_profile_id_from_auth_layer(profile_id, &refund)?;
let payment_id = &refund.payment_id;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
)
@@ -707,10 +707,10 @@ pub async fn refund_retrieve_core(
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_attempt = db
- .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ .find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&refund.connector_transaction_id,
payment_id,
- merchant_id,
+ processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
platform.get_processor().get_key_store(),
)
@@ -2055,7 +2055,7 @@ pub async fn trigger_refund_execute_workflow(
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
let payment_attempt = db
- .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ .find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&refund.connector_transaction_id,
&refund_core.payment_id,
&refund.merchant_id,
@@ -2066,7 +2066,7 @@ pub async fn trigger_refund_execute_workflow(
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_attempt.payment_id,
&refund.merchant_id,
&key_store,
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
index bb3a55c54b..eb3682a98f 100644
--- a/crates/router/src/core/verification/utils.rs
+++ b/crates/router/src/core/verification/utils.rs
@@ -191,7 +191,7 @@ pub async fn check_if_profile_id_is_present_in_payment_intent(
) -> CustomResult<(), errors::ApiErrorResponse> {
let db = &*state.store;
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
processor.get_account().get_id(),
processor.get_key_store(),
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 85018d7652..89209509d1 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -2100,7 +2100,7 @@ async fn refunds_incoming_webhook_flow(
};
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&refund.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -2203,7 +2203,7 @@ pub async fn get_payment_attempt_from_object_reference_id(
let db = &*state.store;
match object_reference_id {
api::ObjectReferenceId::PaymentId(api::PaymentIdType::ConnectorTransactionId(ref id)) => db
- .find_payment_attempt_by_merchant_id_connector_txn_id(
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
platform.get_processor().get_account().get_id(),
id,
platform.get_processor().get_account().storage_scheme,
@@ -2212,7 +2212,7 @@ pub async fn get_payment_attempt_from_object_reference_id(
.await
.to_not_found_response(errors::ApiErrorResponse::WebhookResourceNotFound),
api::ObjectReferenceId::PaymentId(api::PaymentIdType::PaymentAttemptId(ref id)) => db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -2221,7 +2221,7 @@ pub async fn get_payment_attempt_from_object_reference_id(
.await
.to_not_found_response(errors::ApiErrorResponse::WebhookResourceNotFound),
api::ObjectReferenceId::PaymentId(api::PaymentIdType::PreprocessingId(ref id)) => db
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -2764,7 +2764,7 @@ async fn disputes_incoming_webhook_flow(
let state = state.clone();
let platform = platform.clone();
let payment_intent = db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_attempt.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -2910,7 +2910,7 @@ async fn bank_transfer_webhook_flow(
async fn get_payment_id(
db: &dyn StorageInterface,
payment_id: &api::PaymentIdType,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: enums::MerchantStorageScheme,
key_store: &MerchantKeyStore,
) -> errors::RouterResult<common_utils::id_type::PaymentId> {
@@ -2918,8 +2918,8 @@ async fn get_payment_id(
match payment_id {
api_models::payments::PaymentIdType::PaymentIntentId(ref id) => Ok(id.to_owned()),
api_models::payments::PaymentIdType::ConnectorTransactionId(ref id) => db
- .find_payment_attempt_by_merchant_id_connector_txn_id(
- merchant_id,
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
+ processor_merchant_id,
id,
storage_scheme,
key_store,
@@ -2927,18 +2927,18 @@ async fn get_payment_id(
.await
.map(|p| p.payment_id),
api_models::payments::PaymentIdType::PaymentAttemptId(ref id) => db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
.await
.map(|p| p.payment_id),
api_models::payments::PaymentIdType::PreprocessingId(ref id) => db
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index bd81dd6cff..55134a733a 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1539,19 +1539,19 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ async fn find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&self,
connector_transaction_id: &common_utils::types::ConnectorTransactionId,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ .find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
connector_transaction_id,
payment_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
@@ -1559,16 +1559,16 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_merchant_id_connector_txn_id(
+ async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
connector_txn_id: &str,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_by_merchant_id_connector_txn_id(
- merchant_id,
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
+ processor_merchant_id,
connector_txn_id,
storage_scheme,
key_store,
@@ -1595,18 +1595,18 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
attempt_id: &str,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
attempt_id,
storage_scheme,
key_store,
@@ -1615,17 +1615,17 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_attempt_id_merchant_id(
+ async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
attempt_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
@@ -1661,17 +1661,17 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ .find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
@@ -1679,17 +1679,17 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ .find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
@@ -1713,17 +1713,17 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_preprocessing_id_merchant_id(
+ async fn find_payment_attempt_by_preprocessing_id_processor_merchant_id(
&self,
preprocessing_id: &str,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
preprocessing_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
key_store,
)
@@ -1734,21 +1734,21 @@ impl PaymentAttemptInterface for KafkaStore {
async fn get_filters_for_payments(
&self,
pi: &[hyperswitch_domain_models::payments::PaymentIntent],
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters,
errors::StorageError,
> {
self.diesel_store
- .get_filters_for_payments(pi, merchant_id, storage_scheme)
+ .get_filters_for_payments(pi, processor_merchant_id, storage_scheme)
.await
}
#[cfg(feature = "v1")]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -1761,7 +1761,7 @@ impl PaymentAttemptInterface for KafkaStore {
) -> CustomResult<i64, errors::StorageError> {
self.diesel_store
.get_total_count_of_filtered_payment_attempts(
- merchant_id,
+ processor_merchant_id,
active_attempt_ids,
connector,
payment_method,
@@ -1804,16 +1804,16 @@ impl PaymentAttemptInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_attempts_by_merchant_id_payment_id(
+ async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
payment_id: &id_type::PaymentId,
storage_scheme: MerchantStorageScheme,
key_store: &domain::MerchantKeyStore,
) -> CustomResult<Vec<storage::PaymentAttempt>, errors::StorageError> {
self.diesel_store
- .find_attempts_by_merchant_id_payment_id(
- merchant_id,
+ .find_attempts_by_processor_merchant_id_payment_id(
+ processor_merchant_id,
payment_id,
storage_scheme,
key_store,
@@ -1894,18 +1894,18 @@ impl PaymentIntentInterface for KafkaStore {
}
#[cfg(feature = "v1")]
- async fn find_payment_intent_by_payment_id_merchant_id(
+ async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
- key_store: &domain::MerchantKeyStore,
+ processor_merchant_id: &id_type::MerchantId,
+ merchant_key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
self.diesel_store
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
- merchant_id,
- key_store,
+ processor_merchant_id,
+ merchant_key_store,
storage_scheme,
)
.await
@@ -1926,27 +1926,32 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v1"))]
async fn filter_payment_intent_by_constraints(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<storage::PaymentIntent>, errors::StorageError> {
self.diesel_store
- .filter_payment_intent_by_constraints(merchant_id, filters, key_store, storage_scheme)
+ .filter_payment_intent_by_constraints(
+ processor_merchant_id,
+ filters,
+ key_store,
+ storage_scheme,
+ )
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
time_range: &common_utils::types::TimeRange,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<storage::PaymentIntent>, errors::StorageError> {
self.diesel_store
.filter_payment_intents_by_time_range_constraints(
- merchant_id,
+ processor_merchant_id,
time_range,
key_store,
storage_scheme,
@@ -1956,19 +1961,19 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
profile_id_list: Option<Vec<id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, errors::StorageError> {
self.diesel_store
- .get_intent_status_with_count(merchant_id, profile_id_list, time_range)
+ .get_intent_status_with_count(processor_merchant_id, profile_id_list, time_range)
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
key_store: &domain::MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -1981,7 +1986,7 @@ impl PaymentIntentInterface for KafkaStore {
> {
self.diesel_store
.get_filtered_payment_intents_attempt(
- merchant_id,
+ processor_merchant_id,
constraints,
key_store,
storage_scheme,
@@ -2016,13 +2021,13 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &id_type::MerchantId,
constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<String>, errors::StorageError> {
self.diesel_store
.get_filtered_active_attempt_ids_for_total_count(
- merchant_id,
+ processor_merchant_id,
constraints,
storage_scheme,
)
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 60facbc509..4aeb9c8125 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -2379,13 +2379,8 @@ where
merchant_account_type: merchant.merchant_account_type,
});
- let platform = domain::Platform::new(
- merchant.clone(),
- key_store.clone(),
- merchant,
- key_store,
- initiator,
- );
+ let platform =
+ resolve_platform(state, request_headers, merchant, key_store, initiator).await?;
let auth = AuthenticationData {
platform,
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 089d15e651..bf7cc10483 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -382,7 +382,7 @@ mod tests {
.unwrap();
let response = store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
&merchant_id,
&attempt_id,
@@ -514,7 +514,7 @@ mod tests {
.unwrap();
let response = store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
&merchant_id,
&uuid,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 76a3a8f9c4..18bbcaeb4d 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -175,7 +175,7 @@ pub async fn find_payment_intent_from_payment_id_type(
let db = &*state.store;
match payment_id_type {
payments::PaymentIdType::PaymentIntentId(payment_id) => db
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -185,7 +185,7 @@ pub async fn find_payment_intent_from_payment_id_type(
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound),
payments::PaymentIdType::ConnectorTransactionId(connector_transaction_id) => {
let attempt = db
- .find_payment_attempt_by_merchant_id_connector_txn_id(
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
platform.get_processor().get_account().get_id(),
&connector_transaction_id,
platform.get_processor().get_account().storage_scheme,
@@ -193,7 +193,7 @@ pub async fn find_payment_intent_from_payment_id_type(
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- db.find_payment_intent_by_payment_id_merchant_id(
+ db.find_payment_intent_by_payment_id_processor_merchant_id(
&attempt.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -204,7 +204,7 @@ pub async fn find_payment_intent_from_payment_id_type(
}
payments::PaymentIdType::PaymentAttemptId(attempt_id) => {
let attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&attempt_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -212,7 +212,7 @@ pub async fn find_payment_intent_from_payment_id_type(
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- db.find_payment_intent_by_payment_id_merchant_id(
+ db.find_payment_intent_by_payment_id_processor_merchant_id(
&attempt.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -255,7 +255,7 @@ pub async fn find_payment_intent_from_refund_id_type(
.to_not_found_response(errors::ApiErrorResponse::RefundNotFound)?,
};
let attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&refund.attempt_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
@@ -263,7 +263,7 @@ pub async fn find_payment_intent_from_refund_id_type(
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- db.find_payment_intent_by_payment_id_merchant_id(
+ db.find_payment_intent_by_payment_id_processor_merchant_id(
&attempt.payment_id,
platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
@@ -298,7 +298,7 @@ pub async fn find_payment_intent_from_mandate_id_type(
.await
.to_not_found_response(errors::ApiErrorResponse::MandateNotFound)?,
};
- db.find_payment_intent_by_payment_id_merchant_id(
+ db.find_payment_intent_by_payment_id_processor_merchant_id(
&mandate
.original_payment_id
.ok_or(errors::ApiErrorResponse::InternalServerError)
@@ -378,7 +378,7 @@ pub async fn get_mca_from_payment_intent(
#[cfg(feature = "v1")]
let payment_attempt = db
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
&payment_intent.active_attempt.get_id(),
platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 44b98640a3..8713c03752 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -17,10 +17,10 @@ use crate::errors::StorageError;
impl PaymentAttemptInterface for MockDb {
type Error = StorageError;
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
_payment_id: &common_utils::id_type::PaymentId,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_attempt_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
@@ -33,7 +33,7 @@ impl PaymentAttemptInterface for MockDb {
async fn get_filters_for_payments(
&self,
_pi: &[hyperswitch_domain_models::payments::PaymentIntent],
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters,
@@ -45,7 +45,7 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_active_attempt_ids: &[String],
_connector: Option<Vec<api_models::enums::Connector>>,
_payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -76,10 +76,10 @@ impl PaymentAttemptInterface for MockDb {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_attempt_id_merchant_id(
+ async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
_attempt_id: &str,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
@@ -110,10 +110,10 @@ impl PaymentAttemptInterface for MockDb {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_preprocessing_id_merchant_id(
+ async fn find_payment_attempt_by_preprocessing_id_processor_merchant_id(
&self,
_preprocessing_id: &str,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
@@ -122,9 +122,9 @@ impl PaymentAttemptInterface for MockDb {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_merchant_id_connector_txn_id(
+ async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_connector_txn_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
@@ -146,9 +146,9 @@ impl PaymentAttemptInterface for MockDb {
}
#[cfg(feature = "v1")]
- async fn find_attempts_by_merchant_id_payment_id(
+ async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_payment_id: &common_utils::id_type::PaymentId,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
@@ -316,11 +316,11 @@ impl PaymentAttemptInterface for MockDb {
}
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ async fn find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&self,
_connector_transaction_id: &common_utils::types::ConnectorTransactionId,
_payment_id: &common_utils::id_type::PaymentId,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
@@ -331,10 +331,10 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v1")]
// safety: only used for testing
#[allow(clippy::unwrap_used)]
- async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
@@ -344,7 +344,9 @@ impl PaymentAttemptInterface for MockDb {
.iter()
.find(|payment_attempt| {
payment_attempt.payment_id == *payment_id
- && payment_attempt.merchant_id.eq(merchant_id)
+ && payment_attempt
+ .processor_merchant_id
+ .eq(processor_merchant_id)
})
.cloned()
.unwrap())
@@ -352,10 +354,10 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v1")]
#[allow(clippy::unwrap_used)]
- async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
_merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
@@ -365,7 +367,9 @@ impl PaymentAttemptInterface for MockDb {
.iter()
.find(|payment_attempt| {
payment_attempt.payment_id == *payment_id
- && payment_attempt.merchant_id.eq(merchant_id)
+ && payment_attempt
+ .processor_merchant_id
+ .eq(processor_merchant_id)
&& (payment_attempt.status == storage_enums::AttemptStatus::PartialCharged
|| payment_attempt.status == storage_enums::AttemptStatus::Charged)
})
diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs
index ef7d5d558a..9ce4ed4257 100644
--- a/crates/storage_impl/src/mock_db/payment_intent.rs
+++ b/crates/storage_impl/src/mock_db/payment_intent.rs
@@ -21,7 +21,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intent_by_constraints(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
@@ -50,7 +50,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_time_range: &common_utils::types::TimeRange,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
@@ -62,7 +62,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
_time_range: &common_utils::types::TimeRange,
) -> CustomResult<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
@@ -73,7 +73,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
@@ -95,7 +95,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &common_utils::id_type::MerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
@@ -135,7 +135,10 @@ impl PaymentIntentInterface for MockDb {
let mut payment_intents = self.payment_intents.lock().await;
let payment_intent = payment_intents
.iter_mut()
- .find(|item| item.get_id() == this.get_id() && item.merchant_id == this.merchant_id)
+ .find(|item| {
+ item.get_id() == this.get_id()
+ && item.processor_merchant_id == this.processor_merchant_id
+ })
.unwrap();
let diesel_payment_intent_update = diesel_models::PaymentIntentUpdate::from(update);
@@ -174,10 +177,10 @@ impl PaymentIntentInterface for MockDb {
#[cfg(feature = "v1")]
// safety: only used for testing
#[allow(clippy::unwrap_used)]
- async fn find_payment_intent_by_payment_id_merchant_id(
+ async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
@@ -186,7 +189,10 @@ impl PaymentIntentInterface for MockDb {
Ok(payment_intents
.iter()
.find(|payment_intent| {
- payment_intent.get_id() == payment_id && payment_intent.merchant_id.eq(merchant_id)
+ payment_intent.get_id() == payment_id
+ && payment_intent
+ .processor_merchant_id
+ .eq(processor_merchant_id)
})
.cloned()
.unwrap())
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 37b339598e..a14e528d8d 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -180,11 +180,11 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ async fn find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&self,
connector_transaction_id: &ConnectorTransactionId,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
@@ -192,11 +192,11 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
let key_manager_state = self
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_by_connector_transaction_id_payment_id_merchant_id(
+ DieselPaymentAttempt::find_by_connector_transaction_id_payment_id_processor_merchant_id(
&conn,
connector_transaction_id,
payment_id,
- merchant_id,
+ processor_merchant_id,
)
.await
.map_err(|er| {
@@ -218,10 +218,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
@@ -229,10 +229,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
let key_manager_state = self
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_last_successful_attempt_by_payment_id_merchant_id(
+ DieselPaymentAttempt::find_last_successful_attempt_by_payment_id_processor_merchant_id(
&conn,
payment_id,
- merchant_id,
+ processor_merchant_id,
)
.await
.map_err(|er| {
@@ -254,10 +254,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
@@ -265,10 +265,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
let key_manager_state = self
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ DieselPaymentAttempt::find_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&conn,
payment_id,
- merchant_id,
+ processor_merchant_id,
)
.await
.map_err(|er| {
@@ -316,9 +316,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_merchant_id_connector_txn_id(
+ async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
connector_txn_id: &str,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -327,9 +327,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
let key_manager_state = self
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_by_merchant_id_connector_txn_id(
+ DieselPaymentAttempt::find_by_processor_merchant_id_connector_txn_id(
&conn,
- merchant_id,
+ processor_merchant_id,
connector_txn_id,
)
.await
@@ -382,10 +382,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
attempt_id: &str,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -395,10 +395,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_by_payment_id_merchant_id_attempt_id(
+ DieselPaymentAttempt::find_by_payment_id_processor_merchant_id_attempt_id(
&conn,
payment_id,
- merchant_id,
+ processor_merchant_id,
attempt_id,
)
.await
@@ -424,7 +424,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<PaymentListFilters, errors::StorageError> {
use hyperswitch_domain_models::behaviour::Conversion;
@@ -437,37 +437,41 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
}))
.await?;
- DieselPaymentAttempt::get_filters_for_payments(&conn, intents.as_slice(), merchant_id)
- .await
- .map_err(|er| {
- let new_err = diesel_error_to_data_error(*er.current_context());
- er.change_context(new_err)
- })
- .map(
- |(
- connector,
- currency,
- status,
- payment_method,
- payment_method_type,
- authentication_type,
- )| PaymentListFilters {
- connector,
- currency,
- status,
- payment_method,
- payment_method_type,
- authentication_type,
- },
- )
+ DieselPaymentAttempt::get_filters_for_payments(
+ &conn,
+ intents.as_slice(),
+ processor_merchant_id,
+ )
+ .await
+ .map_err(|er| {
+ let new_err = diesel_error_to_data_error(*er.current_context());
+ er.change_context(new_err)
+ })
+ .map(
+ |(
+ connector,
+ currency,
+ status,
+ payment_method,
+ payment_method_type,
+ authentication_type,
+ )| PaymentListFilters {
+ connector,
+ currency,
+ status,
+ payment_method,
+ payment_method_type,
+ authentication_type,
+ },
+ )
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_preprocessing_id_merchant_id(
+ async fn find_payment_attempt_by_preprocessing_id_processor_merchant_id(
&self,
preprocessing_id: &str,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
@@ -476,9 +480,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_by_merchant_id_preprocessing_id(
+ DieselPaymentAttempt::find_by_processor_merchant_id_preprocessing_id(
&conn,
- merchant_id,
+ processor_merchant_id,
preprocessing_id,
)
.await
@@ -501,9 +505,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_attempts_by_merchant_id_payment_id(
+ async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -512,34 +516,36 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
let key_manager_state = self
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_by_merchant_id_payment_id(&conn, merchant_id, payment_id)
- .await
- .map_err(|er| {
- let new_err = diesel_error_to_data_error(*er.current_context());
- er.change_context(new_err)
- })
- .map(|v| {
- try_join_all(v.into_iter().map(|diesel_payment_attempt| {
- PaymentAttempt::convert_back(
- key_manager_state,
- diesel_payment_attempt,
- merchant_key_store.key.get_inner(),
- merchant_key_store.merchant_id.clone().into(),
- )
- }))
- .map(|join_result| {
- join_result.change_context(errors::StorageError::DecryptionError)
- })
- })?
- .await
+ DieselPaymentAttempt::find_by_processor_merchant_id_payment_id(
+ &conn,
+ processor_merchant_id,
+ payment_id,
+ )
+ .await
+ .map_err(|er| {
+ let new_err = diesel_error_to_data_error(*er.current_context());
+ er.change_context(new_err)
+ })
+ .map(|v| {
+ try_join_all(v.into_iter().map(|diesel_payment_attempt| {
+ PaymentAttempt::convert_back(
+ key_manager_state,
+ diesel_payment_attempt,
+ merchant_key_store.key.get_inner(),
+ merchant_key_store.merchant_id.clone().into(),
+ )
+ }))
+ .map(|join_result| join_result.change_context(errors::StorageError::DecryptionError))
+ })?
+ .await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_attempt_id_merchant_id(
+ async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
@@ -548,23 +554,27 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
.get_keymanager_state()
.attach_printable("Missing KeyManagerState")?;
- DieselPaymentAttempt::find_by_merchant_id_attempt_id(&conn, merchant_id, attempt_id)
+ DieselPaymentAttempt::find_by_processor_merchant_id_attempt_id(
+ &conn,
+ processor_merchant_id,
+ attempt_id,
+ )
+ .await
+ .map_err(|er| {
+ let new_err = diesel_error_to_data_error(*er.current_context());
+ er.change_context(new_err)
+ })
+ .async_map(|diesel_payment_attempt| async {
+ PaymentAttempt::convert_back(
+ key_manager_state,
+ diesel_payment_attempt,
+ merchant_key_store.key.get_inner(),
+ merchant_key_store.merchant_id.clone().into(),
+ )
.await
- .map_err(|er| {
- let new_err = diesel_error_to_data_error(*er.current_context());
- er.change_context(new_err)
- })
- .async_map(|diesel_payment_attempt| async {
- PaymentAttempt::convert_back(
- key_manager_state,
- diesel_payment_attempt,
- merchant_key_store.key.get_inner(),
- merchant_key_store.merchant_id.clone().into(),
- )
- .await
- .change_context(errors::StorageError::DecryptionError)
- })
- .await?
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await?
}
#[cfg(feature = "v2")]
@@ -634,7 +644,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -659,7 +669,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
});
DieselPaymentAttempt::get_total_count_of_attempts(
&conn,
- merchant_id,
+ processor_merchant_id,
active_attempt_ids,
connector_strings,
payment_method,
@@ -855,7 +865,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
let reverse_lookup = ReverseLookupNew {
lookup_id: format!(
"pa_{}_{}",
- created_attempt.merchant_id.get_string_repr(),
+ created_attempt.processor_merchant_id.get_string_repr(),
&created_attempt.attempt_id,
),
pk_id: key_str.clone(),
@@ -1006,7 +1016,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id: &this.merchant_id,
+ merchant_id: &this.processor_merchant_id,
payment_id: &this.payment_id,
};
let field = format!("pa_{}", this.attempt_id);
@@ -1075,7 +1085,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
add_connector_txn_id_to_reverse_lookup(
self,
key_str.as_str(),
- &this.merchant_id,
+ &this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
connector_transaction_id,
storage_scheme,
@@ -1087,7 +1097,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
add_connector_txn_id_to_reverse_lookup(
self,
key_str.as_str(),
- &this.merchant_id,
+ &this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
connector_transaction_id,
storage_scheme,
@@ -1103,7 +1113,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
add_preprocessing_id_to_reverse_lookup(
self,
key_str.as_str(),
- &this.merchant_id,
+ &this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
preprocessing_id.as_str(),
storage_scheme,
@@ -1115,7 +1125,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
add_preprocessing_id_to_reverse_lookup(
self,
key_str.as_str(),
- &this.merchant_id,
+ &this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
preprocessing_id.as_str(),
storage_scheme,
@@ -1192,11 +1202,11 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ async fn find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
&self,
connector_transaction_id: &ConnectorTransactionId,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
@@ -1207,32 +1217,31 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
))
.await;
match storage_scheme {
- MerchantStorageScheme::PostgresOnly => {
- self.router_store
- .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
- connector_transaction_id,
- payment_id,
- merchant_id,
- storage_scheme,
- merchant_key_store,
- )
- .await
- }
+ MerchantStorageScheme::PostgresOnly => self
+ .router_store
+ .find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
+ connector_transaction_id,
+ payment_id,
+ processor_merchant_id,
+ storage_scheme,
+ merchant_key_store,
+ )
+ .await,
MerchantStorageScheme::RedisKv => {
// We assume that PaymentAttempt <=> PaymentIntent is a one-to-one relation for now
let lookup_id = format!(
"pa_conn_trans_{}_{}",
- merchant_id.get_string_repr(),
+ processor_merchant_id.get_string_repr(),
connector_transaction_id.get_id()
);
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
- .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
+ .find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(
connector_transaction_id,
payment_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1253,13 +1262,13 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
.attach_printable("Error while constructing domain model")
},
- || async {self.router_store.find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(connector_transaction_id, payment_id, merchant_id, storage_scheme, merchant_key_store).await},
+ || async {self.router_store.find_payment_attempt_by_connector_transaction_id_payment_id_processor_merchant_id(connector_transaction_id, payment_id, processor_merchant_id, storage_scheme, merchant_key_store).await},
))
.await
}
@@ -1268,18 +1277,18 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
- .find_payment_attempt_last_successful_attempt_by_payment_id_merchant_id(
+ .find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1294,7 +1303,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id,
+ merchant_id: processor_merchant_id,
payment_id,
};
let pattern = "pa_*";
@@ -1324,7 +1333,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1341,18 +1350,18 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
- .find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_merchant_id(
+ .find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1367,7 +1376,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id,
+ merchant_id: processor_merchant_id,
payment_id,
};
let pattern = "pa_*";
@@ -1400,7 +1409,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1517,9 +1526,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
#[cfg(feature = "v1")]
- async fn find_payment_attempt_by_merchant_id_connector_txn_id(
+ async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
connector_txn_id: &str,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -1533,8 +1542,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .find_payment_attempt_by_merchant_id_connector_txn_id(
- merchant_id,
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
+ processor_merchant_id,
connector_txn_id,
storage_scheme,
merchant_key_store,
@@ -1544,14 +1553,14 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
MerchantStorageScheme::RedisKv => {
let lookup_id = format!(
"pa_conn_trans_{}_{connector_txn_id}",
- merchant_id.get_string_repr()
+ processor_merchant_id.get_string_repr()
);
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
- .find_payment_attempt_by_merchant_id_connector_txn_id(
- merchant_id,
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
+ processor_merchant_id,
connector_txn_id,
storage_scheme,
merchant_key_store,
@@ -1578,7 +1587,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1586,8 +1595,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
},
|| async {
self.router_store
- .find_payment_attempt_by_merchant_id_connector_txn_id(
- merchant_id,
+ .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
+ processor_merchant_id,
connector_txn_id,
storage_scheme,
merchant_key_store,
@@ -1602,10 +1611,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
attempt_id: &str,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -1619,9 +1628,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
attempt_id,
storage_scheme,
merchant_key_store,
@@ -1630,7 +1639,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id,
+ merchant_id: processor_merchant_id,
payment_id,
};
let field = format!("pa_{attempt_id}");
@@ -1650,7 +1659,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1658,9 +1667,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
},
|| async {
self.router_store
- .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ .find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
payment_id,
- merchant_id,
+ processor_merchant_id,
attempt_id,
storage_scheme,
merchant_key_store,
@@ -1675,10 +1684,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_attempt_id_merchant_id(
+ async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
@@ -1691,23 +1700,26 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
attempt_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
.await
}
MerchantStorageScheme::RedisKv => {
- let lookup_id = format!("pa_{}_{attempt_id}", merchant_id.get_string_repr());
+ let lookup_id = format!(
+ "pa_{}_{attempt_id}",
+ processor_merchant_id.get_string_repr()
+ );
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
attempt_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1733,7 +1745,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1741,9 +1753,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
},
|| async {
self.router_store
- .find_payment_attempt_by_attempt_id_merchant_id(
+ .find_payment_attempt_by_attempt_id_processor_merchant_id(
attempt_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1798,10 +1810,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_attempt_by_preprocessing_id_merchant_id(
+ async fn find_payment_attempt_by_preprocessing_id_processor_merchant_id(
&self,
preprocessing_id: &str,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
@@ -1814,9 +1826,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
preprocessing_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1825,15 +1837,15 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
MerchantStorageScheme::RedisKv => {
let lookup_id = format!(
"pa_preprocessing_{}_{preprocessing_id}",
- merchant_id.get_string_repr()
+ processor_merchant_id.get_string_repr()
);
let lookup = fallback_reverse_lookup_not_found!(
self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
.await,
self.router_store
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
preprocessing_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1859,7 +1871,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- merchant_id.clone().into(),
+ processor_merchant_id.clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1867,9 +1879,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
},
|| async {
self.router_store
- .find_payment_attempt_by_preprocessing_id_merchant_id(
+ .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
preprocessing_id,
- merchant_id,
+ processor_merchant_id,
storage_scheme,
merchant_key_store,
)
@@ -1883,9 +1895,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_attempts_by_merchant_id_payment_id(
+ async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
storage_scheme: MerchantStorageScheme,
merchant_key_store: &MerchantKeyStore,
@@ -1899,8 +1911,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
- .find_attempts_by_merchant_id_payment_id(
- merchant_id,
+ .find_attempts_by_processor_merchant_id_payment_id(
+ processor_merchant_id,
payment_id,
storage_scheme,
merchant_key_store,
@@ -1909,7 +1921,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
}
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id,
+ merchant_id: processor_merchant_id,
payment_id,
};
let key_manager_state = self
@@ -1943,8 +1955,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
},
|| async {
self.router_store
- .find_attempts_by_merchant_id_payment_id(
- merchant_id,
+ .find_attempts_by_processor_merchant_id_payment_id(
+ processor_merchant_id,
payment_id,
storage_scheme,
merchant_key_store,
@@ -1962,11 +1974,11 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentListFilters, errors::StorageError> {
self.router_store
- .get_filters_for_payments(pi, merchant_id, storage_scheme)
+ .get_filters_for_payments(pi, processor_merchant_id, storage_scheme)
.await
}
@@ -1974,7 +1986,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -1987,7 +1999,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
) -> CustomResult<i64, errors::StorageError> {
self.router_store
.get_total_count_of_filtered_payment_attempts(
- merchant_id,
+ processor_merchant_id,
active_attempt_ids,
connector,
payment_method,
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index dcd3a791d9..80af3d6047 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -71,11 +71,11 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
- let merchant_id = payment_intent.merchant_id.clone();
+ let processor_merchant_id = payment_intent.processor_merchant_id.clone();
let payment_id = payment_intent.get_id().to_owned();
let field = payment_intent.get_id().get_hash_key_for_kv_store();
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id: &merchant_id,
+ merchant_id: &processor_merchant_id,
payment_id: &payment_id,
};
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentIntent>(
@@ -247,10 +247,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
- let merchant_id = this.merchant_id.clone();
+ let processor_merchant_id = this.processor_merchant_id.clone();
let payment_id = this.get_id().to_owned();
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id: &merchant_id,
+ merchant_id: &processor_merchant_id,
payment_id: &payment_id,
};
let field = format!("pi_{}", this.get_id().get_string_repr());
@@ -315,7 +315,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
.attach_printable("Missing KeyManagerState")?,
diesel_intent,
merchant_key_store.key.get_inner(),
- merchant_id.into(),
+ processor_merchant_id.into(),
)
.await
.change_context(StorageError::DecryptionError)?;
@@ -406,21 +406,25 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_intent_by_payment_id_merchant_id(
+ async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let database_call = || async {
let conn = pg_connection_read(self).await?;
- DieselPaymentIntent::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id)
- .await
- .map_err(|er| {
- let new_err = diesel_error_to_data_error(*er.current_context());
- er.change_context(new_err)
- })
+ DieselPaymentIntent::find_by_payment_id_processor_merchant_id(
+ &conn,
+ payment_id,
+ processor_merchant_id,
+ )
+ .await
+ .map_err(|er| {
+ let new_err = diesel_error_to_data_error(*er.current_context());
+ er.change_context(new_err)
+ })
};
let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentIntent>(
self,
@@ -433,7 +437,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
- merchant_id,
+ merchant_id: processor_merchant_id,
payment_id,
};
let field = payment_id.get_hash_key_for_kv_store();
@@ -458,7 +462,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
.attach_printable("Missing KeyManagerState")?,
diesel_payment_intent,
merchant_key_store.key.get_inner(),
- merchant_id.to_owned().into(),
+ processor_merchant_id.to_owned().into(),
)
.await
.change_context(StorageError::DecryptionError)
@@ -531,14 +535,14 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intent_by_constraints(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
filters: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
self.router_store
.filter_payment_intent_by_constraints(
- merchant_id,
+ processor_merchant_id,
filters,
merchant_key_store,
storage_scheme,
@@ -549,14 +553,14 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
time_range: &common_utils::types::TimeRange,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
self.router_store
.filter_payment_intents_by_time_range_constraints(
- merchant_id,
+ processor_merchant_id,
time_range,
merchant_key_store,
storage_scheme,
@@ -567,26 +571,26 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
self.router_store
- .get_intent_status_with_count(merchant_id, profile_id_list, time_range)
+ .get_intent_status_with_count(processor_merchant_id, profile_id_list, time_range)
.await
}
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
filters: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
self.router_store
.get_filtered_payment_intents_attempt(
- merchant_id,
+ processor_merchant_id,
filters,
merchant_key_store,
storage_scheme,
@@ -597,13 +601,13 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
self.router_store
.get_filtered_active_attempt_ids_for_total_count(
- merchant_id,
+ processor_merchant_id,
constraints,
storage_scheme,
)
@@ -816,33 +820,37 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[cfg(feature = "v1")]
#[instrument(skip_all)]
- async fn find_payment_intent_by_payment_id_merchant_id(
+ async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
merchant_key_store: &MerchantKeyStore,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
- DieselPaymentIntent::find_by_payment_id_merchant_id(&conn, payment_id, merchant_id)
- .await
- .map_err(|er| {
- let new_err = diesel_error_to_data_error(*er.current_context());
- er.change_context(new_err)
- })
- .async_and_then(|diesel_payment_intent| async {
- PaymentIntent::convert_back(
- self.get_keymanager_state()
- .attach_printable("Missing KeyManagerState")?,
- diesel_payment_intent,
- merchant_key_store.key.get_inner(),
- merchant_key_store.merchant_id.clone().into(),
- )
- .await
- .change_context(StorageError::DecryptionError)
- })
+ DieselPaymentIntent::find_by_payment_id_processor_merchant_id(
+ &conn,
+ payment_id,
+ processor_merchant_id,
+ )
+ .await
+ .map_err(|er| {
+ let new_err = diesel_error_to_data_error(*er.current_context());
+ er.change_context(new_err)
+ })
+ .async_and_then(|diesel_payment_intent| async {
+ PaymentIntent::convert_back(
+ self.get_keymanager_state()
+ .attach_printable("Missing KeyManagerState")?,
+ diesel_payment_intent,
+ merchant_key_store.key.get_inner(),
+ merchant_key_store.merchant_id.clone().into(),
+ )
.await
+ .change_context(StorageError::DecryptionError)
+ })
+ .await
}
#[cfg(feature = "v2")]
@@ -911,7 +919,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn filter_payment_intent_by_constraints(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
filters: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -924,7 +932,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
//[#350]: Replace this with Boxable Expression and pass it into generic filter
// when https://github.com/rust-lang/rust/issues/52662 becomes stable
let mut query = <DieselPaymentIntent as HasTable>::table()
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.order(pi_dsl::created_at.desc())
.into_boxed();
@@ -949,9 +957,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
(None, Some(starting_after_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let starting_at = self
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
starting_after_id,
- merchant_id,
+ processor_merchant_id,
merchant_key_store,
storage_scheme,
)
@@ -967,9 +975,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
(None, Some(ending_before_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let ending_at = self
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
ending_before_id,
- merchant_id,
+ processor_merchant_id,
merchant_key_store,
storage_scheme,
)
@@ -1034,7 +1042,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
time_range: &common_utils::types::TimeRange,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -1042,7 +1050,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
// TODO: Remove this redundant function
let payment_filters = (*time_range).into();
self.filter_payment_intent_by_constraints(
- merchant_id,
+ processor_merchant_id,
&payment_filters,
merchant_key_store,
storage_scheme,
@@ -1054,7 +1062,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_intent_status_with_count(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
@@ -1064,7 +1072,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
let mut query = <DieselPaymentIntent as HasTable>::table()
.group_by(pi_dsl::status)
.select((pi_dsl::status, diesel::dsl::count_star()))
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.into_boxed();
if let Some(profile_id) = profile_id_list {
@@ -1098,7 +1106,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
merchant_key_store: &MerchantKeyStore,
storage_scheme: MerchantStorageScheme,
@@ -1106,11 +1114,11 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
let conn = connection::pg_connection_read(self).await?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.inner_join(
payment_attempt_schema::table.on(pa_dsl::attempt_id.eq(pi_dsl::active_attempt_id)),
)
- .filter(pa_dsl::merchant_id.eq(merchant_id.to_owned())) // Ensure merchant_ids match, as different merchants can share payment/attempt IDs.
+ .filter(pa_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned())) // Ensure merchant_ids match, as different merchants can share payment/attempt IDs.
.into_boxed();
query = match constraints {
@@ -1160,9 +1168,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
(None, Some(starting_after_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let starting_at = self
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
starting_after_id,
- merchant_id,
+ processor_merchant_id,
merchant_key_store,
storage_scheme,
)
@@ -1178,9 +1186,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
(None, Some(ending_before_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let ending_at = self
- .find_payment_intent_by_payment_id_merchant_id(
+ .find_payment_intent_by_payment_id_processor_merchant_id(
ending_before_id,
- merchant_id,
+ processor_merchant_id,
merchant_key_store,
storage_scheme,
)
@@ -1284,7 +1292,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
keymanager_state,
pi,
merchant_key_store.key.get_inner(),
- merchant_id.to_owned().into(),
+ processor_merchant_id.to_owned().into(),
)
.await
.change_context(StorageError::DecryptionError)?;
@@ -1612,7 +1620,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &common_utils::id_type::MerchantId,
constraints: &PaymentIntentFetchConstraints,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
@@ -1620,7 +1628,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
let mut query = DieselPaymentIntent::table()
.select(pi_dsl::active_attempt_id)
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
.order(pi_dsl::created_at.desc())
.into_boxed();
diff --git a/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/down.sql b/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/down.sql
new file mode 100644
index 0000000000..a2e7be9a88
--- /dev/null
+++ b/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+DROP INDEX CONCURRENTLY IF EXISTS payment_intent_processor_merchant_id_payment_id_index;
diff --git a/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/metadata.toml b/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/metadata.toml
new file mode 100644
index 0000000000..16153bc09f
--- /dev/null
+++ b/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/metadata.toml
@@ -0,0 +1 @@
+run_in_transaction = false
\ No newline at end of file
diff --git a/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/up.sql b/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/up.sql
new file mode 100644
index 0000000000..07ccd6d38b
--- /dev/null
+++ b/migrations/2026-01-22-210101_add_index_processor_merchant_id_payment_id_for_payment_intent/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+CREATE INDEX CONCURRENTLY IF NOT EXISTS payment_intent_processor_merchant_id_payment_id_index ON payment_intent (processor_merchant_id, payment_id);
\ No newline at end of file
diff --git a/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/down.sql b/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/down.sql
new file mode 100644
index 0000000000..083cd43077
--- /dev/null
+++ b/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+DROP INDEX CONCURRENTLY IF EXISTS payment_attempt_processor_merchant_id_payment_id_index;
diff --git a/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/metadata.toml b/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/metadata.toml
new file mode 100644
index 0000000000..16153bc09f
--- /dev/null
+++ b/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/metadata.toml
@@ -0,0 +1 @@
+run_in_transaction = false
\ No newline at end of file
diff --git a/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/up.sql b/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/up.sql
new file mode 100644
index 0000000000..6b3edd5f4c
--- /dev/null
+++ b/migrations/2026-01-22-210111_add_index_processor_merchant_id_payment_id_for_payment_attempt/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+CREATE INDEX CONCURRENTLY IF NOT EXISTS payment_attempt_processor_merchant_id_payment_id_index ON payment_attempt (processor_merchant_id, payment_id);
\ No newline at end of file