Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(storage_impl): Move Conversion impl for business_profile to storage_impl crate (#11806)
Anurag Thakure5199cff27ea
diff --git a/Cargo.lock b/Cargo.lockindex fb9d55be6b..0068dd11c2 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -9437,6 +9437,7 @@ dependencies = ["bb8","bytes 1.10.1","common_enums",+ "common_types","common_utils","config","crc32fast",diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rsindex 7747341a8e..c1ea33bcfe 100644--- a/crates/hyperswitch_domain_models/src/business_profile.rs+++ b/crates/hyperswitch_domain_models/src/business_profile.rs@@ -4,31 +4,22 @@ use common_enums::enums as api_enums;use common_types::{domain::AcquirerConfig, primitive_wrappers};use common_utils::{crypto::{OptionalEncryptableName, OptionalEncryptableValue},- date_time,- encryption::Encryption,errors::{CustomResult, ValidationError},ext_traits::{OptionExt, ValueExt},- pii, type_name,- types::keymanager,+ pii,};#[cfg(feature = "v2")]use diesel_models::business_profile::RevenueRecoveryAlgorithmData;use diesel_models::business_profile::{- self as storage_types, AuthenticationConnectorDetails, BusinessPaymentLinkConfig,- BusinessPayoutLinkConfig, CardTestingGuardConfig, ExternalVaultConnectorDetails,- PaymentMethodBlockingConfig, ProfileUpdateInternal, SurchargeConnectorDetails, WebhookDetails,+ AuthenticationConnectorDetails, BusinessPaymentLinkConfig, BusinessPayoutLinkConfig,+ CardTestingGuardConfig, ExternalVaultConnectorDetails, PaymentMethodBlockingConfig,+ SurchargeConnectorDetails, WebhookDetails,};use error_stack::ResultExt;-use hyperswitch_masking::{ExposeInterface, PeekInterface, Secret};+use hyperswitch_masking::ExposeInterface;use router_env::logger;-use crate::{- behaviour::Conversion,- errors::api_error_response,- merchant_key_store::MerchantKeyStore,- payments,- type_encryption::{crypto_operation, AsyncLift, CryptoOperation},-};+use crate::{errors::api_error_response, merchant_key_store::MerchantKeyStore, payments};#[cfg(feature = "v1")]#[derive(Clone, Debug)]pub struct Profile {@@ -336,7 +327,7 @@ impl From<ProfileSetter> for Profile {merchant_business_country: value.merchant_business_country,is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,is_pre_network_tokenization_enabled: value.is_pre_network_tokenization_enabled,- three_ds_decision_rule_algorithm: None, // three_ds_decision_rule_algorithm is not yet created during profile creation+ three_ds_decision_rule_algorithm: None,acquirer_config_map: None,merchant_category_code: value.merchant_category_code,merchant_country_code: value.merchant_country_code,@@ -353,6 +344,148 @@ impl From<ProfileSetter> for Profile {}}+#[cfg(feature = "v1")]+pub struct ProfileDbBuilder {+ pub profile_id: common_utils::id_type::ProfileId,+ pub merchant_id: common_utils::id_type::MerchantId,+ pub profile_name: String,+ pub created_at: time::PrimitiveDateTime,+ pub modified_at: time::PrimitiveDateTime,+ pub return_url: Option<String>,+ pub enable_payment_response_hash: bool,+ pub payment_response_hash_key: Option<String>,+ pub redirect_to_merchant_with_http_post: bool,+ pub webhook_details: Option<WebhookDetails>,+ pub metadata: Option<pii::SecretSerdeValue>,+ pub routing_algorithm: Option<serde_json::Value>,+ pub intent_fulfillment_time: Option<i64>,+ pub frm_routing_algorithm: Option<serde_json::Value>,+ pub payout_routing_algorithm: Option<serde_json::Value>,+ pub is_recon_enabled: bool,+ pub applepay_verified_domains: Option<Vec<String>>,+ pub payment_link_config: Option<BusinessPaymentLinkConfig>,+ pub session_expiry: Option<i64>,+ pub authentication_connector_details: Option<AuthenticationConnectorDetails>,+ pub payout_link_config: Option<BusinessPayoutLinkConfig>,+ pub is_extended_card_info_enabled: Option<bool>,+ pub extended_card_info_config: Option<pii::SecretSerdeValue>,+ pub is_connector_agnostic_mit_enabled: Option<bool>,+ pub use_billing_as_payment_method_billing: Option<bool>,+ pub collect_shipping_details_from_wallet_connector: Option<bool>,+ pub collect_billing_details_from_wallet_connector: Option<bool>,+ pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue,+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,+ pub tax_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub is_tax_connector_enabled: bool,+ pub is_l2_l3_enabled: bool,+ pub version: common_enums::ApiVersion,+ pub dynamic_routing_algorithm: Option<serde_json::Value>,+ pub is_network_tokenization_enabled: bool,+ pub is_auto_retries_enabled: bool,+ pub max_auto_retries_enabled: Option<i16>,+ pub always_request_extended_authorization:+ Option<primitive_wrappers::AlwaysRequestExtendedAuthorization>,+ pub is_click_to_pay_enabled: bool,+ pub authentication_product_ids:+ Option<common_types::payments::AuthenticationConnectorAccountMap>,+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,+ pub card_testing_secret_key: OptionalEncryptableName,+ pub is_clear_pan_retries_enabled: bool,+ pub force_3ds_challenge: bool,+ pub is_debit_routing_enabled: bool,+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ pub is_iframe_redirection_enabled: Option<bool>,+ pub is_pre_network_tokenization_enabled: bool,+ pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,+ pub acquirer_config_map: Option<common_types::domain::AcquirerConfigBucket>,+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,+ pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,+ pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,+ pub is_manual_retry_enabled: Option<bool>,+ pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,+ pub external_vault_details: ExternalVaultDetails,+ pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,+ pub network_tokenization_credentials: OptionalEncryptableValue,+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,+ pub default_fallback_routing: Option<pii::SecretSerdeValue>,+}++#[cfg(feature = "v1")]+impl From<ProfileDbBuilder> for Profile {+ fn from(value: ProfileDbBuilder) -> Self {+ Self {+ profile_id: value.profile_id,+ merchant_id: value.merchant_id,+ profile_name: value.profile_name,+ created_at: value.created_at,+ modified_at: value.modified_at,+ return_url: value.return_url,+ enable_payment_response_hash: value.enable_payment_response_hash,+ payment_response_hash_key: value.payment_response_hash_key,+ redirect_to_merchant_with_http_post: value.redirect_to_merchant_with_http_post,+ webhook_details: value.webhook_details,+ metadata: value.metadata,+ routing_algorithm: value.routing_algorithm,+ intent_fulfillment_time: value.intent_fulfillment_time,+ frm_routing_algorithm: value.frm_routing_algorithm,+ payout_routing_algorithm: value.payout_routing_algorithm,+ is_recon_enabled: value.is_recon_enabled,+ applepay_verified_domains: value.applepay_verified_domains,+ payment_link_config: value.payment_link_config,+ session_expiry: value.session_expiry,+ authentication_connector_details: value.authentication_connector_details,+ payout_link_config: value.payout_link_config,+ is_extended_card_info_enabled: value.is_extended_card_info_enabled,+ extended_card_info_config: value.extended_card_info_config,+ is_connector_agnostic_mit_enabled: value.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: value.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: value+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: value+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: value.outgoing_webhook_custom_http_headers,+ always_collect_billing_details_from_wallet_connector: value+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: value+ .always_collect_shipping_details_from_wallet_connector,+ tax_connector_id: value.tax_connector_id,+ is_tax_connector_enabled: value.is_tax_connector_enabled,+ is_l2_l3_enabled: value.is_l2_l3_enabled,+ version: value.version,+ dynamic_routing_algorithm: value.dynamic_routing_algorithm,+ is_network_tokenization_enabled: value.is_network_tokenization_enabled,+ is_auto_retries_enabled: value.is_auto_retries_enabled,+ max_auto_retries_enabled: value.max_auto_retries_enabled,+ always_request_extended_authorization: value.always_request_extended_authorization,+ is_click_to_pay_enabled: value.is_click_to_pay_enabled,+ authentication_product_ids: value.authentication_product_ids,+ card_testing_guard_config: value.card_testing_guard_config,+ card_testing_secret_key: value.card_testing_secret_key,+ is_clear_pan_retries_enabled: value.is_clear_pan_retries_enabled,+ force_3ds_challenge: value.force_3ds_challenge,+ is_debit_routing_enabled: value.is_debit_routing_enabled,+ merchant_business_country: value.merchant_business_country,+ is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,+ is_pre_network_tokenization_enabled: value.is_pre_network_tokenization_enabled,+ three_ds_decision_rule_algorithm: value.three_ds_decision_rule_algorithm,+ acquirer_config_map: value.acquirer_config_map,+ merchant_category_code: value.merchant_category_code,+ merchant_country_code: value.merchant_country_code,+ dispute_polling_interval: value.dispute_polling_interval,+ is_manual_retry_enabled: value.is_manual_retry_enabled,+ always_enable_overcapture: value.always_enable_overcapture,+ external_vault_details: value.external_vault_details,+ billing_processor_id: value.billing_processor_id,+ surcharge_connector_details: value.surcharge_connector_details,+ network_tokenization_credentials: value.network_tokenization_credentials,+ payment_method_blocking: value.payment_method_blocking,+ default_fallback_routing: value.default_fallback_routing,+ }+ }+}+impl Profile {#[cfg(feature = "v1")]pub fn get_id(&self) -> &common_utils::id_type::ProfileId {@@ -458,969 +591,6 @@ pub enum ProfileUpdate {},}-#[cfg(feature = "v1")]-impl From<ProfileUpdate> for ProfileUpdateInternal {- fn from(profile_update: ProfileUpdate) -> Self {- let now = date_time::now();-- match profile_update {- ProfileUpdate::Update(update) => {- let ProfileGeneralUpdate {- profile_name,- return_url,- enable_payment_response_hash,- payment_response_hash_key,- redirect_to_merchant_with_http_post,- webhook_details,- metadata,- routing_algorithm,- intent_fulfillment_time,- frm_routing_algorithm,- payout_routing_algorithm,- applepay_verified_domains,- payment_link_config,- session_expiry,- authentication_connector_details,- payout_link_config,- extended_card_info_config,- use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector,- is_connector_agnostic_mit_enabled,- outgoing_webhook_custom_http_headers,- always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector,- tax_connector_id,- is_tax_connector_enabled,- is_l2_l3_enabled,- dynamic_routing_algorithm,- is_network_tokenization_enabled,- is_auto_retries_enabled,- max_auto_retries_enabled,- is_click_to_pay_enabled,- authentication_product_ids,- card_testing_guard_config,- card_testing_secret_key,- is_clear_pan_retries_enabled,- force_3ds_challenge,- is_debit_routing_enabled,- merchant_business_country,- is_iframe_redirection_enabled,- is_pre_network_tokenization_enabled,- merchant_category_code,- merchant_country_code,- dispute_polling_interval,- always_request_extended_authorization,- is_manual_retry_enabled,- always_enable_overcapture,- is_external_vault_enabled,- external_vault_connector_details,- billing_processor_id,- surcharge_connector_details,- network_tokenization_credentials,- payment_method_blocking,- } = *update;-- let is_external_vault_enabled = match is_external_vault_enabled {- Some(external_vault_mode) => match external_vault_mode {- common_enums::ExternalVaultEnabled::Enable => Some(true),- common_enums::ExternalVaultEnabled::Skip => Some(false),- },- None => Some(false),- };-- Self {- profile_name,- modified_at: now,- return_url,- enable_payment_response_hash,- payment_response_hash_key,- redirect_to_merchant_with_http_post,- webhook_details,- metadata,- routing_algorithm,- intent_fulfillment_time,- frm_routing_algorithm,- payout_routing_algorithm,- is_recon_enabled: None,- applepay_verified_domains,- payment_link_config,- session_expiry,- authentication_connector_details,- payout_link_config,- is_extended_card_info_enabled: None,- extended_card_info_config,- is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers- .map(Encryption::from),- always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector,- tax_connector_id,- is_tax_connector_enabled,- is_l2_l3_enabled,- dynamic_routing_algorithm,- is_network_tokenization_enabled,- is_auto_retries_enabled,- max_auto_retries_enabled,- always_request_extended_authorization,- is_click_to_pay_enabled,- authentication_product_ids,- card_testing_guard_config,- card_testing_secret_key: card_testing_secret_key.map(Encryption::from),- is_clear_pan_retries_enabled,- force_3ds_challenge,- is_debit_routing_enabled,- merchant_business_country,- is_iframe_redirection_enabled,- is_pre_network_tokenization_enabled,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code,- merchant_country_code,- dispute_polling_interval,- is_manual_retry_enabled,- always_enable_overcapture,- is_external_vault_enabled,- external_vault_connector_details,- billing_processor_id,- surcharge_connector_details,- network_tokenization_credentials: network_tokenization_credentials- .map(Encryption::from),- payment_method_blocking,- default_fallback_routing: None,- }- }- ProfileUpdate::RoutingAlgorithmUpdate {- routing_algorithm,- payout_routing_algorithm,- three_ds_decision_rule_algorithm,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: None,- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::DynamicRoutingAlgorithmUpdate {- dynamic_routing_algorithm,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: None,- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::ExtendedCardInfoUpdate {- is_extended_card_info_enabled,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: Some(is_extended_card_info_enabled),- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: None,- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::ConnectorAgnosticMitUpdate {- is_connector_agnostic_mit_enabled,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: Some(is_connector_agnostic_mit_enabled),- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: None,- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::NetworkTokenizationUpdate {- is_network_tokenization_enabled,- network_tokenization_credentials,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: Some(is_network_tokenization_enabled),- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: network_tokenization_credentials- .map(Encryption::from),- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::CardTestingSecretKeyUpdate {- card_testing_secret_key,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: card_testing_secret_key.map(Encryption::from),- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: None,- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::AcquirerConfigBucketUpdate {- acquirer_config_map,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: acquirer_config_map- .map(diesel_models::business_profile::AcquirerConfigBucket::New),- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- network_tokenization_credentials: None,- payment_method_blocking: None,- default_fallback_routing: None,- },- ProfileUpdate::DefaultRoutingFallbackUpdate {- default_fallback_routing,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- routing_algorithm: None,- intent_fulfillment_time: None,- frm_routing_algorithm: None,- payout_routing_algorithm: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- force_3ds_challenge: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- is_iframe_redirection_enabled: None,- is_pre_network_tokenization_enabled: None,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: None,- merchant_country_code: None,- dispute_polling_interval: None,- is_manual_retry_enabled: None,- always_enable_overcapture: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- billing_processor_id: None,- surcharge_connector_details: None,- is_l2_l3_enabled: None,- payment_method_blocking: None,- default_fallback_routing,- network_tokenization_credentials: None,- },- }- }-}--#[cfg(feature = "v1")]-#[async_trait::async_trait]-impl Conversion for Profile {- type DstType = diesel_models::business_profile::Profile;- type NewDstType = diesel_models::business_profile::ProfileNew;-- async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {- let (is_external_vault_enabled, external_vault_connector_details) =- self.external_vault_details.into();-- Ok(diesel_models::business_profile::Profile {- profile_id: self.profile_id.clone(),- id: Some(self.profile_id),- merchant_id: self.merchant_id,- profile_name: self.profile_name,- created_at: self.created_at,- modified_at: self.modified_at,- return_url: self.return_url,- enable_payment_response_hash: self.enable_payment_response_hash,- payment_response_hash_key: self.payment_response_hash_key,- redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,- webhook_details: self.webhook_details,- metadata: self.metadata,- routing_algorithm: self.routing_algorithm,- intent_fulfillment_time: self.intent_fulfillment_time,- frm_routing_algorithm: self.frm_routing_algorithm,- payout_routing_algorithm: self.payout_routing_algorithm,- is_recon_enabled: self.is_recon_enabled,- applepay_verified_domains: self.applepay_verified_domains,- payment_link_config: self.payment_link_config,- session_expiry: self.session_expiry,- authentication_connector_details: self.authentication_connector_details,- payout_link_config: self.payout_link_config,- is_extended_card_info_enabled: self.is_extended_card_info_enabled,- extended_card_info_config: self.extended_card_info_config,- is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector: self- .collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector: self- .collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: self- .outgoing_webhook_custom_http_headers- .map(Encryption::from),- always_collect_billing_details_from_wallet_connector: self- .always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector: self- .always_collect_shipping_details_from_wallet_connector,- tax_connector_id: self.tax_connector_id,- is_tax_connector_enabled: Some(self.is_tax_connector_enabled),- is_l2_l3_enabled: Some(self.is_l2_l3_enabled),- version: self.version,- dynamic_routing_algorithm: self.dynamic_routing_algorithm,- is_network_tokenization_enabled: self.is_network_tokenization_enabled,- is_auto_retries_enabled: Some(self.is_auto_retries_enabled),- max_auto_retries_enabled: self.max_auto_retries_enabled,- always_request_extended_authorization: self.always_request_extended_authorization,- is_click_to_pay_enabled: self.is_click_to_pay_enabled,- authentication_product_ids: self.authentication_product_ids,- card_testing_guard_config: self.card_testing_guard_config,- card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),- is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,- force_3ds_challenge: Some(self.force_3ds_challenge),- is_debit_routing_enabled: self.is_debit_routing_enabled,- merchant_business_country: self.merchant_business_country,- is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,- is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),- three_ds_decision_rule_algorithm: self.three_ds_decision_rule_algorithm,- acquirer_config_map: self- .acquirer_config_map- .map(diesel_models::business_profile::AcquirerConfigBucket::New),- merchant_category_code: self.merchant_category_code,- merchant_country_code: self.merchant_country_code,- dispute_polling_interval: self.dispute_polling_interval,- is_manual_retry_enabled: self.is_manual_retry_enabled,- always_enable_overcapture: self.always_enable_overcapture,- is_external_vault_enabled,- external_vault_connector_details,- billing_processor_id: self.billing_processor_id,- surcharge_connector_details: self.surcharge_connector_details,- network_tokenization_credentials: self- .network_tokenization_credentials- .map(|name| name.into()),- payment_method_blocking: self.payment_method_blocking,- default_fallback_routing: self.default_fallback_routing,- })- }-- async fn convert_back(- state: &keymanager::KeyManagerState,- item: Self::DstType,- key: &Secret<Vec<u8>>,- key_manager_identifier: keymanager::Identifier,- ) -> CustomResult<Self, ValidationError>- where- Self: Sized,- {- // Decrypt encrypted fields first- let (- outgoing_webhook_custom_http_headers,- card_testing_secret_key,- network_tokenization_credentials,- ) = async {- let outgoing_webhook_custom_http_headers = item- .outgoing_webhook_custom_http_headers- .async_lift(|inner| async {- crypto_operation(- state,- type_name!(Self::DstType),- CryptoOperation::DecryptOptional(inner),- key_manager_identifier.clone(),- key.peek(),- )- .await- .and_then(|val| val.try_into_optionaloperation())- })- .await?;-- let card_testing_secret_key = item- .card_testing_secret_key- .async_lift(|inner| async {- crypto_operation(- state,- type_name!(Self::DstType),- CryptoOperation::DecryptOptional(inner),- key_manager_identifier.clone(),- key.peek(),- )- .await- .and_then(|val| val.try_into_optionaloperation())- })- .await?;-- let network_tokenization_credentials = item- .network_tokenization_credentials- .async_lift(|inner| async {- crypto_operation(- state,- type_name!(Self::DstType),- CryptoOperation::DecryptOptional(inner),- key_manager_identifier.clone(),- key.peek(),- )- .await- .and_then(|val| val.try_into_optionaloperation())- })- .await?;-- Ok::<_, error_stack::Report<common_utils::errors::CryptoError>>((- outgoing_webhook_custom_http_headers,- card_testing_secret_key,- network_tokenization_credentials,- ))- }- .await- .change_context(ValidationError::InvalidValue {- message: "Failed while decrypting business profile data".to_string(),- })?;-- let external_vault_details = ExternalVaultDetails::try_from((- item.is_external_vault_enabled,- item.external_vault_connector_details,- ))?;-- // Construct the domain type- Ok(Self {- profile_id: item.profile_id,- merchant_id: item.merchant_id,- profile_name: item.profile_name,- created_at: item.created_at,- modified_at: item.modified_at,- return_url: item.return_url,- enable_payment_response_hash: item.enable_payment_response_hash,- payment_response_hash_key: item.payment_response_hash_key,- redirect_to_merchant_with_http_post: item.redirect_to_merchant_with_http_post,- webhook_details: item.webhook_details,- metadata: item.metadata,- routing_algorithm: item.routing_algorithm,- intent_fulfillment_time: item.intent_fulfillment_time,- frm_routing_algorithm: item.frm_routing_algorithm,- payout_routing_algorithm: item.payout_routing_algorithm,- is_recon_enabled: item.is_recon_enabled,- applepay_verified_domains: item.applepay_verified_domains,- payment_link_config: item.payment_link_config,- session_expiry: item.session_expiry,- authentication_connector_details: item.authentication_connector_details,- payout_link_config: item.payout_link_config,- is_extended_card_info_enabled: item.is_extended_card_info_enabled,- extended_card_info_config: item.extended_card_info_config,- is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing: item.use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector: item- .collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector: item- .collect_billing_details_from_wallet_connector,- always_collect_billing_details_from_wallet_connector: item- .always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector: item- .always_collect_shipping_details_from_wallet_connector,- outgoing_webhook_custom_http_headers,- tax_connector_id: item.tax_connector_id,- is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false),- is_l2_l3_enabled: item.is_l2_l3_enabled.unwrap_or(false),- version: item.version,- dynamic_routing_algorithm: item.dynamic_routing_algorithm,- is_network_tokenization_enabled: item.is_network_tokenization_enabled,- is_auto_retries_enabled: item.is_auto_retries_enabled.unwrap_or(false),- max_auto_retries_enabled: item.max_auto_retries_enabled,- always_request_extended_authorization: item.always_request_extended_authorization,- is_click_to_pay_enabled: item.is_click_to_pay_enabled,- authentication_product_ids: item.authentication_product_ids,- card_testing_guard_config: item.card_testing_guard_config,- card_testing_secret_key,- is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,- force_3ds_challenge: item.force_3ds_challenge.unwrap_or_default(),- is_debit_routing_enabled: item.is_debit_routing_enabled,- merchant_business_country: item.merchant_business_country,- is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,- is_pre_network_tokenization_enabled: item- .is_pre_network_tokenization_enabled- .unwrap_or(false),- three_ds_decision_rule_algorithm: item.three_ds_decision_rule_algorithm,- acquirer_config_map: item- .acquirer_config_map- .map(common_types::domain::AcquirerConfigBucket::from),- merchant_category_code: item.merchant_category_code,- merchant_country_code: item.merchant_country_code,- dispute_polling_interval: item.dispute_polling_interval,- is_manual_retry_enabled: item.is_manual_retry_enabled,- always_enable_overcapture: item.always_enable_overcapture,- external_vault_details,- billing_processor_id: item.billing_processor_id,- surcharge_connector_details: item.surcharge_connector_details,- network_tokenization_credentials,- payment_method_blocking: item.payment_method_blocking,- default_fallback_routing: item.default_fallback_routing,- })- }-- async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {- let (is_external_vault_enabled, external_vault_connector_details) =- self.external_vault_details.into();-- Ok(diesel_models::business_profile::ProfileNew {- profile_id: self.profile_id.clone(),- id: Some(self.profile_id),- merchant_id: self.merchant_id,- profile_name: self.profile_name,- created_at: self.created_at,- modified_at: self.modified_at,- return_url: self.return_url,- enable_payment_response_hash: self.enable_payment_response_hash,- payment_response_hash_key: self.payment_response_hash_key,- redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,- webhook_details: self.webhook_details,- metadata: self.metadata,- routing_algorithm: self.routing_algorithm,- intent_fulfillment_time: self.intent_fulfillment_time,- frm_routing_algorithm: self.frm_routing_algorithm,- payout_routing_algorithm: self.payout_routing_algorithm,- is_recon_enabled: self.is_recon_enabled,- applepay_verified_domains: self.applepay_verified_domains,- payment_link_config: self.payment_link_config,- session_expiry: self.session_expiry,- authentication_connector_details: self.authentication_connector_details,- payout_link_config: self.payout_link_config,- is_extended_card_info_enabled: self.is_extended_card_info_enabled,- extended_card_info_config: self.extended_card_info_config,- is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector: self- .collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector: self- .collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: self- .outgoing_webhook_custom_http_headers- .map(Encryption::from),- always_collect_billing_details_from_wallet_connector: self- .always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector: self- .always_collect_shipping_details_from_wallet_connector,- tax_connector_id: self.tax_connector_id,- is_tax_connector_enabled: Some(self.is_tax_connector_enabled),- is_l2_l3_enabled: Some(self.is_l2_l3_enabled),- version: self.version,- is_network_tokenization_enabled: self.is_network_tokenization_enabled,- is_auto_retries_enabled: Some(self.is_auto_retries_enabled),- max_auto_retries_enabled: self.max_auto_retries_enabled,- is_click_to_pay_enabled: self.is_click_to_pay_enabled,- authentication_product_ids: self.authentication_product_ids,- card_testing_guard_config: self.card_testing_guard_config,- card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),- is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,- force_3ds_challenge: Some(self.force_3ds_challenge),- is_debit_routing_enabled: self.is_debit_routing_enabled,- merchant_business_country: self.merchant_business_country,- is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,- is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),- merchant_category_code: self.merchant_category_code,- merchant_country_code: self.merchant_country_code,- dispute_polling_interval: self.dispute_polling_interval,- is_manual_retry_enabled: self.is_manual_retry_enabled,- is_external_vault_enabled,- external_vault_connector_details,- billing_processor_id: self.billing_processor_id,- surcharge_connector_details: self.surcharge_connector_details,- network_tokenization_credentials: self- .network_tokenization_credentials- .map(|name| name.into()),- payment_method_blocking: self.payment_method_blocking,- default_fallback_routing: self.default_fallback_routing,- })- }-}-#[cfg(feature = "v2")]#[derive(Clone, Debug)]pub struct Profile {@@ -1610,6 +780,134 @@ impl From<ProfileSetter> for Profile {}}+#[cfg(feature = "v2")]+pub struct ProfileDbBuilder {+ pub id: common_utils::id_type::ProfileId,+ pub merchant_id: common_utils::id_type::MerchantId,+ pub profile_name: String,+ pub created_at: time::PrimitiveDateTime,+ pub modified_at: time::PrimitiveDateTime,+ pub return_url: Option<common_utils::types::Url>,+ pub enable_payment_response_hash: bool,+ pub payment_response_hash_key: Option<String>,+ pub redirect_to_merchant_with_http_post: bool,+ pub webhook_details: Option<WebhookDetails>,+ pub metadata: Option<pii::SecretSerdeValue>,+ pub is_recon_enabled: bool,+ pub applepay_verified_domains: Option<Vec<String>>,+ pub payment_link_config: Option<BusinessPaymentLinkConfig>,+ pub session_expiry: Option<i64>,+ pub authentication_connector_details: Option<AuthenticationConnectorDetails>,+ pub payout_link_config: Option<BusinessPayoutLinkConfig>,+ pub is_extended_card_info_enabled: Option<bool>,+ pub extended_card_info_config: Option<pii::SecretSerdeValue>,+ pub is_connector_agnostic_mit_enabled: Option<bool>,+ pub use_billing_as_payment_method_billing: Option<bool>,+ pub collect_shipping_details_from_wallet_connector: Option<bool>,+ pub collect_billing_details_from_wallet_connector: Option<bool>,+ pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue,+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,+ pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,+ pub order_fulfillment_time: Option<i64>,+ pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,+ pub frm_routing_algorithm_id: Option<String>,+ pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,+ pub default_fallback_routing: Option<pii::SecretSerdeValue>,+ pub should_collect_cvv_during_payment:+ Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,+ pub tax_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub is_tax_connector_enabled: bool,+ pub version: common_enums::ApiVersion,+ pub is_network_tokenization_enabled: bool,+ pub is_click_to_pay_enabled: bool,+ pub authentication_product_ids:+ Option<common_types::payments::AuthenticationConnectorAccountMap>,+ pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,+ pub card_testing_guard_config: Option<CardTestingGuardConfig>,+ pub card_testing_secret_key: OptionalEncryptableName,+ pub is_clear_pan_retries_enabled: bool,+ pub is_debit_routing_enabled: bool,+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,+ pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,+ pub is_iframe_redirection_enabled: Option<bool>,+ pub is_external_vault_enabled: Option<bool>,+ pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,+ pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,+ pub split_txns_enabled: common_enums::SplitTxnsEnabled,+ pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub surcharge_connector_details: Option<SurchargeConnectorDetails>,+}++#[cfg(feature = "v2")]+impl From<ProfileDbBuilder> for Profile {+ fn from(value: ProfileDbBuilder) -> Self {+ Self {+ id: value.id,+ merchant_id: value.merchant_id,+ profile_name: value.profile_name,+ created_at: value.created_at,+ modified_at: value.modified_at,+ return_url: value.return_url,+ enable_payment_response_hash: value.enable_payment_response_hash,+ payment_response_hash_key: value.payment_response_hash_key,+ redirect_to_merchant_with_http_post: value.redirect_to_merchant_with_http_post,+ webhook_details: value.webhook_details,+ metadata: value.metadata,+ is_recon_enabled: value.is_recon_enabled,+ applepay_verified_domains: value.applepay_verified_domains,+ payment_link_config: value.payment_link_config,+ session_expiry: value.session_expiry,+ authentication_connector_details: value.authentication_connector_details,+ payout_link_config: value.payout_link_config,+ is_extended_card_info_enabled: value.is_extended_card_info_enabled,+ extended_card_info_config: value.extended_card_info_config,+ is_connector_agnostic_mit_enabled: value.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: value.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: value+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: value+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: value.outgoing_webhook_custom_http_headers,+ always_collect_billing_details_from_wallet_connector: value+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: value+ .always_collect_shipping_details_from_wallet_connector,+ routing_algorithm_id: value.routing_algorithm_id,+ order_fulfillment_time: value.order_fulfillment_time,+ order_fulfillment_time_origin: value.order_fulfillment_time_origin,+ frm_routing_algorithm_id: value.frm_routing_algorithm_id,+ payout_routing_algorithm_id: value.payout_routing_algorithm_id,+ default_fallback_routing: value.default_fallback_routing,+ should_collect_cvv_during_payment: value.should_collect_cvv_during_payment,+ tax_connector_id: value.tax_connector_id,+ is_tax_connector_enabled: value.is_tax_connector_enabled,+ version: value.version,+ is_network_tokenization_enabled: value.is_network_tokenization_enabled,+ is_click_to_pay_enabled: value.is_click_to_pay_enabled,+ authentication_product_ids: value.authentication_product_ids,+ three_ds_decision_manager_config: value.three_ds_decision_manager_config,+ card_testing_guard_config: value.card_testing_guard_config,+ card_testing_secret_key: value.card_testing_secret_key,+ is_clear_pan_retries_enabled: value.is_clear_pan_retries_enabled,+ is_debit_routing_enabled: value.is_debit_routing_enabled,+ merchant_business_country: value.merchant_business_country,+ revenue_recovery_retry_algorithm_type: value.revenue_recovery_retry_algorithm_type,+ revenue_recovery_retry_algorithm_data: value.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,+ is_external_vault_enabled: value.is_external_vault_enabled,+ external_vault_connector_details: value.external_vault_connector_details,+ merchant_category_code: value.merchant_category_code,+ merchant_country_code: value.merchant_country_code,+ split_txns_enabled: value.split_txns_enabled,+ billing_processor_id: value.billing_processor_id,+ surcharge_connector_details: value.surcharge_connector_details,+ }+ }+}+impl Profile {pub fn get_is_tax_connector_enabled(&self) -> bool {let is_tax_connector_enabled = self.is_tax_connector_enabled;@@ -1946,904 +1244,8 @@ pub enum ProfileUpdate {},}-#[cfg(feature = "v2")]-impl From<ProfileUpdate> for ProfileUpdateInternal {- fn from(profile_update: ProfileUpdate) -> Self {- let now = date_time::now();-- match profile_update {- ProfileUpdate::Update(update) => {- let ProfileGeneralUpdate {- profile_name,- return_url,- enable_payment_response_hash,- payment_response_hash_key,- redirect_to_merchant_with_http_post,- webhook_details,- metadata,- applepay_verified_domains,- payment_link_config,- session_expiry,- authentication_connector_details,- payout_link_config,- extended_card_info_config,- use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector,- is_connector_agnostic_mit_enabled,- outgoing_webhook_custom_http_headers,- always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector,- order_fulfillment_time,- order_fulfillment_time_origin,- is_network_tokenization_enabled,- is_click_to_pay_enabled,- authentication_product_ids,- three_ds_decision_manager_config,- card_testing_guard_config,- card_testing_secret_key,- is_debit_routing_enabled,- merchant_business_country,- is_iframe_redirection_enabled,- is_external_vault_enabled,- external_vault_connector_details,- merchant_category_code,- merchant_country_code,- revenue_recovery_retry_algorithm_type,- split_txns_enabled,- billing_processor_id,- surcharge_connector_details,- } = *update;- Self {- profile_name,- modified_at: now,- return_url,- enable_payment_response_hash,- payment_response_hash_key,- redirect_to_merchant_with_http_post,- webhook_details,- metadata,- is_recon_enabled: None,- applepay_verified_domains,- payment_link_config,- session_expiry,- authentication_connector_details,- payout_link_config,- is_extended_card_info_enabled: None,- extended_card_info_config,- is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers- .map(Encryption::from),- routing_algorithm_id: None,- always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector,- order_fulfillment_time,- order_fulfillment_time_origin,- frm_routing_algorithm_id: None,- payout_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_l2_l3_enabled: None,- is_network_tokenization_enabled,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled,- authentication_product_ids,- three_ds_decision_manager_config,- card_testing_guard_config,- card_testing_secret_key: card_testing_secret_key.map(Encryption::from),- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled,- merchant_business_country,- revenue_recovery_retry_algorithm_type,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled,- is_external_vault_enabled,- external_vault_connector_details,- merchant_category_code,- merchant_country_code,- split_txns_enabled,- billing_processor_id,- surcharge_connector_details,- }- }- ProfileUpdate::RoutingAlgorithmUpdate {- routing_algorithm_id,- payout_routing_algorithm_id,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- routing_algorithm_id,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- payout_routing_algorithm_id,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_l2_l3_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::ExtendedCardInfoUpdate {- is_extended_card_info_enabled,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: Some(is_extended_card_info_enabled),- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_l2_l3_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::ConnectorAgnosticMitUpdate {- is_connector_agnostic_mit_enabled,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- is_l2_l3_enabled: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: Some(is_connector_agnostic_mit_enabled),- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::DefaultRoutingFallbackUpdate {- default_fallback_routing,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- is_l2_l3_enabled: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::NetworkTokenizationUpdate {- is_network_tokenization_enabled,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- is_l2_l3_enabled: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: Some(is_network_tokenization_enabled),- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::CollectCvvDuringPaymentUpdate {- should_collect_cvv_during_payment,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: Some(should_collect_cvv_during_payment),- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- is_l2_l3_enabled: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::DecisionManagerRecordUpdate {- three_ds_decision_manager_config,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: Some(three_ds_decision_manager_config),- card_testing_guard_config: None,- card_testing_secret_key: None,- is_l2_l3_enabled: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::CardTestingSecretKeyUpdate {- card_testing_secret_key,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: card_testing_secret_key.map(Encryption::from),- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- is_l2_l3_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: None,- revenue_recovery_retry_algorithm_data: None,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- ProfileUpdate::RevenueRecoveryAlgorithmUpdate {- revenue_recovery_retry_algorithm_type,- revenue_recovery_retry_algorithm_data,- } => Self {- profile_name: None,- modified_at: now,- return_url: None,- enable_payment_response_hash: None,- payment_response_hash_key: None,- redirect_to_merchant_with_http_post: None,- webhook_details: None,- metadata: None,- is_recon_enabled: None,- applepay_verified_domains: None,- payment_link_config: None,- session_expiry: None,- authentication_connector_details: None,- payout_link_config: None,- is_extended_card_info_enabled: None,- extended_card_info_config: None,- is_connector_agnostic_mit_enabled: None,- use_billing_as_payment_method_billing: None,- collect_shipping_details_from_wallet_connector: None,- collect_billing_details_from_wallet_connector: None,- outgoing_webhook_custom_http_headers: None,- always_collect_billing_details_from_wallet_connector: None,- always_collect_shipping_details_from_wallet_connector: None,- routing_algorithm_id: None,- is_l2_l3_enabled: None,- payout_routing_algorithm_id: None,- order_fulfillment_time: None,- order_fulfillment_time_origin: None,- frm_routing_algorithm_id: None,- default_fallback_routing: None,- should_collect_cvv_during_payment: None,- tax_connector_id: None,- is_tax_connector_enabled: None,- is_network_tokenization_enabled: None,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: None,- authentication_product_ids: None,- three_ds_decision_manager_config: None,- card_testing_guard_config: None,- card_testing_secret_key: None,- is_clear_pan_retries_enabled: None,- is_debit_routing_enabled: None,- merchant_business_country: None,- revenue_recovery_retry_algorithm_type: Some(revenue_recovery_retry_algorithm_type),- revenue_recovery_retry_algorithm_data,- is_iframe_redirection_enabled: None,- is_external_vault_enabled: None,- external_vault_connector_details: None,- merchant_category_code: None,- merchant_country_code: None,- split_txns_enabled: None,- billing_processor_id: None,- surcharge_connector_details: None,- },- }- }-}--#[cfg(feature = "v2")]-#[async_trait::async_trait]-impl Conversion for Profile {- type DstType = diesel_models::business_profile::Profile;- type NewDstType = diesel_models::business_profile::ProfileNew;-- async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {- Ok(diesel_models::business_profile::Profile {- id: self.id,- merchant_id: self.merchant_id,- profile_name: self.profile_name,- created_at: self.created_at,- modified_at: self.modified_at,- return_url: self.return_url,- enable_payment_response_hash: self.enable_payment_response_hash,- payment_response_hash_key: self.payment_response_hash_key,- redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,- webhook_details: self.webhook_details,- metadata: self.metadata,- is_recon_enabled: self.is_recon_enabled,- applepay_verified_domains: self.applepay_verified_domains,- payment_link_config: self.payment_link_config,- session_expiry: self.session_expiry,- authentication_connector_details: self.authentication_connector_details,- payout_link_config: self.payout_link_config,- is_extended_card_info_enabled: self.is_extended_card_info_enabled,- extended_card_info_config: self.extended_card_info_config,- is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector: self- .collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector: self- .collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: self- .outgoing_webhook_custom_http_headers- .map(Encryption::from),- routing_algorithm_id: self.routing_algorithm_id,- always_collect_billing_details_from_wallet_connector: self- .always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector: self- .always_collect_shipping_details_from_wallet_connector,- payout_routing_algorithm_id: self.payout_routing_algorithm_id,- order_fulfillment_time: self.order_fulfillment_time,- order_fulfillment_time_origin: self.order_fulfillment_time_origin,- frm_routing_algorithm_id: self.frm_routing_algorithm_id,- default_fallback_routing: self.default_fallback_routing,- should_collect_cvv_during_payment: self.should_collect_cvv_during_payment,- tax_connector_id: self.tax_connector_id,- is_tax_connector_enabled: Some(self.is_tax_connector_enabled),- version: self.version,- dynamic_routing_algorithm: None,- is_network_tokenization_enabled: self.is_network_tokenization_enabled,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- always_request_extended_authorization: None,- is_click_to_pay_enabled: self.is_click_to_pay_enabled,- authentication_product_ids: self.authentication_product_ids,- three_ds_decision_manager_config: self.three_ds_decision_manager_config,- card_testing_guard_config: self.card_testing_guard_config,- card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),- is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,- force_3ds_challenge: None,- is_debit_routing_enabled: self.is_debit_routing_enabled,- merchant_business_country: self.merchant_business_country,- revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,- revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,- is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,- is_external_vault_enabled: self.is_external_vault_enabled,- external_vault_connector_details: self.external_vault_connector_details,- three_ds_decision_rule_algorithm: None,- acquirer_config_map: None,- merchant_category_code: self.merchant_category_code,- merchant_country_code: self.merchant_country_code,- dispute_polling_interval: None,- split_txns_enabled: Some(self.split_txns_enabled),- is_manual_retry_enabled: None,- is_l2_l3_enabled: None,- always_enable_overcapture: None,- billing_processor_id: self.billing_processor_id,- surcharge_connector_details: self.surcharge_connector_details,- network_tokenization_credentials: None,- payment_method_blocking: None,- })- }-- async fn convert_back(- state: &keymanager::KeyManagerState,- item: Self::DstType,- key: &Secret<Vec<u8>>,- key_manager_identifier: keymanager::Identifier,- ) -> CustomResult<Self, ValidationError>- where- Self: Sized,- {- async {- Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(Self {- id: item.id,- merchant_id: item.merchant_id,- profile_name: item.profile_name,- created_at: item.created_at,- modified_at: item.modified_at,- return_url: item.return_url,- enable_payment_response_hash: item.enable_payment_response_hash,- payment_response_hash_key: item.payment_response_hash_key,- redirect_to_merchant_with_http_post: item.redirect_to_merchant_with_http_post,- webhook_details: item.webhook_details,- metadata: item.metadata,- is_recon_enabled: item.is_recon_enabled,- applepay_verified_domains: item.applepay_verified_domains,- payment_link_config: item.payment_link_config,- session_expiry: item.session_expiry,- authentication_connector_details: item.authentication_connector_details,- payout_link_config: item.payout_link_config,- is_extended_card_info_enabled: item.is_extended_card_info_enabled,- extended_card_info_config: item.extended_card_info_config,- is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing: item.use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector: item- .collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector: item- .collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: item- .outgoing_webhook_custom_http_headers- .async_lift(|inner| async {- crypto_operation(- state,- type_name!(Self::DstType),- CryptoOperation::DecryptOptional(inner),- key_manager_identifier.clone(),- key.peek(),- )- .await- .and_then(|val| val.try_into_optionaloperation())- })- .await?,- routing_algorithm_id: item.routing_algorithm_id,- always_collect_billing_details_from_wallet_connector: item- .always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector: item- .always_collect_shipping_details_from_wallet_connector,- order_fulfillment_time: item.order_fulfillment_time,- order_fulfillment_time_origin: item.order_fulfillment_time_origin,- frm_routing_algorithm_id: item.frm_routing_algorithm_id,- payout_routing_algorithm_id: item.payout_routing_algorithm_id,- default_fallback_routing: item.default_fallback_routing,- should_collect_cvv_during_payment: item.should_collect_cvv_during_payment,- tax_connector_id: item.tax_connector_id,- is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false),- version: item.version,- is_network_tokenization_enabled: item.is_network_tokenization_enabled,- is_click_to_pay_enabled: item.is_click_to_pay_enabled,- authentication_product_ids: item.authentication_product_ids,- three_ds_decision_manager_config: item.three_ds_decision_manager_config,- card_testing_guard_config: item.card_testing_guard_config,- card_testing_secret_key: match item.card_testing_secret_key {- Some(encrypted_value) => crypto_operation(- state,- type_name!(Self::DstType),- CryptoOperation::DecryptOptional(Some(encrypted_value)),- key_manager_identifier.clone(),- key.peek(),- )- .await- .and_then(|val| val.try_into_optionaloperation())- .unwrap_or_default(),- None => None,- },- is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,- is_debit_routing_enabled: item.is_debit_routing_enabled,- merchant_business_country: item.merchant_business_country,- revenue_recovery_retry_algorithm_type: item.revenue_recovery_retry_algorithm_type,- revenue_recovery_retry_algorithm_data: item.revenue_recovery_retry_algorithm_data,- is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,- is_external_vault_enabled: item.is_external_vault_enabled,- external_vault_connector_details: item.external_vault_connector_details,- merchant_category_code: item.merchant_category_code,- merchant_country_code: item.merchant_country_code,- split_txns_enabled: item.split_txns_enabled.unwrap_or_default(),- billing_processor_id: item.billing_processor_id,- surcharge_connector_details: item.surcharge_connector_details,- })- }- .await- .change_context(ValidationError::InvalidValue {- message: "Failed while decrypting business profile data".to_string(),- })- }-- async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {- Ok(diesel_models::business_profile::ProfileNew {- id: self.id,- merchant_id: self.merchant_id,- profile_name: self.profile_name,- created_at: self.created_at,- modified_at: self.modified_at,- return_url: self.return_url,- enable_payment_response_hash: self.enable_payment_response_hash,- payment_response_hash_key: self.payment_response_hash_key,- redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,- webhook_details: self.webhook_details,- metadata: self.metadata,- is_recon_enabled: self.is_recon_enabled,- applepay_verified_domains: self.applepay_verified_domains,- payment_link_config: self.payment_link_config,- session_expiry: self.session_expiry,- authentication_connector_details: self.authentication_connector_details,- payout_link_config: self.payout_link_config,- is_extended_card_info_enabled: self.is_extended_card_info_enabled,- extended_card_info_config: self.extended_card_info_config,- is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,- use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,- collect_shipping_details_from_wallet_connector: self- .collect_shipping_details_from_wallet_connector,- collect_billing_details_from_wallet_connector: self- .collect_billing_details_from_wallet_connector,- outgoing_webhook_custom_http_headers: self- .outgoing_webhook_custom_http_headers- .map(Encryption::from),- routing_algorithm_id: self.routing_algorithm_id,- always_collect_billing_details_from_wallet_connector: self- .always_collect_billing_details_from_wallet_connector,- always_collect_shipping_details_from_wallet_connector: self- .always_collect_shipping_details_from_wallet_connector,- order_fulfillment_time: self.order_fulfillment_time,- order_fulfillment_time_origin: self.order_fulfillment_time_origin,- frm_routing_algorithm_id: self.frm_routing_algorithm_id,- payout_routing_algorithm_id: self.payout_routing_algorithm_id,- default_fallback_routing: self.default_fallback_routing,- should_collect_cvv_during_payment: self.should_collect_cvv_during_payment,- tax_connector_id: self.tax_connector_id,- is_tax_connector_enabled: Some(self.is_tax_connector_enabled),- version: self.version,- is_network_tokenization_enabled: self.is_network_tokenization_enabled,- is_auto_retries_enabled: None,- max_auto_retries_enabled: None,- is_click_to_pay_enabled: self.is_click_to_pay_enabled,- authentication_product_ids: self.authentication_product_ids,- three_ds_decision_manager_config: self.three_ds_decision_manager_config,- card_testing_guard_config: self.card_testing_guard_config,- card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),- is_clear_pan_retries_enabled: Some(self.is_clear_pan_retries_enabled),- is_debit_routing_enabled: self.is_debit_routing_enabled,- merchant_business_country: self.merchant_business_country,- revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,- revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,- is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,- is_external_vault_enabled: self.is_external_vault_enabled,- external_vault_connector_details: self.external_vault_connector_details,- merchant_category_code: self.merchant_category_code,- is_l2_l3_enabled: None,- merchant_country_code: self.merchant_country_code,- split_txns_enabled: Some(self.split_txns_enabled),- billing_processor_id: self.billing_processor_id,- surcharge_connector_details: self.surcharge_connector_details,- payment_method_blocking: None,- })- }-}-#[async_trait::async_trait]-pub trait ProfileInterface-where- Profile: Conversion<DstType = storage_types::Profile, NewDstType = storage_types::ProfileNew>,-{+pub trait ProfileInterface {type Error;async fn insert_business_profile(&self,diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.tomlindex 80ae2f4856..02c35b3cf6 100644--- a/crates/storage_impl/Cargo.toml+++ b/crates/storage_impl/Cargo.toml@@ -14,8 +14,8 @@ oltp = []accounts_cache = []olap = ["hyperswitch_domain_models/olap"]payouts = ["hyperswitch_domain_models/payouts"]-v1 = ["api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "common_utils/v1"]-v2 = ["api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "common_utils/v2"]+v1 = ["api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "common_utils/v1", "common_types/v1"]+v2 = ["api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "common_utils/v2", "common_types/v2"]tokenization_v2 = ["diesel_models/tokenization_v2", "api_models/tokenization_v2", "hyperswitch_domain_models/tokenization_v2"]fred = ["redis_interface/fred"]redis-rs = ["redis_interface/redis-rs"]@@ -25,6 +25,7 @@ redis-rs = ["redis_interface/redis-rs"]api_models = { version = "0.1.0", path = "../api_models" }common_enums = { version = "0.1.0", path = "../common_enums" }common_utils = { version = "0.1.0", path = "../common_utils" }+common_types = { version = "0.1.0", path = "../common_types" }diesel_models = { version = "0.1.0", path = "../diesel_models", default-features = false }hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false }hyperswitch_masking = "0.0.1"diff --git a/crates/storage_impl/src/business_profile.rs b/crates/storage_impl/src/business_profile.rsindex cd86fd69c4..50da9caa6f 100644--- a/crates/storage_impl/src/business_profile.rs+++ b/crates/storage_impl/src/business_profile.rs@@ -1,15 +1,16 @@use common_utils::ext_traits::AsyncExt;-use diesel_models::business_profile::{self, ProfileUpdateInternal};+use diesel_models::business_profile::{self as diesel, ProfileUpdateInternal};use error_stack::{report, ResultExt};use hyperswitch_domain_models::{- behaviour::{Conversion, ReverseConversion},- business_profile as domain,- business_profile::ProfileInterface,+ business_profile::{+ ProfileInterface, {self as domain},+ },merchant_key_store::MerchantKeyStore,};use router_env::{instrument, tracing};use crate::{+ behaviour::{Conversion, ForeignFrom, ReverseConversion},kv_router_store,utils::{pg_accounts_connection_read, pg_accounts_connection_write},CustomResult, DatabaseStore, MockDb, RouterStore, StorageError,@@ -140,9 +141,9 @@ impl<T: DatabaseStore> ProfileInterface for RouterStore<T> {profile_id: &common_utils::id_type::ProfileId,) -> CustomResult<domain::Profile, StorageError> {let conn = pg_accounts_connection_read(self).await?;- self.call_database(+ self.call_database_new(merchant_key_store,- business_profile::Profile::find_by_profile_id(&conn, profile_id),+ diesel::Profile::find_by_profile_id(&conn, profile_id),).await}@@ -154,13 +155,9 @@ impl<T: DatabaseStore> ProfileInterface for RouterStore<T> {profile_id: &common_utils::id_type::ProfileId,) -> CustomResult<domain::Profile, StorageError> {let conn = pg_accounts_connection_read(self).await?;- self.call_database(+ self.call_database_new(merchant_key_store,- business_profile::Profile::find_by_merchant_id_profile_id(- &conn,- merchant_id,- profile_id,- ),+ diesel::Profile::find_by_merchant_id_profile_id(&conn, merchant_id, profile_id),).await}@@ -173,13 +170,9 @@ impl<T: DatabaseStore> ProfileInterface for RouterStore<T> {merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<domain::Profile, StorageError> {let conn = pg_accounts_connection_read(self).await?;- self.call_database(+ self.call_database_new(merchant_key_store,- business_profile::Profile::find_by_profile_name_merchant_id(- &conn,- profile_name,- merchant_id,- ),+ diesel::Profile::find_by_profile_name_merchant_id(&conn, profile_name, merchant_id),).await}@@ -195,7 +188,7 @@ impl<T: DatabaseStore> ProfileInterface for RouterStore<T> {Conversion::convert(current_state).await.change_context(StorageError::EncryptionError)?- .update_by_profile_id(&conn, ProfileUpdateInternal::from(profile_update))+ .update_by_profile_id(&conn, ProfileUpdateInternal::foreign_from(profile_update)).await.map_err(|error| report!(StorageError::from(error)))?.convert(@@ -215,7 +208,7 @@ impl<T: DatabaseStore> ProfileInterface for RouterStore<T> {merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<bool, StorageError> {let conn = pg_accounts_connection_write(self).await?;- business_profile::Profile::delete_by_profile_id_merchant_id(&conn, profile_id, merchant_id)+ diesel::Profile::delete_by_profile_id_merchant_id(&conn, profile_id, merchant_id).await.map_err(|error| report!(StorageError::from(error)))}@@ -227,9 +220,9 @@ impl<T: DatabaseStore> ProfileInterface for RouterStore<T> {merchant_id: &common_utils::id_type::MerchantId,) -> CustomResult<Vec<domain::Profile>, StorageError> {let conn = pg_accounts_connection_read(self).await?;- self.find_resources(+ self.find_resources_new(merchant_key_store,- business_profile::Profile::list_profile_by_merchant_id(&conn, merchant_id),+ diesel::Profile::list_profile_by_merchant_id(&conn, merchant_id),).await}@@ -343,11 +336,12 @@ impl ProfileInterface for MockDb {.iter_mut().find(|business_profile| business_profile.get_id() == current_state.get_id()).async_map(|business_profile| async {- let profile_updated = ProfileUpdateInternal::from(profile_update).apply_changeset(- Conversion::convert(current_state)- .await- .change_context(StorageError::EncryptionError)?,- );+ let profile_updated = ProfileUpdateInternal::foreign_from(profile_update)+ .apply_changeset(+ Conversion::convert(current_state)+ .await+ .change_context(StorageError::EncryptionError)?,+ );*business_profile = profile_updated.clone();profile_updated@@ -457,3 +451,1877 @@ impl ProfileInterface for MockDb {)}}++use common_utils::{+ date_time, encryption::Encryption, errors::ValidationError, type_name, types::keymanager,+};+#[cfg(feature = "v2")]+use diesel_models::business_profile::RevenueRecoveryAlgorithmData;+use hyperswitch_domain_models::{+ // behaviour::Conversion,+ type_encryption::{crypto_operation, AsyncLift, CryptoOperation},+};+use hyperswitch_masking::{PeekInterface, Secret};++#[cfg(feature = "v1")]+impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {+ fn foreign_from(profile_update: domain::ProfileUpdate) -> Self {+ let now = date_time::now();++ match profile_update {+ domain::ProfileUpdate::Update(update) => {+ let domain::ProfileGeneralUpdate {+ profile_name,+ return_url,+ enable_payment_response_hash,+ payment_response_hash_key,+ redirect_to_merchant_with_http_post,+ webhook_details,+ metadata,+ routing_algorithm,+ intent_fulfillment_time,+ frm_routing_algorithm,+ payout_routing_algorithm,+ applepay_verified_domains,+ payment_link_config,+ session_expiry,+ authentication_connector_details,+ payout_link_config,+ extended_card_info_config,+ use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector,+ is_connector_agnostic_mit_enabled,+ outgoing_webhook_custom_http_headers,+ always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector,+ tax_connector_id,+ is_tax_connector_enabled,+ is_l2_l3_enabled,+ dynamic_routing_algorithm,+ is_network_tokenization_enabled,+ is_auto_retries_enabled,+ max_auto_retries_enabled,+ is_click_to_pay_enabled,+ authentication_product_ids,+ card_testing_guard_config,+ card_testing_secret_key,+ is_clear_pan_retries_enabled,+ force_3ds_challenge,+ is_debit_routing_enabled,+ merchant_business_country,+ is_iframe_redirection_enabled,+ is_pre_network_tokenization_enabled,+ merchant_category_code,+ merchant_country_code,+ dispute_polling_interval,+ always_request_extended_authorization,+ is_manual_retry_enabled,+ always_enable_overcapture,+ is_external_vault_enabled,+ external_vault_connector_details,+ billing_processor_id,+ surcharge_connector_details,+ network_tokenization_credentials,+ payment_method_blocking,+ } = *update;++ let is_external_vault_enabled = match is_external_vault_enabled {+ Some(external_vault_mode) => match external_vault_mode {+ common_enums::ExternalVaultEnabled::Enable => Some(true),+ common_enums::ExternalVaultEnabled::Skip => Some(false),+ },+ None => Some(false),+ };++ Self {+ profile_name,+ modified_at: now,+ return_url,+ enable_payment_response_hash,+ payment_response_hash_key,+ redirect_to_merchant_with_http_post,+ webhook_details,+ metadata,+ routing_algorithm,+ intent_fulfillment_time,+ frm_routing_algorithm,+ payout_routing_algorithm,+ is_recon_enabled: None,+ applepay_verified_domains,+ payment_link_config,+ session_expiry,+ authentication_connector_details,+ payout_link_config,+ is_extended_card_info_enabled: None,+ extended_card_info_config,+ is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers+ .map(Encryption::from),+ always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector,+ tax_connector_id,+ is_tax_connector_enabled,+ is_l2_l3_enabled,+ dynamic_routing_algorithm,+ is_network_tokenization_enabled,+ is_auto_retries_enabled,+ max_auto_retries_enabled,+ always_request_extended_authorization,+ is_click_to_pay_enabled,+ authentication_product_ids,+ card_testing_guard_config,+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),+ is_clear_pan_retries_enabled,+ force_3ds_challenge,+ is_debit_routing_enabled,+ merchant_business_country,+ is_iframe_redirection_enabled,+ is_pre_network_tokenization_enabled,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code,+ merchant_country_code,+ dispute_polling_interval,+ is_manual_retry_enabled,+ always_enable_overcapture,+ is_external_vault_enabled,+ external_vault_connector_details,+ billing_processor_id,+ surcharge_connector_details,+ network_tokenization_credentials: network_tokenization_credentials+ .map(Encryption::from),+ payment_method_blocking,+ default_fallback_routing: None,+ }+ }+ domain::ProfileUpdate::RoutingAlgorithmUpdate {+ routing_algorithm,+ payout_routing_algorithm,+ three_ds_decision_rule_algorithm,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::DynamicRoutingAlgorithmUpdate {+ dynamic_routing_algorithm,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::ExtendedCardInfoUpdate {+ is_extended_card_info_enabled,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: Some(is_extended_card_info_enabled),+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::ConnectorAgnosticMitUpdate {+ is_connector_agnostic_mit_enabled,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: Some(is_connector_agnostic_mit_enabled),+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::NetworkTokenizationUpdate {+ is_network_tokenization_enabled,+ network_tokenization_credentials,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: Some(is_network_tokenization_enabled),+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: network_tokenization_credentials+ .map(Encryption::from),+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::CardTestingSecretKeyUpdate {+ card_testing_secret_key,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::AcquirerConfigBucketUpdate {+ acquirer_config_map,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: acquirer_config_map+ .map(diesel_models::business_profile::AcquirerConfigBucket::New),+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ default_fallback_routing: None,+ },+ domain::ProfileUpdate::DefaultRoutingFallbackUpdate {+ default_fallback_routing,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ routing_algorithm: None,+ intent_fulfillment_time: None,+ frm_routing_algorithm: None,+ payout_routing_algorithm: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ force_3ds_challenge: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ is_iframe_redirection_enabled: None,+ is_pre_network_tokenization_enabled: None,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: None,+ merchant_country_code: None,+ dispute_polling_interval: None,+ is_manual_retry_enabled: None,+ always_enable_overcapture: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ is_l2_l3_enabled: None,+ payment_method_blocking: None,+ default_fallback_routing,+ network_tokenization_credentials: None,+ },+ }+ }+}++#[cfg(feature = "v1")]+#[async_trait::async_trait]+impl Conversion for domain::Profile {+ type DstType = diesel::Profile;+ type NewDstType = diesel::ProfileNew;++ async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {+ let (is_external_vault_enabled, external_vault_connector_details) =+ self.external_vault_details.clone().into();++ Ok(diesel::Profile {+ profile_id: self.get_id().to_owned(),+ id: Some(self.get_id().to_owned()),+ merchant_id: self.merchant_id,+ profile_name: self.profile_name,+ created_at: self.created_at,+ modified_at: self.modified_at,+ return_url: self.return_url,+ enable_payment_response_hash: self.enable_payment_response_hash,+ payment_response_hash_key: self.payment_response_hash_key,+ redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,+ webhook_details: self.webhook_details,+ metadata: self.metadata,+ routing_algorithm: self.routing_algorithm,+ intent_fulfillment_time: self.intent_fulfillment_time,+ frm_routing_algorithm: self.frm_routing_algorithm,+ payout_routing_algorithm: self.payout_routing_algorithm,+ is_recon_enabled: self.is_recon_enabled,+ applepay_verified_domains: self.applepay_verified_domains,+ payment_link_config: self.payment_link_config,+ session_expiry: self.session_expiry,+ authentication_connector_details: self.authentication_connector_details,+ payout_link_config: self.payout_link_config,+ is_extended_card_info_enabled: self.is_extended_card_info_enabled,+ extended_card_info_config: self.extended_card_info_config,+ is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: self+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: self+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: self+ .outgoing_webhook_custom_http_headers+ .map(Encryption::from),+ always_collect_billing_details_from_wallet_connector: self+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: self+ .always_collect_shipping_details_from_wallet_connector,+ tax_connector_id: self.tax_connector_id,+ is_tax_connector_enabled: Some(self.is_tax_connector_enabled),+ is_l2_l3_enabled: Some(self.is_l2_l3_enabled),+ version: self.version,+ dynamic_routing_algorithm: self.dynamic_routing_algorithm,+ is_network_tokenization_enabled: self.is_network_tokenization_enabled,+ is_auto_retries_enabled: Some(self.is_auto_retries_enabled),+ max_auto_retries_enabled: self.max_auto_retries_enabled,+ always_request_extended_authorization: self.always_request_extended_authorization,+ is_click_to_pay_enabled: self.is_click_to_pay_enabled,+ authentication_product_ids: self.authentication_product_ids,+ card_testing_guard_config: self.card_testing_guard_config,+ card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),+ is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,+ force_3ds_challenge: Some(self.force_3ds_challenge),+ is_debit_routing_enabled: self.is_debit_routing_enabled,+ merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,+ is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),+ three_ds_decision_rule_algorithm: self.three_ds_decision_rule_algorithm,+ acquirer_config_map: self+ .acquirer_config_map+ .map(diesel_models::business_profile::AcquirerConfigBucket::New),+ merchant_category_code: self.merchant_category_code,+ merchant_country_code: self.merchant_country_code,+ dispute_polling_interval: self.dispute_polling_interval,+ is_manual_retry_enabled: self.is_manual_retry_enabled,+ always_enable_overcapture: self.always_enable_overcapture,+ is_external_vault_enabled,+ external_vault_connector_details,+ billing_processor_id: self.billing_processor_id,+ surcharge_connector_details: self.surcharge_connector_details,+ network_tokenization_credentials: self+ .network_tokenization_credentials+ .map(|name| name.into()),+ payment_method_blocking: self.payment_method_blocking,+ default_fallback_routing: self.default_fallback_routing,+ })+ }++ async fn convert_back(+ state: &keymanager::KeyManagerState,+ item: Self::DstType,+ key: &Secret<Vec<u8>>,+ key_manager_identifier: keymanager::Identifier,+ ) -> CustomResult<Self, ValidationError>+ where+ Self: Sized,+ {+ // Decrypt encrypted fields first+ let (+ outgoing_webhook_custom_http_headers,+ card_testing_secret_key,+ network_tokenization_credentials,+ ) = async {+ let outgoing_webhook_custom_http_headers = item+ .outgoing_webhook_custom_http_headers+ .async_lift(|inner| async {+ crypto_operation(+ state,+ type_name!(Self::DstType),+ CryptoOperation::DecryptOptional(inner),+ key_manager_identifier.clone(),+ key.peek(),+ )+ .await+ .and_then(|val| val.try_into_optionaloperation())+ })+ .await?;++ let card_testing_secret_key = item+ .card_testing_secret_key+ .async_lift(|inner| async {+ crypto_operation(+ state,+ type_name!(Self::DstType),+ CryptoOperation::DecryptOptional(inner),+ key_manager_identifier.clone(),+ key.peek(),+ )+ .await+ .and_then(|val| val.try_into_optionaloperation())+ })+ .await?;++ let network_tokenization_credentials = item+ .network_tokenization_credentials+ .async_lift(|inner| async {+ crypto_operation(+ state,+ type_name!(Self::DstType),+ CryptoOperation::DecryptOptional(inner),+ key_manager_identifier.clone(),+ key.peek(),+ )+ .await+ .and_then(|val| val.try_into_optionaloperation())+ })+ .await?;++ Ok::<_, error_stack::Report<common_utils::errors::CryptoError>>((+ outgoing_webhook_custom_http_headers,+ card_testing_secret_key,+ network_tokenization_credentials,+ ))+ }+ .await+ .change_context(ValidationError::InvalidValue {+ message: "Failed while decrypting business profile data".to_string(),+ })?;++ let external_vault_details = domain::ExternalVaultDetails::try_from((+ item.is_external_vault_enabled,+ item.external_vault_connector_details,+ ))?;++ // Construct the domain type+ Ok(domain::ProfileDbBuilder {+ profile_id: item.profile_id,+ merchant_id: item.merchant_id,+ profile_name: item.profile_name,+ created_at: item.created_at,+ modified_at: item.modified_at,+ return_url: item.return_url,+ enable_payment_response_hash: item.enable_payment_response_hash,+ payment_response_hash_key: item.payment_response_hash_key,+ redirect_to_merchant_with_http_post: item.redirect_to_merchant_with_http_post,+ webhook_details: item.webhook_details,+ metadata: item.metadata,+ routing_algorithm: item.routing_algorithm,+ intent_fulfillment_time: item.intent_fulfillment_time,+ frm_routing_algorithm: item.frm_routing_algorithm,+ payout_routing_algorithm: item.payout_routing_algorithm,+ is_recon_enabled: item.is_recon_enabled,+ applepay_verified_domains: item.applepay_verified_domains,+ payment_link_config: item.payment_link_config,+ session_expiry: item.session_expiry,+ authentication_connector_details: item.authentication_connector_details,+ payout_link_config: item.payout_link_config,+ is_extended_card_info_enabled: item.is_extended_card_info_enabled,+ extended_card_info_config: item.extended_card_info_config,+ is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: item.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: item+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: item+ .collect_billing_details_from_wallet_connector,+ always_collect_billing_details_from_wallet_connector: item+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: item+ .always_collect_shipping_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers,+ tax_connector_id: item.tax_connector_id,+ is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false),+ is_l2_l3_enabled: item.is_l2_l3_enabled.unwrap_or(false),+ version: item.version,+ dynamic_routing_algorithm: item.dynamic_routing_algorithm,+ is_network_tokenization_enabled: item.is_network_tokenization_enabled,+ is_auto_retries_enabled: item.is_auto_retries_enabled.unwrap_or(false),+ max_auto_retries_enabled: item.max_auto_retries_enabled,+ always_request_extended_authorization: item.always_request_extended_authorization,+ is_click_to_pay_enabled: item.is_click_to_pay_enabled,+ authentication_product_ids: item.authentication_product_ids,+ card_testing_guard_config: item.card_testing_guard_config,+ card_testing_secret_key,+ is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,+ force_3ds_challenge: item.force_3ds_challenge.unwrap_or_default(),+ is_debit_routing_enabled: item.is_debit_routing_enabled,+ merchant_business_country: item.merchant_business_country,+ is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,+ is_pre_network_tokenization_enabled: item+ .is_pre_network_tokenization_enabled+ .unwrap_or(false),+ three_ds_decision_rule_algorithm: item.three_ds_decision_rule_algorithm,+ acquirer_config_map: item+ .acquirer_config_map+ .map(common_types::domain::AcquirerConfigBucket::from),+ merchant_category_code: item.merchant_category_code,+ merchant_country_code: item.merchant_country_code,+ dispute_polling_interval: item.dispute_polling_interval,+ is_manual_retry_enabled: item.is_manual_retry_enabled,+ always_enable_overcapture: item.always_enable_overcapture,+ external_vault_details,+ billing_processor_id: item.billing_processor_id,+ surcharge_connector_details: item.surcharge_connector_details,+ network_tokenization_credentials,+ payment_method_blocking: item.payment_method_blocking,+ default_fallback_routing: item.default_fallback_routing,+ }+ .into())+ }++ async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {+ let (is_external_vault_enabled, external_vault_connector_details) =+ self.external_vault_details.clone().into();++ Ok(diesel::ProfileNew {+ profile_id: self.get_id().clone(),+ id: Some(self.get_id().clone()),+ merchant_id: self.merchant_id,+ profile_name: self.profile_name,+ created_at: self.created_at,+ modified_at: self.modified_at,+ return_url: self.return_url,+ enable_payment_response_hash: self.enable_payment_response_hash,+ payment_response_hash_key: self.payment_response_hash_key,+ redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,+ webhook_details: self.webhook_details,+ metadata: self.metadata,+ routing_algorithm: self.routing_algorithm,+ intent_fulfillment_time: self.intent_fulfillment_time,+ frm_routing_algorithm: self.frm_routing_algorithm,+ payout_routing_algorithm: self.payout_routing_algorithm,+ is_recon_enabled: self.is_recon_enabled,+ applepay_verified_domains: self.applepay_verified_domains,+ payment_link_config: self.payment_link_config,+ session_expiry: self.session_expiry,+ authentication_connector_details: self.authentication_connector_details,+ payout_link_config: self.payout_link_config,+ is_extended_card_info_enabled: self.is_extended_card_info_enabled,+ extended_card_info_config: self.extended_card_info_config,+ is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: self+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: self+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: self+ .outgoing_webhook_custom_http_headers+ .map(Encryption::from),+ always_collect_billing_details_from_wallet_connector: self+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: self+ .always_collect_shipping_details_from_wallet_connector,+ tax_connector_id: self.tax_connector_id,+ is_tax_connector_enabled: Some(self.is_tax_connector_enabled),+ is_l2_l3_enabled: Some(self.is_l2_l3_enabled),+ version: self.version,+ is_network_tokenization_enabled: self.is_network_tokenization_enabled,+ is_auto_retries_enabled: Some(self.is_auto_retries_enabled),+ max_auto_retries_enabled: self.max_auto_retries_enabled,+ is_click_to_pay_enabled: self.is_click_to_pay_enabled,+ authentication_product_ids: self.authentication_product_ids,+ card_testing_guard_config: self.card_testing_guard_config,+ card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),+ is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,+ force_3ds_challenge: Some(self.force_3ds_challenge),+ is_debit_routing_enabled: self.is_debit_routing_enabled,+ merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,+ is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),+ merchant_category_code: self.merchant_category_code,+ merchant_country_code: self.merchant_country_code,+ dispute_polling_interval: self.dispute_polling_interval,+ is_manual_retry_enabled: self.is_manual_retry_enabled,+ is_external_vault_enabled,+ external_vault_connector_details,+ billing_processor_id: self.billing_processor_id,+ surcharge_connector_details: self.surcharge_connector_details,+ network_tokenization_credentials: self+ .network_tokenization_credentials+ .map(|name| name.into()),+ payment_method_blocking: self.payment_method_blocking,+ default_fallback_routing: self.default_fallback_routing,+ })+ }+}++#[cfg(feature = "v2")]+impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {+ fn foreign_from(profile_update: domain::ProfileUpdate) -> Self {+ let now = date_time::now();++ match profile_update {+ domain::ProfileUpdate::Update(update) => {+ let domain::ProfileGeneralUpdate {+ profile_name,+ return_url,+ enable_payment_response_hash,+ payment_response_hash_key,+ redirect_to_merchant_with_http_post,+ webhook_details,+ metadata,+ applepay_verified_domains,+ payment_link_config,+ session_expiry,+ authentication_connector_details,+ payout_link_config,+ extended_card_info_config,+ use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector,+ is_connector_agnostic_mit_enabled,+ outgoing_webhook_custom_http_headers,+ always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector,+ order_fulfillment_time,+ order_fulfillment_time_origin,+ is_network_tokenization_enabled,+ is_click_to_pay_enabled,+ authentication_product_ids,+ three_ds_decision_manager_config,+ card_testing_guard_config,+ card_testing_secret_key,+ is_debit_routing_enabled,+ merchant_business_country,+ is_iframe_redirection_enabled,+ is_external_vault_enabled,+ external_vault_connector_details,+ merchant_category_code,+ merchant_country_code,+ revenue_recovery_retry_algorithm_type,+ split_txns_enabled,+ billing_processor_id,+ surcharge_connector_details,+ } = *update;+ Self {+ profile_name,+ modified_at: now,+ return_url,+ enable_payment_response_hash,+ payment_response_hash_key,+ redirect_to_merchant_with_http_post,+ webhook_details,+ metadata,+ is_recon_enabled: None,+ applepay_verified_domains,+ payment_link_config,+ session_expiry,+ authentication_connector_details,+ payout_link_config,+ is_extended_card_info_enabled: None,+ extended_card_info_config,+ is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers+ .map(Encryption::from),+ routing_algorithm_id: None,+ always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector,+ order_fulfillment_time,+ order_fulfillment_time_origin,+ frm_routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_l2_l3_enabled: None,+ is_network_tokenization_enabled,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled,+ authentication_product_ids,+ three_ds_decision_manager_config,+ card_testing_guard_config,+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled,+ merchant_business_country,+ revenue_recovery_retry_algorithm_type,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled,+ is_external_vault_enabled,+ external_vault_connector_details,+ merchant_category_code,+ merchant_country_code,+ split_txns_enabled,+ billing_processor_id,+ surcharge_connector_details,+ }+ }+ domain::ProfileUpdate::RoutingAlgorithmUpdate {+ routing_algorithm_id,+ payout_routing_algorithm_id,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ routing_algorithm_id,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ payout_routing_algorithm_id,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_l2_l3_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::ExtendedCardInfoUpdate {+ is_extended_card_info_enabled,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: Some(is_extended_card_info_enabled),+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_l2_l3_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::ConnectorAgnosticMitUpdate {+ is_connector_agnostic_mit_enabled,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ is_l2_l3_enabled: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: Some(is_connector_agnostic_mit_enabled),+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::DefaultRoutingFallbackUpdate {+ default_fallback_routing,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ is_l2_l3_enabled: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::NetworkTokenizationUpdate {+ is_network_tokenization_enabled,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ is_l2_l3_enabled: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: Some(is_network_tokenization_enabled),+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::CollectCvvDuringPaymentUpdate {+ should_collect_cvv_during_payment,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: Some(should_collect_cvv_during_payment),+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ is_l2_l3_enabled: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::DecisionManagerRecordUpdate {+ three_ds_decision_manager_config,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: Some(three_ds_decision_manager_config),+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_l2_l3_enabled: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::CardTestingSecretKeyUpdate {+ card_testing_secret_key,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: card_testing_secret_key.map(Encryption::from),+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ is_l2_l3_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: None,+ revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ domain::ProfileUpdate::RevenueRecoveryAlgorithmUpdate {+ revenue_recovery_retry_algorithm_type,+ revenue_recovery_retry_algorithm_data,+ } => Self {+ profile_name: None,+ modified_at: now,+ return_url: None,+ enable_payment_response_hash: None,+ payment_response_hash_key: None,+ redirect_to_merchant_with_http_post: None,+ webhook_details: None,+ metadata: None,+ is_recon_enabled: None,+ applepay_verified_domains: None,+ payment_link_config: None,+ session_expiry: None,+ authentication_connector_details: None,+ payout_link_config: None,+ is_extended_card_info_enabled: None,+ extended_card_info_config: None,+ is_connector_agnostic_mit_enabled: None,+ use_billing_as_payment_method_billing: None,+ collect_shipping_details_from_wallet_connector: None,+ collect_billing_details_from_wallet_connector: None,+ outgoing_webhook_custom_http_headers: None,+ always_collect_billing_details_from_wallet_connector: None,+ always_collect_shipping_details_from_wallet_connector: None,+ routing_algorithm_id: None,+ is_l2_l3_enabled: None,+ payout_routing_algorithm_id: None,+ order_fulfillment_time: None,+ order_fulfillment_time_origin: None,+ frm_routing_algorithm_id: None,+ default_fallback_routing: None,+ should_collect_cvv_during_payment: None,+ tax_connector_id: None,+ is_tax_connector_enabled: None,+ is_network_tokenization_enabled: None,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: None,+ authentication_product_ids: None,+ three_ds_decision_manager_config: None,+ card_testing_guard_config: None,+ card_testing_secret_key: None,+ is_clear_pan_retries_enabled: None,+ is_debit_routing_enabled: None,+ merchant_business_country: None,+ revenue_recovery_retry_algorithm_type: Some(revenue_recovery_retry_algorithm_type),+ revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: None,+ is_external_vault_enabled: None,+ external_vault_connector_details: None,+ merchant_category_code: None,+ merchant_country_code: None,+ split_txns_enabled: None,+ billing_processor_id: None,+ surcharge_connector_details: None,+ },+ }+ }+}++#[cfg(feature = "v2")]+#[async_trait::async_trait]+impl Conversion for domain::Profile {+ type DstType = diesel::Profile;+ type NewDstType = diesel::ProfileNew;++ async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {+ Ok(diesel::Profile {+ id: self.get_id().to_owned(),+ merchant_id: self.merchant_id,+ profile_name: self.profile_name,+ created_at: self.created_at,+ modified_at: self.modified_at,+ return_url: self.return_url,+ enable_payment_response_hash: self.enable_payment_response_hash,+ payment_response_hash_key: self.payment_response_hash_key,+ redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,+ webhook_details: self.webhook_details,+ metadata: self.metadata,+ is_recon_enabled: self.is_recon_enabled,+ applepay_verified_domains: self.applepay_verified_domains,+ payment_link_config: self.payment_link_config,+ session_expiry: self.session_expiry,+ authentication_connector_details: self.authentication_connector_details,+ payout_link_config: self.payout_link_config,+ is_extended_card_info_enabled: self.is_extended_card_info_enabled,+ extended_card_info_config: self.extended_card_info_config,+ is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: self+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: self+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: self+ .outgoing_webhook_custom_http_headers+ .map(Encryption::from),+ routing_algorithm_id: self.routing_algorithm_id,+ always_collect_billing_details_from_wallet_connector: self+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: self+ .always_collect_shipping_details_from_wallet_connector,+ payout_routing_algorithm_id: self.payout_routing_algorithm_id,+ order_fulfillment_time: self.order_fulfillment_time,+ order_fulfillment_time_origin: self.order_fulfillment_time_origin,+ frm_routing_algorithm_id: self.frm_routing_algorithm_id,+ default_fallback_routing: self.default_fallback_routing,+ should_collect_cvv_during_payment: self.should_collect_cvv_during_payment,+ tax_connector_id: self.tax_connector_id,+ is_tax_connector_enabled: Some(self.is_tax_connector_enabled),+ version: self.version,+ dynamic_routing_algorithm: None,+ is_network_tokenization_enabled: self.is_network_tokenization_enabled,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ always_request_extended_authorization: None,+ is_click_to_pay_enabled: self.is_click_to_pay_enabled,+ authentication_product_ids: self.authentication_product_ids,+ three_ds_decision_manager_config: self.three_ds_decision_manager_config,+ card_testing_guard_config: self.card_testing_guard_config,+ card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),+ is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,+ force_3ds_challenge: None,+ is_debit_routing_enabled: self.is_debit_routing_enabled,+ merchant_business_country: self.merchant_business_country,+ revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,+ revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,+ is_external_vault_enabled: self.is_external_vault_enabled,+ external_vault_connector_details: self.external_vault_connector_details,+ three_ds_decision_rule_algorithm: None,+ acquirer_config_map: None,+ merchant_category_code: self.merchant_category_code,+ merchant_country_code: self.merchant_country_code,+ dispute_polling_interval: None,+ split_txns_enabled: Some(self.split_txns_enabled),+ is_manual_retry_enabled: None,+ is_l2_l3_enabled: None,+ always_enable_overcapture: None,+ billing_processor_id: self.billing_processor_id,+ surcharge_connector_details: self.surcharge_connector_details,+ network_tokenization_credentials: None,+ payment_method_blocking: None,+ })+ }++ async fn convert_back(+ state: &keymanager::KeyManagerState,+ item: Self::DstType,+ key: &Secret<Vec<u8>>,+ key_manager_identifier: keymanager::Identifier,+ ) -> CustomResult<Self, ValidationError>+ where+ Self: Sized,+ {+ async {+ Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(+ domain::ProfileDbBuilder {+ id: item.id,+ merchant_id: item.merchant_id,+ profile_name: item.profile_name,+ created_at: item.created_at,+ modified_at: item.modified_at,+ return_url: item.return_url,+ enable_payment_response_hash: item.enable_payment_response_hash,+ payment_response_hash_key: item.payment_response_hash_key,+ redirect_to_merchant_with_http_post: item.redirect_to_merchant_with_http_post,+ webhook_details: item.webhook_details,+ metadata: item.metadata,+ is_recon_enabled: item.is_recon_enabled,+ applepay_verified_domains: item.applepay_verified_domains,+ payment_link_config: item.payment_link_config,+ session_expiry: item.session_expiry,+ authentication_connector_details: item.authentication_connector_details,+ payout_link_config: item.payout_link_config,+ is_extended_card_info_enabled: item.is_extended_card_info_enabled,+ extended_card_info_config: item.extended_card_info_config,+ is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: item+ .use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: item+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: item+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: item+ .outgoing_webhook_custom_http_headers+ .async_lift(|inner| async {+ crypto_operation(+ state,+ type_name!(Self::DstType),+ CryptoOperation::DecryptOptional(inner),+ key_manager_identifier.clone(),+ key.peek(),+ )+ .await+ .and_then(|val| val.try_into_optionaloperation())+ })+ .await?,+ routing_algorithm_id: item.routing_algorithm_id,+ always_collect_billing_details_from_wallet_connector: item+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: item+ .always_collect_shipping_details_from_wallet_connector,+ order_fulfillment_time: item.order_fulfillment_time,+ order_fulfillment_time_origin: item.order_fulfillment_time_origin,+ frm_routing_algorithm_id: item.frm_routing_algorithm_id,+ payout_routing_algorithm_id: item.payout_routing_algorithm_id,+ default_fallback_routing: item.default_fallback_routing,+ should_collect_cvv_during_payment: item.should_collect_cvv_during_payment,+ tax_connector_id: item.tax_connector_id,+ is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false),+ version: item.version,+ is_network_tokenization_enabled: item.is_network_tokenization_enabled,+ is_click_to_pay_enabled: item.is_click_to_pay_enabled,+ authentication_product_ids: item.authentication_product_ids,+ three_ds_decision_manager_config: item.three_ds_decision_manager_config,+ card_testing_guard_config: item.card_testing_guard_config,+ card_testing_secret_key: match item.card_testing_secret_key {+ Some(encrypted_value) => crypto_operation(+ state,+ type_name!(Self::DstType),+ CryptoOperation::DecryptOptional(Some(encrypted_value)),+ key_manager_identifier.clone(),+ key.peek(),+ )+ .await+ .and_then(|val| val.try_into_optionaloperation())+ .unwrap_or_default(),+ None => None,+ },+ is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,+ is_debit_routing_enabled: item.is_debit_routing_enabled,+ merchant_business_country: item.merchant_business_country,+ revenue_recovery_retry_algorithm_type: item+ .revenue_recovery_retry_algorithm_type,+ revenue_recovery_retry_algorithm_data: item+ .revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,+ is_external_vault_enabled: item.is_external_vault_enabled,+ external_vault_connector_details: item.external_vault_connector_details,+ merchant_category_code: item.merchant_category_code,+ merchant_country_code: item.merchant_country_code,+ split_txns_enabled: item.split_txns_enabled.unwrap_or_default(),+ billing_processor_id: item.billing_processor_id,+ surcharge_connector_details: item.surcharge_connector_details,+ }+ .into(),+ )+ }+ .await+ .change_context(ValidationError::InvalidValue {+ message: "Failed while decrypting business profile data".to_string(),+ })+ }++ async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {+ Ok(diesel::ProfileNew {+ id: self.get_id().to_owned(),+ merchant_id: self.merchant_id,+ profile_name: self.profile_name,+ created_at: self.created_at,+ modified_at: self.modified_at,+ return_url: self.return_url,+ enable_payment_response_hash: self.enable_payment_response_hash,+ payment_response_hash_key: self.payment_response_hash_key,+ redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,+ webhook_details: self.webhook_details,+ metadata: self.metadata,+ is_recon_enabled: self.is_recon_enabled,+ applepay_verified_domains: self.applepay_verified_domains,+ payment_link_config: self.payment_link_config,+ session_expiry: self.session_expiry,+ authentication_connector_details: self.authentication_connector_details,+ payout_link_config: self.payout_link_config,+ is_extended_card_info_enabled: self.is_extended_card_info_enabled,+ extended_card_info_config: self.extended_card_info_config,+ is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,+ use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,+ collect_shipping_details_from_wallet_connector: self+ .collect_shipping_details_from_wallet_connector,+ collect_billing_details_from_wallet_connector: self+ .collect_billing_details_from_wallet_connector,+ outgoing_webhook_custom_http_headers: self+ .outgoing_webhook_custom_http_headers+ .map(Encryption::from),+ routing_algorithm_id: self.routing_algorithm_id,+ always_collect_billing_details_from_wallet_connector: self+ .always_collect_billing_details_from_wallet_connector,+ always_collect_shipping_details_from_wallet_connector: self+ .always_collect_shipping_details_from_wallet_connector,+ order_fulfillment_time: self.order_fulfillment_time,+ order_fulfillment_time_origin: self.order_fulfillment_time_origin,+ frm_routing_algorithm_id: self.frm_routing_algorithm_id,+ payout_routing_algorithm_id: self.payout_routing_algorithm_id,+ default_fallback_routing: self.default_fallback_routing,+ should_collect_cvv_during_payment: self.should_collect_cvv_during_payment,+ tax_connector_id: self.tax_connector_id,+ is_tax_connector_enabled: Some(self.is_tax_connector_enabled),+ version: self.version,+ is_network_tokenization_enabled: self.is_network_tokenization_enabled,+ is_auto_retries_enabled: None,+ max_auto_retries_enabled: None,+ is_click_to_pay_enabled: self.is_click_to_pay_enabled,+ authentication_product_ids: self.authentication_product_ids,+ three_ds_decision_manager_config: self.three_ds_decision_manager_config,+ card_testing_guard_config: self.card_testing_guard_config,+ card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),+ is_clear_pan_retries_enabled: Some(self.is_clear_pan_retries_enabled),+ is_debit_routing_enabled: self.is_debit_routing_enabled,+ merchant_business_country: self.merchant_business_country,+ revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,+ revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,+ is_external_vault_enabled: self.is_external_vault_enabled,+ external_vault_connector_details: self.external_vault_connector_details,+ merchant_category_code: self.merchant_category_code,+ is_l2_l3_enabled: None,+ merchant_country_code: self.merchant_country_code,+ split_txns_enabled: Some(self.split_txns_enabled),+ billing_processor_id: self.billing_processor_id,+ surcharge_connector_details: self.surcharge_connector_details,+ payment_method_blocking: None,+ })+ }+}diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rsindex 6e487615ca..e7213dad8b 100644--- a/crates/storage_impl/src/lib.rs+++ b/crates/storage_impl/src/lib.rs@@ -196,6 +196,7 @@ impl<T: DatabaseStore> RouterStore<T> {&self.master_encryption_key}+ // TODO: This needs to be removed after the removal of diesel_models dependency from domain_models is donepub async fn call_database<D, R, M>(&self,key_store: &MerchantKeyStore,@@ -223,6 +224,34 @@ impl<T: DatabaseStore> RouterStore<T> {.change_context(StorageError::DecryptionError)}+ // Equivalent of call_database but where conversion trait is implemented in storage_impl crate+ pub async fn call_database_new<D, R, M>(+ &self,+ key_store: &MerchantKeyStore,+ execute_query: R,+ ) -> error_stack::Result<D, StorageError>+ where+ D: Debug + Sync + behaviour::Conversion,+ R: futures::Future<Output = error_stack::Result<M, diesel_models::errors::DatabaseError>>+ + Send,+ M: behaviour::ReverseConversion<D>,+ {+ execute_query+ .await+ .map_err(|error| {+ let new_err = diesel_error_to_data_error(*error.current_context());+ error.change_context(new_err)+ })?+ .convert(+ self.get_keymanager_state()+ .attach_printable("Missing KeyManagerState")?,+ key_store.key.get_inner(),+ key_store.merchant_id.clone().into(),+ )+ .await+ .change_context(StorageError::DecryptionError)+ }+pub async fn find_optional_resource<D, R, M>(&self,key_store: &MerchantKeyStore,@@ -254,6 +283,7 @@ impl<T: DatabaseStore> RouterStore<T> {}}+ // TODO: This needs to be removed after the removal of diesel_models dependency from domain_models is donepub async fn find_resources<D, R, M>(&self,key_store: &MerchantKeyStore,@@ -291,6 +321,44 @@ impl<T: DatabaseStore> RouterStore<T> {Ok(resources)}+ // Equivalent of find_resources but where conversion trait is implemented in storage_impl crate+ pub async fn find_resources_new<D, R, M>(+ &self,+ key_store: &MerchantKeyStore,+ execute_query: R,+ ) -> error_stack::Result<Vec<D>, StorageError>+ where+ D: Debug + Sync + behaviour::Conversion,+ R: futures::Future<+ Output = error_stack::Result<Vec<M>, diesel_models::errors::DatabaseError>,+ > + Send,+ M: behaviour::ReverseConversion<D>,+ {+ let resource_futures = execute_query+ .await+ .map_err(|error| {+ let new_err = diesel_error_to_data_error(*error.current_context());+ error.change_context(new_err)+ })?+ .into_iter()+ .map(|resource| async {+ resource+ .convert(+ self.get_keymanager_state()+ .attach_printable("Missing KeyManagerState")?,+ key_store.key.get_inner(),+ key_store.merchant_id.clone().into(),+ )+ .await+ .change_context(StorageError::DecryptionError)+ })+ .collect::<Vec<_>>();++ let resources = futures::future::try_join_all(resource_futures).await?;++ Ok(resources)+ }+/// # Panics////// Will panic if `CONNECTOR_AUTH_FILE_PATH` is not set