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

fix(connector): Add RedirectInsidePopup response redirection URL (#8257)

awasthi21df34ff43dcdb
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index c8ab763402..7d9a7f0e4b 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -16890,12 +16890,16 @@
"type": "object",
"required": [
"popup_url",
+ "redirect_response_url",
"type"
],
"properties": {
"popup_url": {
"type": "string"
},
+ "redirect_response_url": {
+ "type": "string"
+ },
"type": {
"type": "string",
"enum": [
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index e87527e545..4a0069baa6 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -4499,6 +4499,7 @@ pub enum NextActionData {
#[cfg(feature = "v1")]
RedirectInsidePopup {
popup_url: String,
+ redirect_response_url: String,
},
/// Contains the url for redirection flow
#[cfg(feature = "v2")]
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 81f09e7459..9d48cbb6da 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -116,6 +116,7 @@ pub struct ConfigMetadata {
pub three_ds_requestor_id: Option<InputData>,
pub pull_mechanism_for_external_3ds_enabled: Option<InputData>,
pub klarna_region: Option<InputData>,
+ pub pricing_type: Option<InputData>,
pub source_balance_account: Option<InputData>,
pub brand_id: Option<InputData>,
pub destination_account_number: Option<InputData>,
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index a9b68b86a5..756f94d41d 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -90,11 +90,13 @@ impl TryFrom<&Option<common_utils::pii::SecretSerdeValue>> for AdyenConnectorMet
fn try_from(
meta_data: &Option<common_utils::pii::SecretSerdeValue>,
) -> Result<Self, Self::Error> {
- let metadata: Self = utils::to_connector_meta_from_secret::<Self>(meta_data.clone())
- .change_context(errors::ConnectorError::InvalidConnectorConfig {
- config: "metadata",
- })?;
- Ok(metadata)
+ match meta_data {
+ Some(metadata) => utils::to_connector_meta_from_secret::<Self>(Some(metadata.clone()))
+ .change_context(errors::ConnectorError::InvalidConnectorConfig {
+ config: "metadata",
+ }),
+ None => Ok(Self::default()),
+ }
}
}
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 84a996e3ef..0dd814bc03 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -858,7 +858,7 @@ pub(crate) fn into_stripe_next_action(
},
}
}
- payments::NextActionData::RedirectInsidePopup { popup_url } => {
+ payments::NextActionData::RedirectInsidePopup { popup_url, .. } => {
StripeNextAction::RedirectToUrl {
redirect_to_url: RedirectUrl {
return_url,
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 57b85e33de..40e0e7ae6c 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -411,7 +411,7 @@ pub(crate) fn into_stripe_next_action(
},
}
}
- payments::NextActionData::RedirectInsidePopup { popup_url } => {
+ payments::NextActionData::RedirectInsidePopup { popup_url, .. } => {
StripeNextAction::RedirectToUrl {
redirect_to_url: RedirectUrl {
return_url,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 64a06fc8c1..cd89c96748 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -2546,7 +2546,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::RedirectInsidePopup{popup_url, ..} => Some(popup_url),
api_models::payments::NextActionData::DisplayBankTransferInformation { .. } => None,
api_models::payments::NextActionData::ThirdPartySdkSessionToken { .. } => None,
api_models::payments::NextActionData::QrCodeInformation{..} => None,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 0c61e868d3..e8d1e756b1 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -2513,6 +2513,13 @@ where
})
.unwrap_or_default(),
);
+ let connector_name = payment_attempt.connector.as_deref().unwrap_or_default();
+ let router_return_url = helpers::create_redirect_url(
+ &base_url.to_string(),
+ &payment_attempt,
+ connector_name,
+ payment_data.get_creds_identifier(),
+ );
let output = if payments::is_start_pay(&operation)
&& payment_attempt.authentication_data.is_some()
@@ -2607,6 +2614,7 @@ where
if payment_intent.is_iframe_redirection_enabled.unwrap_or(false) {
api_models::payments::NextActionData::RedirectInsidePopup {
popup_url: redirect_url,
+ redirect_response_url:router_return_url
}
} else {
api_models::payments::NextActionData::RedirectToUrl {