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

refactor(platform): add compile-time context safety to payments (#14793)

Apoorv Dixit7ffb0a506414
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 7fdc3256d4..e7657c1d70 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -55,7 +55,11 @@ use crate::{
address::Address, consts, payment_method_data::PaymentMethodData, platform,
router_response_types,
};
-use crate::{errors, merchant_key_store::MerchantKeyStore, ForeignIDRef};
+use crate::{
+ errors,
+ platform::{ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme},
+ ForeignIDRef,
+};
#[cfg(feature = "v1")]
use crate::{
mandates::{MandateDataType, MandateDetails, MandateTransactionType},
@@ -69,16 +73,16 @@ pub trait PaymentAttemptInterface {
async fn insert_payment_attempt(
&self,
payment_attempt: PaymentAttempt,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v2")]
async fn insert_payment_attempt(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_attempt: PaymentAttempt,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
@@ -86,120 +90,120 @@ pub trait PaymentAttemptInterface {
&self,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v2")]
async fn update_payment_attempt(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v2")]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_id: &id_type::GlobalPaymentId,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
connector_txn_id: &str,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
profile_id: &id_type::ProfileId,
connector_transaction_id: &str,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
attempt_id: &str,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
attempt_id: &id_type::GlobalAttemptId,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, Self::Error>;
#[cfg(feature = "v2")]
async fn find_payment_attempts_by_payment_intent_id(
&self,
payment_id: &id_type::GlobalPaymentId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, Self::Error>;
#[cfg(feature = "v1")]
async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
payment_id: &id_type::PaymentId,
- storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<Vec<PaymentAttempt>, Self::Error>;
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentListFilters, Self::Error>;
#[cfg(all(feature = "v1", feature = "olap"))]
#[allow(clippy::too_many_arguments)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<Connector>>,
payment_method: Option<Vec<storage_enums::PaymentMethod>>,
@@ -208,14 +212,14 @@ pub trait PaymentAttemptInterface {
merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<storage_enums::CardNetwork>>,
card_discovery: Option<Vec<storage_enums::CardDiscovery>>,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<i64, Self::Error>;
#[cfg(all(feature = "v2", feature = "olap"))]
#[allow(clippy::too_many_arguments)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method_type: Option<Vec<storage_enums::PaymentMethod>>,
@@ -223,7 +227,7 @@ pub trait PaymentAttemptInterface {
authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<storage_enums::CardNetwork>>,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<i64, Self::Error>;
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 5bf3ad10ac..a2155691d0 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -35,7 +35,9 @@ use crate::address::Address;
use crate::routing;
use crate::{
behaviour,
- merchant_key_store::MerchantKeyStore,
+ platform::{
+ ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme, ProviderMerchantId,
+ },
type_encryption::{crypto_operation, CryptoOperation},
};
#[cfg(feature = "v1")]
@@ -48,55 +50,55 @@ pub trait PaymentIntentInterface {
&self,
this: PaymentIntent,
payment_intent: PaymentIntentUpdate,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, Self::Error>;
async fn insert_payment_intent(
&self,
new: PaymentIntent,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, Self::Error>;
#[cfg(feature = "v1")]
async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, Self::Error>;
#[cfg(feature = "v2")]
async fn find_payment_intent_by_merchant_reference_id_profile_id(
&self,
merchant_reference_id: &id_type::PaymentReferenceId,
profile_id: &id_type::ProfileId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: &common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: &ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, Self::Error>;
#[cfg(feature = "v2")]
async fn find_payment_intent_by_id(
&self,
id: &id_type::GlobalPaymentId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, Self::Error>;
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intent_by_constraints(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
filters: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, Self::Error>;
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt_for_platform(
&self,
- platform_merchant_id: &id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &PaymentIntentFetchConstraints,
) -> error_stack::Result<
Vec<(
@@ -109,23 +111,23 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_payment_intents_attempt_count_for_platform(
&self,
- platform_merchant_id: &id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &PaymentIntentFetchConstraints,
) -> error_stack::Result<i64, Self::Error>;
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
time_range: &common_utils::types::TimeRange,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, Self::Error>;
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
profile_id_list: Option<Vec<id_type::ProfileId>>,
constraints: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, Self::Error>;
@@ -133,19 +135,19 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, Self::Error>;
#[cfg(all(feature = "v2", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<
Vec<(
PaymentIntent,
@@ -157,17 +159,17 @@ pub trait PaymentIntentInterface {
#[cfg(all(feature = "v2", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- storage_scheme: common_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<Option<String>>, Self::Error>;
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- storage_scheme: common_enums::MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<String>, Self::Error>;
}
diff --git a/crates/hyperswitch_domain_models/src/platform.rs b/crates/hyperswitch_domain_models/src/platform.rs
index 8dd807a8e3..8d1baea4e9 100644
--- a/crates/hyperswitch_domain_models/src/platform.rs
+++ b/crates/hyperswitch_domain_models/src/platform.rs
@@ -1,38 +1,125 @@
+use std::ops::Deref;
+
use common_utils::types::authentication::AuthInfo;
pub use crate::{merchant_account::MerchantAccount, merchant_key_store::MerchantKeyStore};
+impl Deref for ProviderKeyStore {
+ type Target = MerchantKeyStore;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl Deref for ProviderMerchantId {
+ type Target = common_utils::id_type::MerchantId;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl Deref for ProviderStorageScheme {
+ type Target = common_enums::MerchantStorageScheme;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl Deref for ProcessorKeyStore {
+ type Target = MerchantKeyStore;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl Deref for ProcessorMerchantId {
+ type Target = common_utils::id_type::MerchantId;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl Deref for ProcessorStorageScheme {
+ type Target = common_enums::MerchantStorageScheme;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct ProviderKeyStore(MerchantKeyStore);
+
+impl ProviderKeyStore {
+ pub fn inner(&self) -> &MerchantKeyStore {
+ &self.0
+ }
+}
+
+#[derive(Clone, Copy, Debug)]
+pub struct ProviderStorageScheme(common_enums::MerchantStorageScheme);
+
+impl ProviderStorageScheme {
+ pub fn inner(&self) -> common_enums::MerchantStorageScheme {
+ self.0
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct ProviderMerchantAccount(MerchantAccount);
+
+impl ProviderMerchantAccount {
+ pub fn get_account(&self) -> &MerchantAccount {
+ &self.0
+ }
+
+ pub fn get_provider_merchant_id(&self) -> ProviderMerchantId {
+ ProviderMerchantId(self.0.get_id().clone())
+ }
+
+ pub fn get_storage_scheme(&self) -> ProviderStorageScheme {
+ ProviderStorageScheme(self.0.storage_scheme)
+ }
+}
+
/// Provider = The business owner or the governing entity in the hierarchy.
/// In a platform-connected setup this is represented by the platform merchant.
/// For a standard merchant, both provider and processor are represented by the same entity.
#[derive(Clone, Debug)]
pub struct Provider {
- account: MerchantAccount,
- key_store: MerchantKeyStore,
+ account: ProviderMerchantAccount,
+ key_store: ProviderKeyStore,
}
impl Provider {
fn new(account: MerchantAccount, key_store: MerchantKeyStore) -> Self {
- Self { account, key_store }
+ Self {
+ account: ProviderMerchantAccount(account),
+ key_store: ProviderKeyStore(key_store),
+ }
}
- /// Returns a reference to the merchant account of the provider.
- pub fn get_account(&self) -> &MerchantAccount {
+ pub fn get_provider_merchant_account(&self) -> &ProviderMerchantAccount {
&self.account
}
- /// Returns a reference to the key store associated with the provider.
- pub fn get_key_store(&self) -> &MerchantKeyStore {
+ /// Untagged on purpose: interfaces outside payments still take `&MerchantAccount`.
+ pub fn get_account(&self) -> &MerchantAccount {
+ self.account.get_account()
+ }
+
+ pub fn get_key_store(&self) -> &ProviderKeyStore {
&self.key_store
}
- /// Returns the provider merchant
pub fn get_provider_merchant_id(&self) -> ProviderMerchantId {
- ProviderMerchantId(self.account.get_id().clone())
+ self.account.get_provider_merchant_id()
+ }
+
+ pub fn get_storage_scheme(&self) -> ProviderStorageScheme {
+ self.account.get_storage_scheme()
}
}
-/// Provider Merchant ID
#[derive(Debug, Clone)]
pub struct ProviderMerchantId(common_utils::id_type::MerchantId);
@@ -45,36 +132,95 @@ impl ProviderMerchantId {
Self(id)
}
}
-/// Processor = The merchant account whose processor credentials are used
-/// to execute the operation.
+
+#[derive(Clone, Debug)]
+pub struct ProcessorKeyStore(MerchantKeyStore);
+
+impl ProcessorKeyStore {
+ pub fn inner(&self) -> &MerchantKeyStore {
+ &self.0
+ }
+
+ pub fn from_untagged(key_store: MerchantKeyStore) -> Self {
+ Self(key_store)
+ }
+}
+
+#[derive(Clone, Copy, Debug)]
+pub struct ProcessorStorageScheme(common_enums::MerchantStorageScheme);
+
+impl ProcessorStorageScheme {
+ pub fn inner(&self) -> common_enums::MerchantStorageScheme {
+ self.0
+ }
+
+ pub fn postgres_only() -> Self {
+ Self(common_enums::MerchantStorageScheme::PostgresOnly)
+ }
+
+ pub fn retag(self, storage_scheme: common_enums::MerchantStorageScheme) -> Self {
+ Self(storage_scheme)
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct ProcessorMerchantAccount(MerchantAccount);
+
+impl ProcessorMerchantAccount {
+ /// Boundary hatch for flows that resolve a merchant account without a [`Platform`].
+ pub fn from_untagged(account: MerchantAccount) -> Self {
+ Self(account)
+ }
+
+ pub fn get_account(&self) -> &MerchantAccount {
+ &self.0
+ }
+
+ pub fn get_processor_merchant_id(&self) -> ProcessorMerchantId {
+ ProcessorMerchantId(self.0.get_id().clone())
+ }
+
+ pub fn get_storage_scheme(&self) -> ProcessorStorageScheme {
+ ProcessorStorageScheme(self.0.storage_scheme)
+ }
+}
+
#[derive(Clone, Debug)]
pub struct Processor {
- account: MerchantAccount,
- key_store: MerchantKeyStore,
+ account: ProcessorMerchantAccount,
+ key_store: ProcessorKeyStore,
}
impl Processor {
fn new(account: MerchantAccount, key_store: MerchantKeyStore) -> Self {
- Self { account, key_store }
+ Self {
+ account: ProcessorMerchantAccount(account),
+ key_store: ProcessorKeyStore(key_store),
+ }
}
- /// Returns a reference to the merchant account of the processor.
- pub fn get_account(&self) -> &MerchantAccount {
+ pub fn get_processor_merchant_account(&self) -> &ProcessorMerchantAccount {
&self.account
}
- /// Returns a reference to the key store associated with the processor.
- pub fn get_key_store(&self) -> &MerchantKeyStore {
+ /// Untagged on purpose: interfaces outside payments still take `&MerchantAccount`.
+ pub fn get_account(&self) -> &MerchantAccount {
+ self.account.get_account()
+ }
+
+ pub fn get_key_store(&self) -> &ProcessorKeyStore {
&self.key_store
}
- /// Returns the processor merchant ID
pub fn get_processor_merchant_id(&self) -> ProcessorMerchantId {
- ProcessorMerchantId(self.account.get_id().clone())
+ self.account.get_processor_merchant_id()
+ }
+
+ pub fn get_storage_scheme(&self) -> ProcessorStorageScheme {
+ self.account.get_storage_scheme()
}
}
-/// Processor Merchant ID
#[derive(Debug, Clone)]
pub struct ProcessorMerchantId(common_utils::id_type::MerchantId);
@@ -90,7 +236,6 @@ impl From<common_utils::id_type::MerchantId> for ProcessorMerchantId {
}
}
-/// Initiator = The entity that initiated the operation.
#[derive(Clone, Debug)]
pub enum Initiator {
Api {
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 0cc7e8f8f7..b124fa71c6 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -2870,7 +2870,7 @@ pub async fn create_connector(
.clone()
.create_domain_model_from_request(
&state,
- processor.get_key_store().clone(),
+ processor.get_key_store().inner().clone(),
&business_profile,
key_manager_state,
)
@@ -2918,7 +2918,7 @@ pub async fn create_connector(
merchant_connector_id: &mca.get_id(),
store,
business_profile,
- key_store: processor.get_key_store().to_owned(),
+ key_store: processor.get_key_store().inner().to_owned(),
key_manager_state,
};
@@ -3332,7 +3332,7 @@ pub async fn delete_connector(
merchant_connector_id: &mca.get_id(),
store: db,
business_profile,
- key_store: platform.get_processor().get_key_store().to_owned(),
+ key_store: platform.get_processor().get_key_store().inner().to_owned(),
key_manager_state,
};
diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs
index fcb2eb5743..9f2493fa86 100644
--- a/crates/router/src/core/authentication.rs
+++ b/crates/router/src/core/authentication.rs
@@ -443,7 +443,7 @@ where
provider_account,
provider_key_store,
processor.get_account().clone(),
- processor.get_key_store().clone(),
+ processor.get_key_store().inner().clone(),
initiator.cloned(),
);
let provider_business_profile =
@@ -1060,7 +1060,7 @@ pub async fn perform_post_authentication_proxy<F: Clone>(
> {
let key_store = processor.get_key_store();
let key_manager_state = state.into();
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let authentication = state
.store
@@ -1069,7 +1069,7 @@ pub async fn perform_post_authentication_proxy<F: Clone>(
&authentication_id,
key_store,
&key_manager_state,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(ApiErrorResponse::InternalServerError)
@@ -1152,7 +1152,7 @@ pub async fn perform_post_authentication_proxy<F: Clone>(
None,
key_store,
authentication_info,
- storage_scheme,
+ storage_scheme.inner(),
))
.await?
} else {
@@ -1229,8 +1229,8 @@ async fn call_ucs_authenticate_proxy(
let processor = platform.get_processor();
let key_store = processor.get_key_store();
let key_manager_state = state.into();
- let storage_scheme = processor.get_account().storage_scheme;
- let processor_merchant_id = processor.get_account().get_id();
+ let storage_scheme = processor.get_storage_scheme();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let payment_token = payment_attempt
.payment_token
@@ -1296,11 +1296,11 @@ async fn call_ucs_authenticate_proxy(
let authentication = state
.store
.find_authentication_by_processor_merchant_id_authentication_id(
- processor_merchant_id,
+ &processor_merchant_id,
&authentication_id,
key_store,
&key_manager_state,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(ApiErrorResponse::InternalServerError)
@@ -1678,7 +1678,7 @@ pub async fn perform_authentication_proxy(
) -> CustomResult<api::authentication::AuthenticationResponse, ApiErrorResponse> {
let processor = platform.get_processor();
let key_store = processor.get_key_store();
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let AuthenticateProxyContext {
authenticate_router_data,
@@ -1770,7 +1770,7 @@ pub async fn perform_authentication_proxy(
None,
key_store,
authentication_info,
- storage_scheme,
+ storage_scheme.inner(),
))
.await?;
@@ -1780,7 +1780,7 @@ pub async fn perform_authentication_proxy(
external_threeds_authentication_type: Some(authentication_type),
authentication_connector: authentication.authentication_connector.clone(),
authentication_id: Some(authentication_id),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
state
.store
diff --git a/crates/router/src/core/blocklist/utils.rs b/crates/router/src/core/blocklist/utils.rs
index a1ec935c46..18f510d091 100644
--- a/crates/router/src/core/blocklist/utils.rs
+++ b/crates/router/src/core/blocklist/utils.rs
@@ -29,7 +29,7 @@ pub async fn delete_entry_from_blocklist(
transaction_type: common_enums::BlocklistTransactionType,
request: api_blocklist::DeleteFromBlocklistRequest,
) -> RouterResult<api_blocklist::DeleteFromBlocklistResponse> {
- let processor_merchant_id = processor.get_account().get_id();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let profile_id = core_utils::get_profile_from_business_details(
None,
None,
@@ -49,7 +49,7 @@ pub async fn delete_entry_from_blocklist(
delete_card_bin_blocklist_entry(
state,
&bin,
- processor_merchant_id,
+ &processor_merchant_id,
transaction_type,
&profile_id,
)
@@ -59,7 +59,7 @@ pub async fn delete_entry_from_blocklist(
api_blocklist::DeleteFromBlocklistRequest::Fingerprint(fingerprint_id) => state
.store
.delete_blocklist_entry_by_processor_merchant_id_profile_id_fingerprint_id(
- processor_merchant_id,
+ &processor_merchant_id,
transaction_type,
&profile_id,
&fingerprint_id,
@@ -195,7 +195,7 @@ pub async fn get_blocklist_count(
profile_id: Option<common_utils::id_type::ProfileId>,
query: api_blocklist::BlocklistCountQuery,
) -> RouterResult<api_blocklist::BlocklistCountResponse> {
- let processor_merchant_id = processor.get_account().get_id();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let profile_id = core_utils::get_profile_from_business_details(
None,
None,
@@ -213,7 +213,7 @@ pub async fn get_blocklist_count(
let total_count = state
.store
.get_blocklist_entries_count_by_processor_merchant_id_profile_id_data_kind(
- processor_merchant_id,
+ &processor_merchant_id,
query.transaction_type,
Some(&profile_id),
query.data_kind,
@@ -231,7 +231,7 @@ pub async fn get_blocklist_count(
let length_counts = state
.store
.count_blocklist_entries_by_fingerprint_length_processor_merchant_id_profile_id_data_kind(
- processor_merchant_id,
+ &processor_merchant_id,
query.transaction_type,
&profile_id,
query.data_kind,
@@ -274,7 +274,7 @@ pub async fn lookup_blocklist_entry(
profile_id: Option<common_utils::id_type::ProfileId>,
query: api_blocklist::BlocklistLookupQuery,
) -> RouterResult<api_blocklist::BlocklistLookupResponse> {
- let processor_merchant_id = processor.get_account().get_id();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let profile_id = core_utils::get_profile_from_business_details(
None,
None,
@@ -289,7 +289,7 @@ pub async fn lookup_blocklist_entry(
let entries = state
.store
.list_blocklist_entries_by_processor_merchant_id_profile_id_fingerprint_id(
- processor_merchant_id,
+ &processor_merchant_id,
query.transaction_type,
&profile_id,
query.data.get_string_repr(),
@@ -320,7 +320,7 @@ pub async fn insert_entry_into_blocklist(
transaction_type: common_enums::BlocklistTransactionType,
to_block: api_blocklist::AddToBlocklistRequest,
) -> RouterResult<api_blocklist::AddToBlocklistResponse> {
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let profile_id = core_utils::get_profile_from_business_details(
None,
None,
@@ -378,7 +378,7 @@ pub async fn insert_entry_into_blocklist(
let blocklist_entry_result = state
.store
.find_blocklist_entry_by_processor_merchant_id_profile_id_fingerprint_id(
- processor_merchant_id,
+ &processor_merchant_id,
transaction_type,
&profile_id,
fingerprint_id,
@@ -412,7 +412,7 @@ pub async fn insert_entry_into_blocklist(
transaction_type,
metadata: None,
created_at: common_utils::date_time::now(),
- processor_merchant_id: Some(processor_merchant_id.to_owned()),
+ processor_merchant_id: Some(processor_merchant_id.inner().to_owned()),
created_by: platform
.get_initiator()
.and_then(|initiator| initiator.to_created_by())
@@ -453,12 +453,12 @@ async fn duplicate_check_insert_bin(
data_kind: common_enums::BlocklistDataKind,
transaction_type: common_enums::BlocklistTransactionType,
) -> RouterResult<storage::Blocklist> {
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let blocklist_entry_result = state
.store
.find_blocklist_entry_by_processor_merchant_id_profile_id_fingerprint_id(
- processor_merchant_id,
+ &processor_merchant_id,
transaction_type,
profile_id,
bin,
@@ -491,7 +491,7 @@ async fn duplicate_check_insert_bin(
transaction_type,
metadata: None,
created_at: common_utils::date_time::now(),
- processor_merchant_id: Some(processor_merchant_id.to_owned()),
+ processor_merchant_id: Some(processor_merchant_id.inner().to_owned()),
created_by: platform
.get_initiator()
.and_then(|initiator| initiator.to_created_by())
@@ -532,7 +532,7 @@ pub async fn check_blocklist(
business_profile: &domain::Profile,
) -> CustomResult<Option<BlockReason>, errors::ApiErrorResponse> {
let db = &state.store;
- let processor_merchant_id = processor.get_account().get_id();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let merchant_fingerprint_secret =
core_utils::get_merchant_fingerprint_secret(state, processor.get_account()).await?;
@@ -589,7 +589,7 @@ pub async fn check_blocklist(
if !fingerprint_ids.is_empty() {
match db
.find_blocklist_entries_by_processor_merchant_id_profile_id_fingerprint_ids(
- processor_merchant_id,
+ &processor_merchant_id,
transaction_type,
profile_id,
fingerprint_ids,
@@ -685,7 +685,7 @@ where
updated_by: processor.get_account().storage_scheme.to_string(),
},
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -703,7 +703,7 @@ where
db.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt.clone(),
attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index eb1d30e881..807d66c526 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -74,9 +74,9 @@ pub async fn retrieve_dispute(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -89,9 +89,9 @@ pub async fn retrieve_dispute(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&dispute.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&dispute.attempt_id,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -210,9 +210,9 @@ pub async fn retrieve_disputes_list(
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&dispute_response.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -461,9 +461,9 @@ pub async fn accept_dispute(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -471,9 +471,9 @@ pub async fn accept_dispute(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&dispute.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
&dispute.attempt_id,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -591,9 +591,9 @@ pub async fn submit_evidence(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -601,9 +601,9 @@ pub async fn submit_evidence(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&dispute.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
&dispute.attempt_id,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -755,7 +755,7 @@ pub async fn attach_evidence(
})
},
)?;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let create_file_response = Box::pin(files::files_create_core(
state.clone(),
platform,
@@ -785,7 +785,7 @@ pub async fn attach_evidence(
.attach_printable("Error while encoding dispute evidence")?
.into(),
};
- db.update_dispute(dispute, update_dispute, storage_scheme)
+ db.update_dispute(dispute, update_dispute, storage_scheme.inner())
.await
.to_not_found_response(errors::ApiErrorResponse::DisputeNotFound {
dispute_id: dispute_id.to_owned(),
diff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rs
index 7d270fd8ff..7d51fd8b0a 100644
--- a/crates/router/src/core/files/helpers.rs
+++ b/crates/router/src/core/files/helpers.rs
@@ -324,9 +324,9 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&dispute.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -335,9 +335,9 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&dispute.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
&dispute.attempt_id,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index 7c34e9a02f..2e30d846c4 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -872,7 +872,7 @@ where
.to_update_tracker()?
.update_tracker(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
frm_data.clone(),
payment_data,
None,
@@ -1004,7 +1004,7 @@ where
.to_update_tracker()?
.update_tracker(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
frm_data.to_owned(),
payment_data,
None,
@@ -1037,7 +1037,7 @@ where
.to_update_tracker()?
.update_tracker(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
frm_data.to_owned(),
payment_data,
frm_suggestion,
@@ -1184,9 +1184,9 @@ pub async fn frm_fulfillment_core(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&req.payment_id.clone(),
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -1199,9 +1199,9 @@ pub async fn frm_fulfillment_core(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&payment_intent.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -1344,9 +1344,9 @@ pub async fn notify_frm_of_chargeback(
let payment_intent = match db
.find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
{
@@ -1359,9 +1359,9 @@ pub async fn notify_frm_of_chargeback(
let payment_attempt = match db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
&payment_intent.active_attempt.get_id(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
diff --git a/crates/router/src/core/fraud_check/operation.rs b/crates/router/src/core/fraud_check/operation.rs
index 7b76bc99f3..e75e67dacf 100644
--- a/crates/router/src/core/fraud_check/operation.rs
+++ b/crates/router/src/core/fraud_check/operation.rs
@@ -94,7 +94,7 @@ pub trait UpdateTracker<Fd, F: Clone, D>: Send {
async fn update_tracker<'b>(
&'b self,
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
frm_data: Fd,
payment_data: &mut D,
_frm_suggestion: Option<FrmSuggestion>,
diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
index 444b17b346..e9f24f2ae4 100644
--- a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
+++ b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
@@ -397,7 +397,7 @@ where
async fn update_tracker<'b>(
&'b self,
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
mut frm_data: FrmData,
payment_data: &mut D,
frm_suggestion: Option<FrmSuggestion>,
@@ -410,7 +410,7 @@ where
async fn update_tracker<'b>(
&'b self,
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
mut frm_data: FrmData,
payment_data: &mut D,
frm_suggestion: Option<FrmSuggestion>,
@@ -593,8 +593,8 @@ where
.update_payment_attempt_with_attempt_id(
payment_data.get_payment_attempt().clone(),
payment_attempt_update,
- frm_data.merchant_account.storage_scheme,
- key_store,
+ processor.get_storage_scheme(),
+ processor.get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -621,8 +621,8 @@ where
merchant_decision,
updated_by: frm_data.merchant_account.storage_scheme.to_string(),
},
- key_store,
- frm_data.merchant_account.storage_scheme,
+ processor.get_key_store(),
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
index 476ef3f032..f2fe356d8b 100644
--- a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
+++ b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs
@@ -271,7 +271,7 @@ where
async fn update_tracker<'b>(
&'b self,
state: &SessionState,
- _key_store: &domain::MerchantKeyStore,
+ _processor: &domain::Processor,
mut frm_data: FrmData,
payment_data: &mut D,
_frm_suggestion: Option<FrmSuggestion>,
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index 93155a8106..84f61b94c8 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -49,7 +49,7 @@ pub async fn get_mandate(
Ok(services::ApplicationResponse::Json(
mandates::MandateResponse::from_db_mandate(
&state,
- platform.get_processor().get_key_store().clone(),
+ platform.get_processor().get_key_store().inner().clone(),
mandate,
platform.get_processor().get_account(),
)
@@ -249,7 +249,7 @@ pub async fn get_customer_mandates(
response_vec.push(
mandates::MandateResponse::from_db_mandate(
&state,
- platform.get_processor().get_key_store().clone(),
+ platform.get_processor().get_key_store().inner().clone(),
mandate,
platform.get_processor().get_account(),
)
@@ -416,7 +416,7 @@ pub async fn retrieve_mandates_list(
let mandates_list = future::try_join_all(mandates.into_iter().map(|mandate| {
mandates::MandateResponse::from_db_mandate(
&state,
- platform.get_processor().get_key_store().clone(),
+ platform.get_processor().get_key_store().inner().clone(),
mandate,
platform.get_processor().get_account(),
)
diff --git a/crates/router/src/core/mandate/helpers.rs b/crates/router/src/core/mandate/helpers.rs
index 0658aa1c0d..2e5c0d2555 100644
--- a/crates/router/src/core/mandate/helpers.rs
+++ b/crates/router/src/core/mandate/helpers.rs
@@ -21,9 +21,9 @@ pub async fn get_profile_id_for_mandate(
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
diff --git a/crates/router/src/core/offer_engine/notify.rs b/crates/router/src/core/offer_engine/notify.rs
index be6d68387d..54e0bdf230 100644
--- a/crates/router/src/core/offer_engine/notify.rs
+++ b/crates/router/src/core/offer_engine/notify.rs
@@ -1,6 +1,8 @@
use common_utils::{ext_traits::ValueExt, id_type};
use diesel_models::process_tracker::business_status;
-use hyperswitch_domain_models::platform::ProcessorMerchantId;
+use hyperswitch_domain_models::platform::{
+ ProcessorKeyStore, ProcessorMerchantAccount, ProcessorMerchantId,
+};
use scheduler::{consumer::types::process_data, utils as pt_utils};
use super::{
@@ -179,12 +181,14 @@ pub async fn execute_notification(
let merchant_account = db
.find_merchant_account_by_merchant_id(&tracking_data.processor_merchant_id, &key_store)
.await?;
+ let processor_account = ProcessorMerchantAccount::from_untagged(merchant_account.clone());
+ let processor_key_store = ProcessorKeyStore::from_untagged(key_store.clone());
let payment_attempt = db
.find_payment_attempt_by_attempt_id_processor_merchant_id(
&tracking_data.payment_attempt_id,
- &tracking_data.processor_merchant_id,
- merchant_account.storage_scheme,
- &key_store,
+ &processor_account.get_processor_merchant_id(),
+ processor_account.get_storage_scheme(),
+ &processor_key_store,
)
.await?;
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index 96dc338533..d589922a3e 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -89,17 +89,18 @@ pub async fn form_payment_link_data(
pub async fn form_payment_link_data(
state: &SessionState,
processor: domain::Processor,
- processor_merchant_id: common_utils::id_type::MerchantId,
+ merchant_id: common_utils::id_type::MerchantId,
payment_id: common_utils::id_type::PaymentId,
) -> RouterResult<(PaymentLink, PaymentLinkData, PaymentLinkConfig)> {
let db = &*state.store;
+ let processor_merchant_id = domain::ProcessorMerchantId::from(merchant_id);
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
&processor_merchant_id,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -229,7 +230,7 @@ pub async fn form_payment_link_data(
&payment_intent.payment_id,
&processor_merchant_id,
&attempt_id.clone(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -263,7 +264,7 @@ pub async fn form_payment_link_data(
&payment_intent.payment_id,
&processor_merchant_id,
&attempt_id.clone(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -876,17 +877,18 @@ pub async fn get_payment_link_status(
pub async fn get_payment_link_status(
state: SessionState,
processor: domain::Processor,
- processor_merchant_id: common_utils::id_type::MerchantId,
+ merchant_id: common_utils::id_type::MerchantId,
payment_id: common_utils::id_type::PaymentId,
) -> RouterResponse<services::PaymentLinkFormData> {
let db = &*state.store;
+ let processor_merchant_id = domain::ProcessorMerchantId::from(merchant_id);
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
&processor_merchant_id,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -897,7 +899,7 @@ pub async fn get_payment_link_status(
&payment_intent.payment_id,
&processor_merchant_id,
&attempt_id.clone(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
diff --git a/crates/router/src/core/payment_method_balance.rs b/crates/router/src/core/payment_method_balance.rs
index 0d51bef6b7..4b254c9302 100644
--- a/crates/router/src/core/payment_method_balance.rs
+++ b/crates/router/src/core/payment_method_balance.rs
@@ -45,7 +45,7 @@ pub async fn payments_check_gift_card_balance_core(
) -> errors::RouterResult<(MinorUnit, common_enums::Currency)> {
let db = state.store.as_ref();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
payment_id,
@@ -200,7 +200,7 @@ pub async fn payments_check_and_apply_pm_data_core(
payment_id: id_type::GlobalPaymentId,
) -> RouterResponse<CheckAndApplyPaymentMethodDataResponse> {
let db = state.store.as_ref();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
&payment_id,
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index f53933e2bb..3ef24b30c0 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -4992,7 +4992,7 @@ pub async fn build_merchant_enabled_pms_context(
straight_through_algorithm: Some(encoded),
amount_capturable: None,
updated_by: platform
- .get_provider()
+ .get_processor()
.get_account()
.storage_scheme
.to_string(),
@@ -5008,8 +5008,8 @@ pub async fn build_merchant_enabled_pms_context(
.update_payment_attempt_with_attempt_id(
(*payment_attempt).clone(),
attempt_update,
- platform.get_provider().get_account().storage_scheme,
- platform.get_provider().get_key_store(),
+ platform.get_processor().get_storage_scheme(),
+ platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -5427,9 +5427,9 @@ pub async fn list_payment_methods(
.async_map(|pi| async {
db.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&pi.payment_id,
- &pi.processor_merchant_id,
+ &domain::ProcessorMerchantId::from(pi.processor_merchant_id.clone()),
&pi.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -5920,13 +5920,13 @@ pub async fn call_surcharge_decision_management(
storage::PaymentIntentUpdate::SurchargeApplicableUpdate {
surcharge_applicable: true,
updated_by: platform
- .get_provider()
+ .get_processor()
.get_account()
.storage_scheme
.to_string(),
},
- platform.get_provider().get_key_store(),
- platform.get_provider().get_account().storage_scheme,
+ platform.get_processor().get_key_store(),
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -5980,13 +5980,13 @@ pub async fn call_surcharge_decision_management_for_saved_card(
storage::PaymentIntentUpdate::SurchargeApplicableUpdate {
surcharge_applicable: true,
updated_by: platform
- .get_provider()
+ .get_processor()
.get_account()
.storage_scheme
.to_string(),
},
- platform.get_provider().get_key_store(),
- platform.get_provider().get_account().storage_scheme,
+ platform.get_processor().get_key_store(),
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -6347,9 +6347,11 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed(
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &payment_intent.processor_merchant_id,
+ &domain::ProcessorMerchantId::from(
+ payment_intent.processor_merchant_id.clone(),
+ ),
&payment_intent.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
diff --git a/crates/router/src/core/payment_methods/client.rs b/crates/router/src/core/payment_methods/client.rs
index 264483db12..2c2f69ce8a 100644
--- a/crates/router/src/core/payment_methods/client.rs
+++ b/crates/router/src/core/payment_methods/client.rs
@@ -258,7 +258,7 @@ impl CustomerPaymentMethodsFetcher for ModularCustomerPaymentMethodsFetcher {
customer: &domain::Customer,
dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,
) -> errors::RouterResult<Vec<CustomerPaymentMethodForClient>> {
- let merchant_id = platform.get_processor().get_account().get_id().clone();
+ let merchant_id = platform.get_processor().get_processor_merchant_id();
let id = customer.get_global_id().cloned().ok_or(
errors::ApiErrorResponse::MissingRequiredField {
field_name: "id".into(),
@@ -397,9 +397,9 @@ async fn load_payment_intent_context(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -407,9 +407,9 @@ async fn load_payment_intent_context(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &payment_intent.processor_merchant_id,
+ &domain::ProcessorMerchantId::from(payment_intent.processor_merchant_id.clone()),
&payment_intent.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index cdc8ef04ed..86dd212e10 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -695,7 +695,7 @@ async fn restore_pre_call_state<F, D>(
{
let (attempt, intent) = payment_data.get_previous_db_records();
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let attempt_update = storage::PaymentAttemptUpdate::ConfirmUpdate {
@@ -715,7 +715,7 @@ async fn restore_pre_call_state<F, D>(
straight_through_algorithm: attempt.straight_through_algorithm.clone(),
error_code: Some(attempt.error_code.clone()),
error_message: Some(attempt.error_message.clone()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
merchant_connector_id: attempt.merchant_connector_id.clone(),
external_three_ds_authentication_attempted: attempt
.external_three_ds_authentication_attempted,
@@ -748,7 +748,7 @@ async fn restore_pre_call_state<F, D>(
let intent_update = storage::PaymentIntentUpdate::PGStatusUpdate {
status: enums::IntentStatus::from(attempt.status),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
incremental_authorization_allowed: intent.incremental_authorization_allowed,
feature_metadata: intent.feature_metadata.clone(),
};
@@ -4660,7 +4660,7 @@ pub async fn payments_get_intent_using_merchant_reference(
header_payload: HeaderPayload,
) -> RouterResponse<api::PaymentsIntentResponse> {
let db = state.store.as_ref();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_merchant_reference_id_profile_id(
merchant_reference_id,
@@ -5703,9 +5703,9 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -5713,9 +5713,9 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&payment_intent.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -5995,9 +5995,9 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
let connector_enum = common_enums::connector_enums::Connector::from_str(&connector)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid connector name")?;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let merchant_id = platform.get_processor().get_processor_merchant_id();
let dimensions = Dimensions::new()
- .with_processor_merchant_id(merchant_id.clone().into())
+ .with_processor_merchant_id(merchant_id.clone())
.with_connector(connector_enum);
let poll_config = dimensions
.get_poll_config_external_three_ds(
@@ -9448,12 +9448,12 @@ where
"Failed to get authentication connector id from authentication table",
)?;
let key_store = processor.get_key_store();
- let merchant_id = processor.get_account().get_id();
+ let merchant_id = processor.get_processor_merchant_id();
let connector_mca = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
- merchant_id,
+ &merchant_id,
&authentication_connector_id,
key_store,
)
@@ -9478,7 +9478,7 @@ where
payment_method,
payment_attempt.net_amount.get_order_amount(),
Some(&payment_intent.payment_id),
- merchant_id,
+ &merchant_id,
)
.await?;
Ok(())
@@ -10818,9 +10818,9 @@ impl PaymentEligibilityData {
.store
.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_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -10917,9 +10917,9 @@ impl PaymentEligibilityData {
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &payment_intent.processor_merchant_id,
+ &domain::ProcessorMerchantId::from(payment_intent.processor_merchant_id.clone()),
&payment_intent.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -13782,13 +13782,13 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
) -> RouterResponse<api_models::payments::PaymentsExternalAuthenticationResponse> {
let db = &*state.store;
let key_manager_state = &(&(state)).into();
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = req.payment_id;
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -13798,7 +13798,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
&attempt_id.clone(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -13858,11 +13858,11 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
&state,
None,
payment_intent.shipping_address_id.as_deref(),
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.customer_id.as_ref(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
let billing_address = helpers::create_or_find_address_for_payment_by_request(
@@ -13872,11 +13872,11 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
.payment_method_billing_address_id
.as_deref()
.or(payment_intent.billing_address_id.as_deref()),
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.customer_id.as_ref(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
let authentication_connector = payment_attempt
@@ -13928,7 +13928,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
let webhook_url = helpers::create_webhook_url(
&state.base_url,
- processor_merchant_id,
+ &processor_merchant_id,
merchant_connector_account_id_or_connector_name,
);
@@ -14046,7 +14046,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
),
authentication_connector: response.authentication_connector.map(|c| c.to_string()),
authentication_id: Some(response.authentication_id.clone()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
db.update_payment_attempt_with_attempt_id(
@@ -14075,7 +14075,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
} else {
let authentication = db
.find_authentication_by_processor_merchant_id_authentication_id(
- processor_merchant_id,
+ &processor_merchant_id,
&payment_attempt
.authentication_id
.clone()
@@ -14083,7 +14083,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
.attach_printable("missing authentication_id in payment_attempt")?,
platform.get_processor().get_key_store(),
key_manager_state,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
@@ -14094,7 +14094,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
&payment_attempt,
&payment_intent,
&platform,
- storage_scheme,
+ storage_scheme.inner(),
))
.await?
.ok_or(errors::ApiErrorResponse::InternalServerError)
@@ -14129,7 +14129,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
payment_intent.payment_id,
payment_intent.force_3ds_challenge_trigger.unwrap_or(false),
platform.get_processor().get_key_store(),
- storage_scheme,
+ storage_scheme.inner(),
))
.await?
};
@@ -14165,7 +14165,7 @@ pub async fn payment_start_redirection(
) -> RouterResponse<serde_json::Value> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -14274,14 +14274,20 @@ pub async fn payments_manual_update(
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
.attach_printable("Error while fetching the merchant_account by merchant_id")?;
+
+ let processor_account =
+ domain::ProcessorMerchantAccount::from_untagged(merchant_account.clone());
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(key_store);
+ let processor_merchant_id = processor_account.get_processor_merchant_id();
+ let processor_storage_scheme = processor_account.get_storage_scheme();
let payment_attempt = state
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
- &merchant_id,
+ &processor_merchant_id,
&attempt_id.clone(),
- merchant_account.storage_scheme,
- &key_store,
+ processor_storage_scheme,
+ &processor_key_store,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14321,9 +14327,9 @@ pub async fn payments_manual_update(
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_account.get_id(),
- &key_store,
- merchant_account.storage_scheme,
+ &processor_merchant_id,
+ &processor_key_store,
+ processor_storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14408,8 +14414,8 @@ pub async fn payments_manual_update(
.update_payment_attempt_with_attempt_id(
payment_attempt.clone(),
attempt_update,
- merchant_account.storage_scheme,
- &key_store,
+ processor_storage_scheme,
+ &processor_key_store,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14428,8 +14434,8 @@ pub async fn payments_manual_update(
.update_payment_intent(
payment_intent,
payment_intent_update,
- &key_store,
- merchant_account.storage_scheme,
+ &processor_key_store,
+ processor_storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14528,12 +14534,12 @@ pub async fn payments_manual_status_update_eligible_statuses(
profile_id_from_auth_layer: Option<id_type::ProfileId>,
payment_id: id_type::PaymentId,
) -> RouterResponse<api_models::payments::PaymentsManualStatusUpdateEligibleStatusesResponse> {
- let merchant_id = platform.get_processor().get_account().get_id();
+ let merchant_id = platform.get_processor().get_processor_merchant_id();
let key_store = state
.store
.get_merchant_key_store_by_merchant_id(
- merchant_id,
+ &merchant_id,
&state.store.get_master_key().to_vec().into(),
)
.await
@@ -14542,18 +14548,23 @@ pub async fn payments_manual_status_update_eligible_statuses(
let merchant_account = state
.store
- .find_merchant_account_by_merchant_id(merchant_id, &key_store)
+ .find_merchant_account_by_merchant_id(&merchant_id, &key_store)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
.attach_printable("Error while fetching the merchant_account by merchant_id")?;
+ let processor_account = domain::ProcessorMerchantAccount::from_untagged(merchant_account);
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(key_store);
+ let processor_merchant_id = processor_account.get_processor_merchant_id();
+ let processor_storage_scheme = processor_account.get_storage_scheme();
+
let payment_intent = state
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_account.get_id(),
- &key_store,
- merchant_account.storage_scheme,
+ &processor_merchant_id,
+ &processor_key_store,
+ processor_storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14577,10 +14588,10 @@ pub async fn payments_manual_status_update_eligible_statuses(
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
- merchant_id,
+ &processor_merchant_id,
&attempt_id,
- merchant_account.storage_scheme,
- &key_store,
+ processor_storage_scheme,
+ &processor_key_store,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14606,12 +14617,12 @@ pub async fn payments_manual_status_update(
) -> RouterResponse<api_models::payments::PaymentsManualStatusUpdateResponse> {
let api_models::payments::PaymentsManualStatusUpdateRequest { intent_status } = req;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let merchant_id = platform.get_processor().get_processor_merchant_id();
let key_store = state
.store
.get_merchant_key_store_by_merchant_id(
- merchant_id,
+ &merchant_id,
&state.store.get_master_key().to_vec().into(),
)
.await
@@ -14620,18 +14631,24 @@ pub async fn payments_manual_status_update(
let merchant_account = state
.store
- .find_merchant_account_by_merchant_id(merchant_id, &key_store)
+ .find_merchant_account_by_merchant_id(&merchant_id, &key_store)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
.attach_printable("Error while fetching the merchant_account by merchant_id")?;
+ let processor_account =
+ domain::ProcessorMerchantAccount::from_untagged(merchant_account.clone());
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(key_store);
+ let processor_merchant_id = processor_account.get_processor_merchant_id();
+ let processor_storage_scheme = processor_account.get_storage_scheme();
+
let payment_intent = state
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_account.get_id(),
- &key_store,
- merchant_account.storage_scheme,
+ &processor_merchant_id,
+ &processor_key_store,
+ processor_storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14658,10 +14675,10 @@ pub async fn payments_manual_status_update(
.store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
- merchant_id,
+ &processor_merchant_id,
&attempt_id,
- merchant_account.storage_scheme,
- &key_store,
+ processor_storage_scheme,
+ &processor_key_store,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14710,8 +14727,8 @@ pub async fn payments_manual_status_update(
.update_payment_attempt_with_attempt_id(
payment_attempt,
attempt_update,
- merchant_account.storage_scheme,
- &key_store,
+ processor_storage_scheme,
+ &processor_key_store,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -14730,8 +14747,8 @@ pub async fn payments_manual_status_update(
.update_payment_intent(
payment_intent,
intent_update,
- &key_store,
- merchant_account.storage_scheme,
+ &processor_key_store,
+ processor_storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -15137,10 +15154,10 @@ impl SurchargeCalculationInputs {
async fn previous_connector_surcharge_id(
state: &SessionState,
payment_id: &id_type::PaymentId,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &domain::ProcessorMerchantId,
attempt_id: &str,
- storage_scheme: storage_enums::MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
+ key_store: &domain::ProcessorKeyStore,
) -> Option<String> {
match state
.store
@@ -15273,8 +15290,8 @@ async fn calculate_external_surcharge(
.as_ref()
.map(|percent| percent.get_percentage());
let external_surcharge_id = resp.connector_surcharge_id.clone();
- let merchant_id = processor.get_account().get_id().clone();
- let storage_scheme = processor.get_account().storage_scheme;
+ let merchant_id = processor.get_processor_merchant_id();
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store().clone();
// Both writes must succeed: without Redis the cached surcharge can't be
// applied on /confirm, and without the flag /confirm wouldn't even try.
@@ -15296,7 +15313,7 @@ async fn calculate_external_surcharge(
payment_intent,
storage::PaymentIntentUpdate::ExternalSurchargeApplicableUpdate {
external_surcharge_applicable: true,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
&key_store,
storage_scheme,
@@ -15338,8 +15355,8 @@ async fn run_external_surcharge_ucs(
) -> RouterResult<
Option<hyperswitch_domain_models::router_response_types::SurchargeCalculationResponseData>,
> {
- let merchant_id = processor.get_account().get_id().clone();
- let storage_scheme = processor.get_account().storage_scheme;
+ let merchant_id = processor.get_processor_merchant_id();
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let previous_connector_surcharge_id = previous_connector_surcharge_id(
@@ -15800,7 +15817,7 @@ async fn resolve_offer_eligibility_details(
// Eligible offer: store the quote for confirm to validate `/apply`
// against (keyed by a generated offer_quote_id; TTL kept).
Some(selected) => {
- let processor_merchant_id = processor.get_account().get_id().clone();
+ let processor_merchant_id = processor.get_processor_merchant_id();
// Issue a unique quote id; confirm echoes it back to apply this offer.
let offer_quote_id = common_utils::generate_time_ordered_id("offer_quote");
let quotes = HashMap::from([(
@@ -18263,7 +18280,7 @@ impl PaymentIntentStateMetadataExt {
payment_intent.clone(),
domain_update,
&key_store,
- merchant_account.storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -18308,7 +18325,7 @@ impl PaymentIntentStateMetadataExt {
payment_intent,
domain_update,
&key_store,
- merchant_account.storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/filters.rs b/crates/router/src/core/payments/filters.rs
index 6ea9c00367..c307724855 100644
--- a/crates/router/src/core/payments/filters.rs
+++ b/crates/router/src/core/payments/filters.rs
@@ -6,8 +6,6 @@ use common_utils::id_type;
use error_stack::{report, ResultExt};
use strum::IntoEnumIterator;
-#[cfg(feature = "v1")]
-use crate::types::storage::enums as storage_enums;
use crate::{
core::{
admin,
@@ -168,10 +166,10 @@ pub async fn get_filters_for_payments(
let db = state.store.as_ref();
let pi = db
.filter_payment_intents_by_time_range_constraints(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&time_range,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -179,9 +177,9 @@ pub async fn get_filters_for_payments(
let filters = db
.get_filters_for_payments(
pi.as_slice(),
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
// since OLAP doesn't have KV. Force to get the data from PSQL.
- storage_enums::MerchantStorageScheme::PostgresOnly,
+ domain::ProcessorStorageScheme::postgres_only(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -298,7 +296,7 @@ pub async fn get_aggregates_for_payments(
let db = state.store.as_ref();
let intent_status_with_count = db
.get_intent_status_with_count(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
profile_id_list,
&time_range,
)
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5655465750..64735e3f54 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -849,9 +849,9 @@ pub async fn get_token_for_recurring_mandate(
.async_map(|payment_id| async {
db.find_payment_intent_by_payment_id_processor_merchant_id(
payment_id,
- &mandate.merchant_id,
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -866,9 +866,9 @@ pub async fn get_token_for_recurring_mandate(
.async_map(|payment_intent| async {
db.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- &mandate.merchant_id,
+ &platform.get_processor().get_processor_merchant_id(),
payment_intent.active_attempt.get_id().as_str(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -4400,9 +4400,9 @@ where
pub(super) async fn filter_by_constraints(
state: &SessionState,
constraints: &PaymentIntentFetchConstraints,
- merchant_id: &id_type::MerchantId,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ merchant_id: &domain::ProcessorMerchantId,
+ key_store: &domain::ProcessorKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
) -> CustomResult<Vec<PaymentIntent>, errors::StorageError> {
let db = &*state.store;
let result = db
@@ -5109,9 +5109,9 @@ pub async fn verify_payment_intent_time_and_client_secret(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -5476,7 +5476,7 @@ pub async fn insert_merchant_connector_creds_to_config(
processor: &domain::Processor,
merchant_connector_details: admin::MerchantConnectorDetailsWrap,
) -> RouterResult<()> {
- let merchant_id = processor.get_account().get_id();
+ let merchant_id = processor.get_processor_merchant_id();
if let Some(encoded_data) = merchant_connector_details.encoded_data {
let redis = &db
.get_redis_conn()
@@ -6078,8 +6078,8 @@ impl AttemptType {
fetched_payment_intent: PaymentIntent,
fetched_payment_attempt: PaymentAttempt,
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: storage::enums::MerchantStorageScheme,
+ key_store: &domain::ProcessorKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
) -> RouterResult<(PaymentIntent, PaymentAttempt)> {
match self {
Self::SameOld => Ok((fetched_payment_intent, fetched_payment_attempt)),
@@ -6090,7 +6090,7 @@ impl AttemptType {
request,
fetched_payment_attempt,
new_attempt_count,
- storage_scheme,
+ storage_scheme.inner(),
);
#[cfg(feature = "v1")]
@@ -6130,7 +6130,7 @@ impl AttemptType {
),
active_attempt_id: new_payment_attempt.get_id().to_owned(),
attempt_count: new_attempt_count,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
key_store,
storage_scheme,
diff --git a/crates/router/src/core/payments/list.rs b/crates/router/src/core/payments/list.rs
index 90df0af05a..5216a77bf2 100644
--- a/crates/router/src/core/payments/list.rs
+++ b/crates/router/src/core/payments/list.rs
@@ -17,7 +17,7 @@ use crate::{
types::{api, domain, storage, transformers::ForeignFrom},
};
#[cfg(feature = "v1")]
-use crate::{core::payments::helpers, logger, types::storage::enums as storage_enums};
+use crate::{core::payments::helpers, logger};
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn list_payments(
@@ -26,14 +26,14 @@ pub async fn list_payments(
profile_id_list: Option<Vec<id_type::ProfileId>>,
constraints: api::PaymentListConstraints,
) -> RouterResponse<api::PaymentListResponse> {
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let db = state.store.as_ref();
let payment_intents = helpers::filter_by_constraints(
&state,
&(constraints, profile_id_list).try_into()?,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -43,10 +43,10 @@ pub async fn list_payments(
match db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&pi.payment_id,
- processor_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,
+ domain::ProcessorStorageScheme::postgres_only(),
platform.get_processor().get_key_store(),
)
.await
@@ -118,14 +118,14 @@ pub async fn list_payments_for_platform(
)?;
// `limit` is a `PageSize`, already validated at deserialize; no extra check needed.
- let platform_merchant_id = platform.get_provider().get_account().get_id();
+ let provider_merchant_id = platform.get_provider().get_provider_merchant_id();
let db: &dyn StorageInterface = state.store.as_ref();
let pi_fetch_constraints = (constraints, profile_id_list).try_into()?;
let raw_rows = db
.get_filtered_payment_intents_attempt_for_platform(
- platform_merchant_id,
+ &provider_merchant_id,
&pi_fetch_constraints,
)
.await
@@ -133,7 +133,7 @@ pub async fn list_payments_for_platform(
let total_count = db
.get_payment_intents_attempt_count_for_platform(
- platform_merchant_id,
+ &provider_merchant_id,
&pi_fetch_constraints,
)
.await
@@ -173,10 +173,10 @@ pub async fn list_payments(
let fetch_constraints = constraints.clone().into();
let list: Vec<(storage::PaymentIntent, Option<storage::PaymentAttempt>)> = db
.get_filtered_payment_intents_attempt(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&fetch_constraints,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -185,9 +185,9 @@ pub async fn list_payments(
let active_attempt_ids = db
.get_filtered_active_attempt_ids_for_total_count(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&fetch_constraints,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
@@ -204,7 +204,7 @@ pub async fn list_payments(
.collect::<Vec<String>>();
db.get_total_count_of_filtered_payment_attempts(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&active_attempt_ids,
constraints.connector,
constraints.payment_method_type,
@@ -212,7 +212,7 @@ pub async fn list_payments(
constraints.authentication_type,
constraints.merchant_connector_id,
constraints.card_network,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -249,10 +249,10 @@ pub async fn revenue_recovery_list_payments(
let fetch_constraints = constraints.clone().into();
let list: Vec<(storage::PaymentIntent, Option<storage::PaymentAttempt>)> = db
.get_filtered_payment_intents_attempt(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&fetch_constraints,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -325,9 +325,9 @@ pub async fn revenue_recovery_list_payments(
let active_attempt_ids = db
.get_filtered_active_attempt_ids_for_total_count(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&fetch_constraints,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
@@ -344,7 +344,7 @@ pub async fn revenue_recovery_list_payments(
.collect::<Vec<String>>();
db.get_total_count_of_filtered_payment_attempts(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&active_attempt_ids,
constraints.connector,
constraints.payment_method_type,
@@ -352,7 +352,7 @@ pub async fn revenue_recovery_list_payments(
constraints.authentication_type,
constraints.merchant_connector_id,
constraints.card_network,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -389,10 +389,10 @@ pub async fn apply_filters_on_payments(
let fetch_constraints = (constraints.clone(), profile_id_list).try_into()?;
let list: Vec<(storage::PaymentIntent, storage::PaymentAttempt)> = db
.get_filtered_payment_intents_attempt(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&fetch_constraints,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -401,9 +401,9 @@ pub async fn apply_filters_on_payments(
let active_attempt_ids = db
.get_filtered_active_attempt_ids_for_total_count(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&fetch_constraints,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
@@ -414,7 +414,7 @@ pub async fn apply_filters_on_payments(
.attach_printable("Error while converting from usize to i64")
} else {
db.get_total_count_of_filtered_payment_attempts(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&active_attempt_ids,
constraints.connector,
constraints.payment_method,
@@ -423,7 +423,7 @@ pub async fn apply_filters_on_payments(
constraints.merchant_connector_id,
constraints.card_network,
constraints.card_discovery,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
index fec740dea3..5479eb4ca8 100644
--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
+++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
@@ -179,7 +179,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, ExternalVaultP
let db = &*state.store;
let key_manager_state = &state.into();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -234,7 +234,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, ExternalVaultP
hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt::external_vault_proxy_create_domain_model(
&payment_intent,
cell_id,
- storage_scheme,
+ storage_scheme.inner(),
request,
encrypted_data,
platform.get_initiator(),
@@ -492,7 +492,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ExternalVaultProxy
F: 'b + Send,
{
let db = &*state.store;
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let intent_status = common_enums::IntentStatus::Processing;
@@ -519,7 +519,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ExternalVaultProxy
let payment_intent_update =
hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::ConfirmIntent {
status: intent_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
active_attempt_id: Some(payment_data.payment_attempt.id.clone())
};
@@ -540,7 +540,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ExternalVaultProxy
let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ConfirmIntent {
status: attempt_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector,
merchant_connector_id,
authentication_type,
@@ -625,7 +625,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -636,7 +636,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor
processor.get_key_store(),
payment_data.payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 813c00f273..4446569e18 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -51,8 +51,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
operations::GetTrackerResponse<'a, F, api::PaymentsCaptureRequest, PaymentData<F>>,
> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let (mut payment_intent, payment_attempt, currency, amount);
let payment_id = payment_id
@@ -62,7 +62,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -101,7 +101,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
&attempt_id.clone(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -117,7 +117,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -127,7 +127,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -137,7 +137,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -253,7 +253,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureReque
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
if matches!(frm_suggestion, Some(FrmSuggestion::FrmAuthorizeTransaction)) {
@@ -263,7 +263,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureReque
let intent_status_update = storage::PaymentIntentUpdate::ApproveUpdate {
status: payment_data.payment_intent.status,
merchant_decision: Some(api_models::enums::MerchantDecision::Approved.to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
payment_data.payment_intent = state
.store
@@ -281,7 +281,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureReque
payment_data.payment_attempt.clone(),
storage::PaymentAttemptUpdate::StatusUpdate {
status: payment_data.payment_attempt.status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
storage_scheme,
key_store,
diff --git a/crates/router/src/core/payments/operations/payment_attempt_list.rs b/crates/router/src/core/payments/operations/payment_attempt_list.rs
index 44d1d9e69f..e8d575b737 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_list.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_list.rs
@@ -93,7 +93,7 @@ impl<F: Send + Clone + Sync>
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentAttemptListData<F>>> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_attempt_list = db
.find_payment_attempts_by_payment_intent_id(
&request.payment_intent_id,
diff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rs
index c561799fae..1d3f919800 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs
@@ -127,7 +127,7 @@ impl<F: Send + Clone + Sync>
let db = &*state.store;
let key_manager_state = &state.into();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -180,7 +180,7 @@ impl<F: Send + Clone + Sync>
hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt::create_domain_model_using_record_request(
&payment_intent,
cell_id,
- storage_scheme,
+ storage_scheme.inner(),
request,
encrypted_data,
platform.get_initiator(),
@@ -258,7 +258,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentAttemptRecordData<F>, PaymentsAtte
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let feature_metadata = payment_data.get_updated_feature_metadata()?;
let active_attempt_id = match payment_data.revenue_recovery_data.triggered_by {
@@ -280,7 +280,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentAttemptRecordData<F>, PaymentsAtte
{
status,
feature_metadata: Box::new(feature_metadata),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
active_attempt_id,
active_attempts_group_id,
}
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 3e370daf49..8128b36428 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -54,8 +54,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -63,7 +63,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -86,7 +86,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
let mut payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_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::PaymentsCancelRe
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_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::PaymentsCancelRe
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_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::PaymentsCancelRe
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -256,7 +256,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelReques
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let cancellation_reason = payment_data.payment_attempt.cancellation_reason.clone();
@@ -264,7 +264,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelReques
if payment_data.payment_intent.status != enums::IntentStatus::RequiresCapture {
let payment_intent_update = storage::PaymentIntentUpdate::PGStatusUpdate {
status: enums::IntentStatus::Cancelled,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
incremental_authorization_allowed: None,
feature_metadata: payment_data.payment_intent.feature_metadata.clone(),
};
@@ -293,7 +293,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelReques
storage::PaymentAttemptUpdate::VoidUpdate {
status: attempt_status_update,
cancellation_reason: cancellation_reason.clone(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
storage_scheme,
key_store,
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 d642bfaa54..177268a862 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
@@ -58,8 +58,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -67,7 +67,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -86,7 +86,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo
let mut payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_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::PaymentsCancelPo
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_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::PaymentsCancelPo
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_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::PaymentsCancelPo
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_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_sync.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture_sync.rs
index 10b6d4b1a5..175f11bd37 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture_sync.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture_sync.rs
@@ -52,8 +52,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, id_type::PaymentId>
{
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -61,7 +61,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, id_type::PaymentId>
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_id,
+ &merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -81,7 +81,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, id_type::PaymentId>
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- merchant_id,
+ &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>, id_type::PaymentId>
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ &merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -104,7 +104,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, id_type::PaymentId>
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ &merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -114,7 +114,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, id_type::PaymentId>
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- merchant_id,
+ &merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_cancel_v2.rs b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
index db8cb64b0b..5c6dce58e7 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
@@ -143,7 +143,7 @@ impl<F: Send + Clone + Sync>
let db = &*state.store;
let merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
payment_id,
@@ -214,13 +214,13 @@ impl<F: Clone + Send + Sync>
F: 'b + Send,
{
let db = &*state.store;
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let merchant_key_store = processor.get_key_store();
let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::VoidUpdate {
status: enums::AttemptStatus::VoidInitiated,
cancellation_reason: payment_data.payment_attempt.cancellation_reason.clone(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
let updated_payment_attempt = db
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index f3a1692f31..71fc33225b 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -59,8 +59,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let (payment_intent, mut payment_attempt, currency, amount);
let payment_id = payment_id
@@ -70,7 +70,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -80,7 +80,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -128,7 +128,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
&payment_attempt.merchant_id,
&payment_attempt.payment_id,
&payment_attempt.attempt_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -137,7 +137,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
.insert_capture(
payment_attempt
.make_new_capture(amount_to_capture, enums::CaptureStatus::Started)?,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::DuplicatePayment {
@@ -161,7 +161,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -171,7 +171,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -181,7 +181,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -311,7 +311,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCa
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let merchant_key_store = processor.get_key_store();
payment_data.payment_attempt = if payment_data.multiple_capture_data.is_some()
@@ -329,7 +329,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCa
storage::PaymentAttemptUpdate::CaptureUpdate {
amount_to_capture,
multiple_capture_count,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
storage_scheme,
merchant_key_store,
diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rs
index cf2a38f031..d61a8222d5 100644
--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs
@@ -154,7 +154,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentCaptureData<F>, PaymentsCaptureReques
) -> RouterResult<operations::GetTrackerResponse<PaymentCaptureData<F>>> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -305,9 +305,9 @@ impl<F: Clone> UpdateTracker<F, PaymentCaptureData<F>, PaymentsCaptureRequest> f
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
- let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::PreCaptureUpdate { amount_to_capture: payment_data.payment_attempt.amount_details.get_amount_to_capture(), updated_by: storage_scheme.to_string() };
+ let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::PreCaptureUpdate { amount_to_capture: payment_data.payment_attempt.amount_details.get_amount_to_capture(), updated_by: storage_scheme.inner().to_string() };
let payment_attempt = state
.store
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 8be4177e20..e616962e89 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -58,8 +58,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
{
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let (mut payment_intent, mut payment_attempt, currency, amount);
let payment_id = payment_id
@@ -69,7 +69,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -109,7 +109,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
&payment_intent.active_attempt.get_id(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -234,11 +234,11 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
state,
request.shipping.as_ref(),
payment_intent.shipping_address_id.clone().as_deref(),
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.customer_id.as_ref(),
platform.get_processor().get_key_store(),
&payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
@@ -251,7 +251,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -261,7 +261,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -560,7 +560,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::CompleteAuthorizeUpdate {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index f9348bfe68..a202bb1061 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -95,8 +95,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_method_with_raw_data,
token_data: prefetched_token_data,
} = payment_method_fetch_data;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let (currency, amount);
let payment_id = payment_id
@@ -259,7 +259,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.or(m_customer_details_customer_id.as_ref()),
&m_key_store,
&m_payment_intent_payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
}
@@ -287,7 +287,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.or(m_customer_details_customer_id.as_ref()),
&m_key_store,
&m_payment_intent_payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
}
@@ -613,7 +613,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.or(m_customer_details_customer_id.as_ref()),
&m_key_store,
&m_payment_intent_payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
}
@@ -1349,9 +1349,9 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -2737,7 +2737,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let payment_method = payment_data.payment_attempt.payment_method;
let browser_info = payment_data.payment_attempt.browser_info.clone();
@@ -2994,7 +2994,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
straight_through_algorithm: m_straight_through_algorithm,
error_code: m_error_code,
error_message: m_error_message,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
merchant_connector_id,
external_three_ds_authentication_attempted,
external_threeds_authentication_type,
@@ -3112,7 +3112,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
let m_metadata = metadata.clone();
let m_frm_metadata = frm_metadata.clone();
let m_db = state.clone().store;
- let m_storage_scheme = storage_scheme.to_string();
+ let m_storage_scheme = storage_scheme.inner().to_string();
let session_expiry = m_payment_data_payment_intent.session_expiry;
let m_key_store = key_store.clone();
let is_payment_processor_token_flow =
@@ -3396,7 +3396,7 @@ async fn apply_selected_offer<F: Clone + Send + Sync>(
message: "Offer Engine is not available for this offer selection".to_string(),
})?;
- let processor_merchant_id = processor.get_account().get_id().clone();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let payment_id = payment_data.payment_attempt.payment_id.clone();
// Recover the eligibility quote stored at `/eligibility`.
diff --git a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
index d2c2e448e2..917782ee96 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_external_vault_proxy.rs
@@ -191,8 +191,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsRequest>
) -> RouterResult<operations::GetTrackerResponse<'a, F, PaymentsRequest, PaymentData<F>>> {
let db = &*state.store;
let payment_method_wrapper = payment_method_fetch_data.payment_method_with_raw_data;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
@@ -201,7 +201,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsRequest>
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -243,7 +243,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsRequest>
let active_payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -305,8 +305,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsRequest>
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
- storage_scheme,
+ &processor_merchant_id,
+ storage_scheme.inner(),
)
.await?;
@@ -315,8 +315,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsRequest>
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
- storage_scheme,
+ &processor_merchant_id,
+ storage_scheme.inner(),
)
.await?;
@@ -325,8 +325,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsRequest>
payment_attempt.payment_method_billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
- storage_scheme,
+ &processor_merchant_id,
+ storage_scheme.inner(),
)
.await?;
@@ -548,7 +548,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsRequest>
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let connector = payment_data.payment_attempt.connector.clone();
@@ -651,7 +651,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsRequest>
.clone(),
error_code,
error_message,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
merchant_connector_id,
external_three_ds_authentication_attempted,
external_threeds_authentication_type,
@@ -730,7 +730,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsRequest>
payment_data.payment_intent.clone(),
storage::PaymentIntentUpdate::PGStatusUpdate {
status: intent_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
incremental_authorization_allowed: payment_data
.payment_intent
.incremental_authorization_allowed,
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 783e4f3553..7d6b005bcf 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -167,7 +167,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
let db = &*state.store;
let key_manager_state = &state.into();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -211,7 +211,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt::create_domain_model(
&payment_intent,
cell_id,
- storage_scheme,
+ storage_scheme.inner(),
request,
encrypted_data,
platform.get_initiator(),
@@ -305,7 +305,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
let db = &*state.store;
let key_manager_state = &state.into();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -349,7 +349,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
crate::core::split_payments::create_domain_model_for_split_payment(
&payment_intent,
cell_id,
- storage_scheme,
+ storage_scheme.inner(),
request,
encrypted_data,
pm_split_amount_data.split_amount,
@@ -770,7 +770,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
F: 'b + Send,
{
let db = &*state.store;
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let intent_status = common_enums::IntentStatus::Processing;
@@ -801,7 +801,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
let payment_intent_update =
hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::ConfirmIntent {
status: intent_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
active_attempt_id: Some(payment_data.payment_attempt.id.clone()),
};
@@ -823,7 +823,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
Some(payment_method) => {
hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ConfirmIntentTokenized {
status: attempt_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector,
merchant_connector_id: merchant_connector_id.ok_or_else( || {
error_stack::report!(errors::ApiErrorResponse::InternalServerError)
@@ -837,7 +837,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
None => {
hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ConfirmIntent {
status: attempt_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector,
merchant_connector_id,
authentication_type,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index ebe773d160..7ce5fe00ec 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -26,7 +26,6 @@ use hyperswitch_domain_models::{
use hyperswitch_masking::{ExposeInterface, PeekInterface, Secret};
use router_derive::PaymentOperation;
use router_env::{instrument, logger, tracing};
-use storage_impl::platform_wrapper;
use time::PrimitiveDateTime;
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
@@ -347,15 +346,17 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
)
.await?;
- let payment_intent = platform_wrapper::payment_intent::insert_payment_intent(
- state.store.as_ref(),
- platform.get_processor(),
- payment_intent_new,
- )
- .await
- .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
- payment_id: payment_id.clone(),
- })?;
+ let payment_intent = state
+ .store
+ .insert_payment_intent(
+ payment_intent_new,
+ platform.get_processor().get_key_store(),
+ platform.get_processor().get_storage_scheme(),
+ )
+ .await
+ .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
+ payment_id: payment_id.clone(),
+ })?;
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
@@ -366,26 +367,30 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
}
#[cfg(feature = "v1")]
- let mut payment_attempt = platform_wrapper::payment_attempt::insert_payment_attempt(
- state.store.as_ref(),
- platform.get_processor(),
- payment_attempt_new,
- )
- .await
- .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
- payment_id: payment_id.clone(),
- })?;
+ let mut payment_attempt = state
+ .store
+ .insert_payment_attempt(
+ payment_attempt_new,
+ platform.get_processor().get_storage_scheme(),
+ platform.get_processor().get_key_store(),
+ )
+ .await
+ .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
+ payment_id: payment_id.clone(),
+ })?;
#[cfg(feature = "v2")]
- let payment_attempt = platform_wrapper::payment_attempt::insert_payment_attempt(
- state.store.as_ref(),
- platform.get_processor(),
- payment_attempt_new,
- )
- .await
- .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
- payment_id: payment_id.clone(),
- })?;
+ let payment_attempt = state
+ .store
+ .insert_payment_attempt(
+ platform.get_processor().get_key_store(),
+ payment_attempt_new,
+ platform.get_processor().get_storage_scheme(),
+ )
+ .await
+ .to_duplicate_response(errors::ApiErrorResponse::DuplicatePayment {
+ payment_id: payment_id.clone(),
+ })?;
let mandate_details_present = payment_attempt.mandate_details.is_some();
@@ -1084,7 +1089,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let status = match payment_data.payment_intent.status {
IntentStatus::RequiresPaymentMethod => match payment_data.payment_method_data {
@@ -1141,7 +1146,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
},
surcharge_amount,
tax_amount,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
merchant_connector_id,
routing_approach,
is_stored_credential,
@@ -1167,7 +1172,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
shipping_address_id: None,
billing_address_id: None,
customer_details,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
key_store,
storage_scheme,
@@ -2054,7 +2059,7 @@ async fn create_payment_link(
let created_at @ last_modified_at = Some(common_utils::date_time::now());
let payment_link_id = utils::generate_id(consts::ID_LENGTH, "plink");
let locale_str = locale.unwrap_or("en".to_owned());
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let open_payment_link = format!(
"{}/payment_link/{}/{}?locale={}",
domain_name,
@@ -2094,7 +2099,7 @@ async fn create_payment_link(
payment_link_config: Some(payment_link_config_encoded_value),
profile_id: Some(profile_id),
secure_link,
- processor_merchant_id: Some(processor_merchant_id.clone()),
+ processor_merchant_id: Some(processor_merchant_id.inner().clone()),
created_by: platform
.get_initiator()
.and_then(|initiator| initiator.to_created_by())
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index 267b75eb6c..673e9213a3 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -112,7 +112,7 @@ impl<F: Send + Clone + Sync>
let cell_id = state.conf.cell_information.id.clone();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let batch_encrypted_data = domain_types::crypto_operation(
key_manager_state,
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index 21d381ad9a..bb464d68a0 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -165,7 +165,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentStatusData<F>, PaymentsRetriev
) -> RouterResult<operations::GetTrackerResponse<PaymentStatusData<F>>> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index 8a2c50b057..0785450b26 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -91,7 +91,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentIntentData<F>>> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
&request.id,
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 3b4afdeaf4..f94525b132 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
@@ -62,12 +62,12 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -86,7 +86,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
let mut payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -118,7 +118,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,
- processor_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::PaymentsPostSess
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_recurrence.rs b/crates/router/src/core/payments/operations/payment_recurrence.rs
index 994c8127d6..608591c511 100644
--- a/crates/router/src/core/payments/operations/payment_recurrence.rs
+++ b/crates/router/src/core/payments/operations/payment_recurrence.rs
@@ -61,8 +61,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_method_with_raw_data,
..
} = payment_method_fetch_data;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let (currency, amount);
let payment_id = payment_id
@@ -194,7 +194,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
let m_key_store = platform.get_processor().get_key_store().clone();
let m_payment_intent_payment_id = payment_intent.payment_id.clone();
let m_merchant_id = processor_merchant_id.clone();
- let m_storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let m_storage_scheme = platform.get_processor().get_storage_scheme();
let payment_method_billing_future = tokio::spawn(
async move {
@@ -204,7 +204,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
&m_key_store,
&m_payment_intent_payment_id,
&m_merchant_id,
- m_storage_scheme,
+ m_storage_scheme.inner(),
)
.await
}
@@ -291,20 +291,20 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
let shipping_address = helpers::get_address_by_id(
state,
payment_intent.shipping_address_id.clone(),
- &platform.get_processor().get_key_store().clone(),
+ platform.get_processor().get_key_store(),
&payment_intent.payment_id.clone(),
&processor_merchant_id.clone(),
- m_storage_scheme,
+ m_storage_scheme.inner(),
)
.await?;
let billing_address = helpers::get_address_by_id(
state,
payment_intent.billing_address_id.clone(),
- &platform.get_processor().get_key_store().clone(),
+ platform.get_processor().get_key_store(),
&payment_intent.payment_id.clone(),
&processor_merchant_id.clone(),
- m_storage_scheme,
+ m_storage_scheme.inner(),
)
.await?;
@@ -537,7 +537,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let frm_message = payment_data.frm_message.clone();
@@ -626,7 +626,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
error_code: m_error_code.flatten(),
error_message: m_error_message.flatten(),
error_reason: m_error_reason.flatten(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_mandate_detail: payment_data
.payment_attempt
.connector_mandate_detail
@@ -644,7 +644,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
let m_payment_data_payment_intent = payment_data.payment_intent.clone();
let m_db = state.clone().store;
- let m_storage_scheme = storage_scheme.to_string();
+ let m_storage_scheme = storage_scheme.inner().to_string();
let m_key_store = key_store.clone();
let payment_intent_fut = tokio::spawn(
async move {
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 07ad12e629..f7a551daa3 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -50,8 +50,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
{
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -59,7 +59,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -82,7 +82,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
attempt_id.clone().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -95,7 +95,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -105,7 +105,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -115,7 +115,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -247,13 +247,13 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> fo
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let intent_status_update = storage::PaymentIntentUpdate::RejectUpdate {
status: enums::IntentStatus::Failed,
merchant_decision: Some(enums::MerchantDecision::Rejected.to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
let (error_code, error_message) =
payment_data
@@ -277,7 +277,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> fo
status: enums::AttemptStatus::Failure,
error_code,
error_message,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
payment_data.payment_intent = state
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 7c0009c5d2..62b4291e0f 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1045,7 +1045,7 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthor
.update_payment_attempt_with_attempt_id(
payment_attempt,
payment_attempt_update,
- cloned_platform.get_processor().get_account().storage_scheme,
+ cloned_platform.get_processor().get_storage_scheme(),
cloned_platform.get_processor().get_key_store(),
)
.await;
@@ -1220,7 +1220,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsIncrementalAu
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt.clone(),
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -1250,7 +1250,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsIncrementalAu
payment_data.payment_intent.clone(),
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -1607,7 +1607,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SdkPaymentsSessionUpd
payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -1687,7 +1687,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsPostSessionTo
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt.clone(),
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -1763,7 +1763,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsUpdateMetadat
payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -3298,7 +3298,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
let m_db = state.clone().store;
let m_payment_attempt_update = payment_attempt_update.clone();
let m_payment_attempt = payment_attempt.clone();
- let m_storage_scheme = processor.get_account().storage_scheme;
+ let m_storage_scheme = processor.get_storage_scheme();
let m_key_store = processor.get_key_store().clone();
let diesel_payment_attempt = payment_attempt
@@ -3398,7 +3398,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
let m_db = state.clone().store;
let m_key_store = processor.get_key_store().clone();
- let m_storage_scheme = processor.get_account().storage_scheme;
+ let m_storage_scheme = processor.get_storage_scheme();
let m_payment_data_payment_intent = payment_data.payment_intent.clone();
let m_payment_intent_update = payment_intent_update.clone();
let payment_intent_fut = tokio::spawn(
@@ -3429,7 +3429,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
.clone()
.and_then(|mandate_ids| mandate_ids.mandate_id));
let m_router_data_response = router_data.response.clone();
- let m_storage_scheme = processor.get_account().storage_scheme;
+ let m_storage_scheme = processor.get_storage_scheme();
let mandate_update_fut = tokio::spawn(
async move {
mandate::update_connector_mandate_id(
@@ -3438,7 +3438,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
m_payment_data_mandate_id,
m_payment_method_id,
m_router_data_response,
- m_storage_scheme,
+ m_storage_scheme.inner(),
)
.await
}
@@ -4334,7 +4334,7 @@ impl<F: Clone>
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4345,7 +4345,7 @@ impl<F: Clone>
processor.get_key_store(),
payment_data.payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4405,7 +4405,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4416,7 +4416,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor
processor.get_key_store(),
payment_data.payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4606,7 +4606,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentStatusData<F>, types::PaymentsSyncDat
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4617,7 +4617,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentStatusData<F>, types::PaymentsSyncDat
processor.get_key_store(),
payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4880,7 +4880,7 @@ impl
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4891,7 +4891,7 @@ impl
processor.get_key_store(),
payment_data.payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4953,7 +4953,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::SetupMandateRe
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4964,7 +4964,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::SetupMandateRe
processor.get_key_store(),
payment_data.payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -5284,7 +5284,7 @@ impl<F: Clone + Send + Sync>
payment_data.payment_intent.clone(),
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -5307,7 +5307,7 @@ impl<F: Clone + Send + Sync>
processor.get_key_store(),
payment_data.payment_attempt.clone(),
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -5360,7 +5360,7 @@ impl<F: Clone + Send + Sync>
Ok(types::PaymentsResponseData::PaymentResourceUpdateResponse { status, .. }) => {
if status.is_success() {
let m_db = db.clone().store;
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let update_request_fields = payment_data
@@ -5431,7 +5431,7 @@ impl<F: Clone + Send + Sync>
payment_data.payment_intent.customer_id.as_ref(),
processor.get_key_store(),
&payment_data.payment_intent.payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 9293c66ddf..afa07189de 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -57,13 +57,13 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let mut payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -87,7 +87,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
let mut payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_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::PaymentsSessionR
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_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::PaymentsSessionR
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -126,7 +126,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -270,7 +270,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionReque
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let metadata = payment_data.payment_intent.metadata.clone();
@@ -281,7 +281,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionReque
payment_data.payment_intent,
storage::PaymentIntentUpdate::MetadataUpdate {
metadata: Some(metadata),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
key_store,
storage_scheme,
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index 617fa9e0ae..2d378b1941 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -128,7 +128,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentIntentData<F>>> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -179,7 +179,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsS
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let prerouting_algorithm = payment_data.payment_intent.prerouting_algorithm.clone();
payment_data.payment_intent = match prerouting_algorithm {
@@ -189,7 +189,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsS
payment_data.payment_intent,
storage::PaymentIntentUpdate::SessionIntentUpdate {
prerouting_algorithm,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
key_store,
storage_scheme,
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index d34bb7070e..77f8d490e3 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -55,8 +55,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
let (mut payment_intent, payment_attempt, currency, amount);
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -64,7 +64,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -91,7 +91,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -107,7 +107,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -117,7 +117,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,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -127,7 +127,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,
- processor_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 450953c5fa..da3ea1c528 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -247,7 +247,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieve
state,
request,
self,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
))
.await
}
@@ -282,7 +282,7 @@ async fn get_tracker_for_sync<
state: &SessionState,
request: &api::PaymentsRetrieveRequest,
operation: Op,
- storage_scheme: enums::MerchantStorageScheme,
+ storage_scheme: domain::ProcessorStorageScheme,
) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>>
{
let (payment_intent, mut payment_attempt, currency, amount);
@@ -290,7 +290,7 @@ async fn get_tracker_for_sync<
(payment_intent, payment_attempt) = get_payment_intent_payment_attempt(
state,
payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -337,7 +337,7 @@ async fn get_tracker_for_sync<
let attempts = match request.expand_attempts {
Some(true) => {
Some(db
- .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())
+ .find_attempts_by_processor_merchant_id_payment_id(&platform.get_processor().get_processor_merchant_id(), &payment_id, storage_scheme, platform.get_processor().get_key_store())
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)
.attach_printable_lazy(|| {
@@ -353,7 +353,7 @@ async fn get_tracker_for_sync<
&payment_attempt.merchant_id,
&payment_attempt.payment_id,
&payment_attempt.attempt_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)
@@ -372,7 +372,7 @@ async fn get_tracker_for_sync<
.find_refund_by_payment_id_processor_merchant_id(
&payment_id,
platform.get_processor().get_account().get_id(),
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)
@@ -465,7 +465,7 @@ async fn get_tracker_for_sync<
.find_payment_method(
platform.get_provider().get_key_store(),
payment_method_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
{
@@ -661,9 +661,9 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRetrieveRequest, Pa
pub async fn get_payment_intent_payment_attempt(
state: &SessionState,
payment_id: &api::PaymentIdType,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: enums::MerchantStorageScheme,
+ processor_merchant_id: &domain::ProcessorMerchantId,
+ key_store: &domain::ProcessorKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
) -> RouterResult<(storage::PaymentIntent, storage::PaymentAttempt)> {
let db = &*state.store;
let get_pi_pa = || async {
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 422911a714..5cb68f44d1 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -72,12 +72,12 @@ 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 processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let db = &*state.store;
helpers::allow_payment_update_enabled_for_client_auth(
- processor_merchant_id,
+ &processor_merchant_id,
state,
auth_flow,
)
@@ -85,7 +85,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -135,7 +135,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -228,7 +228,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
state,
request.shipping.as_ref(),
payment_intent.shipping_address_id.as_deref(),
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent
.customer_id
.as_ref()
@@ -242,7 +242,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
state,
request.billing.as_ref(),
payment_intent.billing_address_id.as_deref(),
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent
.customer_id
.as_ref()
@@ -260,7 +260,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(),
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent
.customer_id
.as_ref()
@@ -332,7 +332,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(
- processor_merchant_id,
+ &processor_merchant_id,
mandate_id,
platform.get_processor().get_account().storage_scheme,
)
@@ -898,7 +898,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.await?;
}
- let processor_merchant_id = processor.get_account().get_id().clone();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let payment_id = payment_data.payment_intent.payment_id.clone();
// Check if client session validation is enabled
@@ -1093,7 +1093,7 @@ impl PaymentUpdate {
where
F: Clone + Send + Sync,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let profile_id = payment_data
.payment_intent
@@ -1174,7 +1174,7 @@ impl PaymentUpdate {
fingerprint_id: None,
fingerprint_type: None,
payment_method_billing_address_id,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
network_transaction_id,
network_transaction_link_id,
net_amount: hyperswitch_domain_models::payments::payment_attempt::NetAmount::new(
@@ -1355,7 +1355,7 @@ impl PaymentUpdate {
metadata,
connector_metadata,
payment_confirm_source: None,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
fingerprint_id: None,
session_expiry,
request_external_three_ds_authentication: payment_data
@@ -1410,7 +1410,7 @@ impl PaymentUpdate {
where
F: Clone + Send + Sync,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let update_request_fields = payment_data
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index ebcc971f30..7ef0583be6 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -157,8 +157,8 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
.await?;
}
let key_manager_state = &state.into();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
payment_id,
@@ -266,7 +266,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
feature_metadata: (feature_metadata
.map(FeatureMetadata::convert_from)
.or(payment_intent.feature_metadata)),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
request_incremental_authorization: request_incremental_authorization
.unwrap_or(payment_intent.request_incremental_authorization),
session_expiry: session_expiry.unwrap_or(payment_intent.session_expiry),
@@ -354,7 +354,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIn
F: 'b + Send,
{
let db = &*state.store;
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let intent = payment_data.payment_intent.clone();
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 d5b1b784de..a6f7ac108a 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -57,12 +57,12 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsUpdateMe
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let mut payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -84,7 +84,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsUpdateMe
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -292,7 +292,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsUpdateMetada
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let metadata = payment_data.payment_intent.metadata.clone();
@@ -302,7 +302,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsUpdateMetada
payment_data.payment_intent,
storage::PaymentIntentUpdate::MetadataUpdate {
metadata,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
key_store,
storage_scheme,
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 65720e8850..74cccf12c6 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -58,8 +58,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -67,7 +67,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -86,7 +86,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -109,7 +109,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,
- processor_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::PaymentsExtendAu
payment_intent.billing_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -129,7 +129,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,
- processor_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 26822392c9..0f116340f4 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -63,8 +63,8 @@ impl<F: Send + Clone + Sync>
> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_id = payment_id
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -72,7 +72,7 @@ impl<F: Send + Clone + Sync>
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -96,7 +96,7 @@ impl<F: Send + Clone + Sync>
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
attempt_id.clone().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -227,7 +227,7 @@ impl<F: Clone + Sync>
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let new_authorization_count = payment_data
.payment_intent
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
index 1d82fd8332..246586b483 100644
--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -158,7 +158,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, ProxyPaymentsR
let db = &*state.store;
let key_manager_state = &state.into();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_id(
@@ -213,7 +213,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, ProxyPaymentsR
hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt::proxy_create_domain_model(
&payment_intent,
cell_id,
- storage_scheme,
+ storage_scheme.inner(),
request,
encrypted_data,
platform.get_initiator(),
@@ -374,7 +374,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsReque
F: 'b + Send,
{
let db = &*state.store;
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
let intent_status = common_enums::IntentStatus::Processing;
@@ -401,7 +401,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsReque
let payment_intent_update =
hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::ConfirmIntent {
status: intent_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
active_attempt_id,
};
@@ -422,7 +422,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsReque
let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ConfirmIntent {
status: attempt_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector,
merchant_connector_id,
authentication_type,
@@ -507,7 +507,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor
payment_data.payment_intent,
payment_intent_update,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -518,7 +518,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor
processor.get_key_store(),
payment_data.payment_attempt,
payment_attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 1b6ef5c3b1..79732400fa 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -67,13 +67,13 @@ impl<F: Send + Clone + Sync>
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
storage_scheme,
)
@@ -103,7 +103,7 @@ impl<F: Send + Clone + Sync>
let mut payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
payment_intent.active_attempt.get_id().as_str(),
storage_scheme,
platform.get_processor().get_key_store(),
@@ -122,7 +122,7 @@ impl<F: Send + Clone + Sync>
payment_intent.shipping_address_id.clone(),
platform.get_processor().get_key_store(),
&payment_intent.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await?;
@@ -405,7 +405,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCa
where
F: 'b + Send,
{
- let storage_scheme = processor.get_account().storage_scheme;
+ let storage_scheme = processor.get_storage_scheme();
let key_store = processor.get_key_store();
// For Google Pay and Apple Pay, we don’t need to call the connector again; we can directly confirm the payment after tax_calculation. So, we update the required fields in the database during the update_tracker call.
if payment_data.should_update_in_update_tracker() {
@@ -438,7 +438,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCa
payment_data.payment_intent.customer_id.as_ref(),
key_store,
&payment_data.payment_intent.payment_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs
index 2e74036789..fe1431d2ec 100644
--- a/crates/router/src/core/payments/payment_methods.rs
+++ b/crates/router/src/core/payments/payment_methods.rs
@@ -37,7 +37,7 @@ pub async fn list_payment_methods(
.find_payment_intent_by_id(
&payment_id,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 0dce1ecf47..c2c144f67f 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -442,7 +442,7 @@ where
connector.connector_name.to_string(),
payment_data,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
router_data,
is_step_up,
initial_gsm,
@@ -548,8 +548,8 @@ pub async fn modify_trackers<F, FData, D>(
state: &routes::SessionState,
connector: String,
payment_data: &mut D,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: storage_enums::MerchantStorageScheme,
+ key_store: &domain::ProcessorKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
router_data: types::RouterData<F, FData, types::PaymentsResponseData>,
is_step_up: bool,
initial_gsm: Option<hyperswitch_domain_models::gsm::GatewayStatusMap>,
@@ -643,7 +643,7 @@ where
} else {
None
},
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
authentication_data,
encoded_data,
unified_code: None,
@@ -738,7 +738,7 @@ where
status: storage_enums::AttemptStatus::Failure,
error_reason: Some(error_response.reason.clone()),
amount_capturable: Some(MinorUnit::new(0)),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
unified_code: initial_gsm.clone().map(|gsm| gsm.unified_code),
unified_message: initial_gsm.clone().map(|gsm| gsm.unified_message),
standardised_code: Some(initial_gsm.as_ref().and_then(|gsm| gsm.standardised_code)),
@@ -806,7 +806,7 @@ where
storage::PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {
active_attempt_id: payment_data.get_payment_attempt().get_id().to_owned(),
attempt_count: new_attempt_count,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
key_store,
storage_scheme,
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index ae9fed513e..b4f67aa1cc 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -1350,7 +1350,7 @@ pub async fn payouts_filtered_list_core(
<domain::Customer as storage_impl::behaviour::Conversion>::convert_back(
&(&state).into(),
cust,
- &(platform.get_processor().get_key_store().clone()).key,
+ &(platform.get_processor().get_key_store().inner().clone()).key,
platform
.get_processor()
.get_key_store()
@@ -1372,7 +1372,7 @@ pub async fn payouts_filtered_list_core(
<domain::Address as domain::behaviour::Conversion>::convert_back(
&(&state).into(),
addr,
- &(platform.get_processor().get_key_store().clone()).key,
+ &(platform.get_processor().get_key_store().inner().clone()).key,
platform
.get_processor()
.get_key_store()
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 844c76121e..2b285c8dd1 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -326,9 +326,9 @@ async fn store_bank_details_in_payment_methods(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payload.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(ApiErrorResponse::PaymentNotFound)?;
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 958f94a3f6..1638289d14 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -125,15 +125,14 @@ pub async fn refund_reverse_core(
) -> RouterResponse<api_models::refunds::RefundResponse> {
let db = state.store.as_ref();
let processor = platform.get_processor();
- let processor_account = processor.get_account();
- let storage_scheme = processor_account.storage_scheme;
- let processor_merchant_id = processor_account.get_id();
+ let storage_scheme = processor.get_storage_scheme();
+ let processor_merchant_id = processor.get_processor_merchant_id();
let refund = db
.find_refund_by_processor_merchant_id_refund_id(
- processor_merchant_id,
+ &processor_merchant_id,
&req.refund_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::RefundNotFound)?;
@@ -151,7 +150,7 @@ pub async fn refund_reverse_core(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&refund.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
processor.get_key_store(),
storage_scheme,
)
@@ -161,7 +160,7 @@ pub async fn refund_reverse_core(
let payment_attempt = db
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&refund.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
storage_scheme,
processor.get_key_store(),
)
@@ -300,9 +299,9 @@ pub async fn refund_reverse_core(
diesel_refund::RefundUpdate::MetadataAndReasonUpdate {
metadata: Some(metadata),
reason: req.cancellation_reason,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
},
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -387,14 +386,14 @@ pub async fn refund_create_core(
let db = &*state.store;
let (processor_merchant_id, payment_intent, payment_attempt, amount);
- processor_merchant_id = platform.get_processor().get_account().get_id();
+ processor_merchant_id = platform.get_processor().get_processor_merchant_id();
payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&req.payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -441,8 +440,8 @@ pub async fn refund_create_core(
payment_attempt = db
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&req.payment_id,
- processor_merchant_id,
- platform.get_processor().get_account().storage_scheme,
+ &processor_merchant_id,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store()
).await
.to_not_found_response(errors::ApiErrorResponse::SuccessfulPaymentNotFound)?;
@@ -494,7 +493,7 @@ pub async fn trigger_refund_to_gateway(
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to retrieve connector from payment attempt")?;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
metrics::REFUND_COUNT.add(
1,
router_env::metric_attributes!(("connector", routed_through.clone())),
@@ -730,7 +729,7 @@ pub async fn trigger_refund_to_gateway(
refund_status,
refund_error_message,
refund_error_code,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: None,
processor_refund_data: None,
unified_code: Some(unified_code),
@@ -766,7 +765,7 @@ pub async fn trigger_refund_to_gateway(
err.field_names
)),
refund_error_code: Some("IE".to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: refund_connector_transaction_id,
processor_refund_data,
unified_code: None,
@@ -793,7 +792,7 @@ pub async fn trigger_refund_to_gateway(
sent_to_gateway: true,
refund_error_message: None,
refund_arn: "".to_string(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
processor_refund_data,
}
}
@@ -841,7 +840,7 @@ async fn execute_refund_execute_via_direct(
router_data: types::RefundExecuteRouterData,
all_keys_required: Option<bool>,
) -> RouterResult<types::RefundExecuteRouterData> {
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let connector_integration: services::BoxedRefundConnectorIntegrationInterface<
api::Execute,
@@ -872,7 +871,7 @@ async fn execute_refund_execute_via_direct(
errors::ConnectorError::NotImplemented(message.to_owned()).to_string(),
),
refund_error_code: Some("NOT_IMPLEMENTED".to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: None,
processor_refund_data: None,
unified_code: None,
@@ -888,7 +887,7 @@ async fn execute_refund_execute_via_direct(
"{flow} is not supported by {connector}"
)),
refund_error_code: Some("NOT_SUPPORTED".to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: None,
processor_refund_data: None,
unified_code: None,
@@ -902,7 +901,7 @@ async fn execute_refund_execute_via_direct(
refund_status: Some(enums::RefundStatus::Failure),
refund_error_message: Some(not_supported_message(message, connector)),
refund_error_code: Some("NOT_SUPPORTED".to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: None,
processor_refund_data: None,
unified_code: None,
@@ -918,7 +917,11 @@ async fn execute_refund_execute_via_direct(
if let Some(refund_error_update) = option_refund_error_update {
state
.store
- .update_refund(refund.to_owned(), refund_error_update, storage_scheme)
+ .update_refund(
+ refund.to_owned(),
+ refund_error_update,
+ storage_scheme.inner(),
+ )
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
@@ -1069,15 +1072,15 @@ pub async fn refund_retrieve_core(
Option<hyperswitch_masking::Secret<String>>,
)> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_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_processor_merchant_id(
payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -1085,9 +1088,9 @@ pub async fn refund_retrieve_core(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
payment_id,
- processor_merchant_id,
+ &processor_merchant_id,
&refund.attempt_id,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -1197,7 +1200,7 @@ pub async fn sync_refund_with_gateway(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get the connector")?;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let currency = payment_attempt.currency.get_required_value("currency")?;
@@ -1368,7 +1371,7 @@ pub async fn sync_refund_with_gateway(
refund_status,
refund_error_message,
refund_error_code,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: None,
processor_refund_data: None,
unified_code: None,
@@ -1403,7 +1406,7 @@ pub async fn sync_refund_with_gateway(
err.field_names
)),
refund_error_code: Some("IE".to_string()),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
connector_refund_id: refund_connector_transaction_id,
processor_refund_data,
unified_code: None,
@@ -1421,7 +1424,7 @@ pub async fn sync_refund_with_gateway(
sent_to_gateway: true,
refund_error_message: None,
refund_arn: "".to_string(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
processor_refund_data,
}
}
@@ -2070,12 +2073,12 @@ pub async fn refund_retrieve_core_with_internal_reference_id(
force_sync: Option<bool>,
) -> RouterResult<diesel_refund::Refund> {
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let refund = db
.find_refund_by_internal_reference_id_processor_merchant_id(
&refund_internal_request_id,
- processor_merchant_id,
+ &processor_merchant_id,
platform.get_processor().get_account().storage_scheme,
)
.await
@@ -2111,11 +2114,11 @@ pub async fn refund_retrieve_core_with_refund_id(
)> {
let refund_id = request.refund_id.clone();
let db = &*state.store;
- let processor_merchant_id = platform.get_processor().get_account().get_id();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let refund = db
.find_refund_by_processor_merchant_id_refund_id(
- processor_merchant_id,
+ &processor_merchant_id,
refund_id.as_str(),
platform.get_processor().get_account().storage_scheme,
)
@@ -2519,7 +2522,7 @@ pub async fn sync_refund_with_gateway_workflow(
})?;
let platform = core_utils::build_platform_from_refund_core(state, &refund_core).await?;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let response = Box::pin(refund_retrieve_core_with_internal_reference_id(
state.clone(),
@@ -2576,7 +2579,7 @@ pub async fn sync_refund_with_gateway_workflow(
.find_refund_by_internal_reference_id_processor_merchant_id(
&refund_core.refund_internal_reference_id,
&processor_merchant_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.change_context(errors::ApiErrorResponse::RefundNotFound)
@@ -2592,7 +2595,7 @@ pub async fn sync_refund_with_gateway_workflow(
state
.store
- .update_refund(refund, refund_update, storage_scheme)
+ .update_refund(refund, refund_update, storage_scheme.inner())
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
@@ -2679,18 +2682,20 @@ pub async fn trigger_refund_execute_workflow(
})?;
let platform = core_utils::build_platform_from_refund_core(state, &refund_core).await?;
- let processor_storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let processor_storage_scheme = platform.get_processor().get_storage_scheme();
let processor_merchant_id = refund_core
.processor_merchant_id
.as_ref()
.unwrap_or(&refund_core.merchant_id);
+ let typed_processor_merchant_id =
+ domain::ProcessorMerchantId::from(processor_merchant_id.clone());
let refund = db
.find_refund_by_internal_reference_id_processor_merchant_id(
&refund_core.refund_internal_reference_id,
processor_merchant_id,
- processor_storage_scheme,
+ processor_storage_scheme.inner(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::RefundNotFound)?;
@@ -2699,7 +2704,7 @@ pub async fn trigger_refund_execute_workflow(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&refund.payment_id,
- processor_merchant_id,
+ &typed_processor_merchant_id,
&refund.attempt_id,
processor_storage_scheme,
platform.get_processor().get_key_store(),
@@ -2710,7 +2715,7 @@ pub async fn trigger_refund_execute_workflow(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_attempt.payment_id,
- processor_merchant_id,
+ &typed_processor_merchant_id,
platform.get_processor().get_key_store(),
processor_storage_scheme,
)
diff --git a/crates/router/src/core/refunds_v2.rs b/crates/router/src/core/refunds_v2.rs
index 557b98e4ca..f5007f3c7b 100644
--- a/crates/router/src/core/refunds_v2.rs
+++ b/crates/router/src/core/refunds_v2.rs
@@ -51,7 +51,7 @@ pub async fn refund_create_core(
.find_payment_intent_by_id(
&req.payment_id,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -90,7 +90,7 @@ pub async fn refund_create_core(
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
platform.get_processor().get_key_store(),
&req.payment_id,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::SuccessfulPaymentNotFound)?;
@@ -722,7 +722,7 @@ pub async fn refund_retrieve_core(
.find_payment_intent_by_id(
payment_id,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -737,7 +737,7 @@ pub async fn refund_retrieve_core(
.find_payment_attempt_by_id(
processor.get_key_store(),
&active_attempt_id,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index 9194a60fc4..68a4b9b674 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -288,7 +288,7 @@ pub async fn upsert_calculate_pcr_task(
let revenue_recovery_payment_data = pcr::RevenueRecoveryPaymentData {
merchant_account: platform.get_processor().get_account().clone(),
profile: business_profile.clone(),
- key_store: platform.get_processor().get_key_store().clone(),
+ key_store: platform.get_processor().get_key_store().inner().clone(),
billing_mca: billing_connector_account.clone(),
retry_algorithm: revenue_recovery_retry,
psync_data: None,
@@ -1654,13 +1654,17 @@ pub async fn resume_revenue_recovery_process_tracker(
IntentStatus::Succeeded => {
// Sync the intent's *active* (charged) attempt, NOT tracking_data's attempt — the latter
// is the original failed attempt; the successful retry lives on `active_attempt_id`.
+ let processor_account = domain::ProcessorMerchantAccount::from_untagged(
+ revenue_recovery_payment_data.merchant_account.clone(),
+ );
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(
+ revenue_recovery_payment_data.key_store.clone(),
+ );
let payment_intent = db
.find_payment_intent_by_id(
&id,
- &revenue_recovery_payment_data.key_store,
- revenue_recovery_payment_data
- .merchant_account
- .storage_scheme,
+ &processor_key_store,
+ processor_account.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)
@@ -1958,8 +1962,8 @@ pub fn decide_invoice_cancellation(
/// the decision returned and returns it. Otherwise returns the refusal without changing anything.
pub async fn cancel_invoice_workflows(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: common_enums::MerchantStorageScheme,
+ key_store: &domain::ProcessorKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
payment_intent: PaymentIntent,
) -> CustomResult<Result<PaymentIntent, CancelInvoiceRefusal>, errors::RevenueRecoveryError> {
let db = &*state.store;
@@ -1998,7 +2002,7 @@ pub async fn cancel_invoice_workflows(
let intent_update = PaymentIntentUpdate::VoidUpdate {
status: cancelled_status,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
let cancelled_intent = db
.update_payment_intent(payment_intent, intent_update, key_store, storage_scheme)
diff --git a/crates/router/src/core/revenue_recovery/api.rs b/crates/router/src/core/revenue_recovery/api.rs
index 2a99dd3e8f..3f9ced27a7 100644
--- a/crates/router/src/core/revenue_recovery/api.rs
+++ b/crates/router/src/core/revenue_recovery/api.rs
@@ -468,7 +468,7 @@ pub async fn cancel_revenue_recovery_core(
merchant_reference_id: id_type::PaymentReferenceId,
) -> RouterResponse<api_payments::RecoveryPaymentsResponse> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = db
.find_payment_intent_by_merchant_reference_id_profile_id(
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index 6a704eadab..c3094ef0aa 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -1661,18 +1661,21 @@ async fn persist_billing_connector_transaction_id(
};
revenue_recovery.billing_connector_transaction_id = Some(connector_transaction_id.to_string());
- let storage_scheme = revenue_recovery_payment_data
- .merchant_account
- .storage_scheme;
+ let processor_account = domain::ProcessorMerchantAccount::from_untagged(
+ revenue_recovery_payment_data.merchant_account.clone(),
+ );
+ let processor_key_store =
+ domain::ProcessorKeyStore::from_untagged(revenue_recovery_payment_data.key_store.clone());
+ let storage_scheme = processor_account.get_storage_scheme();
let update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::RecordBackUpdate {
feature_metadata: Some(feature_metadata),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
if let Err(error) = state
.store
.update_payment_attempt(
- &revenue_recovery_payment_data.key_store,
+ &processor_key_store,
payment_attempt.clone(),
update,
storage_scheme,
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index fd0080108e..26575c43dc 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -2593,7 +2593,7 @@ pub async fn create_specific_dynamic_routing(
// disable specific dynamic routing for the requested profile
helpers::disable_dynamic_routing_algorithm(
&state,
- processor.get_key_store().clone(),
+ processor.get_key_store().inner().clone(),
business_profile,
dynamic_routing_algo_ref,
dynamic_routing_type,
@@ -2961,7 +2961,7 @@ pub async fn contract_based_dynamic_routing_setup(
.attach_printable("Failed to get dynamic_routing_algo_ref")?;
return helpers::disable_dynamic_routing_algorithm(
&state,
- processor.get_key_store().clone(),
+ processor.get_key_store().inner().clone(),
business_profile,
algorithm,
routing_types::DynamicRoutingType::ContractBasedRouting,
diff --git a/crates/router/src/core/split_payments.rs b/crates/router/src/core/split_payments.rs
index 1c1ee92e8f..a5978aa5f8 100644
--- a/crates/router/src/core/split_payments.rs
+++ b/crates/router/src/core/split_payments.rs
@@ -237,7 +237,7 @@ pub(crate) async fn split_payments_execute_core(
.find_payment_intent_by_id(
&payment_id,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -270,7 +270,7 @@ pub(crate) async fn split_payments_execute_core(
payment_intent,
payment_intent_update,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -352,7 +352,7 @@ pub(crate) async fn split_payments_execute_core(
payment_data.payment_intent.clone(),
payment_intent_update,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -444,7 +444,7 @@ pub(crate) async fn split_payments_execute_core(
payment_data.payment_intent.clone(),
payment_intent_update,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -478,7 +478,7 @@ pub(crate) async fn split_payments_execute_core(
payment_intent,
payment_intent_update,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/superposition_sdk_config.rs b/crates/router/src/core/superposition_sdk_config.rs
index 8a11e0c07f..c4711d6d65 100644
--- a/crates/router/src/core/superposition_sdk_config.rs
+++ b/crates/router/src/core/superposition_sdk_config.rs
@@ -44,9 +44,9 @@ async fn get_payment_context(
.async_map(|pi| async {
db.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&pi.payment_id,
- &pi.processor_merchant_id,
+ &domain::ProcessorMerchantId::from(pi.processor_merchant_id.clone()),
&pi.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -359,9 +359,9 @@ pub async fn get_superposition_sdk_config(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- merchant_account.get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- merchant_account.storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
index 1569d94755..e9e105cce9 100644
--- a/crates/router/src/core/verification/utils.rs
+++ b/crates/router/src/core/verification/utils.rs
@@ -194,9 +194,9 @@ pub async fn check_if_profile_id_is_present_in_payment_intent(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::Unauthorized)?;
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 05bcf2a335..232494a523 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -1695,9 +1695,9 @@ async fn refunds_incoming_webhook_flow(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&refund.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -1812,9 +1812,9 @@ pub async fn get_payment_attempt_from_object_reference_id(
match object_reference_id {
api::ObjectReferenceId::PaymentId(api::PaymentIdType::ConnectorTransactionId(ref id)) => db
.find_payment_attempt_by_processor_merchant_id_connector_txn_id(
- processor.get_account().get_id(),
+ &processor.get_processor_merchant_id(),
id,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -1822,8 +1822,8 @@ pub async fn get_payment_attempt_from_object_reference_id(
api::ObjectReferenceId::PaymentId(api::PaymentIdType::PaymentAttemptId(ref id)) => db
.find_payment_attempt_by_attempt_id_processor_merchant_id(
id,
- processor.get_account().get_id(),
- processor.get_account().storage_scheme,
+ &processor.get_processor_merchant_id(),
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -1845,7 +1845,7 @@ pub async fn get_or_update_dispute_object(
connector_name: &str,
) -> CustomResult<diesel_models::dispute::Dispute, errors::ApiErrorResponse> {
let db = &*state.store;
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let incoming_dispute_stage = dispute_details.dispute_stage;
let update_dispute = diesel_models::dispute::DisputeUpdate::Update {
dispute_stage: dispute_details.dispute_stage,
@@ -1911,7 +1911,7 @@ pub async fn get_or_update_dispute_object(
let connector_dispute_id = new_dispute.connector_dispute_id.clone();
match state
.store
- .insert_dispute(new_dispute.clone(), storage_scheme)
+ .insert_dispute(new_dispute.clone(), storage_scheme.inner())
.await
{
Ok(dispute) => Ok(dispute),
@@ -1925,7 +1925,7 @@ pub async fn get_or_update_dispute_object(
platform.get_processor().get_account().get_id(),
&payment_attempt.payment_id,
&connector_dispute_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::WebhookResourceNotFound)?;
@@ -1937,7 +1937,7 @@ pub async fn get_or_update_dispute_object(
incoming_dispute_stage,
dispute_status,
update_dispute,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
}
@@ -1961,7 +1961,7 @@ pub async fn get_or_update_dispute_object(
incoming_dispute_stage,
dispute_status,
update_dispute,
- storage_scheme,
+ storage_scheme.inner(),
)
.await
}
@@ -2108,18 +2108,18 @@ async fn external_authentication_incoming_webhook_flow(
.store
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
- let processor_merchant_id = platform.get_processor().get_account().get_id().clone();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let payment_confirm_req = api::PaymentsRequest {
payment_id: Some(api_models::payments::PaymentIdType::PaymentIntentId(
payment_intent.payment_id.clone(),
)),
- merchant_id: Some(processor_merchant_id.clone()),
+ merchant_id: Some(processor_merchant_id.inner().clone()),
..Default::default()
};
let is_setup_mandate = payment_intent.is_setup_mandate();
@@ -2136,7 +2136,7 @@ async fn external_authentication_incoming_webhook_flow(
&payment_intent.payment_id,
&processor_merchant_id,
&attempt_id,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -2180,7 +2180,7 @@ async fn external_authentication_incoming_webhook_flow(
payment_id: Some(api_models::payments::PaymentIdType::PaymentIntentId(
payment_intent.payment_id.clone(),
)),
- merchant_id: Some(processor_merchant_id.clone()),
+ merchant_id: Some(processor_merchant_id.inner().clone()),
payment_token: Some(payment_token),
payment_method: Some(common_enums::PaymentMethod::Card),
payment_method_type: payment_attempt.payment_method_type,
@@ -2402,14 +2402,13 @@ async fn update_connector_managed_mandate_by_connector_txn_id(
event_type: webhooks::IncomingWebhookEvent,
) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let db = &*state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
let storage_scheme = platform.get_processor().get_account().storage_scheme;
let setup_attempt = db
.find_payment_attempt_by_processor_merchant_id_connector_txn_id(
- merchant_id,
+ &platform.get_processor().get_processor_merchant_id(),
connector_transaction_id.as_str(),
- storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -2468,7 +2467,7 @@ async fn update_existing_mandate(
let mandates_response = Box::new(
api::mandates::MandateResponse::from_db_mandate(
&state,
- platform.get_processor().get_key_store().clone(),
+ platform.get_processor().get_key_store().inner().clone(),
updated_mandate.clone(),
platform.get_processor().get_account(),
)
@@ -2677,7 +2676,7 @@ async fn associated_data_incoming_webhook_flow(
match associated_data {
Some(associated_data) => {
let processor = platform.get_processor();
- let merchant_id = processor.get_account().get_id().to_owned();
+ let merchant_id = processor.get_processor_merchant_id().to_owned();
// Resolve the payment once to derive the locking key.
let payment_id = get_payment_attempt_from_object_reference_id(
@@ -2694,7 +2693,7 @@ async fn associated_data_incoming_webhook_flow(
&payment_id,
&merchant_id,
processor.get_key_store(),
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -2708,7 +2707,7 @@ async fn associated_data_incoming_webhook_flow(
};
lock_action
.clone()
- .perform_locking_action(&state, merchant_id.clone())
+ .perform_locking_action(&state, merchant_id.inner().clone())
.await?;
let payment_attempt = get_payment_attempt_from_object_reference_id(
@@ -2749,7 +2748,7 @@ async fn associated_data_incoming_webhook_flow(
.update_payment_attempt_with_attempt_id(
payment_attempt,
attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -2779,7 +2778,7 @@ async fn associated_data_incoming_webhook_flow(
};
lock_action
- .free_lock_action(&state, merchant_id.clone())
+ .free_lock_action(&state, merchant_id.inner().clone())
.await?;
payment_method_update_result?;
@@ -3100,7 +3099,7 @@ async fn update_payment_attempt_associated_data(
.update_payment_attempt_with_attempt_id(
payment_attempt,
attempt_update,
- processor.get_account().storage_scheme,
+ processor.get_storage_scheme(),
processor.get_key_store(),
)
.await
@@ -3310,9 +3309,9 @@ async fn disputes_incoming_webhook_flow(
let payment_intent = db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_attempt.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -3746,7 +3745,7 @@ async fn update_connector_mandate_details(
.update_payment_attempt_with_attempt_id(
payment_attempt.clone(),
attempt_update,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
@@ -3851,7 +3850,7 @@ async fn update_connector_mandate_details(
.update_payment_attempt_with_attempt_id(
payment_attempt.clone(),
attempt_update,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
diff --git a/crates/router/src/core/webhooks/incoming_v2.rs b/crates/router/src/core/webhooks/incoming_v2.rs
index 31698176e4..e46d9e4839 100644
--- a/crates/router/src/core/webhooks/incoming_v2.rs
+++ b/crates/router/src/core/webhooks/incoming_v2.rs
@@ -441,7 +441,7 @@ async fn payments_incoming_webhook_flow(
profile.get_id(),
key_manager_state,
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await?;
@@ -592,8 +592,8 @@ async fn get_trackers_response_for_payment_get_operation<F>(
payment_id: &api::PaymentIdType,
profile_id: &common_utils::id_type::ProfileId,
key_manager_state: &KeyManagerState,
- merchant_key_store: &domain::MerchantKeyStore,
- storage_scheme: enums::MerchantStorageScheme,
+ merchant_key_store: &domain::ProcessorKeyStore,
+ storage_scheme: domain::ProcessorStorageScheme,
) -> errors::RouterResult<payments::operations::GetTrackerResponse<PaymentStatusData<F>>>
where
F: Clone,
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index 084ab5928a..ce244c2736 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -237,7 +237,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
.await?;
let provider_merchant_id = platform.get_provider().get_account().get_id().clone();
- let processor_merchant_id = platform.get_processor().get_account().get_id().clone();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
for event_data in events_to_trigger {
let event_type = event_data.event_type;
@@ -247,7 +247,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook(
event_data,
&webhook_recipient,
provider_merchant_id.clone(),
- processor_merchant_id.clone(),
+ processor_merchant_id.inner().clone(),
primary_object_id.clone(),
primary_object_type,
primary_object_created_at,
@@ -766,25 +766,33 @@ async fn trigger_webhook_to_connector(
}
}
+/// Outgoing webhooks run at provider or processor level depending on who triggered them, so
+/// the merchant id and key store both come from that merchant and are tagged here.
async fn update_payment_attempt_from_webhook_response(
state: &SessionState,
event: &domain::Event,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ merchant_id: &common_utils::id_type::MerchantId,
merchant_key_store: &domain::MerchantKeyStore,
) {
if event.event_type == enums::EventType::SurchargePaymentSucceeded {
let merchant_account = state
.store
- .find_merchant_account_by_merchant_id(processor_merchant_id, merchant_key_store)
+ .find_merchant_account_by_merchant_id(merchant_id, merchant_key_store)
.await;
let storage_scheme = match &merchant_account {
- Ok(ma) => ma.storage_scheme,
+ Ok(merchant_account) => {
+ domain::ProcessorMerchantAccount::from_untagged(merchant_account.clone())
+ .get_storage_scheme()
+ }
Err(err) => {
logger::warn!(?err, "Using default PostgresOnly storage scheme");
- enums::MerchantStorageScheme::PostgresOnly
+ domain::ProcessorStorageScheme::postgres_only()
}
};
+ let processor_merchant_id = domain::ProcessorMerchantId::from(merchant_id.clone());
+ let merchant_key_store =
+ domain::ProcessorKeyStore::from_untagged(merchant_key_store.clone());
let attempt_id = match &event.metadata {
Some(diesel_models::EventMetadata::Surcharge {
@@ -804,9 +812,9 @@ async fn update_payment_attempt_from_webhook_response(
.store
.find_payment_attempt_by_attempt_id_processor_merchant_id(
attempt_id,
- processor_merchant_id,
+ &processor_merchant_id,
storage_scheme,
- merchant_key_store,
+ &merchant_key_store,
)
.await;
let payment_attempt = match payment_attempt_result {
@@ -838,7 +846,7 @@ async fn update_payment_attempt_from_webhook_response(
};
let update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::ExternalSurchargeUpdate {
external_surcharge_details: updated_details,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
let _ = state
.store
@@ -846,7 +854,7 @@ async fn update_payment_attempt_from_webhook_response(
payment_attempt,
update,
storage_scheme,
- merchant_key_store,
+ &merchant_key_store,
)
.await
.inspect_err(|err| {
@@ -1034,10 +1042,10 @@ pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker(
application_source: common_enums::ApplicationSource,
webhook_recipient_data: types::WebhookRecipientData,
) -> CustomResult<storage::ProcessTracker, errors::StorageError> {
- let processor_merchant_id = platform.get_processor().get_account().get_id().clone();
+ let processor_merchant_id = platform.get_processor().get_processor_merchant_id();
let provider_merchant_id = platform.get_provider().get_account().get_id().clone();
let dimensions = crate::core::configs::dimension_state::Dimensions::new()
- .with_processor_merchant_id(processor_merchant_id.clone().into());
+ .with_processor_merchant_id(processor_merchant_id.clone());
let schedule_time = outgoing_webhook_retry::get_webhook_delivery_retry_schedule_time(
db,
superposition_client,
@@ -1053,7 +1061,7 @@ pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker(
let tracking_data = types::OutgoingWebhookTrackingData {
merchant_id: provider_merchant_id,
business_profile_id: webhook_recipient.profile.get_id().to_owned(),
- processor_merchant_id: Some(processor_merchant_id),
+ processor_merchant_id: Some(processor_merchant_id.inner().clone()),
initiator_merchant_id: Some(webhook_recipient.key_store.merchant_id.clone()),
event_type: event.event_type,
event_class: event.event_class,
diff --git a/crates/router/src/core/webhooks/recovery_incoming.rs b/crates/router/src/core/webhooks/recovery_incoming.rs
index 159eae3b30..84140001dd 100644
--- a/crates/router/src/core/webhooks/recovery_incoming.rs
+++ b/crates/router/src/core/webhooks/recovery_incoming.rs
@@ -1713,7 +1713,7 @@ impl RecoveryAction {
common_types::payments::RecoveryAction::CancelInvoice => {
let (_, recovery_intent) = recovery_tuple;
let key_store = platform.get_processor().get_key_store();
- let storage_scheme = platform.get_processor().get_account().storage_scheme;
+ let storage_scheme = platform.get_processor().get_storage_scheme();
let payment_intent = state
.store
.find_payment_intent_by_id(
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index e4732fad78..9834c7aacb 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -380,7 +380,7 @@ async fn resolve_webhook_recipient_inner(
(
provider.get_account().clone(),
- provider.get_key_store().clone(),
+ provider.get_key_store().inner().clone(),
provider_profile,
)
} else {
@@ -388,7 +388,7 @@ async fn resolve_webhook_recipient_inner(
(
processor.get_account().clone(),
- processor.get_key_store().clone(),
+ processor.get_key_store().inner().clone(),
profile.clone(),
)
};
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 7184c3ae3e..173a3f47cf 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -23,6 +23,8 @@ use hyperswitch_domain_models::payouts::{
};
#[cfg(feature = "v2")]
use hyperswitch_domain_models::platform::Initiator;
+#[cfg(all(feature = "olap", feature = "v1"))]
+use hyperswitch_domain_models::platform::ProviderMerchantId;
use hyperswitch_domain_models::{
authentication::AuthenticationInterface,
cards_info::CardsInfoInterface,
@@ -30,6 +32,7 @@ use hyperswitch_domain_models::{
invoice::{Invoice as DomainInvoice, InvoiceInterface, InvoiceUpdate as DomainInvoiceUpdate},
payment_methods::PaymentMethodInterface,
payments::{payment_attempt::PaymentAttemptInterface, payment_intent::PaymentIntentInterface},
+ platform::{ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme},
refunds,
subscription::{
Subscription as DomainSubscription, SubscriptionInterface,
@@ -1750,8 +1753,8 @@ impl PaymentAttemptInterface for KafkaStore {
async fn insert_payment_attempt(
&self,
payment_attempt: storage::PaymentAttempt,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
let attempt = self
.diesel_store
@@ -1772,9 +1775,9 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v2")]
async fn insert_payment_attempt(
&self,
- merchant_key_store: &domain::MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_attempt: storage::PaymentAttempt,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
let attempt = self
.diesel_store
@@ -1797,8 +1800,8 @@ impl PaymentAttemptInterface for KafkaStore {
&self,
this: storage::PaymentAttempt,
payment_attempt: storage::PaymentAttemptUpdate,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &domain::MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
let mut attempt = self
.diesel_store
@@ -1827,10 +1830,10 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v2")]
async fn update_payment_attempt(
&self,
- merchant_key_store: &domain::MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
this: storage::PaymentAttempt,
payment_attempt: storage::PaymentAttemptUpdate,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
let attempt = self
.diesel_store
@@ -1856,10 +1859,10 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
connector_txn_id: &str,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_by_processor_merchant_id_connector_txn_id(
@@ -1874,10 +1877,10 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
- merchant_key_store: &domain::MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
profile_id: &id_type::ProfileId,
connector_transaction_id: &str,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_by_profile_id_connector_transaction_id(
@@ -1893,10 +1896,10 @@ impl PaymentAttemptInterface for KafkaStore {
async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
attempt_id: &str,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
@@ -1913,9 +1916,9 @@ impl PaymentAttemptInterface for KafkaStore {
async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_by_attempt_id_processor_merchant_id(
@@ -1930,9 +1933,9 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_id(
&self,
- merchant_key_store: &domain::MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
attempt_id: &id_type::GlobalAttemptId,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_by_id(merchant_key_store, attempt_id, storage_scheme)
@@ -1943,8 +1946,8 @@ impl PaymentAttemptInterface for KafkaStore {
async fn find_payment_attempts_by_payment_intent_id(
&self,
payment_id: &id_type::GlobalPaymentId,
- merchant_key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<storage::PaymentAttempt>, errors::StorageError> {
self.diesel_store
.find_payment_attempts_by_payment_intent_id(
@@ -1959,9 +1962,9 @@ impl PaymentAttemptInterface for KafkaStore {
async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
@@ -1977,9 +1980,9 @@ impl PaymentAttemptInterface for KafkaStore {
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id_processor_merchant_id(
@@ -1994,9 +1997,9 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v2")]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
- merchant_key_store: &domain::MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_id: &id_type::GlobalPaymentId,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentAttempt, errors::StorageError> {
self.diesel_store
.find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
@@ -2011,8 +2014,8 @@ impl PaymentAttemptInterface for KafkaStore {
async fn get_filters_for_payments(
&self,
pi: &[hyperswitch_domain_models::payments::PaymentIntent],
- processor_merchant_id: &id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters,
errors::StorageError,
@@ -2025,7 +2028,7 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v1")]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -2034,7 +2037,7 @@ impl PaymentAttemptInterface for KafkaStore {
merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
card_discovery: Option<Vec<common_enums::CardDiscovery>>,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.diesel_store
.get_total_count_of_filtered_payment_attempts(
@@ -2055,7 +2058,7 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v2")]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method_type: Option<Vec<common_enums::PaymentMethod>>,
@@ -2063,7 +2066,7 @@ impl PaymentAttemptInterface for KafkaStore {
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.diesel_store
.get_total_count_of_filtered_payment_attempts(
@@ -2083,10 +2086,10 @@ impl PaymentAttemptInterface for KafkaStore {
#[cfg(feature = "v1")]
async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
payment_id: &id_type::PaymentId,
- storage_scheme: MerchantStorageScheme,
- key_store: &domain::MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ key_store: &ProcessorKeyStore,
) -> CustomResult<Vec<storage::PaymentAttempt>, errors::StorageError> {
self.diesel_store
.find_attempts_by_processor_merchant_id_payment_id(
@@ -2106,8 +2109,8 @@ impl PaymentIntentInterface for KafkaStore {
&self,
this: storage::PaymentIntent,
payment_intent: storage::PaymentIntentUpdate,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
let intent = self
.diesel_store
@@ -2141,8 +2144,8 @@ impl PaymentIntentInterface for KafkaStore {
async fn insert_payment_intent(
&self,
new: storage::PaymentIntent,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
logger::debug!("Inserting PaymentIntent Via KafkaStore");
let state = self
@@ -2174,9 +2177,9 @@ impl PaymentIntentInterface for KafkaStore {
async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &id_type::PaymentId,
- processor_merchant_id: &id_type::MerchantId,
- merchant_key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
self.diesel_store
.find_payment_intent_by_payment_id_processor_merchant_id(
@@ -2192,8 +2195,8 @@ impl PaymentIntentInterface for KafkaStore {
async fn find_payment_intent_by_id(
&self,
payment_id: &id_type::GlobalPaymentId,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<storage::PaymentIntent, errors::StorageError> {
self.diesel_store
.find_payment_intent_by_id(payment_id, key_store, storage_scheme)
@@ -2203,10 +2206,10 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v1"))]
async fn filter_payment_intent_by_constraints(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<Vec<storage::PaymentIntent>, errors::StorageError> {
self.diesel_store
.filter_payment_intent_by_constraints(
@@ -2221,7 +2224,7 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_filtered_payment_intents_attempt_for_platform(
&self,
- platform_merchant_id: &id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
) -> CustomResult<
Vec<(
@@ -2231,28 +2234,28 @@ impl PaymentIntentInterface for KafkaStore {
errors::StorageError,
> {
self.diesel_store
- .get_filtered_payment_intents_attempt_for_platform(platform_merchant_id, filters)
+ .get_filtered_payment_intents_attempt_for_platform(provider_merchant_id, filters)
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_payment_intents_attempt_count_for_platform(
&self,
- platform_merchant_id: &id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
) -> CustomResult<i64, errors::StorageError> {
self.diesel_store
- .get_payment_intents_attempt_count_for_platform(platform_merchant_id, filters)
+ .get_payment_intents_attempt_count_for_platform(provider_merchant_id, filters)
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
time_range: &common_utils::types::TimeRange,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<Vec<storage::PaymentIntent>, errors::StorageError> {
self.diesel_store
.filter_payment_intents_by_time_range_constraints(
@@ -2266,7 +2269,7 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
profile_id_list: Option<Vec<id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, errors::StorageError> {
@@ -2278,10 +2281,10 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_filtered_payment_intents_attempt(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<
Vec<(
hyperswitch_domain_models::payments::PaymentIntent,
@@ -2302,10 +2305,10 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v2"))]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- key_store: &domain::MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<
Vec<(
hyperswitch_domain_models::payments::PaymentIntent,
@@ -2326,9 +2329,9 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v1"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- processor_merchant_id: &id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<Vec<String>, errors::StorageError> {
self.diesel_store
.get_filtered_active_attempt_ids_for_total_count(
@@ -2344,8 +2347,8 @@ impl PaymentIntentInterface for KafkaStore {
&self,
merchant_reference_id: &id_type::PaymentReferenceId,
profile_id: &id_type::ProfileId,
- merchant_key_store: &domain::MerchantKeyStore,
- storage_scheme: &MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: &ProcessorStorageScheme,
) -> error_stack::Result<hyperswitch_domain_models::payments::PaymentIntent, errors::StorageError>
{
self.diesel_store
@@ -2360,9 +2363,9 @@ impl PaymentIntentInterface for KafkaStore {
#[cfg(all(feature = "olap", feature = "v2"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<Vec<Option<String>>, errors::StorageError> {
self.diesel_store
.get_filtered_active_attempt_ids_for_total_count(
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index f919c43c5b..5f85d06704 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -26,7 +26,12 @@ pub async fn api_key_create(
&req,
payload,
|state, auth_data, payload, _| {
- let key_store = auth_data.platform.get_processor().get_key_store().clone();
+ let key_store = auth_data
+ .platform
+ .get_processor()
+ .get_key_store()
+ .inner()
+ .clone();
async move { api_keys::create_api_key(state, payload, key_store).await }
},
auth::auth_type(
diff --git a/crates/router/src/routes/profiles.rs b/crates/router/src/routes/profiles.rs
index 233e98716e..02140258b4 100644
--- a/crates/router/src/routes/profiles.rs
+++ b/crates/router/src/routes/profiles.rs
@@ -152,7 +152,12 @@ pub async fn profile_retrieve(
.get_account()
.get_id()
.clone(),
- auth_data.platform.get_processor().get_key_store().clone(),
+ auth_data
+ .platform
+ .get_processor()
+ .get_key_store()
+ .inner()
+ .clone(),
)
},
auth::auth_type(
@@ -269,7 +274,12 @@ pub async fn profile_update(
.get_account()
.get_id()
.clone(),
- auth_data.platform.get_processor().get_key_store().clone(),
+ auth_data
+ .platform
+ .get_processor()
+ .get_key_store()
+ .inner()
+ .clone(),
req,
Some(provider_merchant_id),
)
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 2bf435d1e4..007f614690 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -878,6 +878,7 @@ pub async fn upsert_decision_manager_config(
.get_processor()
.clone()
.get_key_store()
+ .inner()
.clone(),
update_decision,
auth.profile,
@@ -969,6 +970,7 @@ pub async fn retrieve_decision_manager_config(
.get_processor()
.clone()
.get_key_store()
+ .inner()
.clone(),
auth.profile,
)
diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs
index 27dc701011..33dee34867 100644
--- a/crates/router/src/types/domain.rs
+++ b/crates/router/src/types/domain.rs
@@ -25,7 +25,11 @@ mod business_profile {
}
mod platform {
- pub use hyperswitch_domain_models::platform::{Initiator, Platform, Processor, Provider};
+ pub use hyperswitch_domain_models::platform::{
+ Initiator, Platform, Processor, ProcessorKeyStore, ProcessorMerchantAccount,
+ ProcessorMerchantId, ProcessorStorageScheme, Provider, ProviderKeyStore,
+ ProviderMerchantAccount, ProviderMerchantId, ProviderStorageScheme,
+ };
}
mod customers {
pub use hyperswitch_domain_models::customer::*;
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index a290dc02c7..b7c9f82181 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -135,7 +135,7 @@ mod tests {
configs::settings::Settings,
db::StorageImpl,
routes, services,
- types::{self, storage::enums},
+ types::{self, domain},
};
async fn create_single_connection_test_transaction_pool() -> routes::AppState {
@@ -270,11 +270,12 @@ mod tests {
)
.await
.unwrap();
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(key_store);
let response = store
.insert_payment_attempt(
payment_attempt,
- enums::MerchantStorageScheme::PostgresOnly,
- &key_store,
+ domain::ProcessorStorageScheme::postgres_only(),
+ &processor_key_store,
)
.await
.unwrap();
@@ -398,11 +399,12 @@ mod tests {
)
.await
.unwrap();
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(key_store);
store
.insert_payment_attempt(
payment_attempt,
- enums::MerchantStorageScheme::PostgresOnly,
- &key_store,
+ domain::ProcessorStorageScheme::postgres_only(),
+ &processor_key_store,
)
.await
.unwrap();
@@ -410,10 +412,10 @@ mod tests {
let response = store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
- &merchant_id,
+ &domain::ProcessorMerchantId::from(merchant_id),
&attempt_id,
- enums::MerchantStorageScheme::PostgresOnly,
- &key_store,
+ domain::ProcessorStorageScheme::postgres_only(),
+ &processor_key_store,
)
.await
.unwrap();
@@ -541,11 +543,12 @@ mod tests {
)
.await
.unwrap();
+ let processor_key_store = domain::ProcessorKeyStore::from_untagged(key_store);
store
.insert_payment_attempt(
payment_attempt,
- enums::MerchantStorageScheme::PostgresOnly,
- &key_store,
+ domain::ProcessorStorageScheme::postgres_only(),
+ &processor_key_store,
)
.await
.unwrap();
@@ -553,10 +556,10 @@ mod tests {
let response = store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_id,
- &merchant_id,
+ &domain::ProcessorMerchantId::from(merchant_id),
&uuid,
- enums::MerchantStorageScheme::PostgresOnly,
- &key_store,
+ domain::ProcessorStorageScheme::postgres_only(),
+ &processor_key_store,
)
.await
.unwrap();
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 72e56c3176..e63c1f846b 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -189,27 +189,27 @@ pub async fn find_payment_intent_from_payment_id_type(
payments::PaymentIdType::PaymentIntentId(payment_id) => db
.find_payment_intent_by_payment_id_processor_merchant_id(
&payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound),
payments::PaymentIdType::ConnectorTransactionId(connector_transaction_id) => {
let attempt = db
.find_payment_attempt_by_processor_merchant_id_connector_txn_id(
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&connector_transaction_id,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
db.find_payment_intent_by_payment_id_processor_merchant_id(
&attempt.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -218,17 +218,17 @@ pub async fn find_payment_intent_from_payment_id_type(
let attempt = db
.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,
+ &platform.get_processor().get_processor_merchant_id(),
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
db.find_payment_intent_by_payment_id_processor_merchant_id(
&attempt.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -266,18 +266,18 @@ pub async fn find_payment_intent_from_refund_id_type(
let attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&refund.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&refund.attempt_id,
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
db.find_payment_intent_by_payment_id_processor_merchant_id(
&attempt.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -313,9 +313,9 @@ pub async fn find_payment_intent_from_mandate_id_type(
.original_payment_id
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("original_payment_id not present in mandate record")?,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -392,9 +392,9 @@ pub async fn get_mca_from_payment_intent(
let payment_attempt = db
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&payment_intent.payment_id,
- platform.get_processor().get_account().get_id(),
+ &platform.get_processor().get_processor_merchant_id(),
&payment_intent.active_attempt.get_id(),
- platform.get_processor().get_account().storage_scheme,
+ platform.get_processor().get_storage_scheme(),
platform.get_processor().get_key_store(),
)
.await
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index 0758688bf0..be644273c5 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -190,8 +190,8 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt,
payment_attempt_update,
- merchant_account.storage_scheme,
- &key_store,
+ platform.get_processor().get_storage_scheme(),
+ platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
@@ -200,8 +200,8 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
.update_payment_intent(
payment_data.payment_intent,
payment_intent_update,
- &key_store,
- merchant_account.storage_scheme,
+ platform.get_processor().get_key_store(),
+ platform.get_processor().get_storage_scheme(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index b4debf9601..ee4bd27873 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -4,8 +4,8 @@ use common_utils::id_type;
use diesel_models::enums as storage_enums;
use error_stack::ResultExt;
use hyperswitch_domain_models::{
- merchant_key_store::MerchantKeyStore,
payments::payment_attempt::{PaymentAttempt, PaymentAttemptInterface, PaymentAttemptUpdate},
+ platform::{ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme},
};
use super::MockDb;
@@ -20,10 +20,10 @@ impl PaymentAttemptInterface for MockDb {
async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
_payment_id: &common_utils::id_type::PaymentId,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_attempt_id: &str,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -33,8 +33,8 @@ impl PaymentAttemptInterface for MockDb {
async fn get_filters_for_payments(
&self,
_pi: &[hyperswitch_domain_models::payments::PaymentIntent],
- _processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payments::payment_attempt::PaymentListFilters,
StorageError,
@@ -45,7 +45,7 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_active_attempt_ids: &[String],
_connector: Option<Vec<api_models::enums::Connector>>,
_payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -54,7 +54,7 @@ impl PaymentAttemptInterface for MockDb {
_merchanat_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
_card_network: Option<Vec<storage_enums::CardNetwork>>,
_card_discovery: Option<Vec<storage_enums::CardDiscovery>>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, StorageError> {
Err(StorageError::MockDbError)?
}
@@ -62,7 +62,7 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(all(feature = "v2", feature = "olap"))]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- _merchant_id: &id_type::MerchantId,
+ _merchant_id: &ProcessorMerchantId,
_active_attempt_ids: &[String],
_connector: Option<Vec<api_models::enums::Connector>>,
_payment_method_type: Option<Vec<common_enums::PaymentMethod>>,
@@ -70,7 +70,7 @@ impl PaymentAttemptInterface for MockDb {
_authentication_type: Option<Vec<common_enums::AuthenticationType>>,
_merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
_card_network: Option<Vec<storage_enums::CardNetwork>>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, StorageError> {
Err(StorageError::MockDbError)?
}
@@ -79,9 +79,9 @@ impl PaymentAttemptInterface for MockDb {
async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
_attempt_id: &str,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ _processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -90,9 +90,9 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_id(
&self,
- _merchant_key_store: &MerchantKeyStore,
+ _merchant_key_store: &ProcessorKeyStore,
_attempt_id: &id_type::GlobalAttemptId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -102,8 +102,8 @@ impl PaymentAttemptInterface for MockDb {
async fn find_payment_attempts_by_payment_intent_id(
&self,
_id: &id_type::GlobalPaymentId,
- _merchant_key_store: &MerchantKeyStore,
- _storage_scheme: common_enums::MerchantStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -112,10 +112,10 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_connector_txn_id: &str,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -124,10 +124,10 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
- _merchant_key_store: &MerchantKeyStore,
+ _merchant_key_store: &ProcessorKeyStore,
_profile_id: &id_type::ProfileId,
_connector_transaction_id: &str,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -136,10 +136,10 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v1")]
async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_payment_id: &common_utils::id_type::PaymentId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<Vec<PaymentAttempt>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -150,8 +150,8 @@ impl PaymentAttemptInterface for MockDb {
async fn insert_payment_attempt(
&self,
payment_attempt: PaymentAttempt,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
let mut payment_attempts = self.payment_attempts.lock().await;
let payment_attempt = PaymentAttempt {
@@ -194,7 +194,7 @@ impl PaymentAttemptInterface for MockDb {
multiple_capture_count: payment_attempt.multiple_capture_count,
connector_response_reference_id: None,
amount_capturable: payment_attempt.amount_capturable,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
authentication_data: payment_attempt.authentication_data,
encoded_data: payment_attempt.encoded_data,
merchant_connector_id: payment_attempt.merchant_connector_id,
@@ -257,9 +257,9 @@ impl PaymentAttemptInterface for MockDb {
#[allow(clippy::panic)]
async fn insert_payment_attempt(
&self,
- _merchant_key_store: &MerchantKeyStore,
+ _merchant_key_store: &ProcessorKeyStore,
_payment_attempt: PaymentAttempt,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -272,8 +272,8 @@ impl PaymentAttemptInterface for MockDb {
&self,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
let mut payment_attempts = self.payment_attempts.lock().await;
@@ -306,10 +306,10 @@ impl PaymentAttemptInterface for MockDb {
#[cfg(feature = "v2")]
async fn update_payment_attempt(
&self,
- _merchant_key_store: &MerchantKeyStore,
+ _merchant_key_store: &ProcessorKeyStore,
_this: PaymentAttempt,
_payment_attempt: PaymentAttemptUpdate,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -321,9 +321,9 @@ impl PaymentAttemptInterface for MockDb {
async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
let payment_attempts = self.payment_attempts.lock().await;
@@ -344,9 +344,9 @@ impl PaymentAttemptInterface for MockDb {
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,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, StorageError> {
let payment_attempts = self.payment_attempts.lock().await;
@@ -368,9 +368,9 @@ impl PaymentAttemptInterface for MockDb {
#[allow(clippy::unwrap_used)]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
- _merchant_key_store: &MerchantKeyStore,
+ _merchant_key_store: &ProcessorKeyStore,
payment_id: &id_type::GlobalPaymentId,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, StorageError> {
let payment_attempts = self.payment_attempts.lock().await;
diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs
index c46259674e..c3e4f1fdd0 100644
--- a/crates/storage_impl/src/mock_db/payment_intent.rs
+++ b/crates/storage_impl/src/mock_db/payment_intent.rs
@@ -1,17 +1,18 @@
use common_utils::errors::CustomResult;
-use diesel_models::enums as storage_enums;
#[cfg(all(feature = "v1", feature = "olap"))]
use diesel_models::PaymentIntent as DieselPaymentIntent;
#[cfg(feature = "v1")]
use error_stack::ResultExt;
#[cfg(feature = "v1")]
use hyperswitch_domain_models::behaviour::Conversion;
+#[cfg(all(feature = "v1", feature = "olap"))]
+use hyperswitch_domain_models::platform::ProviderMerchantId;
use hyperswitch_domain_models::{
- merchant_key_store::MerchantKeyStore,
payments::{
payment_intent::{PaymentIntentInterface, PaymentIntentUpdate},
PaymentIntent,
},
+ platform::{ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme},
};
use super::MockDb;
@@ -23,10 +24,10 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intent_by_constraints(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- _key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<Vec<PaymentIntent>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -35,10 +36,10 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v2", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _merchant_id: &ProcessorMerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- _merchant_key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<
Vec<(
PaymentIntent,
@@ -52,7 +53,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt_for_platform(
&self,
- _platform_merchant_id: &common_utils::id_type::MerchantId,
+ _provider_merchant_id: &ProviderMerchantId,
_filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
) -> CustomResult<
Vec<(
@@ -68,7 +69,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_payment_intents_attempt_count_for_platform(
&self,
- _platform_merchant_id: &common_utils::id_type::MerchantId,
+ _provider_merchant_id: &ProviderMerchantId,
_filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
) -> CustomResult<i64, StorageError> {
// [#172]: Implement function for `MockDb`
@@ -78,10 +79,10 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_time_range: &common_utils::types::TimeRange,
- _key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<Vec<PaymentIntent>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -90,7 +91,7 @@ impl PaymentIntentInterface for MockDb {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
_time_range: &common_utils::types::TimeRange,
) -> CustomResult<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
@@ -101,9 +102,9 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -112,9 +113,9 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v2", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- _merchant_id: &common_utils::id_type::MerchantId,
+ _merchant_id: &ProcessorMerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<Option<String>>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
@@ -123,10 +124,10 @@ impl PaymentIntentInterface for MockDb {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- _processor_merchant_id: &common_utils::id_type::MerchantId,
+ _processor_merchant_id: &ProcessorMerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
- _key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<
Vec<(
PaymentIntent,
@@ -142,8 +143,8 @@ impl PaymentIntentInterface for MockDb {
async fn insert_payment_intent(
&self,
new: PaymentIntent,
- _key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
let mut payment_intents = self.payment_intents.lock().await;
payment_intents.push(new.clone());
@@ -157,8 +158,8 @@ impl PaymentIntentInterface for MockDb {
&self,
this: PaymentIntent,
update: PaymentIntentUpdate,
- key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
let mut payment_intents = self.payment_intents.lock().await;
let payment_intent = payment_intents
@@ -196,8 +197,8 @@ impl PaymentIntentInterface for MockDb {
&self,
_this: PaymentIntent,
_update: PaymentIntentUpdate,
- _key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
todo!()
}
@@ -208,9 +209,9 @@ impl PaymentIntentInterface for MockDb {
async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ _key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
let payment_intents = self.payment_intents.lock().await;
@@ -230,8 +231,8 @@ impl PaymentIntentInterface for MockDb {
async fn find_payment_intent_by_id(
&self,
id: &common_utils::id_type::GlobalPaymentId,
- _merchant_key_store: &MerchantKeyStore,
- _storage_scheme: storage_enums::MerchantStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let payment_intents = self.payment_intents.lock().await;
let payment_intent = payment_intents
@@ -248,8 +249,8 @@ impl PaymentIntentInterface for MockDb {
&self,
merchant_reference_id: &common_utils::id_type::PaymentReferenceId,
profile_id: &common_utils::id_type::ProfileId,
- _merchant_key_store: &MerchantKeyStore,
- _storage_scheme: &common_enums::MerchantStorageScheme,
+ _merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: &ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let payment_intents = self.payment_intents.lock().await;
let payment_intent = payment_intents
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 43c8adf337..778cd46053 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -23,8 +23,8 @@ use futures::future::{try_join_all, FutureExt};
use hyperswitch_domain_models::payments::payment_attempt::ConfirmIntentResponseUpdate;
use hyperswitch_domain_models::{
mandates::{MandateAmountData, MandateDataType, MandateDetails},
- merchant_key_store::MerchantKeyStore,
payments::payment_attempt::{PaymentAttempt, PaymentAttemptInterface, PaymentAttemptUpdate},
+ platform::{ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme},
};
#[cfg(all(feature = "v1", feature = "olap"))]
use hyperswitch_domain_models::{
@@ -61,8 +61,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn insert_payment_attempt(
&self,
payment_attempt: PaymentAttempt,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
let diesel_payment_attempt = payment_attempt
@@ -96,9 +96,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn insert_payment_attempt(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_attempt: PaymentAttempt,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
Box::pin(
@@ -129,8 +129,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
&self,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
let key_manager_state = self
@@ -164,10 +164,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn update_payment_attempt(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
@@ -200,9 +200,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let key_manager_state = self
@@ -236,9 +236,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
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,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let key_manager_state = self
@@ -270,9 +270,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_id: &common_utils::id_type::GlobalPaymentId,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
DieselPaymentAttempt::find_last_successful_or_partially_captured_attempt_by_payment_id(
@@ -297,10 +297,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
connector_txn_id: &str,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let key_manager_state = self
@@ -333,10 +333,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
profile_id: &common_utils::id_type::ProfileId,
connector_txn_id: &str,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
DieselPaymentAttempt::find_by_profile_id_connector_transaction_id(
@@ -364,10 +364,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
attempt_id: &str,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let key_manager_state = self
@@ -403,8 +403,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentListFilters, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let intents = try_join_all(pi.iter().map(|pi| async {
@@ -447,10 +447,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
payment_id: &common_utils::id_type::PaymentId,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<Vec<PaymentAttempt>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let key_manager_state = self
@@ -485,9 +485,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- _storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ _storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let key_manager_state = self
@@ -521,9 +521,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn find_payment_attempt_by_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
attempt_id: &common_utils::id_type::GlobalAttemptId,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
@@ -548,8 +548,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
async fn find_payment_attempts_by_payment_intent_id(
&self,
payment_id: &common_utils::id_type::GlobalPaymentId,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, errors::StorageError> {
use common_utils::ext_traits::AsyncExt;
@@ -584,7 +584,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
#[instrument(skip_all)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -593,7 +593,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
card_discovery: Option<Vec<common_enums::CardDiscovery>>,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
let conn = pg_connection_read_replica(self).await?;
let connector_strings = connector.as_ref().map(|connector| {
@@ -624,7 +624,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,
+ merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method_type: Option<Vec<common_enums::PaymentMethod>>,
@@ -632,7 +632,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
let conn = pg_connection_read_replica(self).await?;
@@ -665,16 +665,18 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn insert_payment_attempt(
&self,
payment_attempt: PaymentAttempt,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Insert,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Insert,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.insert_payment_attempt(payment_attempt, storage_scheme, merchant_key_store)
@@ -728,7 +730,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
connector_response_reference_id: None,
charge_id: None,
amount_capturable: payment_attempt.amount_capturable,
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
authentication_data: payment_attempt.authentication_data.clone(),
encoded_data: payment_attempt.encoded_data.clone(),
merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
@@ -810,9 +812,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
pk_id: key_str.clone(),
sk_id: field.clone(),
source: "payment_attempt".to_string(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
- self.insert_reverse_lookup(reverse_lookup, storage_scheme)
+ self.insert_reverse_lookup(reverse_lookup, storage_scheme.inner())
.await?;
let mut query_gen_conn = pg_connection_write(self).await?;
@@ -855,13 +857,13 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn insert_payment_attempt(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_attempt: PaymentAttempt,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let decided_storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
- storage_scheme,
+ storage_scheme.inner(),
Op::Insert,
))
.await;
@@ -872,7 +874,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.insert_payment_attempt(
merchant_key_store,
payment_attempt,
- decided_storage_scheme,
+ storage_scheme.retag(decided_storage_scheme),
)
.await
}
@@ -957,21 +959,23 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
&self,
this: PaymentAttempt,
payment_attempt: PaymentAttemptUpdate,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let key = PartitionKey::MerchantIdPaymentId {
merchant_id: &this.processor_merchant_id,
payment_id: &this.payment_id,
};
let field = format!("pa_{}", this.attempt_id);
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Update(key.clone(), &field, Some(&this.updated_by)),
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Update(key.clone(), &field, Some(&this.updated_by)),
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.update_payment_attempt_with_attempt_id(
@@ -1022,7 +1026,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
&this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
connector_transaction_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
}
@@ -1034,7 +1038,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
&this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
connector_transaction_id,
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
}
@@ -1050,7 +1054,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
&this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
preprocessing_id.as_str(),
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
}
@@ -1062,7 +1066,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
&this.processor_merchant_id,
updated_attempt.attempt_id.as_str(),
preprocessing_id.as_str(),
- storage_scheme,
+ storage_scheme.inner(),
)
.await?;
}
@@ -1099,10 +1103,10 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn update_payment_attempt(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
this: PaymentAttempt,
payment_attempt_update: PaymentAttemptUpdate,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let payment_attempt = Conversion::convert(this.clone())
.await
@@ -1147,7 +1151,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
Box::pin(self.update_resource(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
updated_payment_attempt_with_id,
updated_payment_attempt,
UpdateResourceParams {
@@ -1163,9 +1167,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn find_payment_attempt_last_successful_attempt_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
@@ -1176,13 +1180,15 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
merchant_key_store,
)
};
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
@@ -1216,7 +1222,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- processor_merchant_id.clone().into(),
+ processor_merchant_id.inner().clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1236,9 +1242,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
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,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
@@ -1249,13 +1255,15 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
merchant_key_store,
)
};
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::MerchantIdPaymentId {
@@ -1292,7 +1300,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- processor_merchant_id.clone().into(),
+ processor_merchant_id.inner().clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1311,9 +1319,9 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn find_payment_attempt_last_successful_or_partially_captured_attempt_by_payment_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
payment_id: &common_utils::id_type::GlobalPaymentId,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let database_call = || {
self.router_store
@@ -1326,7 +1334,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
let decided_storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
self,
- storage_scheme,
+ storage_scheme.inner(),
Op::Find,
))
.await;
@@ -1385,15 +1393,15 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v2")]
async fn find_payment_attempt_by_profile_id_connector_transaction_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
profile_id: &common_utils::id_type::ProfileId,
connector_transaction_id: &str,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
Box::pin(self.find_resource_by_id(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
DieselPaymentAttempt::find_by_profile_id_connector_transaction_id(
&conn,
profile_id,
@@ -1411,18 +1419,20 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[cfg(feature = "v1")]
async fn find_payment_attempt_by_processor_merchant_id_connector_txn_id(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
connector_txn_id: &str,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_processor_merchant_id_connector_txn_id(
@@ -1439,7 +1449,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
processor_merchant_id.get_string_repr()
);
let lookup = fallback_reverse_lookup_not_found!(
- self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
+ self.get_lookup_by_lookup_id(&lookup_id, storage_scheme.inner())
.await,
self.router_store
.find_payment_attempt_by_processor_merchant_id_connector_txn_id(
@@ -1470,7 +1480,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- processor_merchant_id.clone().into(),
+ processor_merchant_id.inner().clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1497,18 +1507,20 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
attempt_id: &str,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_payment_id_processor_merchant_id_attempt_id(
@@ -1542,7 +1554,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- processor_merchant_id.clone().into(),
+ processor_merchant_id.inner().clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1570,17 +1582,19 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn find_payment_attempt_by_attempt_id_processor_merchant_id(
&self,
attempt_id: &str,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_attempt_by_attempt_id_processor_merchant_id(
@@ -1597,7 +1611,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
processor_merchant_id.get_string_repr()
);
let lookup = fallback_reverse_lookup_not_found!(
- self.get_lookup_by_lookup_id(&lookup_id, storage_scheme)
+ self.get_lookup_by_lookup_id(&lookup_id, storage_scheme.inner())
.await,
self.router_store
.find_payment_attempt_by_attempt_id_processor_merchant_id(
@@ -1628,7 +1642,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
key_manager_state,
diesel_payment_attempt,
merchant_key_store.key.get_inner(),
- processor_merchant_id.clone().into(),
+ processor_merchant_id.inner().clone().into(),
)
.await
.change_context(redis_interface::errors::RedisError::UnknownResult)
@@ -1654,14 +1668,14 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn find_payment_attempt_by_id(
&self,
- merchant_key_store: &MerchantKeyStore,
+ merchant_key_store: &ProcessorKeyStore,
attempt_id: &common_utils::id_type::GlobalAttemptId,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
Box::pin(self.find_resource_by_id(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
DieselPaymentAttempt::find_by_id(&conn, attempt_id),
FindResourceBy::LookupId(label::get_global_id_label(attempt_id)),
))
@@ -1673,13 +1687,13 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn find_payment_attempts_by_payment_intent_id(
&self,
payment_id: &common_utils::id_type::GlobalPaymentId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentAttempt>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
Box::pin(self.filter_resources(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
DieselPaymentAttempt::find_by_payment_id(&conn, payment_id),
|_| true,
FilterResourceParams {
@@ -1695,18 +1709,20 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn find_attempts_by_processor_merchant_id_payment_id(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
payment_id: &common_utils::id_type::PaymentId,
- storage_scheme: MerchantStorageScheme,
- merchant_key_store: &MerchantKeyStore,
+ storage_scheme: ProcessorStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
) -> error_stack::Result<Vec<PaymentAttempt>, errors::StorageError> {
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
- match storage_scheme {
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentAttempt>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_attempts_by_processor_merchant_id_payment_id(
@@ -1772,8 +1788,8 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
async fn get_filters_for_payments(
&self,
pi: &[PaymentIntent],
- processor_merchant_id: &common_utils::id_type::MerchantId,
- storage_scheme: MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentListFilters, errors::StorageError> {
self.router_store
.get_filters_for_payments(pi, processor_merchant_id, storage_scheme)
@@ -1784,7 +1800,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn get_total_count_of_filtered_payment_attempts(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method: Option<Vec<common_enums::PaymentMethod>>,
@@ -1793,7 +1809,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
card_discovery: Option<Vec<common_enums::CardDiscovery>>,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
.get_total_count_of_filtered_payment_attempts(
@@ -1814,7 +1830,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,
+ merchant_id: &ProcessorMerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<api_models::enums::Connector>>,
payment_method_type: Option<Vec<common_enums::PaymentMethod>>,
@@ -1822,7 +1838,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
authentication_type: Option<Vec<common_enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<common_enums::CardNetwork>>,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
.get_total_count_of_filtered_payment_attempts(
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index 499d7a6b72..5e276d66d4 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -7,8 +7,11 @@ use common_utils::ext_traits::AsyncExt;
use common_utils::{ext_traits::Encode, fallback_reverse_lookup_not_found};
#[cfg(feature = "olap")]
use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl};
+#[cfg(feature = "v2")]
+use diesel_models::enums::MerchantStorageScheme;
#[cfg(feature = "v1")]
use diesel_models::errors::DatabaseError;
+use diesel_models::payment_intent::PaymentIntent as DieselPaymentIntent;
#[cfg(feature = "v1")]
use diesel_models::payment_intent::PaymentIntentUpdate as DieselPaymentIntentUpdate;
#[cfg(feature = "v2")]
@@ -27,9 +30,6 @@ use diesel_models::schema_v2::{
payment_attempt::{self as payment_attempt_schema, dsl as pa_dsl},
payment_intent::dsl as pi_dsl,
};
-use diesel_models::{
- enums::MerchantStorageScheme, payment_intent::PaymentIntent as DieselPaymentIntent,
-};
use error_stack::ResultExt;
#[cfg(all(feature = "v1", feature = "olap"))]
use futures::future::try_join_all;
@@ -37,13 +37,15 @@ use futures::future::try_join_all;
use hyperswitch_domain_models::payments::{
payment_attempt::PaymentAttempt, payment_intent::PaymentIntentFetchConstraints,
};
+#[cfg(all(feature = "v1", feature = "olap"))]
+use hyperswitch_domain_models::platform::ProviderMerchantId;
use hyperswitch_domain_models::{
behaviour::Conversion,
- merchant_key_store::MerchantKeyStore,
payments::{
payment_intent::{PaymentIntentInterface, PaymentIntentUpdate},
PaymentIntent,
},
+ platform::{ProcessorKeyStore, ProcessorMerchantId, ProcessorStorageScheme},
};
#[cfg(feature = "v2")]
use redis_interface::HsetnxReply;
@@ -79,8 +81,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
async fn insert_payment_intent(
&self,
payment_intent: PaymentIntent,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let processor_merchant_id = payment_intent.processor_merchant_id.clone();
let payment_id = payment_intent.get_id().to_owned();
@@ -119,7 +121,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
Box::pin(self.insert_resource_old(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
create_resource_fut,
diesel_payment_intent,
InsertResourceParams {
@@ -137,10 +139,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
async fn insert_payment_intent(
&self,
payment_intent: PaymentIntent,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
- match storage_scheme {
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.insert_payment_intent(payment_intent, merchant_key_store, storage_scheme)
@@ -175,9 +177,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
pk_id: key_str.clone(),
sk_id: field.clone(),
source: "payment_intent".to_string(),
- updated_by: storage_scheme.to_string(),
+ updated_by: storage_scheme.inner().to_string(),
};
- self.insert_reverse_lookup(reverse_lookup, storage_scheme)
+ self.insert_reverse_lookup(reverse_lookup, storage_scheme.inner())
.await?;
}
@@ -217,10 +219,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[instrument(skip_all)]
async fn get_filtered_payment_intents_attempt(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, Option<PaymentAttempt>)>, StorageError> {
self.router_store
.get_filtered_payment_intents_attempt(
@@ -238,8 +240,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
&self,
this: PaymentIntent,
payment_intent_update: PaymentIntentUpdate,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let processor_merchant_id = this.processor_merchant_id.clone();
let payment_id = this.get_id().to_owned();
@@ -286,7 +288,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
Box::pin(self.update_resource_old(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
update_resource_fut,
diesel_intent,
UpdateResourceParams {
@@ -303,10 +305,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
&self,
this: PaymentIntent,
payment_intent_update: PaymentIntentUpdate,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
- match storage_scheme {
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.update_payment_intent(
@@ -380,14 +382,14 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
Box::pin(self.find_resource_by_id_old(
merchant_key_store,
- storage_scheme,
+ storage_scheme.inner(),
DieselPaymentIntent::find_by_payment_id_processor_merchant_id(
&conn,
payment_id,
@@ -409,15 +411,17 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
async fn find_payment_intent_by_id(
&self,
id: &common_utils::id_type::GlobalPaymentId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
- let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselPaymentIntent>(
- self,
- storage_scheme,
- Op::Find,
- ))
- .await;
+ let storage_scheme = storage_scheme.retag(
+ Box::pin(decide_storage_scheme::<_, DieselPaymentIntent>(
+ self,
+ storage_scheme.inner(),
+ Op::Find,
+ ))
+ .await,
+ );
let database_call = || async {
let conn = pg_connection_read(self).await?;
@@ -430,7 +434,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
})
};
- let diesel_payment_intent = match storage_scheme {
+ let diesel_payment_intent = match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => database_call().await,
MerchantStorageScheme::RedisKv => {
let key = PartitionKey::GlobalPaymentId { id };
@@ -468,10 +472,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intent_by_constraints(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
filters: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
self.router_store
.filter_payment_intent_by_constraints(
@@ -486,7 +490,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt_for_platform(
&self,
- platform_merchant_id: &common_utils::id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &PaymentIntentFetchConstraints,
) -> error_stack::Result<
Vec<(
@@ -496,28 +500,28 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
StorageError,
> {
self.router_store
- .get_filtered_payment_intents_attempt_for_platform(platform_merchant_id, filters)
+ .get_filtered_payment_intents_attempt_for_platform(provider_merchant_id, filters)
.await
}
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_payment_intents_attempt_count_for_platform(
&self,
- platform_merchant_id: &common_utils::id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &PaymentIntentFetchConstraints,
) -> error_stack::Result<i64, StorageError> {
self.router_store
- .get_payment_intents_attempt_count_for_platform(platform_merchant_id, filters)
+ .get_payment_intents_attempt_count_for_platform(provider_merchant_id, filters)
.await
}
#[cfg(all(feature = "v1", feature = "olap"))]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
time_range: &common_utils::types::TimeRange,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
self.router_store
.filter_payment_intents_by_time_range_constraints(
@@ -532,7 +536,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
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> {
@@ -544,10 +548,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_payment_intents_attempt(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
filters: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
self.router_store
.get_filtered_payment_intents_attempt(
@@ -562,9 +566,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v1", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
self.router_store
.get_filtered_active_attempt_ids_for_total_count(
@@ -578,9 +582,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
#[cfg(all(feature = "v2", feature = "olap"))]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- merchant_id: &common_utils::id_type::MerchantId,
+ merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- storage_scheme: MerchantStorageScheme,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<Option<String>>, StorageError> {
self.router_store
.get_filtered_active_attempt_ids_for_total_count(
@@ -596,10 +600,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
&self,
merchant_reference_id: &common_utils::id_type::PaymentReferenceId,
profile_id: &common_utils::id_type::ProfileId,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: &MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: &ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
- match storage_scheme {
+ match storage_scheme.inner() {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.find_payment_intent_by_merchant_reference_id_profile_id(
@@ -618,7 +622,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
);
let lookup = fallback_reverse_lookup_not_found!(
- self.get_lookup_by_lookup_id(&lookup_id, *storage_scheme)
+ self.get_lookup_by_lookup_id(&lookup_id, storage_scheme.inner())
.await,
self.router_store
.find_payment_intent_by_merchant_reference_id_profile_id(
@@ -685,8 +689,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
async fn insert_payment_intent(
&self,
payment_intent: PaymentIntent,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_write(self).await?;
let diesel_payment_intent = Box::pin(
@@ -719,8 +723,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
&self,
this: PaymentIntent,
payment_intent: PaymentIntentUpdate,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_write(self).await?;
let diesel_payment_intent_update = DieselPaymentIntentUpdate::from(payment_intent);
@@ -754,8 +758,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
&self,
this: PaymentIntent,
payment_intent: PaymentIntentUpdate,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_write(self).await?;
let diesel_payment_intent_update = PaymentIntentUpdateInternal::try_from(payment_intent)
@@ -788,9 +792,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
async fn find_payment_intent_by_payment_id_processor_merchant_id(
&self,
payment_id: &common_utils::id_type::PaymentId,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: MerchantStorageScheme,
+ processor_merchant_id: &ProcessorMerchantId,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
@@ -823,8 +827,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
async fn find_payment_intent_by_id(
&self,
id: &common_utils::id_type::GlobalPaymentId,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
let diesel_payment_intent = DieselPaymentIntent::find_by_global_id(&conn, id)
@@ -853,8 +857,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
&self,
merchant_reference_id: &common_utils::id_type::PaymentReferenceId,
profile_id: &common_utils::id_type::ProfileId,
- merchant_key_store: &MerchantKeyStore,
- _storage_scheme: &MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ _storage_scheme: &ProcessorStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let conn = pg_connection_read(self).await?;
let diesel_payment_intent = DieselPaymentIntent::find_by_merchant_reference_id_profile_id(
@@ -884,10 +888,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn filter_payment_intent_by_constraints(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
filters: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
use futures::{future::try_join_all, FutureExt};
@@ -897,7 +901,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
// when https://github.com/rust-lang/rust/issues/52662 becomes stable
let mut query = diesel_models::boxed_list_query!(
DieselPaymentIntent,
- scope = pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()),
+ scope = pi_dsl::processor_merchant_id.eq(processor_merchant_id.inner().to_owned()),
order = pi_dsl::created_at.desc()
);
@@ -1003,7 +1007,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_filtered_payment_intents_attempt_for_platform(
&self,
- platform_merchant_id: &common_utils::id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &PaymentIntentFetchConstraints,
) -> error_stack::Result<
Vec<(
@@ -1020,8 +1024,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
payment_attempt_schema::table
.on(pa_dsl::attempt_id.eq(pi_dsl::active_attempt_id)),
)
- .filter(pi_dsl::merchant_id.eq(platform_merchant_id.to_owned()))
- .filter(pa_dsl::merchant_id.eq(platform_merchant_id.to_owned())),
+ .filter(pi_dsl::merchant_id.eq(provider_merchant_id.inner().to_owned()))
+ .filter(pa_dsl::merchant_id.eq(provider_merchant_id.inner().to_owned())),
);
query = match filters {
@@ -1165,7 +1169,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_payment_intents_attempt_count_for_platform(
&self,
- platform_merchant_id: &common_utils::id_type::MerchantId,
+ provider_merchant_id: &ProviderMerchantId,
filters: &PaymentIntentFetchConstraints,
) -> error_stack::Result<i64, StorageError> {
let conn = connection::pg_connection_read(self).await?;
@@ -1177,8 +1181,8 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.on(pa_dsl::attempt_id.eq(pi_dsl::active_attempt_id)),
)
.count()
- .filter(pi_dsl::merchant_id.eq(platform_merchant_id.to_owned()))
- .filter(pa_dsl::merchant_id.eq(platform_merchant_id.to_owned())),
+ .filter(pi_dsl::merchant_id.eq(provider_merchant_id.inner().to_owned()))
+ .filter(pa_dsl::merchant_id.eq(provider_merchant_id.inner().to_owned())),
);
query = match filters {
@@ -1281,10 +1285,10 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn filter_payment_intents_by_time_range_constraints(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
time_range: &common_utils::types::TimeRange,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
// TODO: Remove this redundant function
let payment_filters = (*time_range).into();
@@ -1301,7 +1305,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_intent_status_with_count(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
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> {
@@ -1311,7 +1315,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
<DieselPaymentIntent as HasTable>::table()
.group_by(pi_dsl::status)
.select((pi_dsl::status, diesel::dsl::count_star()))
- .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned())),
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.inner().to_owned())),
);
if let Some(profile_id) = profile_id_list {
@@ -1344,22 +1348,22 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_filtered_payment_intents_attempt(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
let conn = connection::pg_connection_read(self).await?;
let conn = conn.raw_connection();
let mut query = diesel_models::list::into_boxed_list(
DieselPaymentIntent::table()
- .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.inner().to_owned()))
.inner_join(
payment_attempt_schema::table
.on(pa_dsl::attempt_id.eq(pi_dsl::active_attempt_id)),
)
// Ensure merchant_ids match, as different merchants can share payment/attempt IDs.
- .filter(pa_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned())),
+ .filter(pa_dsl::processor_merchant_id.eq(processor_merchant_id.inner().to_owned())),
);
query = match constraints {
@@ -1537,7 +1541,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
keymanager_state,
pi,
merchant_key_store.key.get_inner(),
- processor_merchant_id.to_owned().into(),
+ processor_merchant_id.inner().to_owned().into(),
)
.await
.change_context(StorageError::DecryptionError)?;
@@ -1565,10 +1569,10 @@ 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,
+ merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- merchant_key_store: &MerchantKeyStore,
- storage_scheme: MerchantStorageScheme,
+ merchant_key_store: &ProcessorKeyStore,
+ storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, Option<PaymentAttempt>)>, StorageError> {
use diesel::NullableExpressionMethods as _;
use futures::{future::try_join_all, FutureExt};
@@ -1578,7 +1582,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
// Filtering on merchant_id for payment_attempt is not required for v2 as payment_attempt_ids are globally unique
let mut query = diesel_models::list::into_boxed_list(
DieselPaymentIntent::table()
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pi_dsl::merchant_id.eq(merchant_id.inner().to_owned()))
.left_join(
payment_attempt_schema::table
.on(pi_dsl::active_attempt_id.eq(pa_dsl::id.nullable())),
@@ -1752,7 +1756,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.attach_printable("Missing KeyManagerState")?,
pi,
merchant_key_store.key.get_inner(),
- merchant_id.to_owned().into(),
+ merchant_id.inner().to_owned().into(),
);
let payment_attempt = pa
.async_map(|val| {
@@ -1760,7 +1764,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
keymanager_state,
val,
merchant_key_store.key.get_inner(),
- merchant_id.to_owned().into(),
+ merchant_id.inner().to_owned().into(),
)
})
.map(|val| val.transpose());
@@ -1779,15 +1783,15 @@ 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,
+ merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<Option<String>>, StorageError> {
let conn = connection::pg_connection_read(self).await?;
let mut query = diesel_models::list::into_boxed_list(
DieselPaymentIntent::table()
.select(pi_dsl::active_attempt_id)
- .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned()))
+ .filter(pi_dsl::merchant_id.eq(merchant_id.inner().to_owned()))
.order(pi_dsl::created_at.desc()),
);
@@ -1866,15 +1870,15 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
#[instrument(skip_all)]
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
- processor_merchant_id: &common_utils::id_type::MerchantId,
+ processor_merchant_id: &ProcessorMerchantId,
constraints: &PaymentIntentFetchConstraints,
- _storage_scheme: MerchantStorageScheme,
+ _storage_scheme: ProcessorStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
let conn = connection::pg_connection_read(self).await?;
let mut query = diesel_models::list::into_boxed_list(
DieselPaymentIntent::table()
.select(pi_dsl::active_attempt_id)
- .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.to_owned()))
+ .filter(pi_dsl::processor_merchant_id.eq(processor_merchant_id.inner().to_owned()))
.order(pi_dsl::created_at.desc()),
);
diff --git a/crates/storage_impl/src/platform_wrapper.rs b/crates/storage_impl/src/platform_wrapper.rs
index 9591d8d295..21bfe90f69 100644
--- a/crates/storage_impl/src/platform_wrapper.rs
+++ b/crates/storage_impl/src/platform_wrapper.rs
@@ -2,6 +2,9 @@
///
/// Purpose: Prevent mixing Provider and Processor credentials when making DB calls.
///
+/// Payment intent and payment attempt no longer need one: their interfaces take tagged
+/// credentials. The rest are for interfaces that are not typed yet.
+///
/// Use wrappers when:
/// - You have Platform and need DB calls
/// - Multiple credentials needed (key_store, merchant_id, storage_scheme)
@@ -14,7 +17,5 @@
/// Never mix Provider and Processor credentials or pass Platform to wrappers.
/// Extract the specific context (Provider/Processor) and pass that instead.
///
-// TODO: Remove wrappers and migrate to DB interface with typed parameters (ProviderMerchantId, ProcessorMerchantId, etc.) once the platform stabilizes
+// TODO: Type the remaining interfaces the same way payments are typed, then drop this module.
pub mod business_profile;
-pub mod payment_attempt;
-pub mod payment_intent;
diff --git a/crates/storage_impl/src/platform_wrapper/payment_attempt.rs b/crates/storage_impl/src/platform_wrapper/payment_attempt.rs
deleted file mode 100644
index a0c6d97cbf..0000000000
--- a/crates/storage_impl/src/platform_wrapper/payment_attempt.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-use common_utils::errors::CustomResult;
-use hyperswitch_domain_models::{
- payments::payment_attempt::{PaymentAttempt, PaymentAttemptInterface},
- platform::Processor,
-};
-
-use crate::StorageError;
-
-#[cfg(feature = "v1")]
-pub async fn insert_payment_attempt<S>(
- store: &S,
- processor: &Processor,
- payment_attempt: PaymentAttempt,
-) -> CustomResult<PaymentAttempt, StorageError>
-where
- S: PaymentAttemptInterface<Error = StorageError> + ?Sized,
-{
- store
- .insert_payment_attempt(
- payment_attempt,
- processor.get_account().storage_scheme,
- processor.get_key_store(),
- )
- .await
-}
-
-#[cfg(feature = "v2")]
-pub async fn insert_payment_attempt<S>(
- store: &S,
- processor: &Processor,
- payment_attempt: PaymentAttempt,
-) -> CustomResult<PaymentAttempt, StorageError>
-where
- S: PaymentAttemptInterface<Error = StorageError> + ?Sized,
-{
- store
- .insert_payment_attempt(
- processor.get_key_store(),
- payment_attempt,
- processor.get_account().storage_scheme,
- )
- .await
-}
diff --git a/crates/storage_impl/src/platform_wrapper/payment_intent.rs b/crates/storage_impl/src/platform_wrapper/payment_intent.rs
deleted file mode 100644
index 959c7179fd..0000000000
--- a/crates/storage_impl/src/platform_wrapper/payment_intent.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use common_utils::errors::CustomResult;
-use hyperswitch_domain_models::{
- payments::{payment_intent::PaymentIntentInterface, PaymentIntent},
- platform::Processor,
-};
-
-use crate::StorageError;
-
-pub async fn insert_payment_intent<S>(
- store: &S,
- processor: &Processor,
- payment_intent: PaymentIntent,
-) -> CustomResult<PaymentIntent, StorageError>
-where
- S: PaymentIntentInterface<Error = StorageError> + ?Sized,
-{
- store
- .insert_payment_intent(
- payment_intent,
- processor.get_key_store(),
- processor.get_account().storage_scheme,
- )
- .await
-}
diff --git a/crates/subscriptions/src/core/subscription_handler.rs b/crates/subscriptions/src/core/subscription_handler.rs
index b9bbda1e94..dd40c187cc 100644
--- a/crates/subscriptions/src/core/subscription_handler.rs
+++ b/crates/subscriptions/src/core/subscription_handler.rs
@@ -378,6 +378,7 @@ impl SubscriptionWithHandler<'_> {
.platform
.get_processor()
.get_key_store()
+ .inner()
.clone(),
}
}