refactor: move merchant_key_store table to accounts schema (#7746)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Hrithikesh
2025-04-08 17:19:46 +05:30
committed by GitHub
parent 5d5dbe0c26
commit e88672c97c
13 changed files with 180 additions and 38 deletions

View File

@ -3946,7 +3946,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
.or(Some(common_utils::consts::DEFAULT_ORDER_FULFILLMENT_TIME)),
order_fulfillment_time_origin: self.order_fulfillment_time_origin,
default_fallback_routing: None,
should_collect_cvv_during_payment: false,
should_collect_cvv_during_payment: None,
tax_connector_id: self.tax_connector_id,
is_tax_connector_enabled: self.is_tax_connector_enabled,
is_network_tokenization_enabled: self.is_network_tokenization_enabled,

View File

@ -168,6 +168,7 @@ pub trait AccountsStorageInterface:
+ merchant_account::MerchantAccountInterface
+ business_profile::ProfileInterface
+ merchant_connector_account::MerchantConnectorAccountInterface
+ merchant_key_store::MerchantKeyStoreInterface
+ 'static
{
}

View File

@ -63,7 +63,7 @@ impl MerchantKeyStoreInterface for Store {
merchant_key_store: domain::MerchantKeyStore,
key: &Secret<Vec<u8>>,
) -> CustomResult<domain::MerchantKeyStore, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
let conn = connection::pg_accounts_connection_write(self).await?;
let merchant_id = merchant_key_store.merchant_id.clone();
merchant_key_store
.construct_new()
@ -85,7 +85,7 @@ impl MerchantKeyStoreInterface for Store {
key: &Secret<Vec<u8>>,
) -> CustomResult<domain::MerchantKeyStore, errors::StorageError> {
let fetch_func = || async {
let conn = connection::pg_connection_read(self).await?;
let conn = connection::pg_accounts_connection_read(self).await?;
diesel_models::merchant_key_store::MerchantKeyStore::find_by_merchant_id(
&conn,
@ -127,7 +127,7 @@ impl MerchantKeyStoreInterface for Store {
merchant_id: &common_utils::id_type::MerchantId,
) -> CustomResult<bool, errors::StorageError> {
let delete_func = || async {
let conn = connection::pg_connection_write(self).await?;
let conn = connection::pg_accounts_connection_write(self).await?;
diesel_models::merchant_key_store::MerchantKeyStore::delete_by_merchant_id(
&conn,
merchant_id,
@ -163,7 +163,7 @@ impl MerchantKeyStoreInterface for Store {
key: &Secret<Vec<u8>>,
) -> CustomResult<Vec<domain::MerchantKeyStore>, errors::StorageError> {
let fetch_func = || async {
let conn = connection::pg_connection_read(self).await?;
let conn = connection::pg_accounts_connection_read(self).await?;
diesel_models::merchant_key_store::MerchantKeyStore::list_multiple_key_stores(
&conn,
@ -190,7 +190,7 @@ impl MerchantKeyStoreInterface for Store {
from: u32,
to: u32,
) -> CustomResult<Vec<domain::MerchantKeyStore>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
let conn = connection::pg_accounts_connection_read(self).await?;
let stores = diesel_models::merchant_key_store::MerchantKeyStore::list_all_key_stores(
&conn, from, to,
)

View File

@ -9,6 +9,8 @@ use cards::CardNumber;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use cards::{CardNumber, NetworkToken};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use common_types::primitive_wrappers;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
use common_utils::generate_id;
use common_utils::id_type;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
@ -123,7 +125,7 @@ impl VaultingInterface for VaultDelete {
pub struct SavedPMLPaymentsInfo {
pub payment_intent: storage::PaymentIntent,
pub profile: domain::Profile,
pub collect_cvv_during_payment: bool,
pub collect_cvv_during_payment: Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,
pub off_session_payment_flag: bool,
pub is_connector_agnostic_mit_enabled: bool,
}