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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(core): return an empty array when the customer does not have any payment methods (#1431)
Shankar Singh C6563587564a6
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex 499056aa4e..a5a5c0917f 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -1562,6 +1562,10 @@ pub async fn list_customer_payment_method() -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {let db = &*state.store;+ db.find_customer_by_customer_id_merchant_id(customer_id, &merchant_account.merchant_id)+ .await+ .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;+let resp = db.find_payment_method_by_customer_id_merchant_id_list(customer_id,@@ -1570,11 +1574,6 @@ pub async fn list_customer_payment_method(.await.to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?;//let mca = query::find_mca_by_merchant_id(conn, &merchant_account.merchant_id)?;- if resp.is_empty() {- return Err(error_stack::report!(- errors::ApiErrorResponse::PaymentMethodNotFound- ));- }let mut customer_pms = Vec::new();for pm in resp.into_iter() {let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token");