mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
feat: Session flow for Apple Pay trustpay (#1155)
This commit is contained in:
committed by
GitHub
parent
d21fcc7bfc
commit
a6e91a828b
@ -1620,6 +1620,8 @@ pub struct PaymentsSessionRequest {
|
||||
/// Merchant connector details used to make payments.
|
||||
#[schema(value_type = Option<MerchantConnectorDetailsWrap>)]
|
||||
pub merchant_connector_details: Option<admin::MerchantConnectorDetailsWrap>,
|
||||
/// Identifier for the delayed session response
|
||||
pub delayed_session_token: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -1783,13 +1785,47 @@ pub struct ApplepaySessionTokenResponse {
|
||||
/// Session object for Apple Pay
|
||||
pub session_token_data: ApplePaySessionResponse,
|
||||
/// Payment request object for Apple Pay
|
||||
pub payment_request_data: ApplePayPaymentRequest,
|
||||
pub payment_request_data: Option<ApplePayPaymentRequest>,
|
||||
/// The session token is w.r.t this connector
|
||||
pub connector: String,
|
||||
/// Identifier for the delayed session response
|
||||
pub delayed_session_token: bool,
|
||||
/// The next action for the sdk (ex: calling confirm or sync call)
|
||||
pub sdk_next_action: SdkNextAction,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
|
||||
pub struct SdkNextAction {
|
||||
/// The type of next action
|
||||
pub next_action: NextActionCall,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum NextActionCall {
|
||||
/// The next action call is confirm
|
||||
Confirm,
|
||||
/// The next action call is sync
|
||||
Sync,
|
||||
/// The next action call is session
|
||||
SessionToken,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema)]
|
||||
#[serde(untagged)]
|
||||
pub enum ApplePaySessionResponse {
|
||||
/// We get this session response, when third party sdk is involved
|
||||
ThirdPartySdk(ThirdPartySdkSessionResponse),
|
||||
/// We get this session response, when there is no involvement of third party sdk
|
||||
/// This is the common response most of the times
|
||||
NoThirdPartySdk(Option<NoThirdPartySdkSessionResponse>),
|
||||
/// This is for the empty session response
|
||||
NoSessionResponse,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
#[serde(rename_all(deserialize = "camelCase"))]
|
||||
pub struct ApplePaySessionResponse {
|
||||
pub struct NoThirdPartySdkSessionResponse {
|
||||
/// Timestamp at which session is requested
|
||||
pub epoch_timestamp: u64,
|
||||
/// Timestamp at which session expires
|
||||
@ -1814,6 +1850,21 @@ pub struct ApplePaySessionResponse {
|
||||
pub psp_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema)]
|
||||
pub struct ThirdPartySdkSessionResponse {
|
||||
pub secrets: SecretInfoToInitiateSdk,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
pub struct SecretInfoToInitiateSdk {
|
||||
// Authorization secrets used by client to initiate sdk
|
||||
#[schema(value_type = String)]
|
||||
pub display: Secret<String>,
|
||||
// Authorization secrets used by client for payment
|
||||
#[schema(value_type = String)]
|
||||
pub payment: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
pub struct ApplePayPaymentRequest {
|
||||
/// The code for country
|
||||
@ -1827,7 +1878,7 @@ pub struct ApplePayPaymentRequest {
|
||||
pub merchant_capabilities: Vec<String>,
|
||||
/// The list of supported networks
|
||||
pub supported_networks: Vec<String>,
|
||||
pub merchant_identifier: String,
|
||||
pub merchant_identifier: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
@ -1836,7 +1887,7 @@ pub struct AmountInfo {
|
||||
pub label: String,
|
||||
/// A value that indicates whether the line item(Ex: total, tax, discount, or grand total) is final or pending.
|
||||
#[serde(rename = "type")]
|
||||
pub total_type: String,
|
||||
pub total_type: Option<String>,
|
||||
/// The total amount for the payment
|
||||
pub amount: String,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user