From fcf52973f49e091cfbf4390e70cdfe883b15bf3b Mon Sep 17 00:00:00 2001 From: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com> Date: Tue, 4 Jun 2024 20:04:39 +0530 Subject: [PATCH] feat(router): add `request_external_three_ds_authentication` flag in payment_method_list_response (#4864) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- crates/api_models/src/payment_methods.rs | 4 ++++ crates/router/src/core/payment_methods/cards.rs | 5 +++++ openapi/openapi_spec.json | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 3d996ec05b..7d4d3282f3 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -791,6 +791,10 @@ pub struct PaymentMethodListResponse { #[schema(value_type = Option)] pub payment_type: Option, + + /// flag to indicate whether to perform external 3ds authentication + #[schema(example = true)] + pub request_external_three_ds_authentication: bool, } #[derive(Eq, PartialEq, Hash, Debug, serde::Deserialize, ToSchema)] diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index c62f47b536..210fdd947c 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -2572,6 +2572,10 @@ pub async fn list_payment_methods( }); } let currency = payment_intent.as_ref().and_then(|pi| pi.currency); + let request_external_three_ds_authentication = payment_intent + .as_ref() + .and_then(|intent| intent.request_external_three_ds_authentication) + .unwrap_or(false); let merchant_surcharge_configs = if let Some((payment_attempt, payment_intent, business_profile)) = payment_attempt .as_ref() @@ -2627,6 +2631,7 @@ pub async fn list_payment_methods( .show_surcharge_breakup_screen .unwrap_or_default(), currency, + request_external_three_ds_authentication, }, )) } diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 195fb7ed00..560f61bc26 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -13471,7 +13471,8 @@ "currency", "payment_methods", "mandate_payment", - "show_surcharge_breakup_screen" + "show_surcharge_breakup_screen", + "request_external_three_ds_authentication" ], "properties": { "redirect_url": { @@ -13518,6 +13519,11 @@ } ], "nullable": true + }, + "request_external_three_ds_authentication": { + "type": "boolean", + "description": "flag to indicate whether to perform external 3ds authentication", + "example": true } } },