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(payment_methods): Re-revert changes done in `pr#7866` by `pr#7882` (#7954)

Uzair Khand5eee96f3c0c
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 5749715e51..c228975faa 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -3485,61 +3485,6 @@ pub async fn list_payment_methods(
response
);
- // Filter out wallet payment method from mca if customer has already saved it
- customer
- .as_ref()
- .async_map(|customer| async {
- let wallet_pm_exists = response
- .iter()
- .any(|mca| mca.payment_method == enums::PaymentMethod::Wallet);
- if wallet_pm_exists {
- match db
- .find_payment_method_by_customer_id_merchant_id_status(
- &((&state).into()),
- merchant_context.get_merchant_key_store(),
- &customer.customer_id,
- merchant_context.get_merchant_account().get_id(),
- common_enums::PaymentMethodStatus::Active,
- None,
- merchant_context.get_merchant_account().storage_scheme,
- )
- .await
- {
- Ok(customer_payment_methods) => {
- let customer_wallet_pm = customer_payment_methods
- .iter()
- .filter(|cust_pm| {
- cust_pm.get_payment_method_type() == Some(enums::PaymentMethod::Wallet)
- })
- .collect::<Vec<_>>();
-
- response.retain(|mca| {
- !(mca.payment_method == enums::PaymentMethod::Wallet
- && customer_wallet_pm.iter().any(|cust_pm| {
- cust_pm.get_payment_method_subtype() == Some(mca.payment_method_type)
- }))
- });
-
- logger::debug!("Filtered out wallet payment method from mca since customer has already saved it");
- Ok(())
- }
- Err(error) => {
- if error.current_context().is_db_not_found() {
- Ok(())
- } else {
- Err(error)
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("failed to find payment methods for a customer")
- }
- }
- }
- } else {
- Ok(())
- }
- })
- .await
- .transpose()?;
-
let mut pmt_to_auth_connector: HashMap<
enums::PaymentMethod,
HashMap<enums::PaymentMethodType, String>,