mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(router): Add support for confirm-intent external vault proxy flow (#8923)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -2594,6 +2594,69 @@ pub struct PaymentMethodDataRequest {
|
||||
pub billing: Option<Address>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)]
|
||||
pub struct ProxyPaymentMethodDataRequest {
|
||||
/// This field is optional because, in case of saved cards we pass the payment_token
|
||||
/// There might be cases where we don't need to pass the payment_method_data and pass only payment method billing details
|
||||
/// We have flattened it because to maintain backwards compatibility with the old API contract
|
||||
#[serde(flatten)]
|
||||
pub payment_method_data: Option<ProxyPaymentMethodData>,
|
||||
/// billing details for the payment method.
|
||||
/// This billing details will be passed to the processor as billing address.
|
||||
/// If not passed, then payment.billing will be considered
|
||||
pub billing: Option<Address>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ProxyPaymentMethodData {
|
||||
#[schema(title = "ProxyCardData")]
|
||||
VaultDataCard(ProxyCardData),
|
||||
}
|
||||
|
||||
#[derive(Default, Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct ProxyCardData {
|
||||
/// The token which refers to the card number
|
||||
#[schema(value_type = String, example = "token_card_number")]
|
||||
pub card_number: Secret<String>,
|
||||
|
||||
/// The card's expiry month
|
||||
#[schema(value_type = String, example = "24")]
|
||||
pub card_exp_month: Secret<String>,
|
||||
|
||||
/// The card's expiry year
|
||||
#[schema(value_type = String, example = "24")]
|
||||
pub card_exp_year: Secret<String>,
|
||||
|
||||
/// The card holder's name
|
||||
#[schema(value_type = String, example = "John Test")]
|
||||
pub card_holder_name: Option<Secret<String>>,
|
||||
|
||||
/// The CVC number for the card
|
||||
#[schema(value_type = String, example = "242")]
|
||||
pub card_cvc: Secret<String>,
|
||||
|
||||
/// The name of the issuer of card
|
||||
#[schema(example = "chase")]
|
||||
pub card_issuer: Option<String>,
|
||||
|
||||
/// The card network for the card
|
||||
#[schema(value_type = Option<CardNetwork>, example = "Visa")]
|
||||
pub card_network: Option<api_enums::CardNetwork>,
|
||||
|
||||
#[schema(example = "CREDIT")]
|
||||
pub card_type: Option<String>,
|
||||
|
||||
#[schema(example = "INDIA")]
|
||||
pub card_issuing_country: Option<String>,
|
||||
|
||||
#[schema(example = "JP_AMEX")]
|
||||
pub bank_code: Option<String>,
|
||||
/// The card holder's nick name
|
||||
#[schema(value_type = Option<String>, example = "John Test")]
|
||||
pub nick_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, Eq, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PaymentMethodData {
|
||||
@ -5522,6 +5585,52 @@ pub struct ProxyPaymentsRequest {
|
||||
pub merchant_connector_id: id_type::MerchantConnectorAccountId,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub struct ExternalVaultProxyPaymentsRequest {
|
||||
/// The URL to which you want the user to be redirected after the completion of the payment operation
|
||||
/// If this url is not passed, the url configured in the business profile will be used
|
||||
#[schema(value_type = Option<String>, example = "https://hyperswitch.io")]
|
||||
pub return_url: Option<common_utils::types::Url>,
|
||||
|
||||
/// The payment instrument data to be used for the payment
|
||||
pub payment_method_data: ProxyPaymentMethodDataRequest,
|
||||
|
||||
/// The payment method type to be used for the payment. This should match with the `payment_method_data` provided
|
||||
#[schema(value_type = PaymentMethod, example = "card")]
|
||||
pub payment_method_type: api_enums::PaymentMethod,
|
||||
|
||||
/// The payment method subtype to be used for the payment. This should match with the `payment_method_data` provided
|
||||
#[schema(value_type = PaymentMethodType, example = "apple_pay")]
|
||||
pub payment_method_subtype: api_enums::PaymentMethodType,
|
||||
|
||||
/// The shipping address for the payment. This will override the shipping address provided in the create-intent request
|
||||
pub shipping: Option<Address>,
|
||||
|
||||
/// This "CustomerAcceptance" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.
|
||||
#[schema(value_type = Option<CustomerAcceptance>)]
|
||||
pub customer_acceptance: Option<common_payments_types::CustomerAcceptance>,
|
||||
|
||||
/// Additional details required by 3DS 2.0
|
||||
#[schema(value_type = Option<BrowserInformation>)]
|
||||
pub browser_info: Option<common_utils::types::BrowserInformation>,
|
||||
|
||||
/// The payment_method_id to be associated with the payment
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
|
||||
|
||||
#[schema(example = "187282ab-40ef-47a9-9206-5099ba31e432")]
|
||||
pub payment_token: Option<String>,
|
||||
|
||||
/// Merchant connector details used to make payments.
|
||||
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
|
||||
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
|
||||
|
||||
/// If true, returns stringified connector raw response body
|
||||
pub return_raw_connector_response: Option<bool>,
|
||||
}
|
||||
|
||||
// This struct contains the union of fields in `PaymentsCreateIntentRequest` and
|
||||
// `PaymentsConfirmIntentRequest`
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
|
||||
Reference in New Issue
Block a user