Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat: Add amount, currency and email to paze session response (#6412)
DEEPANSHU BANSALa3ea62f88524
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.jsonindex 8ee962b0bb..aa6c45d10a 100644--- a/api-reference-v2/openapi_spec.json+++ b/api-reference-v2/openapi_spec.json@@ -16200,7 +16200,9 @@"required": ["client_id","client_name",- "client_profile_id"+ "client_profile_id",+ "transaction_currency_code",+ "transaction_amount"],"properties": {"client_id": {@@ -16214,6 +16216,21 @@"client_profile_id": {"type": "string","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": "[email protected]",+ "nullable": true,+ "maxLength": 255}}},diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex 2f6f4fdf0b..7e7df8ce1d 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -20986,7 +20986,9 @@"required": ["client_id","client_name",- "client_profile_id"+ "client_profile_id",+ "transaction_currency_code",+ "transaction_amount"],"properties": {"client_id": {@@ -21000,6 +21002,21 @@"client_profile_id": {"type": "string","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": "[email protected]",+ "nullable": true,+ "maxLength": 255}}},diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex 4ab0158d01..2e31c0ba25 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -5578,6 +5578,15 @@ pub struct PazeSessionTokenResponse {pub client_name: String,/// Paze Client Profile IDpub 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 = "[email protected]")]+ pub email_address: Option<Email>,}#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex f958b8475e..5878a28f40 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -821,7 +821,7 @@ pub struct PaymentsSessionData {pub country: Option<common_enums::CountryAlpha2>,pub surcharge_details: Option<SurchargeDetails>,pub order_details: Option<Vec<api_models::payments::OrderDetailsWithAmount>>,-+ pub email: Option<pii::Email>,// Minor Unit amount for amount frame workpub minor_amount: MinorUnit,}diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rsindex 736ffdd7b8..ba8054696a 100644--- a/crates/router/src/core/payments/flows/session_flow.rs+++ b/crates/router/src/core/payments/flows/session_flow.rs@@ -511,7 +511,13 @@ fn create_paze_session_token(field_name: "connector_wallets_details".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 {response: Ok(types::PaymentsResponseData::SessionResponse {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_name: paze_wallet_details.data.client_name,client_profile_id: paze_wallet_details.data.client_profile_id,+ transaction_currency_code,+ transaction_amount,+ email_address: router_data.request.email.clone(),},)),}),diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex fe217445ee..c623ad86e6 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -2650,6 +2650,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionD),order_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,+ email: payment_data.email,surcharge_details: payment_data.surcharge_details,})}