mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +08:00
feat: Add amount, currency and email to paze session response (#6412)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -16200,7 +16200,9 @@
|
|||||||
"required": [
|
"required": [
|
||||||
"client_id",
|
"client_id",
|
||||||
"client_name",
|
"client_name",
|
||||||
"client_profile_id"
|
"client_profile_id",
|
||||||
|
"transaction_currency_code",
|
||||||
|
"transaction_amount"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"client_id": {
|
"client_id": {
|
||||||
@ -16214,6 +16216,21 @@
|
|||||||
"client_profile_id": {
|
"client_profile_id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Paze Client Profile ID"
|
"description": "Paze Client Profile ID"
|
||||||
|
},
|
||||||
|
"transaction_currency_code": {
|
||||||
|
"$ref": "#/components/schemas/Currency"
|
||||||
|
},
|
||||||
|
"transaction_amount": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The transaction amount",
|
||||||
|
"example": "38.02"
|
||||||
|
},
|
||||||
|
"email_address": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Email Address",
|
||||||
|
"example": "johntest@test.com",
|
||||||
|
"nullable": true,
|
||||||
|
"maxLength": 255
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20986,7 +20986,9 @@
|
|||||||
"required": [
|
"required": [
|
||||||
"client_id",
|
"client_id",
|
||||||
"client_name",
|
"client_name",
|
||||||
"client_profile_id"
|
"client_profile_id",
|
||||||
|
"transaction_currency_code",
|
||||||
|
"transaction_amount"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"client_id": {
|
"client_id": {
|
||||||
@ -21000,6 +21002,21 @@
|
|||||||
"client_profile_id": {
|
"client_profile_id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Paze Client Profile ID"
|
"description": "Paze Client Profile ID"
|
||||||
|
},
|
||||||
|
"transaction_currency_code": {
|
||||||
|
"$ref": "#/components/schemas/Currency"
|
||||||
|
},
|
||||||
|
"transaction_amount": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The transaction amount",
|
||||||
|
"example": "38.02"
|
||||||
|
},
|
||||||
|
"email_address": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Email Address",
|
||||||
|
"example": "johntest@test.com",
|
||||||
|
"nullable": true,
|
||||||
|
"maxLength": 255
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5578,6 +5578,15 @@ pub struct PazeSessionTokenResponse {
|
|||||||
pub client_name: String,
|
pub client_name: String,
|
||||||
/// Paze Client Profile ID
|
/// Paze Client Profile ID
|
||||||
pub client_profile_id: String,
|
pub client_profile_id: String,
|
||||||
|
/// The transaction currency code
|
||||||
|
#[schema(value_type = Currency, example = "USD")]
|
||||||
|
pub transaction_currency_code: api_enums::Currency,
|
||||||
|
/// The transaction amount
|
||||||
|
#[schema(value_type = String, example = "38.02")]
|
||||||
|
pub transaction_amount: StringMajorUnit,
|
||||||
|
/// Email Address
|
||||||
|
#[schema(max_length = 255, value_type = Option<String>, example = "johntest@test.com")]
|
||||||
|
pub email_address: Option<Email>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
|
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
|
||||||
|
|||||||
@ -821,7 +821,7 @@ pub struct PaymentsSessionData {
|
|||||||
pub country: Option<common_enums::CountryAlpha2>,
|
pub country: Option<common_enums::CountryAlpha2>,
|
||||||
pub surcharge_details: Option<SurchargeDetails>,
|
pub surcharge_details: Option<SurchargeDetails>,
|
||||||
pub order_details: Option<Vec<api_models::payments::OrderDetailsWithAmount>>,
|
pub order_details: Option<Vec<api_models::payments::OrderDetailsWithAmount>>,
|
||||||
|
pub email: Option<pii::Email>,
|
||||||
// Minor Unit amount for amount frame work
|
// Minor Unit amount for amount frame work
|
||||||
pub minor_amount: MinorUnit,
|
pub minor_amount: MinorUnit,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -511,7 +511,13 @@ fn create_paze_session_token(
|
|||||||
field_name: "connector_wallets_details".to_string(),
|
field_name: "connector_wallets_details".to_string(),
|
||||||
expected_format: "paze_metadata_format".to_string(),
|
expected_format: "paze_metadata_format".to_string(),
|
||||||
})?;
|
})?;
|
||||||
|
let required_amount_type = StringMajorUnitForConnector;
|
||||||
|
let transaction_currency_code = router_data.request.currency;
|
||||||
|
let transaction_amount = required_amount_type
|
||||||
|
.convert(router_data.request.minor_amount, transaction_currency_code)
|
||||||
|
.change_context(errors::ApiErrorResponse::PreconditionFailed {
|
||||||
|
message: "Failed to convert amount to string major unit for paze".to_string(),
|
||||||
|
})?;
|
||||||
Ok(types::PaymentsSessionRouterData {
|
Ok(types::PaymentsSessionRouterData {
|
||||||
response: Ok(types::PaymentsResponseData::SessionResponse {
|
response: Ok(types::PaymentsResponseData::SessionResponse {
|
||||||
session_token: payment_types::SessionToken::Paze(Box::new(
|
session_token: payment_types::SessionToken::Paze(Box::new(
|
||||||
@ -519,6 +525,9 @@ fn create_paze_session_token(
|
|||||||
client_id: paze_wallet_details.data.client_id,
|
client_id: paze_wallet_details.data.client_id,
|
||||||
client_name: paze_wallet_details.data.client_name,
|
client_name: paze_wallet_details.data.client_name,
|
||||||
client_profile_id: paze_wallet_details.data.client_profile_id,
|
client_profile_id: paze_wallet_details.data.client_profile_id,
|
||||||
|
transaction_currency_code,
|
||||||
|
transaction_amount,
|
||||||
|
email_address: router_data.request.email.clone(),
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -2650,6 +2650,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionD
|
|||||||
),
|
),
|
||||||
order_details,
|
order_details,
|
||||||
surcharge_details: payment_data.surcharge_details,
|
surcharge_details: payment_data.surcharge_details,
|
||||||
|
email: payment_data.email,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2709,6 +2710,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionD
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
order_details,
|
order_details,
|
||||||
|
email: payment_data.email,
|
||||||
surcharge_details: payment_data.surcharge_details,
|
surcharge_details: payment_data.surcharge_details,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user