Skip to content

Commit

Permalink
fix(core): make parsing optional for connector_wallet_details in sess…
Browse files Browse the repository at this point in the history
…ion token flow (#7365)
  • Loading branch information
Sakilmostak authored Feb 25, 2025
1 parent ea2c780 commit 1b4c5c1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions crates/router/src/core/payments/flows/session_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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);

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1b4c5c1

Please sign in to comment.