mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
feat(session_token): serialize with camelCase for gpay token (#324)
This commit is contained in:
@ -778,18 +778,21 @@ pub struct PaymentsSessionRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayAllowedMethodsParameters {
|
pub struct GpayAllowedMethodsParameters {
|
||||||
pub allowed_auth_methods: Vec<String>,
|
pub allowed_auth_methods: Vec<String>,
|
||||||
pub allowed_card_networks: Vec<String>,
|
pub allowed_card_networks: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayTokenParameters {
|
pub struct GpayTokenParameters {
|
||||||
pub gateway: String,
|
pub gateway: String,
|
||||||
pub gateway_merchant_id: String,
|
pub gateway_merchant_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayTokenizationSpecification {
|
pub struct GpayTokenizationSpecification {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub token_specification_type: String,
|
pub token_specification_type: String,
|
||||||
@ -797,6 +800,7 @@ pub struct GpayTokenizationSpecification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayAllowedPaymentMethods {
|
pub struct GpayAllowedPaymentMethods {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub payment_method_type: String,
|
pub payment_method_type: String,
|
||||||
@ -805,6 +809,7 @@ pub struct GpayAllowedPaymentMethods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayTransactionInfo {
|
pub struct GpayTransactionInfo {
|
||||||
pub country_code: String,
|
pub country_code: String,
|
||||||
pub currency_code: String,
|
pub currency_code: String,
|
||||||
@ -813,11 +818,13 @@ pub struct GpayTransactionInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayMerchantInfo {
|
pub struct GpayMerchantInfo {
|
||||||
pub merchant_name: String,
|
pub merchant_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[serde(rename_all(serialize = "camelCase"))]
|
||||||
pub struct GpayMetadata {
|
pub struct GpayMetadata {
|
||||||
pub merchant_info: GpayMerchantInfo,
|
pub merchant_info: GpayMerchantInfo,
|
||||||
pub allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
|
pub allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
|
||||||
@ -833,7 +840,9 @@ pub struct GpaySessionTokenData {
|
|||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum SessionToken {
|
pub enum SessionToken {
|
||||||
Gpay {
|
Gpay {
|
||||||
allowed_payment_methods: Vec<GpayAllowedPaymentMethods>,
|
#[serde(flatten)]
|
||||||
|
gpay_token: GpayMetadata,
|
||||||
|
#[serde(rename(serialize = "transactionInfo"))]
|
||||||
transaction_info: GpayTransactionInfo,
|
transaction_info: GpayTransactionInfo,
|
||||||
},
|
},
|
||||||
Klarna {
|
Klarna {
|
||||||
|
|||||||
@ -84,7 +84,7 @@ fn create_gpay_session_token(
|
|||||||
let response_router_data = types::PaymentsSessionRouterData {
|
let response_router_data = types::PaymentsSessionRouterData {
|
||||||
response: Ok(types::PaymentsResponseData::SessionResponse {
|
response: Ok(types::PaymentsResponseData::SessionResponse {
|
||||||
session_token: payment_types::SessionToken::Gpay {
|
session_token: payment_types::SessionToken::Gpay {
|
||||||
allowed_payment_methods: gpay_data.gpay.allowed_payment_methods,
|
gpay_token: gpay_data.gpay,
|
||||||
transaction_info,
|
transaction_info,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user