From b8639e71a5fe43ddc29c1d09adce970f995c34c9 Mon Sep 17 00:00:00 2001 From: Shankar Singh C Date: Wed, 11 Sep 2024 13:41:49 +0530 Subject: [PATCH] fix(router): fix merchant payment method list --- .../router/src/core/payment_methods/cards.rs | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index cee4e9d1dd22..4d4c4f8ccdb2 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -3652,23 +3652,29 @@ pub async fn list_payment_methods( api_surcharge_decision_configs::MerchantSurchargeConfigs::default() }; - let collect_shipping_details_from_wallets = business_profile - .as_ref() - .and_then(|business_profile| { - business_profile.always_collect_shipping_details_from_wallet_connector - }) - .or(business_profile.as_ref().and_then(|business_profile| { - business_profile.collect_shipping_details_from_wallet_connector - })); + let collect_shipping_details_from_wallets = + business_profile.as_ref().and_then(|business_profile| { + if business_profile + .always_collect_shipping_details_from_wallet_connector + .unwrap_or(false) + { + business_profile.always_collect_shipping_details_from_wallet_connector + } else { + business_profile.collect_shipping_details_from_wallet_connector + } + }); - let collect_billing_details_from_wallets = business_profile - .as_ref() - .and_then(|business_profile| { - business_profile.always_collect_billing_details_from_wallet_connector - }) - .or(business_profile.as_ref().and_then(|business_profile| { - business_profile.collect_billing_details_from_wallet_connector - })); + let collect_billing_details_from_wallets = + business_profile.as_ref().and_then(|business_profile| { + if business_profile + .always_collect_billing_details_from_wallet_connector + .unwrap_or(false) + { + business_profile.always_collect_billing_details_from_wallet_connector + } else { + business_profile.collect_billing_details_from_wallet_connector + } + }); Ok(services::ApplicationResponse::Json( api::PaymentMethodListResponse {