Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -10165,6 +10165,16 @@
}
}
},
"ExternalVaultConnectorDetails": {
"type": "object",
"properties": {
"vault_connector_id": {
"type": "string",
"description": "Merchant Connector id to be stored for vault connector",
"nullable": true
}
}
},
"FeatureMatrixListResponse": {
"type": "object",
"required": [
Expand Down Expand Up @@ -19820,6 +19830,19 @@
}
],
"nullable": true
},
"is_external_vault_enabled": {
"type": "boolean",
"description": "Indicates if external vault is enabled or not.",
"nullable": true
},
"external_vault_connector_details": {
"allOf": [
{
"$ref": "#/components/schemas/ExternalVaultConnectorDetails"
}
],
"nullable": true
}
},
"additionalProperties": false
Expand Down Expand Up @@ -20070,6 +20093,19 @@
}
],
"nullable": true
},
"is_external_vault_enabled": {
"type": "boolean",
"description": "Indicates if external vault is enabled or not.",
"nullable": true
},
"external_vault_connector_details": {
"allOf": [
{
"$ref": "#/components/schemas/ExternalVaultConnectorDetails"
}
],
"nullable": true
}
}
},
Expand Down
25 changes: 25 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ pub struct AuthenticationConnectorDetails {
pub three_ds_requestor_app_url: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct ExternalVaultConnectorDetails {
/// Merchant Connector id to be stored for vault connector
#[schema(value_type = Option<String>)]
pub vault_connector_id: id_type::MerchantConnectorAccountId,
}

#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct MerchantAccountMetadata {
pub compatible_connector: Option<api_enums::Connector>,
Expand Down Expand Up @@ -2124,6 +2131,12 @@ pub struct ProfileCreate {
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,

/// Indicates if external vault is enabled or not.
pub is_external_vault_enabled: Option<bool>,

/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -2423,6 +2436,12 @@ pub struct ProfileResponse {
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,

/// Indicates if external vault is enabled or not.
pub is_external_vault_enabled: Option<bool>,

/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -2697,6 +2716,12 @@ pub struct ProfileUpdate {
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,

/// Indicates if external vault is enabled or not.
pub is_external_vault_enabled: Option<bool>,

/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
Expand Down
20 changes: 20 additions & 0 deletions crates/diesel_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ pub struct Profile {
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
pub should_collect_cvv_during_payment:
Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
}
Expand Down Expand Up @@ -436,6 +438,8 @@ pub struct ProfileNew {
pub id: common_utils::id_type::ProfileId,
pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -490,6 +494,8 @@ pub struct ProfileUpdateInternal {
Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,
pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -541,6 +547,8 @@ impl ProfileUpdateInternal {
merchant_business_country,
revenue_recovery_retry_algorithm_type,
revenue_recovery_retry_algorithm_data,
is_external_vault_enabled,
external_vault_connector_details,
} = self;
Profile {
id: source.id,
Expand Down Expand Up @@ -625,6 +633,10 @@ impl ProfileUpdateInternal {
.or(source.revenue_recovery_retry_algorithm_type),
revenue_recovery_retry_algorithm_data: revenue_recovery_retry_algorithm_data
.or(source.revenue_recovery_retry_algorithm_data),
is_external_vault_enabled: is_external_vault_enabled
.or(source.is_external_vault_enabled),
external_vault_connector_details: external_vault_connector_details
.or(source.external_vault_connector_details),
}
}
}
Expand All @@ -639,6 +651,14 @@ pub struct AuthenticationConnectorDetails {

common_utils::impl_to_sql_from_sql_json!(AuthenticationConnectorDetails);

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct ExternalVaultConnectorDetails {
pub vault_connector_id: common_utils::id_type::MerchantConnectorAccountId,
}

common_utils::impl_to_sql_from_sql_json!(ExternalVaultConnectorDetails);

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct CardTestingGuardConfig {
Expand Down
2 changes: 2 additions & 0 deletions crates/diesel_models/src/schema_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ diesel::table! {
default_fallback_routing -> Nullable<Jsonb>,
three_ds_decision_manager_config -> Nullable<Jsonb>,
should_collect_cvv_during_payment -> Nullable<Bool>,
is_external_vault_enabled -> Nullable<Bool>,
external_vault_connector_details -> Nullable<Jsonb>,
revenue_recovery_retry_algorithm_type -> Nullable<RevenueRecoveryAlgorithmType>,
revenue_recovery_retry_algorithm_data -> Nullable<Jsonb>,
}
Expand Down
42 changes: 40 additions & 2 deletions crates/hyperswitch_domain_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ use common_utils::{
pii, type_name,
types::keymanager,
};
#[cfg(feature = "v2")]
use diesel_models::business_profile::RevenueRecoveryAlgorithmData;
use diesel_models::business_profile::{
AuthenticationConnectorDetails, BusinessPaymentLinkConfig, BusinessPayoutLinkConfig,
CardTestingGuardConfig, ProfileUpdateInternal, WebhookDetails,
};
#[cfg(feature = "v2")]
use diesel_models::business_profile::{
ExternalVaultConnectorDetails, RevenueRecoveryAlgorithmData,
};
use error_stack::ResultExt;
use masking::{PeekInterface, Secret};

Expand Down Expand Up @@ -905,6 +907,8 @@ pub struct Profile {
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_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -957,6 +961,8 @@ pub struct ProfileSetter {
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_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -1014,6 +1020,8 @@ impl From<ProfileSetter> for Profile {
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_external_vault_enabled: value.is_external_vault_enabled,
external_vault_connector_details: value.external_vault_connector_details,
}
}
}
Expand Down Expand Up @@ -1072,6 +1080,8 @@ pub struct ProfileGeneralUpdate {
pub card_testing_secret_key: OptionalEncryptableName,
pub is_debit_routing_enabled: bool,
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -1147,6 +1157,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key,
is_debit_routing_enabled,
merchant_business_country,
is_external_vault_enabled,
external_vault_connector_details,
} = *update;
Self {
profile_name,
Expand Down Expand Up @@ -1195,6 +1207,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled,
external_vault_connector_details,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
Expand Down Expand Up @@ -1246,6 +1260,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
Expand Down Expand Up @@ -1295,6 +1311,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
Expand Down Expand Up @@ -1344,6 +1362,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
Expand Down Expand Up @@ -1393,6 +1413,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
Expand Down Expand Up @@ -1442,6 +1464,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
Expand Down Expand Up @@ -1491,6 +1515,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
Expand Down Expand Up @@ -1540,6 +1566,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
Expand Down Expand Up @@ -1589,6 +1617,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
ProfileUpdate::RevenueRecoveryAlgorithmUpdate {
revenue_recovery_retry_algorithm_type,
Expand Down Expand Up @@ -1639,6 +1669,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: Some(revenue_recovery_retry_algorithm_type),
revenue_recovery_retry_algorithm_data,
is_external_vault_enabled: None,
external_vault_connector_details: None,
},
}
}
Expand Down Expand Up @@ -1710,6 +1742,8 @@ impl super::behaviour::Conversion for Profile {
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_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self.external_vault_connector_details,
})
}

Expand Down Expand Up @@ -1801,6 +1835,8 @@ impl super::behaviour::Conversion for Profile {
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_external_vault_enabled: item.is_external_vault_enabled,
external_vault_connector_details: item.external_vault_connector_details,
})
}
.await
Expand Down Expand Up @@ -1866,6 +1902,8 @@ impl super::behaviour::Conversion for Profile {
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_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self.external_vault_connector_details,
})
}
}
1 change: 1 addition & 0 deletions crates/openapi/src/openapi_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::MerchantConnectorResponse,
api_models::admin::MerchantConnectorListResponse,
api_models::admin::AuthenticationConnectorDetails,
api_models::admin::ExternalVaultConnectorDetails,
api_models::admin::ExtendedCardInfoConfig,
api_models::admin::BusinessGenericLinkConfig,
api_models::admin::BusinessCollectLinkConfig,
Expand Down
8 changes: 8 additions & 0 deletions crates/router/src/core/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4005,6 +4005,10 @@ impl ProfileCreateBridge for api::ProfileCreate {
merchant_business_country: self.merchant_business_country,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self
.external_vault_connector_details
.map(ForeignInto::foreign_into),
}))
}
}
Expand Down Expand Up @@ -4439,6 +4443,10 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
card_testing_secret_key,
is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),
merchant_business_country: self.merchant_business_country,
is_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self
.external_vault_connector_details
.map(ForeignInto::foreign_into),
},
)))
}
Expand Down
Loading
Loading