Skip to content

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

fix(core): make parsing optional for connector_wallet_details in session token flow (#7365)

Sakil Mostak5e7e0d829a7d
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 662453c4a3..5403590084 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -930,7 +930,7 @@ fn create_gpay_session_token(
) -> RouterResult<types::PaymentsSessionRouterData> {
// connector_wallet_details is being parse into admin types to check specifically if google_pay field is present
// this is being done because apple_pay details from metadata is also being filled into connector_wallets_details
- let connector_wallets_details = router_data
+ let google_pay_wallets_details = router_data
.connector_wallets_details
.clone()
.parse_value::<admin_types::ConnectorWalletDetails>("ConnectorWalletDetails")
@@ -939,10 +939,14 @@ fn create_gpay_session_token(
"cannot parse connector_wallets_details from the given value {:?}",
router_data.connector_wallets_details
))
- .change_context(errors::ApiErrorResponse::InvalidDataFormat {
- field_name: "connector_wallets_details".to_string(),
- expected_format: "admin_types_connector_wallets_details_format".to_string(),
- })?;
+ .map_err(|err| {
+ logger::debug!(
+ "Failed to parse connector_wallets_details for google_pay flow: {:?}",
+ err
+ );
+ })
+ .ok()
+ .and_then(|connector_wallets_details| connector_wallets_details.google_pay);
let connector_metadata = router_data.connector_meta_data.clone();
let delayed_response = is_session_response_delayed(state, connector);
@@ -996,7 +1000,7 @@ fn create_gpay_session_token(
enums::PaymentMethodType::GooglePay,
);
- if connector_wallets_details.google_pay.is_some() {
+ if google_pay_wallets_details.is_some() {
let gpay_data = router_data
.connector_wallets_details
.clone()