mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
fix(core): make parsing optional for connector_wallet_details in session token flow (#7365)
This commit is contained in:
@ -930,7 +930,7 @@ fn create_gpay_session_token(
|
|||||||
) -> RouterResult<types::PaymentsSessionRouterData> {
|
) -> RouterResult<types::PaymentsSessionRouterData> {
|
||||||
// connector_wallet_details is being parse into admin types to check specifically if google_pay field is present
|
// 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
|
// 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
|
.connector_wallets_details
|
||||||
.clone()
|
.clone()
|
||||||
.parse_value::<admin_types::ConnectorWalletDetails>("ConnectorWalletDetails")
|
.parse_value::<admin_types::ConnectorWalletDetails>("ConnectorWalletDetails")
|
||||||
@ -939,10 +939,14 @@ fn create_gpay_session_token(
|
|||||||
"cannot parse connector_wallets_details from the given value {:?}",
|
"cannot parse connector_wallets_details from the given value {:?}",
|
||||||
router_data.connector_wallets_details
|
router_data.connector_wallets_details
|
||||||
))
|
))
|
||||||
.change_context(errors::ApiErrorResponse::InvalidDataFormat {
|
.map_err(|err| {
|
||||||
field_name: "connector_wallets_details".to_string(),
|
logger::debug!(
|
||||||
expected_format: "admin_types_connector_wallets_details_format".to_string(),
|
"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 connector_metadata = router_data.connector_meta_data.clone();
|
||||||
let delayed_response = is_session_response_delayed(state, connector);
|
let delayed_response = is_session_response_delayed(state, connector);
|
||||||
|
|
||||||
@ -996,7 +1000,7 @@ fn create_gpay_session_token(
|
|||||||
enums::PaymentMethodType::GooglePay,
|
enums::PaymentMethodType::GooglePay,
|
||||||
);
|
);
|
||||||
|
|
||||||
if connector_wallets_details.google_pay.is_some() {
|
if google_pay_wallets_details.is_some() {
|
||||||
let gpay_data = router_data
|
let gpay_data = router_data
|
||||||
.connector_wallets_details
|
.connector_wallets_details
|
||||||
.clone()
|
.clone()
|
||||||
|
|||||||
Reference in New Issue
Block a user