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
feat(core): Add Support for redirection inside Iframe (#7976)
awasthi21831149c96216
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rsindex 26501e87fc..a7b57b7433 100644--- a/crates/api_models/src/admin.rs+++ b/crates/api_models/src/admin.rs@@ -1999,6 +1999,9 @@ pub struct ProfileCreate {//Merchant country for the profile#[schema(value_type = Option<CountryAlpha2>, example = "US")]pub merchant_business_country: Option<api_enums::CountryAlpha2>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[nutype::nutype(@@ -2132,6 +2135,9 @@ pub struct ProfileCreate {#[schema(value_type = Option<CountryAlpha2>, example = "US")]pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,+/// Indicates if external vault is enabled or not.pub is_external_vault_enabled: Option<bool>,@@ -2437,6 +2443,9 @@ pub struct ProfileResponse {#[schema(value_type = Option<CountryAlpha2>, example = "US")]pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,+/// Indicates if external vault is enabled or not.pub is_external_vault_enabled: Option<bool>,@@ -2590,6 +2599,9 @@ pub struct ProfileUpdate {//Merchant country for the profile#[schema(value_type = Option<CountryAlpha2>, example = "US")]pub merchant_business_country: Option<api_enums::CountryAlpha2>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v2")]diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex dbf3f0baff..6e81cf8049 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -1161,6 +1161,9 @@ pub struct PaymentsRequest {/// Indicates if 3DS method data was successfully completed or notpub threeds_method_comp_ind: Option<ThreeDsCompletionIndicator>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]@@ -4471,6 +4474,7 @@ pub enum NextActionType {DisplayBankTransferInformation,DisplayWaitScreen,CollectOtp,+ RedirectInsidePopup,}#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]@@ -4481,6 +4485,10 @@ pub enum NextActionData {RedirectToUrl {redirect_to_url: String,},+ #[cfg(feature = "v1")]+ RedirectInsidePopup {+ popup_url: String,+ },/// Contains the url for redirection flow#[cfg(feature = "v2")]RedirectToUrl {@@ -5130,6 +5138,9 @@ pub struct PaymentsResponse {/// Error message received from the issuer in case of failed paymentspub issuer_error_message: Option<String>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v2")]@@ -5472,6 +5483,9 @@ pub struct PaymentsRequest {/// Indicates if 3ds challenge is forcedpub force_3ds_challenge: Option<bool>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v2")]@@ -5686,6 +5700,9 @@ pub struct PaymentsResponse {/// This depeneds on the 3DS rules configured, If not a default authentication type will be applied#[schema(value_type = Option<AuthenticationType>, example = "no_three_ds", default = "no_three_ds")]pub authentication_type_applied: Option<api_enums::AuthenticationType>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v2")]diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rsindex 06081fc060..9309bb4287 100644--- a/crates/diesel_models/src/business_profile.rs+++ b/crates/diesel_models/src/business_profile.rs@@ -70,6 +70,7 @@ pub struct Profile {pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<common_enums::CountryAlpha2>,pub id: Option<common_utils::id_type::ProfileId>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -123,6 +124,7 @@ pub struct ProfileNew {pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<common_enums::CountryAlpha2>,pub id: Option<common_utils::id_type::ProfileId>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -174,6 +176,7 @@ pub struct ProfileUpdateInternal {pub force_3ds_challenge: Option<bool>,pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<common_enums::CountryAlpha2>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -222,6 +225,7 @@ impl ProfileUpdateInternal {force_3ds_challenge,is_debit_routing_enabled,merchant_business_country,+ is_iframe_redirection_enabled,} = self;Profile {profile_id: source.profile_id,@@ -297,6 +301,8 @@ impl ProfileUpdateInternal {is_debit_routing_enabled,merchant_business_country: merchant_business_country.or(source.merchant_business_country),+ is_iframe_redirection_enabled: is_iframe_redirection_enabled+ .or(source.is_iframe_redirection_enabled),}}}@@ -355,6 +361,7 @@ pub struct Profile {pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<common_enums::CountryAlpha2>,pub id: common_utils::id_type::ProfileId,+ pub is_iframe_redirection_enabled: Option<bool>,pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,pub order_fulfillment_time: Option<i64>,pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,@@ -438,6 +445,7 @@ pub struct ProfileNew {pub id: common_utils::id_type::ProfileId,pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,+ pub is_iframe_redirection_enabled: Option<bool>,pub is_external_vault_enabled: Option<bool>,pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,}@@ -494,6 +502,7 @@ pub struct ProfileUpdateInternal {Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,+ pub is_iframe_redirection_enabled: Option<bool>,pub is_external_vault_enabled: Option<bool>,pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,}@@ -547,6 +556,7 @@ impl ProfileUpdateInternal {merchant_business_country,revenue_recovery_retry_algorithm_type,revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled,is_external_vault_enabled,external_vault_connector_details,} = self;@@ -633,6 +643,8 @@ impl ProfileUpdateInternal {.or(source.revenue_recovery_retry_algorithm_type),revenue_recovery_retry_algorithm_data: revenue_recovery_retry_algorithm_data.or(source.revenue_recovery_retry_algorithm_data),+ is_iframe_redirection_enabled: is_iframe_redirection_enabled+ .or(source.is_iframe_redirection_enabled),is_external_vault_enabled: is_external_vault_enabled.or(source.is_external_vault_enabled),external_vault_connector_details: external_vault_connector_detailsdiff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rsindex 5b23147356..d200d352fa 100644--- a/crates/diesel_models/src/payment_intent.rs+++ b/crates/diesel_models/src/payment_intent.rs@@ -62,6 +62,7 @@ pub struct PaymentIntent {pub force_3ds_challenge_trigger: Option<bool>,pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,pub created_by: Option<String>,+ pub is_iframe_redirection_enabled: Option<bool>,pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,pub billing_address: Option<Encryption>,pub shipping_address: Option<Encryption>,@@ -152,6 +153,7 @@ pub struct PaymentIntent {pub force_3ds_challenge_trigger: Option<bool>,pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,pub created_by: Option<String>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]@@ -345,6 +347,7 @@ pub struct PaymentIntentNew {pub force_3ds_challenge_trigger: Option<bool>,pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,pub created_by: Option<String>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -418,6 +421,7 @@ pub struct PaymentIntentNew {pub force_3ds_challenge_trigger: Option<bool>,pub processor_merchant_id: Option<common_utils::id_type::MerchantId>,pub created_by: Option<String>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v2")]@@ -542,6 +546,7 @@ pub struct PaymentIntentUpdateFields {pub merchant_order_reference_id: Option<String>,pub is_payment_processor_token_flow: Option<bool>,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -575,6 +580,7 @@ pub struct PaymentIntentUpdateFields {pub is_payment_processor_token_flow: Option<bool>,pub tax_details: Option<TaxDetails>,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}// TODO: uncomment fields as necessary@@ -618,6 +624,7 @@ pub struct PaymentIntentUpdateInternal {pub request_external_three_ds_authentication: Option<bool>,pub updated_by: String,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -662,6 +669,7 @@ pub struct PaymentIntentUpdateInternal {pub is_payment_processor_token_flow: Option<bool>,pub tax_details: Option<TaxDetails>,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -705,6 +713,7 @@ impl PaymentIntentUpdate {is_payment_processor_token_flow,tax_details,force_3ds_challenge,+ is_iframe_redirection_enabled,} = self.into();PaymentIntent {amount: amount.unwrap_or(source.amount),@@ -751,6 +760,8 @@ impl PaymentIntentUpdate {.or(source.is_payment_processor_token_flow),tax_details: tax_details.or(source.tax_details),force_3ds_challenge: force_3ds_challenge.or(source.force_3ds_challenge),+ is_iframe_redirection_enabled: is_iframe_redirection_enabled+ .or(source.is_iframe_redirection_enabled),..source}}@@ -801,6 +812,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::Update(value) => Self {amount: Some(value.amount),@@ -841,6 +853,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: value.is_payment_processor_token_flow,tax_details: None,force_3ds_challenge: value.force_3ds_challenge,+ is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,},PaymentIntentUpdate::PaymentCreateUpdate {return_url,@@ -888,6 +901,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::PGStatusUpdate {status,@@ -931,6 +945,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::MerchantStatusUpdate {status,@@ -975,6 +990,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::ResponseUpdate {// amount,@@ -1026,6 +1042,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {active_attempt_id,@@ -1069,6 +1086,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::StatusAndAttemptUpdate {status,@@ -1113,6 +1131,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::ApproveUpdate {status,@@ -1156,6 +1175,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::RejectUpdate {status,@@ -1199,6 +1219,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::SurchargeApplicableUpdate {surcharge_applicable,@@ -1241,6 +1262,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate { amount } => Self {amount: Some(amount),@@ -1280,6 +1302,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::AuthorizationCountUpdate {authorization_count,@@ -1321,6 +1344,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::CompleteAuthorizeUpdate {shipping_address_id,@@ -1362,6 +1386,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::ManualUpdate { status, updated_by } => Self {status,@@ -1401,6 +1426,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {is_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},PaymentIntentUpdate::SessionResponseUpdate {tax_details,@@ -1445,6 +1471,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {shipping_details,is_payment_processor_token_flow: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,},}}diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 50474dd949..f890963c18 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -225,6 +225,7 @@ diesel::table! {merchant_business_country -> Nullable<CountryAlpha2>,#[max_length = 64]id -> Nullable<Varchar>,+ is_iframe_redirection_enabled -> Nullable<Bool>,}}@@ -1035,6 +1036,7 @@ diesel::table! {processor_merchant_id -> Nullable<Varchar>,#[max_length = 255]created_by -> Nullable<Varchar>,+ is_iframe_redirection_enabled -> Nullable<Bool>,}}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex caef78cf79..2e137fe64c 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -221,6 +221,7 @@ diesel::table! {merchant_business_country -> Nullable<CountryAlpha2>,#[max_length = 64]id -> Varchar,+ is_iframe_redirection_enabled -> Nullable<Bool>,#[max_length = 64]routing_algorithm_id -> Nullable<Varchar>,order_fulfillment_time -> Nullable<Int8>,@@ -971,6 +972,7 @@ diesel::table! {processor_merchant_id -> Nullable<Varchar>,#[max_length = 255]created_by -> Nullable<Varchar>,+ is_iframe_redirection_enabled -> Nullable<Bool>,#[max_length = 64]merchant_reference_id -> Nullable<Varchar>,billing_address -> Nullable<Bytea>,diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rsindex 84c2f76857..9f70f46238 100644--- a/crates/hyperswitch_domain_models/src/business_profile.rs+++ b/crates/hyperswitch_domain_models/src/business_profile.rs@@ -73,6 +73,7 @@ pub struct Profile {pub force_3ds_challenge: bool,pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<common_enums::CountryAlpha2>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -124,6 +125,7 @@ pub struct ProfileSetter {pub force_3ds_challenge: bool,pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -180,6 +182,7 @@ impl From<ProfileSetter> for Profile {force_3ds_challenge: value.force_3ds_challenge,is_debit_routing_enabled: value.is_debit_routing_enabled,merchant_business_country: value.merchant_business_country,+ is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,}}}@@ -238,6 +241,7 @@ pub struct ProfileGeneralUpdate {pub force_3ds_challenge: Option<bool>,pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -311,6 +315,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge,is_debit_routing_enabled,merchant_business_country,+ is_iframe_redirection_enabled,} = *update;Self {@@ -357,6 +362,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge,is_debit_routing_enabled,merchant_business_country,+ is_iframe_redirection_enabled,}}ProfileUpdate::RoutingAlgorithmUpdate {@@ -405,6 +411,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge: None,is_debit_routing_enabled: false,merchant_business_country: None,+ is_iframe_redirection_enabled: None,},ProfileUpdate::DynamicRoutingAlgorithmUpdate {dynamic_routing_algorithm,@@ -451,6 +458,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge: None,is_debit_routing_enabled: false,merchant_business_country: None,+ is_iframe_redirection_enabled: None,},ProfileUpdate::ExtendedCardInfoUpdate {is_extended_card_info_enabled,@@ -497,6 +505,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge: None,is_debit_routing_enabled: false,merchant_business_country: None,+ is_iframe_redirection_enabled: None,},ProfileUpdate::ConnectorAgnosticMitUpdate {is_connector_agnostic_mit_enabled,@@ -543,6 +552,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge: None,is_debit_routing_enabled: false,merchant_business_country: None,+ is_iframe_redirection_enabled: None,},ProfileUpdate::NetworkTokenizationUpdate {is_network_tokenization_enabled,@@ -589,6 +599,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge: None,is_debit_routing_enabled: false,merchant_business_country: None,+ is_iframe_redirection_enabled: None,},ProfileUpdate::CardTestingSecretKeyUpdate {card_testing_secret_key,@@ -635,6 +646,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {force_3ds_challenge: None,is_debit_routing_enabled: false,merchant_business_country: None,+ is_iframe_redirection_enabled: None,},}}@@ -701,6 +713,7 @@ impl super::behaviour::Conversion for Profile {force_3ds_challenge: Some(self.force_3ds_challenge),is_debit_routing_enabled: self.is_debit_routing_enabled,merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,})}@@ -791,6 +804,7 @@ impl super::behaviour::Conversion for Profile {force_3ds_challenge: item.force_3ds_challenge.unwrap_or_default(),is_debit_routing_enabled: item.is_debit_routing_enabled,merchant_business_country: item.merchant_business_country,+ is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,})}.await@@ -852,6 +866,7 @@ impl super::behaviour::Conversion for Profile {force_3ds_challenge: Some(self.force_3ds_challenge),is_debit_routing_enabled: self.is_debit_routing_enabled,merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,})}}@@ -908,6 +923,7 @@ pub struct Profile {pub merchant_business_country: Option<api_enums::CountryAlpha2>,pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,+ pub is_iframe_redirection_enabled: Option<bool>,pub is_external_vault_enabled: Option<bool>,pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,}@@ -962,6 +978,7 @@ pub struct ProfileSetter {pub merchant_business_country: Option<api_enums::CountryAlpha2>,pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,+ pub is_iframe_redirection_enabled: Option<bool>,pub is_external_vault_enabled: Option<bool>,pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,}@@ -1021,6 +1038,7 @@ impl From<ProfileSetter> for Profile {merchant_business_country: value.merchant_business_country,revenue_recovery_retry_algorithm_type: value.revenue_recovery_retry_algorithm_type,revenue_recovery_retry_algorithm_data: value.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,is_external_vault_enabled: value.is_external_vault_enabled,external_vault_connector_details: value.external_vault_connector_details,}@@ -1089,6 +1107,7 @@ pub struct ProfileGeneralUpdate {pub card_testing_secret_key: OptionalEncryptableName,pub is_debit_routing_enabled: bool,pub merchant_business_country: Option<api_enums::CountryAlpha2>,+ pub is_iframe_redirection_enabled: Option<bool>,pub is_external_vault_enabled: Option<bool>,pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,}@@ -1166,6 +1185,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {card_testing_secret_key,is_debit_routing_enabled,merchant_business_country,+ is_iframe_redirection_enabled,is_external_vault_enabled,external_vault_connector_details,} = *update;@@ -1216,6 +1236,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled,external_vault_connector_details,}@@ -1269,6 +1290,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1320,6 +1342,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1371,6 +1394,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1422,6 +1446,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1473,6 +1498,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1524,6 +1550,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1575,6 +1602,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1626,6 +1654,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1678,6 +1707,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {merchant_business_country: None,revenue_recovery_retry_algorithm_type: Some(revenue_recovery_retry_algorithm_type),revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: None,external_vault_connector_details: None,},@@ -1751,6 +1781,7 @@ impl super::behaviour::Conversion for Profile {merchant_business_country: self.merchant_business_country,revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,is_external_vault_enabled: self.is_external_vault_enabled,external_vault_connector_details: self.external_vault_connector_details,})@@ -1844,6 +1875,7 @@ impl super::behaviour::Conversion for Profile {merchant_business_country: item.merchant_business_country,revenue_recovery_retry_algorithm_type: item.revenue_recovery_retry_algorithm_type,revenue_recovery_retry_algorithm_data: item.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,is_external_vault_enabled: item.is_external_vault_enabled,external_vault_connector_details: item.external_vault_connector_details,})@@ -1911,6 +1943,7 @@ impl super::behaviour::Conversion for Profile {merchant_business_country: self.merchant_business_country,revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,is_external_vault_enabled: self.is_external_vault_enabled,external_vault_connector_details: self.external_vault_connector_details,})diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rsindex a5471f95bd..103ccd593f 100644--- a/crates/hyperswitch_domain_models/src/payments.rs+++ b/crates/hyperswitch_domain_models/src/payments.rs@@ -119,6 +119,7 @@ pub struct PaymentIntent {pub created_by: Option<CreatedBy>,pub force_3ds_challenge: Option<bool>,pub force_3ds_challenge_trigger: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}impl PaymentIntent {@@ -503,6 +504,9 @@ pub struct PaymentIntent {pub processor_merchant_id: id_type::MerchantId,/// merchantwho invoked the resource based api (identifier) and through what source (Api, Jwt(Dashboard))pub created_by: Option<CreatedBy>,++ /// Indicates if the redirection has to open in the iframe+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v2")]@@ -668,6 +672,7 @@ impl PaymentIntent {force_3ds_challenge_trigger: None,processor_merchant_id: merchant_context.get_merchant_account().get_id().clone(),created_by: None,+ is_iframe_redirection_enabled: None,})}diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rsindex 83b449adcf..8df0ff705e 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs@@ -209,6 +209,7 @@ pub struct PaymentIntentUpdateFields {// updated_by is set internally, field not present in requestpub updated_by: String,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -242,6 +243,7 @@ pub struct PaymentIntentUpdateFields {pub is_payment_processor_token_flow: Option<bool>,pub tax_details: Option<diesel_models::TaxDetails>,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}#[cfg(feature = "v1")]@@ -410,6 +412,7 @@ pub struct PaymentIntentUpdateInternal {pub is_payment_processor_token_flow: Option<bool>,pub tax_details: Option<diesel_models::TaxDetails>,pub force_3ds_challenge: Option<bool>,+ pub is_iframe_redirection_enabled: Option<bool>,}// This conversion is used in the `update_payment_intent` function@@ -459,6 +462,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalrequest_external_three_ds_authentication: None,updated_by,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,}),PaymentIntentUpdate::ConfirmIntentPostUpdate {@@ -503,6 +507,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalrequest_external_three_ds_authentication: None,updated_by,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,}),PaymentIntentUpdate::SyncUpdate {status,@@ -545,6 +550,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalrequest_external_three_ds_authentication: None,updated_by,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,}),PaymentIntentUpdate::CaptureUpdate {status,@@ -587,6 +593,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalrequest_external_three_ds_authentication: None,updated_by,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,}),PaymentIntentUpdate::SessionIntentUpdate {prerouting_algorithm,@@ -632,6 +639,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalrequest_external_three_ds_authentication: None,updated_by,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,}),PaymentIntentUpdate::UpdateIntent(boxed_intent) => {let PaymentIntentUpdateFields {@@ -667,6 +675,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalactive_attempt_id,updated_by,force_3ds_challenge,+ is_iframe_redirection_enabled,} = *boxed_intent;Ok(Self {status: None,@@ -712,6 +721,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalupdated_by,force_3ds_challenge,+ is_iframe_redirection_enabled: None,})}PaymentIntentUpdate::RecordUpdate {@@ -756,6 +766,7 @@ impl TryFrom<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternalrequest_external_three_ds_authentication: None,updated_by,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,}),}}@@ -1032,6 +1043,7 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {is_payment_processor_token_flow: value.is_payment_processor_token_flow,tax_details: value.tax_details,force_3ds_challenge: value.force_3ds_challenge,+ is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,}))}PaymentIntentUpdate::PaymentCreateUpdate {@@ -1189,6 +1201,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateIntis_payment_processor_token_flow,tax_details,force_3ds_challenge,+ is_iframe_redirection_enabled,} = value;Self {amount,@@ -1228,6 +1241,7 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateIntis_payment_processor_token_flow,tax_details,force_3ds_challenge,+ is_iframe_redirection_enabled,}}}@@ -1609,6 +1623,7 @@ impl behaviour::Conversion for PaymentIntent {force_3ds_challenge_trigger,processor_merchant_id,created_by,+ is_iframe_redirection_enabled,} = self;Ok(DieselPaymentIntent {skip_external_tax_calculation: Some(amount_details.get_external_tax_action_as_bool()),@@ -1693,6 +1708,7 @@ impl behaviour::Conversion for PaymentIntent {force_3ds_challenge_trigger,processor_merchant_id: Some(processor_merchant_id),created_by: created_by.map(|cb| cb.to_string()),+ is_iframe_redirection_enabled,})}async fn convert_back(@@ -1833,6 +1849,7 @@ impl behaviour::Conversion for PaymentIntent {created_by: storage_model.created_by.and_then(|created_by| created_by.parse::<CreatedBy>().ok()),+ is_iframe_redirection_enabled: storage_model.is_iframe_redirection_enabled,})}.await@@ -1918,6 +1935,7 @@ impl behaviour::Conversion for PaymentIntent {force_3ds_challenge_trigger: self.force_3ds_challenge_trigger,processor_merchant_id: Some(self.processor_merchant_id),created_by: self.created_by.map(|cb| cb.to_string()),+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,})}}@@ -1990,6 +2008,7 @@ impl behaviour::Conversion for PaymentIntent {created_by: self.created_by.map(|cb| cb.to_string()),force_3ds_challenge: self.force_3ds_challenge,force_3ds_challenge_trigger: self.force_3ds_challenge_trigger,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,})}@@ -2087,6 +2106,7 @@ impl behaviour::Conversion for PaymentIntent {.and_then(|created_by| created_by.parse::<CreatedBy>().ok()),force_3ds_challenge: storage_model.force_3ds_challenge,force_3ds_challenge_trigger: storage_model.force_3ds_challenge_trigger,+ is_iframe_redirection_enabled: storage_model.is_iframe_redirection_enabled,})}.await@@ -2157,6 +2177,7 @@ impl behaviour::Conversion for PaymentIntent {created_by: self.created_by.map(|cb| cb.to_string()),force_3ds_challenge: self.force_3ds_challenge,force_3ds_challenge_trigger: self.force_3ds_challenge_trigger,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,})}}diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rsindex 11eddab48f..ee5fb18425 100644--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs@@ -857,6 +857,14 @@ pub(crate) fn into_stripe_next_action(},}}+ payments::NextActionData::RedirectInsidePopup { popup_url } => {+ StripeNextAction::RedirectToUrl {+ redirect_to_url: RedirectUrl {+ return_url,+ url: Some(popup_url),+ },+ }+ }payments::NextActionData::DisplayBankTransferInformation {bank_transfer_steps_and_charges_details,} => StripeNextAction::DisplayBankTransferInformation {diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rsindex 158a134611..77db75e218 100644--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs@@ -410,6 +410,14 @@ pub(crate) fn into_stripe_next_action(},}}+ payments::NextActionData::RedirectInsidePopup { popup_url } => {+ StripeNextAction::RedirectToUrl {+ redirect_to_url: RedirectUrl {+ return_url,+ url: Some(popup_url),+ },+ }+ }payments::NextActionData::DisplayBankTransferInformation {bank_transfer_steps_and_charges_details,} => StripeNextAction::DisplayBankTransferInformation {diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rsindex 694bfe08cb..723f732803 100644--- a/crates/router/src/core/admin.rs+++ b/crates/router/src/core/admin.rs@@ -3910,6 +3910,7 @@ impl ProfileCreateBridge for api::ProfileCreate {force_3ds_challenge: self.force_3ds_challenge.unwrap_or_default(),is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,}))}@@ -4053,6 +4054,7 @@ impl ProfileCreateBridge for api::ProfileCreate {merchant_business_country: self.merchant_business_country,revenue_recovery_retry_algorithm_type: None,revenue_recovery_retry_algorithm_data: None,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: self.is_external_vault_enabled,external_vault_connector_details: self.external_vault_connector_details@@ -4357,6 +4359,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {force_3ds_challenge: self.force_3ds_challenge, //is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,},)))}@@ -4491,6 +4494,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {card_testing_secret_key,is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),merchant_business_country: self.merchant_business_country,+ is_iframe_redirection_enabled: None,is_external_vault_enabled: self.is_external_vault_enabled,external_vault_connector_details: self.external_vault_connector_detailsdiff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 00dfe35f79..221390e573 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -2599,6 +2599,7 @@ fn construct_zero_auth_payments_request(customer_acceptance: None,browser_info: None,force_3ds_challenge: None,+ is_iframe_redirection_enabled: None,})}diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex 3aca124c22..f5350e81d5 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -2405,6 +2405,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {.clone().and_then(|next_action_data| match next_action_data {api_models::payments::NextActionData::RedirectToUrl { redirect_to_url } => Some(redirect_to_url),+ api_models::payments::NextActionData::RedirectInsidePopup{popup_url} => Some(popup_url),api_models::payments::NextActionData::DisplayBankTransferInformation { .. } => None,api_models::payments::NextActionData::ThirdPartySdkSessionToken { .. } => None,api_models::payments::NextActionData::QrCodeInformation{..} => None,@@ -2440,9 +2441,27 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {),_ => Err(errors::ApiErrorResponse::InternalServerError).attach_printable_lazy(|| format!("Could not proceed with payment as payment status {} cannot be handled during redirection",payments_response.status))?}?;- Ok(services::ApplicationResponse::JsonForRedirection(- redirection_response,- ))+ if payments_response+ .is_iframe_redirection_enabled+ .unwrap_or(false)+ {+ // html script to check if inside iframe, then send post message to parent for redirection else redirect self to return_url+ let html = core_utils::get_html_redirect_response_popup(+ redirection_response.return_url_with_query_params,+ )?;+ Ok(services::ApplicationResponse::Form(Box::new(+ services::RedirectionFormData {+ redirect_form: services::RedirectForm::Html { html_data: html },+ payment_method_data: None,+ amount: payments_response.amount.to_string(),+ currency: payments_response.currency.clone(),+ },+ )))+ } else {+ Ok(services::ApplicationResponse::JsonForRedirection(+ redirection_response,+ ))+ }}}@@ -2530,14 +2549,34 @@ impl PaymentRedirectFlow for PaymentRedirectSync {payment_id: id_type::PaymentId,connector: String,) -> RouterResult<services::ApplicationResponse<api::RedirectionResponse>> {- Ok(services::ApplicationResponse::JsonForRedirection(- helpers::get_handle_response_url(- payment_id,- &payment_flow_response.business_profile,- &payment_flow_response.payments_response,- connector,- )?,- ))+ let payments_response = &payment_flow_response.payments_response;+ let redirect_response = helpers::get_handle_response_url(+ payment_id.clone(),+ &payment_flow_response.business_profile,+ payments_response,+ connector.clone(),+ )?;+ if payments_response+ .is_iframe_redirection_enabled+ .unwrap_or(false)+ {+ // html script to check if inside iframe, then send post message to parent for redirection else redirect self to return_url+ let html = core_utils::get_html_redirect_response_popup(+ redirect_response.return_url_with_query_params,+ )?;+ Ok(services::ApplicationResponse::Form(Box::new(+ services::RedirectionFormData {+ redirect_form: services::RedirectForm::Html { html_data: html },+ payment_method_data: None,+ amount: payments_response.amount.to_string(),+ currency: payments_response.currency.clone(),+ },+ )))+ } else {+ Ok(services::ApplicationResponse::JsonForRedirection(+ redirect_response,+ ))+ }}fn get_payment_action(&self) -> services::PaymentAction {diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex ca3b5d9a2d..59b25d9b86 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -3685,6 +3685,7 @@ mod tests {created_by: None,force_3ds_challenge: None,force_3ds_challenge_trigger: None,+ is_iframe_redirection_enabled: None,};let req_cs = Some("1".to_string());assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());@@ -3760,6 +3761,7 @@ mod tests {created_by: None,force_3ds_challenge: None,force_3ds_challenge_trigger: None,+ is_iframe_redirection_enabled: None,};let req_cs = Some("1".to_string());assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())@@ -3833,6 +3835,7 @@ mod tests {created_by: None,force_3ds_challenge: None,force_3ds_challenge_trigger: None,+ is_iframe_redirection_enabled: None,};let req_cs = Some("1".to_string());assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex f93e5fcec1..a99359d7ea 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -1878,6 +1878,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> foris_payment_processor_token_flow,tax_details: None,force_3ds_challenge: payment_data.payment_intent.force_3ds_challenge,+ is_iframe_redirection_enabled: payment_data+ .payment_intent+ .is_iframe_redirection_enabled,})),&m_key_store,storage_scheme,diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 8a1335ccf9..fc781e1350 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -1592,6 +1592,9 @@ impl PaymentCreate {created_by: None,force_3ds_challenge: request.force_3ds_challenge,force_3ds_challenge_trigger: Some(force_3ds_challenge_trigger),+ is_iframe_redirection_enabled: request+ .is_iframe_redirection_enabled+ .or(business_profile.is_iframe_redirection_enabled),})}diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex de146e99c1..0f3a58d9b9 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -935,6 +935,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> foris_payment_processor_token_flow: None,tax_details: None,force_3ds_challenge: payment_data.payment_intent.force_3ds_challenge,+ is_iframe_redirection_enabled: payment_data+ .payment_intent+ .is_iframe_redirection_enabled,})),key_store,storage_scheme,diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rsindex 7e558fe55e..c605f9b342 100644--- a/crates/router/src/core/payments/operations/payment_update_intent.rs+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs@@ -366,6 +366,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIntax_details: intent.amount_details.tax_details,active_attempt_id: Some(intent.active_attempt_id),force_3ds_challenge: intent.force_3ds_challenge,+ is_iframe_redirection_enabled: intent.is_iframe_redirection_enabled,}));let new_payment_intent = dbdiff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 9ab06102fe..7e715d40ce 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -1879,6 +1879,7 @@ whereattempts: None,billing: None, //TODO: add thisshipping: None, //TODO: add this+ is_iframe_redirection_enabled: None,};Ok(services::ApplicationResponse::JsonWithHeaders((@@ -1989,6 +1990,7 @@ wherenext_action: None,attempts,return_url,+ is_iframe_redirection_enabled: payment_intent.is_iframe_redirection_enabled,};Ok(services::ApplicationResponse::JsonWithHeaders((@@ -2586,12 +2588,21 @@ where}})).or(payment_attempt.authentication_data.as_ref().map(|_| {- api_models::payments::NextActionData::RedirectToUrl {- redirect_to_url: helpers::create_startpay_url(- base_url,- &payment_attempt,- &payment_intent,- ),+ // Check if iframe redirection is enabled in the business profile+ let redirect_url = helpers::create_startpay_url(+ base_url,+ &payment_attempt,+ &payment_intent,+ );+ // Check if redirection inside popup is enabled in the payment intent+ if payment_intent.is_iframe_redirection_enabled.unwrap_or(false) {+ api_models::payments::NextActionData::RedirectInsidePopup {+ popup_url: redirect_url,+ }+ } else {+ api_models::payments::NextActionData::RedirectToUrl {+ redirect_to_url: redirect_url,+ }}})).or(match payment_data.get_authentication(){@@ -2858,6 +2869,7 @@ whereforce_3ds_challenge_trigger: payment_intent.force_3ds_challenge_trigger,issuer_error_code: payment_attempt.issuer_error_code,issuer_error_message: payment_attempt.issuer_error_message,+ is_iframe_redirection_enabled: payment_intent.is_iframe_redirection_enabled,};services::ApplicationResponse::JsonWithHeaders((payments_response, headers))@@ -3150,6 +3162,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Payforce_3ds_challenge_trigger: pi.force_3ds_challenge_trigger,issuer_error_code: pa.issuer_error_code,issuer_error_message: pa.issuer_error_message,+ is_iframe_redirection_enabled:pi.is_iframe_redirection_enabled}}}diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rsindex d8b01bfd23..7b88998953 100644--- a/crates/router/src/core/utils.rs+++ b/crates/router/src/core/utils.rs@@ -1721,6 +1721,38 @@ pub fn get_external_authentication_request_poll_id() -> String {payment_id.get_external_authentication_request_poll_id()}+pub fn get_html_redirect_response_popup(+ return_url_with_query_params: String,+) -> RouterResult<String> {+ Ok(html! {+ head {+ title { "Redirect Form" }+ (PreEscaped(format!(r#"+ <script>+ let return_url = "{return_url_with_query_params}";+ try {{+ // if inside iframe, send post message to parent for redirection+ if (window.self !== window.parent) {{+ window.parent.postMessage({{openurl_if_required: return_url}}, '*')+ // if parent, redirect self to return_url+ }} else {{+ window.location.href = return_url+ }}+ }}+ catch(err) {{+ // if error occurs, send post message to parent and wait for 10 secs to redirect. if doesn't redirect, redirect self to return_url+ window.parent.postMessage({{openurl_if_required: return_url}}, '*')+ setTimeout(function() {{+ window.location.href = return_url+ }}, 10000);+ console.log(err.message)+ }}+ </script>+ "#)))+ }+ }+ .into_string())+}#[cfg(feature = "v1")]pub fn get_html_redirect_response_for_external_authentication(diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rsindex 344cccc129..bf7596adb4 100644--- a/crates/router/src/types/api/admin.rs+++ b/crates/router/src/types/api/admin.rs@@ -274,6 +274,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,is_debit_routing_enabled: Some(item.is_debit_routing_enabled),merchant_business_country: item.merchant_business_country,+ is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,is_external_vault_enabled: item.is_external_vault_enabled,external_vault_connector_details: item.external_vault_connector_details@@ -441,5 +442,6 @@ pub async fn create_profile_from_merchant_account(force_3ds_challenge: request.force_3ds_challenge.unwrap_or_default(),is_debit_routing_enabled: request.is_debit_routing_enabled.unwrap_or_default(),merchant_business_country: request.merchant_business_country,+ is_iframe_redirection_enabled: request.is_iframe_redirection_enabled,}))}diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rsindex 61e4d73134..dddded4c3d 100644--- a/crates/router/src/utils/user/sample_data.rs+++ b/crates/router/src/utils/user/sample_data.rs@@ -288,6 +288,7 @@ pub async fn generate_sample_data(created_by: None,force_3ds_challenge: None,force_3ds_challenge_trigger: None,+ is_iframe_redirection_enabled: None,};let (connector_transaction_id, processor_transaction_data) =ConnectorTransactionId::form_id_and_data(attempt_id.clone());diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rsindex 7657515d63..82296d2a83 100644--- a/crates/router/tests/payments.rs+++ b/crates/router/tests/payments.rs@@ -463,6 +463,7 @@ async fn payments_create_core() {force_3ds_challenge_trigger: None,issuer_error_code: None,issuer_error_message: None,+ is_iframe_redirection_enabled: None,};let expected_response =services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));@@ -739,6 +740,7 @@ async fn payments_create_core_adyen_no_redirect() {force_3ds_challenge_trigger: None,issuer_error_code: None,issuer_error_message: None,+ is_iframe_redirection_enabled: None,},vec![],));diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rsindex 1017d65a3f..1240d1c17a 100644--- a/crates/router/tests/payments2.rs+++ b/crates/router/tests/payments2.rs@@ -225,6 +225,7 @@ async fn payments_create_core() {force_3ds_challenge_trigger: None,issuer_error_code: None,issuer_error_message: None,+ is_iframe_redirection_enabled: None,};let expected_response =@@ -509,6 +510,7 @@ async fn payments_create_core_adyen_no_redirect() {force_3ds_challenge_trigger: None,issuer_error_code: None,issuer_error_message: None,+ is_iframe_redirection_enabled: None,},vec![],));diff --git a/migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/down.sql b/migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/down.sqlnew file mode 100644index 0000000000..cd6f797e91--- /dev/null+++ b/migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/down.sql@@ -0,0 +1,3 @@+-- This file should undo anything in `up.sql`+ALTER TABLE business_profile+DROP COLUMN is_iframe_redirection_enabled;\ No newline at end of filediff --git a/migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/up.sql b/migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/up.sqlnew file mode 100644index 0000000000..ef315ec9c8--- /dev/null+++ b/migrations/2025-05-05-104001_is_iframe_redirection_enabled_to_business_profile/up.sql@@ -0,0 +1,4 @@+-- Your SQL goes here++ALTER TABLE business_profile+ADD COLUMN is_iframe_redirection_enabled BOOLEAN ;\ No newline at end of filediff --git a/migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/down.sql b/migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/down.sqlnew file mode 100644index 0000000000..2b097a46c3--- /dev/null+++ b/migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/down.sql@@ -0,0 +1,3 @@+-- This file should undo anything in `up.sql`+ALTER TABLE payment_intent+DROP COLUMN is_iframe_redirection_enabled;\ No newline at end of filediff --git a/migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/up.sql b/migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/up.sqlnew file mode 100644index 0000000000..71a83bcfd9--- /dev/null+++ b/migrations/2025-05-06-121325_is_iframe_redirection_enabled_to_payment_intent/up.sql@@ -0,0 +1,5 @@+-- Your SQL goes here+-- Your SQL goes here++ALTER TABLE payment_intent+ADD COLUMN is_iframe_redirection_enabled BOOLEAN;\ No newline at end of file