mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat: support gpay and applepay session response for all connectors (#839)
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
committed by
GitHub
parent
465933ba72
commit
d23e14c57a
@ -668,16 +668,6 @@ pub enum RoutableConnectors {
|
||||
Worldpay,
|
||||
}
|
||||
|
||||
/// Wallets which support obtaining session object
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SupportedWallets {
|
||||
Paypal,
|
||||
ApplePay,
|
||||
Klarna,
|
||||
Gpay,
|
||||
}
|
||||
|
||||
/// Name of banks supported by Hyperswitch
|
||||
#[derive(
|
||||
Clone,
|
||||
|
||||
@ -1339,8 +1339,8 @@ pub struct PaymentsSessionRequest {
|
||||
/// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
|
||||
pub client_secret: String,
|
||||
/// The list of the supported wallets
|
||||
#[schema(value_type = Vec<SupportedWallets>)]
|
||||
pub wallets: Vec<api_enums::SupportedWallets>,
|
||||
#[schema(value_type = Vec<PaymentMethodType>)]
|
||||
pub wallets: Vec<api_enums::PaymentMethodType>,
|
||||
/// Merchant connector details used to make payments.
|
||||
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
|
||||
}
|
||||
@ -1412,6 +1412,44 @@ pub struct GpaySessionTokenData {
|
||||
pub data: GpayMetaData,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ApplepaySessionRequest {
|
||||
pub merchant_identifier: String,
|
||||
pub display_name: String,
|
||||
pub initiative: String,
|
||||
pub initiative_context: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ApplepaySessionTokenData {
|
||||
#[serde(rename = "apple_pay")]
|
||||
pub data: ApplePayMetadata,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ApplePayMetadata {
|
||||
pub payment_request_data: PaymentRequestMetadata,
|
||||
pub session_token_data: SessionTokenInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PaymentRequestMetadata {
|
||||
pub supported_networks: Vec<String>,
|
||||
pub merchant_capabilities: Vec<String>,
|
||||
pub label: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SessionTokenInfo {
|
||||
pub certificate: String,
|
||||
pub certificate_keys: String,
|
||||
pub merchant_identifier: String,
|
||||
pub display_name: String,
|
||||
pub initiative: String,
|
||||
pub initiative_context: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema)]
|
||||
#[serde(tag = "wallet_name")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
@ -1435,6 +1473,7 @@ pub struct GpaySessionTokenResponse {
|
||||
pub allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
|
||||
/// The transaction info Google Pay requires
|
||||
pub transaction_info: GpayTransactionInfo,
|
||||
pub connector: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema)]
|
||||
@ -1460,9 +1499,11 @@ pub struct ApplepaySessionTokenResponse {
|
||||
pub session_token_data: ApplePaySessionResponse,
|
||||
/// Payment request object for Apple Pay
|
||||
pub payment_request_data: ApplePayPaymentRequest,
|
||||
pub connector: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ApplePaySessionResponse {
|
||||
/// Timestamp at which session is requested
|
||||
pub epoch_timestamp: u64,
|
||||
@ -1501,6 +1542,7 @@ pub struct ApplePayPaymentRequest {
|
||||
pub merchant_capabilities: Vec<String>,
|
||||
/// The list of supported networks
|
||||
pub supported_networks: Vec<String>,
|
||||
pub merchant_identifier: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
@ -1514,6 +1556,13 @@ pub struct AmountInfo {
|
||||
pub amount: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ApplepayErrorResponse {
|
||||
pub status_code: String,
|
||||
pub status_message: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, serde::Serialize, Clone, ToSchema)]
|
||||
pub struct PaymentsSessionResponse {
|
||||
/// The identifier for the payment
|
||||
|
||||
Reference in New Issue
Block a user