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

feat(core): return customer_acceptance_support in the payment method list response (#13854)

Vani Gupta4eff11fcdf44
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index fefdc06852..7fc9858ec2 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -19721,6 +19721,15 @@
},
"additionalProperties": false
},
+ "CustomerAcceptanceSupport": {
+ "type": "string",
+ "description": "Returned in the payment method list response so the SDK,\ncan help decide whether to show the \"save my details\" checkbox and how to word it.",
+ "enum": [
+ "supported",
+ "partially_supported",
+ "unsupported"
+ ]
+ },
"CustomerDefaultPaymentMethodResponse": {
"type": "object",
"required": [
@@ -42108,7 +42117,8 @@
"ResponsePaymentMethodTypes": {
"type": "object",
"required": [
- "payment_method_type"
+ "payment_method_type",
+ "customer_acceptance_support"
],
"properties": {
"payment_method_type": {
@@ -42175,6 +42185,9 @@
"type": "string",
"description": "auth service connector label for this payment method type, if exists",
"nullable": true
+ },
+ "customer_acceptance_support": {
+ "$ref": "#/components/schemas/CustomerAcceptanceSupport"
}
}
},
@@ -42211,7 +42224,8 @@
"type": "object",
"required": [
"payment_method",
- "payment_method_type"
+ "payment_method_type",
+ "customer_acceptance_support"
],
"properties": {
"payment_method": {
@@ -42237,6 +42251,9 @@
"type": "boolean",
"description": "Whether to collect billing details from the wallet connector (null for non-wallet)",
"nullable": true
+ },
+ "customer_acceptance_support": {
+ "$ref": "#/components/schemas/CustomerAcceptanceSupport"
}
}
}
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 3b136d305c..450cec2143 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -13357,6 +13357,15 @@
},
"additionalProperties": false
},
+ "CustomerAcceptanceSupport": {
+ "type": "string",
+ "description": "Returned in the payment method list response so the SDK,\ncan help decide whether to show the \"save my details\" checkbox and how to word it.",
+ "enum": [
+ "supported",
+ "partially_supported",
+ "unsupported"
+ ]
+ },
"CustomerDefaultPaymentMethodResponse": {
"type": "object",
"required": [
@@ -29980,7 +29989,8 @@
"required": [
"payment_method_type",
"payment_method_subtype",
- "required_fields"
+ "required_fields",
+ "customer_acceptance_support"
],
"properties": {
"payment_method_type": {
@@ -29995,6 +30005,9 @@
"$ref": "#/components/schemas/RequiredFieldInfo"
},
"description": "Required fields for the payment_method_type.\nThis is the union of all the required fields for the payment method type enabled in all the connectors."
+ },
+ "customer_acceptance_support": {
+ "$ref": "#/components/schemas/CustomerAcceptanceSupport"
}
}
}
diff --git a/config/config.example.toml b/config/config.example.toml
index fdfdcfca02..13009d4673 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -450,6 +450,14 @@ zen.secondary_base_url = "https://secure.zen-test.com/"
[pm_filters.default]
apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GR,GL,GG,HU,IS,IE,IM,IT,KZ,JE,LV,LI,LT,LU,MT,MD,MC,ME,NL,NO,PL,PT,RO,SM,RS,SK,SI,ES,SE,CH,UA,GB,AR,CO,CR,BR,MX,PE,BH,IL,JO,KW,PS,QA,SA,AE,CA,UM,US,KR,VN,MA,ZA,VA,CL,SV,GT,HN,PA", currency = "AED,AUD,CHF,CAD,EUR,GBP,HKD,SGD,USD" }
+# Whether saving a payment method is supported by all, some, or none of the connectors
+# eligible for it. Returned in the PML response so the SDK can decide whether to show the
+# "save my details" checkbox ("supported" | "partially_supported" | "unsupported").
+[customer_acceptance_support]
+card.credit = "supported"
+card.debit = "supported"
+bank_redirect.open_banking = "partially_supported"
+
# Bank redirect configs for allowed banks through online_banking_czech_republic payment method
[bank_config.online_banking_czech_republic]
adyen = { banks = "ceska_sporitelna,komercni_banka,platnosc_online_karta_platnicza" }
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 621be9dfa4..10fd0db313 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -1,3 +1,11 @@
+# Whether saving a payment method is supported by all, some, or none of the connectors
+# eligible for it. Returned in the PML response so the SDK can decide whether to show the
+# "save my details" checkbox ("supported" | "partially_supported" | "unsupported").
+[customer_acceptance_support]
+card.credit = "supported"
+card.debit = "supported"
+bank_redirect.open_banking = "partially_supported"
+
# Bank redirect configs for allowed banks
[bank_config]
eps.adyen.banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index f59cee3351..ef0b361980 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -1,3 +1,11 @@
+# Whether saving a payment method is supported by all, some, or none of the connectors
+# eligible for it. Returned in the PML response so the SDK can decide whether to show the
+# "save my details" checkbox ("supported" | "partially_supported" | "unsupported").
+[customer_acceptance_support]
+card.credit = "supported"
+card.debit = "supported"
+bank_redirect.open_banking = "partially_supported"
+
# Bank redirect configs for allowed banks
[bank_config]
eps.adyen.banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index cc32e5a536..ce2d006a6e 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -1,3 +1,11 @@
+# Whether saving a payment method is supported by all, some, or none of the connectors
+# eligible for it. Returned in the PML response so the SDK can decide whether to show the
+# "save my details" checkbox ("supported" | "partially_supported" | "unsupported").
+[customer_acceptance_support]
+card.credit = "supported"
+card.debit = "supported"
+bank_redirect.open_banking = "partially_supported"
+
# Bank redirect configs for allowed banks
[bank_config]
eps.adyen.banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag"
diff --git a/config/development.toml b/config/development.toml
index 18fae281e8..3671f0c0f9 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -523,6 +523,14 @@ client_secret = "" # Client secret used to authenticate the client (Generate usi
redirect_uri = "" # Redirect URI registered for the OIDC client
+# Whether saving a payment method is supported by all, some, or none of the connectors
+# eligible for it. Returned in the PML response so the SDK can decide whether to show the
+# "save my details" checkbox ("supported" | "partially_supported" | "unsupported").
+[customer_acceptance_support]
+card.credit = "supported"
+card.debit = "supported"
+bank_redirect.open_banking = "partially_supported"
+
[bank_config.eps]
stripe = { banks = "arzte_und_apotheker_bank,austrian_anadi_bank_ag,bank_austria,bankhaus_carl_spangler,bankhaus_schelhammer_und_schattera_ag,bawag_psk_ag,bks_bank_ag,brull_kallmus_bank_ag,btv_vier_lander_bank,capital_bank_grawe_gruppe_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_alpeadriabank_international_ag,hypo_noe_lb_fur_niederosterreich_u_wien,hypo_oberosterreich_salzburg_steiermark,hypo_tirol_bank_ag,hypo_vorarlberg_bank_ag,hypo_bank_burgenland_aktiengesellschaft,marchfelder_bank,oberbank_ag,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag,vr_bank_braunau" }
adyen = { banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_tirol_bank_ag,posojilnica_bank_e_gen,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 41d45cb1d4..4220809bb0 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -1148,6 +1148,14 @@ payjustnow = { country = "ZA", currency = "ZAR" }
[pm_filters.payjustnowinstore]
payjustnow = { country = "ZA", currency = "ZAR" }
+# Whether saving a payment method is supported by all, some, or none of the connectors
+# eligible for it. Returned in the PML response so the SDK can decide whether to show the
+# "save my details" checkbox ("supported" | "partially_supported" | "unsupported").
+[customer_acceptance_support]
+card.credit = "supported"
+card.debit = "supported"
+bank_redirect.open_banking = "partially_supported"
+
[bank_config.online_banking_fpx]
adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
fiuu.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_of_china,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 4fd3f20aa0..507156e9cb 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -2342,6 +2342,13 @@ pub struct ResponsePaymentMethodTypes {
/// auth service connector label for this payment method type, if exists
pub pm_auth_connector: Option<String>,
+
+ /// Whether saving this payment method type is supported by all, some, or none of the
+ /// connectors eligible for it. Lets the SDK decide whether to show the "save my details"
+ /// checkbox and whether to word it definitely or hedged. Defaults to `unsupported` for
+ /// payment method types absent from the config.
+ #[schema(value_type = CustomerAcceptanceSupport, example = "partially_supported")]
+ pub customer_acceptance_support: api_enums::CustomerAcceptanceSupport,
}
#[cfg(feature = "v2")]
@@ -2377,6 +2384,13 @@ pub struct ResponsePaymentMethodTypes {
/// Required fields for the payment_method_type.
/// This is the union of all the required fields for the payment method type enabled in all the connectors.
pub required_fields: Vec<RequiredFieldInfo>,
+
+ /// Whether saving this payment method type is supported by all, some, or none of the
+ /// connectors eligible for it. Lets the SDK decide whether to show the "save my details"
+ /// checkbox and whether to word it definitely or hedged. Defaults to `unsupported` for
+ /// payment method types absent from the config.
+ #[schema(value_type = CustomerAcceptanceSupport, example = "partially_supported")]
+ pub customer_acceptance_support: common_enums::CustomerAcceptanceSupport,
}
#[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema)]
@@ -3016,6 +3030,13 @@ pub struct ResponsePaymentMethodsEnabledForClient {
/// Whether to collect billing details from the wallet connector (null for non-wallet)
pub collect_billing_details_from_wallets: Option<bool>,
+
+ /// Whether saving this payment method type is supported by all, some, or none of the
+ /// connectors eligible for it. Lets the SDK decide whether to show the "save my details"
+ /// checkbox and whether to word it definitely or hedged. Defaults to `unsupported` for
+ /// payment method types absent from the config.
+ #[schema(value_type = CustomerAcceptanceSupport, example = "partially_supported")]
+ pub customer_acceptance_support: api_enums::CustomerAcceptanceSupport,
}
/// Typed subtype-specific data for a saved customer payment method, returned in the
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 8fefb55674..1da361739b 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2446,6 +2446,34 @@ pub enum PaymentExperience {
CollectOtp,
}
+/// Returned in the payment method list response so the SDK,
+/// can help decide whether to show the "save my details" checkbox and how to word it.
+#[derive(
+ Eq,
+ PartialEq,
+ Hash,
+ Copy,
+ Clone,
+ Debug,
+ serde::Serialize,
+ serde::Deserialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+ Default,
+)]
+#[strum(serialize_all = "snake_case")]
+#[serde(rename_all = "snake_case")]
+pub enum CustomerAcceptanceSupport {
+ /// Every eligible connector supports saving this payment method.
+ Supported,
+ /// Only some of the eligible connectors support saving this payment method
+ PartiallySupported,
+ /// No eligible connector supports saving this payment method
+ #[default]
+ Unsupported,
+}
+
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display)]
#[serde(rename_all = "lowercase")]
pub enum SamsungPayCardBrand {
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 1feb78830c..72e940f46c 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -475,6 +475,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::TaxStatus,
api_models::enums::MandateStatus,
api_models::enums::PaymentExperience,
+ api_models::enums::CustomerAcceptanceSupport,
api_models::enums::BankNames,
api_models::enums::BankType,
api_models::enums::BankHolderType,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 957b8a8318..838773c7ef 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -378,6 +378,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::MandateStatus,
api_models::enums::MerchantProductType,
api_models::enums::PaymentExperience,
+ api_models::enums::CustomerAcceptanceSupport,
api_models::enums::BankNames,
api_models::enums::BankType,
api_models::enums::BankHolderType,
diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index fdbe1ce1cb..9f1b06963b 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -706,6 +706,7 @@ pub(crate) async fn fetch_raw_secrets(
jwekey,
webhooks: conf.webhooks,
pm_filters: conf.pm_filters,
+ customer_acceptance_support: conf.customer_acceptance_support,
payout_method_filters: conf.payout_method_filters,
bank_config: conf.bank_config,
api_keys,
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 3b382b3243..c02b2cbd4a 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -110,6 +110,7 @@ pub struct Settings<S: SecretState> {
pub jwekey: SecretStateContainer<Jwekey, S>,
pub webhooks: WebhooksSettings,
pub pm_filters: ConnectorFilters,
+ pub customer_acceptance_support: CustomerAcceptanceSupportConfig,
pub bank_config: BankRedirectConfig,
pub api_keys: SecretStateContainer<ApiKeys, S>,
pub file_storage: FileStorageConfig,
@@ -965,6 +966,32 @@ pub enum PaymentMethodFilterKey {
CardNetwork(enums::CardNetwork),
}
+#[derive(Debug, Deserialize, Clone, Default)]
+#[serde(transparent)]
+pub struct CustomerAcceptanceSupportConfig(
+ pub HashMap<enums::PaymentMethod, PaymentMethodTypeCustomerAcceptanceSupport>,
+);
+
+#[derive(Debug, Deserialize, Clone, Default)]
+#[serde(transparent)]
+pub struct PaymentMethodTypeCustomerAcceptanceSupport(
+ pub HashMap<enums::PaymentMethodType, common_enums::CustomerAcceptanceSupport>,
+);
+
+impl CustomerAcceptanceSupportConfig {
+ pub fn get_customer_acceptance_support(
+ &self,
+ payment_method: enums::PaymentMethod,
+ payment_method_type: enums::PaymentMethodType,
+ ) -> common_enums::CustomerAcceptanceSupport {
+ self.0
+ .get(&payment_method)
+ .and_then(|pm_types| pm_types.0.get(&payment_method_type))
+ .copied()
+ .unwrap_or_default()
+ }
+}
+
#[derive(Debug, Deserialize, Clone, Default)]
#[serde(default)]
pub struct CurrencyCountryFlowFilter {
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 95485668b6..513dfe6e2e 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -4277,7 +4277,10 @@ pub async fn list_payment_methods_for_session(
hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled::from_payment_connectors_list(payment_connector_accounts)
.perform_filtering()
.get_required_fields(RequiredFieldsInput::new(state.conf.required_fields.clone()))
- .generate_response_for_session(customer_payment_methods);
+ .generate_response_for_session(
+ customer_payment_methods,
+ &state.conf.customer_acceptance_support,
+ );
Ok(hyperswitch_domain_models::api::ApplicationResponse::Json(
response,
@@ -4527,6 +4530,7 @@ impl RequiredFieldsForEnabledPaymentMethodTypes {
fn generate_response_for_session(
self,
customer_payment_methods: Vec<payment_methods::CustomerPaymentMethodResponseItem>,
+ customer_acceptance_support_config: &settings::CustomerAcceptanceSupportConfig,
) -> payment_methods::PaymentMethodListResponseForSession {
let response_payment_methods = self
.0
@@ -4537,6 +4541,11 @@ impl RequiredFieldsForEnabledPaymentMethodTypes {
payment_method_subtype: payment_methods_enabled.payment_method_subtype,
required_fields: payment_methods_enabled.required_fields,
extra_information: None,
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(
+ payment_methods_enabled.payment_method_type,
+ payment_methods_enabled.payment_method_subtype,
+ ),
},
)
.collect();
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 3f16deb8d8..3872d2de07 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -4119,7 +4119,10 @@ impl MerchantEnabledPmsContext {
}
/// Converts `payment_experiences_consolidated_hm` → client PM entries (wallet, pay_later, upi, …)
- pub fn payment_experience_pms_for_client(&self) -> Vec<ResponsePaymentMethodsEnabledForClient> {
+ pub fn payment_experience_pms_for_client(
+ &self,
+ customer_acceptance_support_config: &settings::CustomerAcceptanceSupportConfig,
+ ) -> Vec<ResponsePaymentMethodsEnabledForClient> {
let mut out = vec![];
for (payment_method, pmt_map) in &self.payment_experiences_consolidated_hm {
for (payment_method_type, pe_map) in pmt_map {
@@ -4140,6 +4143,8 @@ impl MerchantEnabledPmsContext {
collect_billing_details_from_wallets: is_wallet
.then_some(self.collect_billing_details_from_wallets)
.flatten(),
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(*payment_method, *payment_method_type),
});
}
}
@@ -4147,7 +4152,10 @@ impl MerchantEnabledPmsContext {
}
/// Converts `card_networks_consolidated_hm` → client PM entries (card, card_redirect)
- pub fn card_network_pms_for_client(&self) -> Vec<ResponsePaymentMethodsEnabledForClient> {
+ pub fn card_network_pms_for_client(
+ &self,
+ customer_acceptance_support_config: &settings::CustomerAcceptanceSupportConfig,
+ ) -> Vec<ResponsePaymentMethodsEnabledForClient> {
let mut out = vec![];
for (payment_method, pmt_map) in &self.card_networks_consolidated_hm {
for (payment_method_type, card_network_hashmap) in pmt_map {
@@ -4161,6 +4169,8 @@ impl MerchantEnabledPmsContext {
payment_experience: None,
collect_shipping_details_from_wallets: None,
collect_billing_details_from_wallets: None,
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(*payment_method, *payment_method_type),
});
}
}
@@ -4193,13 +4203,23 @@ impl MerchantEnabledPmsContext {
payment_experience: None,
collect_shipping_details_from_wallets: None,
collect_billing_details_from_wallets: None,
+ customer_acceptance_support: state
+ .conf
+ .customer_acceptance_support
+ .get_customer_acceptance_support(
+ api_enums::PaymentMethod::BankRedirect,
+ *payment_method_type,
+ ),
});
}
Ok(out)
}
/// Converts `bank_debits_consolidated_hm` → client PM entries (bank_debit)
- pub fn bank_debit_pms_for_client(&self) -> Vec<ResponsePaymentMethodsEnabledForClient> {
+ pub fn bank_debit_pms_for_client(
+ &self,
+ customer_acceptance_support_config: &settings::CustomerAcceptanceSupportConfig,
+ ) -> Vec<ResponsePaymentMethodsEnabledForClient> {
self.bank_debits_consolidated_hm
.keys()
.map(
@@ -4210,13 +4230,21 @@ impl MerchantEnabledPmsContext {
payment_experience: None,
collect_shipping_details_from_wallets: None,
collect_billing_details_from_wallets: None,
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(
+ api_enums::PaymentMethod::BankDebit,
+ *payment_method_type,
+ ),
},
)
.collect()
}
/// Converts `bank_transfer_consolidated_hm` → client PM entries (bank_transfer)
- pub fn bank_transfer_pms_for_client(&self) -> Vec<ResponsePaymentMethodsEnabledForClient> {
+ pub fn bank_transfer_pms_for_client(
+ &self,
+ customer_acceptance_support_config: &settings::CustomerAcceptanceSupportConfig,
+ ) -> Vec<ResponsePaymentMethodsEnabledForClient> {
self.bank_transfer_consolidated_hm
.keys()
.map(
@@ -4227,6 +4255,11 @@ impl MerchantEnabledPmsContext {
payment_experience: None,
collect_shipping_details_from_wallets: None,
collect_billing_details_from_wallets: None,
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(
+ api_enums::PaymentMethod::BankTransfer,
+ *payment_method_type,
+ ),
},
)
.collect()
@@ -5102,6 +5135,8 @@ pub async fn list_payment_methods(
))
.await?;
+ let customer_acceptance_support_config = &state.conf.customer_acceptance_support;
+
let mut payment_method_responses: Vec<ResponsePaymentMethodsEnabled> = vec![];
for key in pms_ctx.payment_experiences_consolidated_hm.iter() {
let mut payment_method_types = vec![];
@@ -5133,6 +5168,8 @@ pub async fn list_payment_methods(
.get(key.0)
.and_then(|pm_map| pm_map.get(payment_method_types_hm.0))
.cloned(),
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(*key.0, *payment_method_types_hm.0),
})
}
@@ -5173,6 +5210,8 @@ pub async fn list_payment_methods(
.get(key.0)
.and_then(|pm_map| pm_map.get(payment_method_types_hm.0))
.cloned(),
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(*key.0, *payment_method_types_hm.0),
})
}
@@ -5208,6 +5247,11 @@ pub async fn list_payment_methods(
.get(&enums::PaymentMethod::BankRedirect)
.and_then(|pm_map| pm_map.get(key.0))
.cloned(),
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(
+ api_enums::PaymentMethod::BankRedirect,
+ payment_method_type,
+ ),
}
})
}
@@ -5246,6 +5290,11 @@ pub async fn list_payment_methods(
.get(&enums::PaymentMethod::BankDebit)
.and_then(|pm_map| pm_map.get(key.0))
.cloned(),
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(
+ api_enums::PaymentMethod::BankDebit,
+ payment_method_type,
+ ),
}
})
}
@@ -5284,6 +5333,11 @@ pub async fn list_payment_methods(
.get(&enums::PaymentMethod::BankTransfer)
.and_then(|pm_map| pm_map.get(key.0))
.cloned(),
+ customer_acceptance_support: customer_acceptance_support_config
+ .get_customer_acceptance_support(
+ api_enums::PaymentMethod::BankTransfer,
+ payment_method_type,
+ ),
}
})
}
diff --git a/crates/router/src/core/payment_methods/client.rs b/crates/router/src/core/payment_methods/client.rs
index afd26fe891..1f2e1a2bce 100644
--- a/crates/router/src/core/payment_methods/client.rs
+++ b/crates/router/src/core/payment_methods/client.rs
@@ -429,11 +429,22 @@ async fn fetch_enabled_payment_methods(
))
.await?;
- let mut flat_pms = merchant_enabled_pms_context.payment_experience_pms_for_client();
- flat_pms.extend(merchant_enabled_pms_context.card_network_pms_for_client());
+ let customer_acceptance_support_config = &state.conf.customer_acceptance_support;
+
+ let mut flat_pms = merchant_enabled_pms_context
+ .payment_experience_pms_for_client(customer_acceptance_support_config);
+ flat_pms.extend(
+ merchant_enabled_pms_context
+ .card_network_pms_for_client(customer_acceptance_support_config),
+ );
flat_pms.extend(merchant_enabled_pms_context.bank_redirect_pms_for_client(state)?);
- flat_pms.extend(merchant_enabled_pms_context.bank_debit_pms_for_client());
- flat_pms.extend(merchant_enabled_pms_context.bank_transfer_pms_for_client());
+ flat_pms.extend(
+ merchant_enabled_pms_context.bank_debit_pms_for_client(customer_acceptance_support_config),
+ );
+ flat_pms.extend(
+ merchant_enabled_pms_context
+ .bank_transfer_pms_for_client(customer_acceptance_support_config),
+ );
Ok(EnabledPmsResult {
payment_methods_enabled: flat_pms,