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
Revert: "feat(payment_links): Add Validation On Not Allowing Custom T&C When Domain is set to Hyperswitch Hosted" (#10616)
Sayak Bhattacharyab258d2b48f40
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 84c96ca471..ab6b1de185 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -24870,11 +24870,6 @@"type": "string","description": "Hex color for the CVC icon during error state","nullable": true- },- "payment_test_mode": {- "type": "boolean",- "description": "Indicates whether the merchant is testing or live",- "nullable": true}}},diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 040df77c8a..a97c0b7504 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -18174,11 +18174,6 @@"type": "string","description": "Hex color for the CVC icon during error state","nullable": true- },- "payment_test_mode": {- "type": "boolean",- "description": "Indicates whether the merchant is testing or live",- "nullable": true}}},diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rsindex d7d09b6f10..9c00b9c60c 100644--- a/crates/api_models/src/admin.rs+++ b/crates/api_models/src/admin.rs@@ -3399,8 +3399,6 @@ pub struct PaymentLinkConfigRequest {pub is_setup_mandate_flow: Option<bool>,/// Hex color for the CVC icon during error statepub color_icon_card_cvc_error: Option<String>,- /// Indicates whether the merchant is testing or live- pub payment_test_mode: Option<bool>,}impl PaymentLinkConfigRequest {diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rsindex 4cd151c85e..95f1e14431 100644--- a/crates/hyperswitch_domain_models/src/lib.rs+++ b/crates/hyperswitch_domain_models/src/lib.rs@@ -596,7 +596,6 @@ impl ApiModelToDieselModelConvertor<api_models::admin::PaymentLinkConfigRequest>show_card_terms,is_setup_mandate_flow,color_icon_card_cvc_error,- payment_test_mode: None,}}}diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rsindex 3a03b6ced8..613379e5e4 100644--- a/crates/router/src/core/payment_link.rs+++ b/crates/router/src/core/payment_link.rs@@ -627,7 +627,7 @@ pub fn get_payment_link_config_based_on_priority(.map(|name| name.into_inner().peek().to_owned()).unwrap_or_default();let (domain_name, business_theme_configs, allowed_domains, branding_visibility) =- if let Some(ref business_config) = business_link_config {+ if let Some(business_config) = business_link_config {(business_config.domain_name@@ -638,19 +638,18 @@ pub fn get_payment_link_config_based_on_priority(}).unwrap_or_else(|| default_domain_name.clone()),payment_link_config_id- .as_ref().and_then(|id| {business_config.business_specific_configs.as_ref()- .and_then(|specific_configs| specific_configs.get(id).cloned())+ .and_then(|specific_configs| specific_configs.get(&id).cloned())})- .or(business_config.default_config.clone()),- business_config.allowed_domains.clone(),+ .or(business_config.default_config),+ business_config.allowed_domains,business_config.branding_visibility,)} else {- (default_domain_name.clone(), None, None, None)+ (default_domain_name, None, None, None)};let (@@ -756,47 +755,6 @@ pub fn get_payment_link_config_based_on_priority(color_icon_card_cvc_error,};- let has_custom_tnc = payment_link_config.custom_message_for_card_terms.is_some()- || payment_link_config- .custom_message_for_payment_method_types- .is_some();- let is_default_domain = domain_name == default_domain_name;- let is_test_mode = payment_create_link_config- .and_then(|mode| mode.theme_config.payment_test_mode)- .unwrap_or(false);- let is_production = matches!(router_env::env::which(), router_env::Env::Production);-- // We do further checks only when Merchant is using our default domain and has passed custom T&C -> Which is not allowed to do- if is_default_domain && has_custom_tnc {- match (is_test_mode, is_production) {- // Custom T&C cannot be passed when base url is default domain- (false, true) => {- return Err(errors::ApiErrorResponse::InvalidRequestData {- message: format!(- "payment_link_config.custom_message_for_card_terms cannot be passed when base url is set to: {domain_name}"- ),- }- .into())- }- // Test mode must be true to pass custom tnc- (false, false) => {- return Err(errors::ApiErrorResponse::InvalidRequestData {- message: "To pass payment_link_config.custom_message_for_card_terms, set payment_link_config.payment_test_mode = true".to_string()- }- .into(),- )}- // Test Mode cannot be set to True when Env is Production- (true, true) => {- return Err(errors::ApiErrorResponse::InvalidRequestData {- message: "Cannot set payment_link_config.payment_test_mode = true in Production".to_string()- }- .into(),- )}- // Test mode is true and the env is non Production so we are allowed to pass custom T&C with our default domain- (true,false) => ()- }- }-Ok((payment_link_config, domain_name))}diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex e19c4ba0fb..e40e556f4d 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -6667,7 +6667,6 @@ impl ForeignFrom<diesel_models::PaymentLinkConfigRequestForPayments>show_card_terms: config.show_card_terms,is_setup_mandate_flow: config.is_setup_mandate_flow,color_icon_card_cvc_error: config.color_icon_card_cvc_error,- payment_test_mode: None,}}}diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 8400242ae6..a56d17da5e 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -2206,7 +2206,6 @@ impl ForeignFrom<diesel_models::business_profile::PaymentLinkConfigRequest>show_card_terms: item.show_card_terms,is_setup_mandate_flow: item.is_setup_mandate_flow,color_icon_card_cvc_error: item.color_icon_card_cvc_error,- payment_test_mode: None,}}}