feat(payment_methods): add external_vault_details for payments v2 sdk session call (#8003)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sakil Mostak
2025-06-06 17:31:08 +05:30
committed by GitHub
parent 65acf59886
commit d32c61a256
58 changed files with 2311 additions and 103 deletions

View File

@ -287,6 +287,10 @@ pub struct ExternalVaultConnectorDetails {
/// Merchant Connector id to be stored for vault connector
#[schema(value_type = Option<String>)]
pub vault_connector_id: id_type::MerchantConnectorAccountId,
/// External vault to be used for storing payment method information
#[schema(value_type = Option<VaultSdk>)]
pub vault_sdk: Option<common_enums::VaultSdk>,
}
#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]

View File

@ -175,12 +175,14 @@ pub enum BillingConnectors {
#[strum(serialize_all = "snake_case")]
pub enum VaultConnectors {
Vgs,
HyperswitchVault,
}
impl From<VaultConnectors> for Connector {
fn from(value: VaultConnectors) -> Self {
match value {
VaultConnectors::Vgs => Self::Vgs,
VaultConnectors::HyperswitchVault => Self::HyperswitchVault,
}
}
}

View File

@ -7004,6 +7004,38 @@ pub enum SessionToken {
NoSessionTokenReceived,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum VaultSessionDetails {
Vgs(VgsSessionDetails),
HyperswitchVault(HyperswitchVaultSessionDetails),
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
pub struct VgsSessionDetails {
/// The identifier of the external vault
#[schema(value_type = String)]
pub external_vault_id: Secret<String>,
/// The environment for the external vault initiation
pub sdk_env: String,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
pub struct HyperswitchVaultSessionDetails {
/// Session ID for Hyperswitch Vault
#[schema(value_type = String)]
pub payment_method_session_id: Secret<String>,
/// Client secret for Hyperswitch Vault
#[schema(value_type = String)]
pub client_secret: Secret<String>,
/// Publishable key for Hyperswitch Vault
#[schema(value_type = String)]
pub publishable_key: Secret<String>,
/// Profile ID for Hyperswitch Vault
#[schema(value_type = String)]
pub profile_id: Secret<String>,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
#[serde(rename_all = "lowercase")]
pub struct PazeSessionTokenResponse {
@ -7392,6 +7424,8 @@ pub struct PaymentsSessionResponse {
pub payment_id: id_type::GlobalPaymentId,
/// The list of session token object
pub session_token: Vec<SessionToken>,
/// External vault session details
pub vault_details: Option<VaultSessionDetails>,
}
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]