refactor(merchant_account_v2): recreate id for merchant_account v2 (#5439)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-07-26 12:39:34 +05:30
committed by GitHub
parent 2d235a64e9
commit 93976db30a
18 changed files with 438 additions and 119 deletions

View File

@ -22,17 +22,14 @@ use api_models::{
};
use base64::Engine;
use common_utils::types::keymanager::KeyManagerState;
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use common_utils::types::keymanager::{Identifier, ToEncryptable};
pub use common_utils::{
crypto,
ext_traits::{ByteSliceExt, BytesExt, Encode, StringExt, ValueExt},
fp_utils::when,
validation::validate_email,
};
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use common_utils::{
id_type,
types::keymanager::{Identifier, ToEncryptable},
};
use error_stack::ResultExt;
use hyperswitch_domain_models::payments::PaymentIntent;
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
@ -677,15 +674,15 @@ pub trait CustomerAddress {
address_details: payments::AddressDetails,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
merchant_id: id_type::MerchantId,
merchant_id: common_utils::id_type::MerchantId,
) -> CustomResult<storage::AddressUpdate, common_utils::errors::CryptoError>;
async fn get_domain_address(
&self,
state: &SessionState,
address_details: payments::AddressDetails,
merchant_id: &id_type::MerchantId,
customer_id: &id_type::CustomerId,
merchant_id: &common_utils::id_type::MerchantId,
customer_id: &common_utils::id_type::CustomerId,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
) -> CustomResult<domain::CustomerAddress, common_utils::errors::CryptoError>;
@ -700,7 +697,7 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
address_details: payments::AddressDetails,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
merchant_id: id_type::MerchantId,
merchant_id: common_utils::id_type::MerchantId,
) -> CustomResult<storage::AddressUpdate, common_utils::errors::CryptoError> {
let encrypted_data = batch_encrypt(
&state.into(),
@ -736,8 +733,8 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
&self,
state: &SessionState,
address_details: payments::AddressDetails,
merchant_id: &id_type::MerchantId,
customer_id: &id_type::CustomerId,
merchant_id: &common_utils::id_type::MerchantId,
customer_id: &common_utils::id_type::CustomerId,
key: &[u8],
storage_scheme: storage::enums::MerchantStorageScheme,
) -> CustomResult<domain::CustomerAddress, common_utils::errors::CryptoError> {
@ -784,7 +781,7 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
pub fn add_apple_pay_flow_metrics(
apple_pay_flow: &Option<domain::ApplePayFlow>,
connector: Option<String>,
merchant_id: id_type::MerchantId,
merchant_id: common_utils::id_type::MerchantId,
) {
if let Some(flow) = apple_pay_flow {
match flow {
@ -818,7 +815,7 @@ pub fn add_apple_pay_payment_status_metrics(
payment_attempt_status: enums::AttemptStatus,
apple_pay_flow: Option<domain::ApplePayFlow>,
connector: Option<String>,
merchant_id: id_type::MerchantId,
merchant_id: common_utils::id_type::MerchantId,
) {
if payment_attempt_status == enums::AttemptStatus::Charged {
if let Some(flow) = apple_pay_flow {