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(payment-methods): customer's pml failures during card info lookup failures (#15096)
Kashifa59cea9a7871
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex e2dc7d218c..cede71ab50 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -14417,7 +14417,6 @@"payment_method_token","customer_id","payment_method_type",- "payment_method_subtype","recurring_enabled","created","requires_cvv",@@ -14441,7 +14440,12 @@"$ref": "#/components/schemas/PaymentMethod"},"payment_method_subtype": {- "$ref": "#/components/schemas/PaymentMethodType"+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodType"+ }+ ],+ "nullable": true},"recurring_enabled": {"type": "boolean",@@ -25126,7 +25130,6 @@"id","customer_id","payment_method_type",- "payment_method_subtype","created","requires_cvv","is_default"@@ -25154,7 +25157,12 @@"$ref": "#/components/schemas/PaymentMethod"},"payment_method_subtype": {- "$ref": "#/components/schemas/PaymentMethodType"+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodType"+ }+ ],+ "nullable": true},"recurring_enabled": {"type": "boolean",diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rsindex c0f0fc8e65..6e4c3982fa 100644--- a/crates/api_models/src/payment_methods.rs+++ b/crates/api_models/src/payment_methods.rs@@ -3768,8 +3768,8 @@ pub struct PaymentMethodResponseItem {pub payment_method_type: api_enums::PaymentMethod,/// This is a sub-category of payment method.- #[schema(value_type = PaymentMethodType,example = "credit")]- pub payment_method_subtype: api_enums::PaymentMethodType,+ #[schema(value_type = Option<PaymentMethodType>,example = "credit")]+ pub payment_method_subtype: Option<api_enums::PaymentMethodType>,/// Indicates whether the payment method supports recurring payments. Optional.#[schema(example = true)]@@ -3833,8 +3833,8 @@ pub struct CustomerPaymentMethodResponseItem {pub payment_method_type: api_enums::PaymentMethod,/// This is a sub-category of payment method.- #[schema(value_type = PaymentMethodType,example = "credit")]- pub payment_method_subtype: api_enums::PaymentMethodType,+ #[schema(value_type = Option<PaymentMethodType>,example = "credit")]+ pub payment_method_subtype: Option<api_enums::PaymentMethodType>,/// Indicates whether the payment method is eligible for recurring payments#[schema(example = true)]diff --git a/crates/payment_methods/src/types.rs b/crates/payment_methods/src/types.rsindex 9d43690d89..349332b5a6 100644--- a/crates/payment_methods/src/types.rs+++ b/crates/payment_methods/src/types.rs@@ -23,7 +23,7 @@ pub struct PaymentMethodResponseItemV1 {pub id: String,pub customer_id: id_type::CustomerId,pub payment_method_type: PaymentMethod,- pub payment_method_subtype: PaymentMethodType,+ pub payment_method_subtype: Option<PaymentMethodType>,pub recurring_enabled: Option<bool>,pub payment_method_data: Option<PaymentMethodResponseData>,pub bank: Option<api_models::payment_methods::MaskedBankDetails>,diff --git a/crates/router/src/core/payment_methods/client.rs b/crates/router/src/core/payment_methods/client.rsindex f6b370bb91..c3bef0bd87 100644--- a/crates/router/src/core/payment_methods/client.rs+++ b/crates/router/src/core/payment_methods/client.rs@@ -359,7 +359,7 @@ impl CustomerPaymentMethodsFetcher for ModularCustomerPaymentMethodsFetcher {customer_payment_methods.push(CustomerPaymentMethodForClient {payment_token,payment_method: pm.payment_method_type,- payment_method_type: Some(pm.payment_method_subtype),+ payment_method_type: pm.payment_method_subtype,default_payment_method_set: pm.is_default,requires_cvv,recurring_enabled: Some(recurring_enabled),diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rsindex 89550d5a07..8904633504 100644--- a/crates/router/src/core/payment_methods/transformers.rs+++ b/crates/router/src/core/payment_methods/transformers.rs@@ -1001,12 +1001,7 @@ implOption<id_type::GlobalPaymentMethodId>,),) -> Result<Self, Self::Error> {- // For payment methods that are active we should always have the payment method subtype- let payment_method_subtype =- item.payment_method_subtype- .ok_or(errors::ValidationError::MissingRequiredField {- field_name: "payment_method_subtype".into(),- })?;+ let payment_method_subtype = item.payment_method_subtype;// For payment methods that are active we should always have the payment method typelet payment_method_type =@@ -1033,17 +1028,17 @@ impl),payment_method_data::PaymentMethodsData::WalletDetails(info) => {match payment_method_subtype {- api_enums::PaymentMethodType::ApplePay => {+ Some(api_enums::PaymentMethodType::ApplePay) => {Some(api_models::payment_methods::PaymentMethodListData::Wallet(WalletPaymentMethodData::ApplePay(Box::new(info)),))}- api_enums::PaymentMethodType::GooglePay => {+ Some(api_enums::PaymentMethodType::GooglePay) => {Some(api_models::payment_methods::PaymentMethodListData::Wallet(WalletPaymentMethodData::GooglePay(Box::new(info)),))}- api_enums::PaymentMethodType::Paypal => {+ Some(api_enums::PaymentMethodType::Paypal) => {Some(api_models::payment_methods::PaymentMethodListData::Wallet(WalletPaymentMethodData::PayPal(Box::new(api_models::payments::PaypalRedirection::from(info),@@ -1112,12 +1107,7 @@ implOption<id_type::CustomerId>,),) -> Result<Self, Self::Error> {- // For payment methods that are active we should always have the payment method subtype- let payment_method_subtype =- item.payment_method_subtype- .ok_or(errors::ValidationError::MissingRequiredField {- field_name: "payment_method_subtype".into(),- })?;+ let payment_method_subtype = item.payment_method_subtype;// For payment methods that are active we should always have the payment method typelet payment_method_type =@@ -1144,17 +1134,17 @@ impl),payment_method_data::PaymentMethodsData::WalletDetails(info) => {match payment_method_subtype {- api_enums::PaymentMethodType::ApplePay => {+ Some(api_enums::PaymentMethodType::ApplePay) => {Some(api_models::payment_methods::PaymentMethodListData::Wallet(WalletPaymentMethodData::ApplePay(Box::new(info)),))}- api_enums::PaymentMethodType::GooglePay => {+ Some(api_enums::PaymentMethodType::GooglePay) => {Some(api_models::payment_methods::PaymentMethodListData::Wallet(WalletPaymentMethodData::GooglePay(Box::new(info)),))}- api_enums::PaymentMethodType::Paypal => {+ Some(api_enums::PaymentMethodType::Paypal) => {Some(api_models::payment_methods::PaymentMethodListData::Wallet(WalletPaymentMethodData::PayPal(Box::new(api_models::payments::PaypalRedirection::from(info),diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rsindex c2c144f67f..d750555543 100644--- a/crates/router/src/core/payments/retry.rs+++ b/crates/router/src/core/payments/retry.rs@@ -893,7 +893,7 @@ pub fn make_new_auto_retry_payment_attempt(payment_method_billing_address_id: Default::default(),fingerprint_id: Default::default(),fingerprint_type: Default::default(),- customer_acceptance: Default::default(),+ customer_acceptance: old_payment_attempt.customer_acceptance,connector_mandate_detail: Default::default(),request_extended_authorization: Default::default(),extended_authorization_applied: Default::default(),