diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 1af9284596..78d58c6971 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -17241,7 +17241,8 @@ "ProfileCreate": { "type": "object", "required": [ - "profile_name" + "profile_name", + "is_click_to_pay_enabled" ], "properties": { "profile_name": { @@ -17399,6 +17400,12 @@ "is_network_tokenization_enabled": { "type": "boolean", "description": "Indicates if network tokenization is enabled or not." + }, + "is_click_to_pay_enabled": { + "type": "boolean", + "description": "Indicates if click to pay is enabled or not.", + "default": false, + "example": false } }, "additionalProperties": false @@ -17431,7 +17438,8 @@ "redirect_to_merchant_with_http_post", "is_tax_connector_enabled", "is_network_tokenization_enabled", - "should_collect_cvv_during_payment" + "should_collect_cvv_during_payment", + "is_click_to_pay_enabled" ], "properties": { "merchant_id": { @@ -17611,6 +17619,12 @@ "should_collect_cvv_during_payment": { "type": "boolean", "description": "Indicates if CVV should be collected during payment or not." + }, + "is_click_to_pay_enabled": { + "type": "boolean", + "description": "Indicates if click to pay is enabled or not.", + "default": false, + "example": false } } }, diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index f2904dd478..b391061c38 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -21668,6 +21668,10 @@ "description": "Maximum number of auto retries allowed for a payment", "nullable": true, "minimum": 0 + }, + "is_click_to_pay_enabled": { + "type": "boolean", + "description": "Indicates if click to pay is enabled or not." } }, "additionalProperties": false @@ -21700,7 +21704,8 @@ "redirect_to_merchant_with_http_post", "is_tax_connector_enabled", "is_network_tokenization_enabled", - "is_auto_retries_enabled" + "is_auto_retries_enabled", + "is_click_to_pay_enabled" ], "properties": { "merchant_id": { @@ -21897,6 +21902,12 @@ "format": "int32", "description": "Maximum number of auto retries allowed for a payment", "nullable": true + }, + "is_click_to_pay_enabled": { + "type": "boolean", + "description": "Indicates if click to pay is enabled or not.", + "default": false, + "example": false } } }, diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index f0a8c99943..53ce867896 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -1966,6 +1966,10 @@ pub struct ProfileCreate { /// Maximum number of auto retries allowed for a payment pub max_auto_retries_enabled: Option, + + /// Indicates if click to pay is enabled or not. + #[serde(default)] + pub is_click_to_pay_enabled: bool, } #[nutype::nutype( @@ -2074,6 +2078,10 @@ pub struct ProfileCreate { /// Indicates if network tokenization is enabled or not. #[serde(default)] pub is_network_tokenization_enabled: bool, + + /// Indicates if click to pay is enabled or not. + #[schema(default = false, example = false)] + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v1")] @@ -2202,6 +2210,10 @@ pub struct ProfileResponse { /// Maximum number of auto retries allowed for a payment pub max_auto_retries_enabled: Option, + + /// Indicates if click to pay is enabled or not. + #[schema(default = false, example = false)] + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v2")] @@ -2317,6 +2329,10 @@ pub struct ProfileResponse { /// Indicates if CVV should be collected during payment or not. pub should_collect_cvv_during_payment: bool, + + /// Indicates if click to pay is enabled or not. + #[schema(default = false, example = false)] + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v1")] @@ -2439,6 +2455,10 @@ pub struct ProfileUpdate { /// Maximum number of auto retries allowed for a payment pub max_auto_retries_enabled: Option, + + /// Indicates if click to pay is enabled or not. + #[schema(default = false, example = false)] + pub is_click_to_pay_enabled: Option, } #[cfg(feature = "v2")] @@ -2542,6 +2562,10 @@ pub struct ProfileUpdate { /// Indicates if network tokenization is enabled or not. pub is_network_tokenization_enabled: Option, + + /// Indicates if click to pay is enabled or not. + #[schema(default = false, example = false)] + pub is_click_to_pay_enabled: Option, } #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs index 1f8209397a..484a1c0c69 100644 --- a/crates/diesel_models/src/business_profile.rs +++ b/crates/diesel_models/src/business_profile.rs @@ -57,6 +57,7 @@ pub struct Profile { pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v1")] @@ -100,6 +101,7 @@ pub struct ProfileNew { pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v1")] @@ -140,6 +142,7 @@ pub struct ProfileUpdateInternal { pub is_network_tokenization_enabled: Option, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: Option, } #[cfg(feature = "v1")] @@ -179,6 +182,7 @@ impl ProfileUpdateInternal { is_network_tokenization_enabled, is_auto_retries_enabled, max_auto_retries_enabled, + is_click_to_pay_enabled, } = self; Profile { profile_id: source.profile_id, @@ -238,6 +242,8 @@ impl ProfileUpdateInternal { .unwrap_or(source.is_network_tokenization_enabled), is_auto_retries_enabled: is_auto_retries_enabled.or(source.is_auto_retries_enabled), max_auto_retries_enabled: max_auto_retries_enabled.or(source.max_auto_retries_enabled), + is_click_to_pay_enabled: is_click_to_pay_enabled + .unwrap_or(source.is_click_to_pay_enabled), } } } @@ -292,6 +298,7 @@ pub struct Profile { pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: bool, } impl Profile { @@ -350,6 +357,7 @@ pub struct ProfileNew { pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v2")] @@ -392,6 +400,7 @@ pub struct ProfileUpdateInternal { pub is_network_tokenization_enabled: Option, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: Option, } #[cfg(feature = "v2")] @@ -433,6 +442,7 @@ impl ProfileUpdateInternal { is_network_tokenization_enabled, is_auto_retries_enabled, max_auto_retries_enabled, + is_click_to_pay_enabled, } = self; Profile { id: source.id, @@ -497,6 +507,8 @@ impl ProfileUpdateInternal { .unwrap_or(source.is_network_tokenization_enabled), is_auto_retries_enabled: is_auto_retries_enabled.or(source.is_auto_retries_enabled), max_auto_retries_enabled: max_auto_retries_enabled.or(source.max_auto_retries_enabled), + is_click_to_pay_enabled: is_click_to_pay_enabled + .unwrap_or(source.is_click_to_pay_enabled), } } } diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index b6f1a4f8d0..936428bd46 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -213,6 +213,7 @@ diesel::table! { is_network_tokenization_enabled -> Bool, is_auto_retries_enabled -> Nullable, max_auto_retries_enabled -> Nullable, + is_click_to_pay_enabled -> Bool, } } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index 470868ed82..8a1733fc98 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -221,6 +221,7 @@ diesel::table! { is_network_tokenization_enabled -> Bool, is_auto_retries_enabled -> Nullable, max_auto_retries_enabled -> Nullable, + is_click_to_pay_enabled -> Bool, } } diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs index 3e8213a358..433353b2f8 100644 --- a/crates/hyperswitch_domain_models/src/business_profile.rs +++ b/crates/hyperswitch_domain_models/src/business_profile.rs @@ -58,6 +58,7 @@ pub struct Profile { pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: bool, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v1")] @@ -98,6 +99,7 @@ pub struct ProfileSetter { pub is_network_tokenization_enabled: bool, pub is_auto_retries_enabled: bool, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v1")] @@ -145,6 +147,7 @@ impl From for Profile { is_network_tokenization_enabled: value.is_network_tokenization_enabled, is_auto_retries_enabled: value.is_auto_retries_enabled, max_auto_retries_enabled: value.max_auto_retries_enabled, + is_click_to_pay_enabled: value.is_click_to_pay_enabled, } } } @@ -194,6 +197,7 @@ pub struct ProfileGeneralUpdate { pub is_network_tokenization_enabled: Option, pub is_auto_retries_enabled: Option, pub max_auto_retries_enabled: Option, + pub is_click_to_pay_enabled: Option, } #[cfg(feature = "v1")] @@ -256,6 +260,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled, is_auto_retries_enabled, max_auto_retries_enabled, + is_click_to_pay_enabled, } = *update; Self { @@ -293,6 +298,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled, is_auto_retries_enabled, max_auto_retries_enabled, + is_click_to_pay_enabled, } } ProfileUpdate::RoutingAlgorithmUpdate { @@ -332,6 +338,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::DynamicRoutingAlgorithmUpdate { dynamic_routing_algorithm, @@ -369,6 +376,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::ExtendedCardInfoUpdate { is_extended_card_info_enabled, @@ -406,6 +414,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::ConnectorAgnosticMitUpdate { is_connector_agnostic_mit_enabled, @@ -443,6 +452,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::NetworkTokenizationUpdate { is_network_tokenization_enabled, @@ -480,6 +490,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: Some(is_network_tokenization_enabled), is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, } } @@ -536,6 +547,7 @@ impl super::behaviour::Conversion for Profile { is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: Some(self.is_auto_retries_enabled), max_auto_retries_enabled: self.max_auto_retries_enabled, + is_click_to_pay_enabled: self.is_click_to_pay_enabled, }) } @@ -604,6 +616,7 @@ impl super::behaviour::Conversion for Profile { is_network_tokenization_enabled: item.is_network_tokenization_enabled, is_auto_retries_enabled: item.is_auto_retries_enabled.unwrap_or(false), max_auto_retries_enabled: item.max_auto_retries_enabled, + is_click_to_pay_enabled: item.is_click_to_pay_enabled, }) } .await @@ -656,6 +669,7 @@ impl super::behaviour::Conversion for Profile { is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: Some(self.is_auto_retries_enabled), max_auto_retries_enabled: self.max_auto_retries_enabled, + is_click_to_pay_enabled: self.is_click_to_pay_enabled, }) } } @@ -700,6 +714,7 @@ pub struct Profile { pub is_tax_connector_enabled: bool, pub version: common_enums::ApiVersion, pub is_network_tokenization_enabled: bool, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v2")] @@ -740,6 +755,7 @@ pub struct ProfileSetter { pub tax_connector_id: Option, pub is_tax_connector_enabled: bool, pub is_network_tokenization_enabled: bool, + pub is_click_to_pay_enabled: bool, } #[cfg(feature = "v2")] @@ -787,6 +803,7 @@ impl From for Profile { is_tax_connector_enabled: value.is_tax_connector_enabled, version: consts::API_VERSION, is_network_tokenization_enabled: value.is_network_tokenization_enabled, + is_click_to_pay_enabled: value.is_click_to_pay_enabled, } } } @@ -837,6 +854,7 @@ pub struct ProfileGeneralUpdate { pub order_fulfillment_time: Option, pub order_fulfillment_time_origin: Option, pub is_network_tokenization_enabled: Option, + pub is_click_to_pay_enabled: Option, } #[cfg(feature = "v2")] @@ -895,6 +913,7 @@ impl From for ProfileUpdateInternal { order_fulfillment_time, order_fulfillment_time_origin, is_network_tokenization_enabled, + is_click_to_pay_enabled, } = *update; Self { profile_name, @@ -933,6 +952,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled, } } ProfileUpdate::RoutingAlgorithmUpdate { @@ -974,6 +994,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::ExtendedCardInfoUpdate { is_extended_card_info_enabled, @@ -1013,6 +1034,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::ConnectorAgnosticMitUpdate { is_connector_agnostic_mit_enabled, @@ -1052,6 +1074,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::DefaultRoutingFallbackUpdate { default_fallback_routing, @@ -1091,6 +1114,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::NetworkTokenizationUpdate { is_network_tokenization_enabled, @@ -1130,6 +1154,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: Some(is_network_tokenization_enabled), is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, ProfileUpdate::CollectCvvDuringPaymentUpdate { should_collect_cvv_during_payment, @@ -1169,6 +1194,7 @@ impl From for ProfileUpdateInternal { is_network_tokenization_enabled: None, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: None, }, } } @@ -1228,6 +1254,7 @@ impl super::behaviour::Conversion for Profile { is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: self.is_click_to_pay_enabled, }) } @@ -1296,6 +1323,7 @@ impl super::behaviour::Conversion for Profile { is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false), version: item.version, is_network_tokenization_enabled: item.is_network_tokenization_enabled, + is_click_to_pay_enabled: item.is_click_to_pay_enabled, }) } .await @@ -1351,6 +1379,7 @@ impl super::behaviour::Conversion for Profile { is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: None, max_auto_retries_enabled: None, + is_click_to_pay_enabled: self.is_click_to_pay_enabled, }) } } diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 055c428b1f..6e2ed22072 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -3555,6 +3555,7 @@ impl ProfileCreateBridge for api::ProfileCreate { is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: self.is_auto_retries_enabled.unwrap_or_default(), max_auto_retries_enabled: self.max_auto_retries_enabled.map(i16::from), + is_click_to_pay_enabled: self.is_click_to_pay_enabled, })) } @@ -3662,6 +3663,7 @@ impl ProfileCreateBridge for api::ProfileCreate { tax_connector_id: self.tax_connector_id, is_tax_connector_enabled: self.is_tax_connector_enabled, is_network_tokenization_enabled: self.is_network_tokenization_enabled, + is_click_to_pay_enabled: self.is_click_to_pay_enabled, })) } } @@ -3911,6 +3913,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate { is_network_tokenization_enabled: self.is_network_tokenization_enabled, is_auto_retries_enabled: self.is_auto_retries_enabled, max_auto_retries_enabled: self.max_auto_retries_enabled.map(i16::from), + is_click_to_pay_enabled: self.is_click_to_pay_enabled, }, ))) } @@ -4007,6 +4010,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate { always_collect_shipping_details_from_wallet_connector: self .always_collect_shipping_details_from_wallet_connector, is_network_tokenization_enabled: self.is_network_tokenization_enabled, + is_click_to_pay_enabled: self.is_click_to_pay_enabled, }, ))) } diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs index 85275a768d..7207f63aa0 100644 --- a/crates/router/src/types/api/admin.rs +++ b/crates/router/src/types/api/admin.rs @@ -174,6 +174,7 @@ impl ForeignTryFrom for ProfileResponse { is_network_tokenization_enabled: item.is_network_tokenization_enabled, is_auto_retries_enabled: item.is_auto_retries_enabled, max_auto_retries_enabled: item.max_auto_retries_enabled, + is_click_to_pay_enabled: item.is_click_to_pay_enabled, }) } } @@ -241,6 +242,7 @@ impl ForeignTryFrom for ProfileResponse { tax_connector_id: item.tax_connector_id, is_tax_connector_enabled: item.is_tax_connector_enabled, is_network_tokenization_enabled: item.is_network_tokenization_enabled, + is_click_to_pay_enabled: item.is_click_to_pay_enabled, }) } } @@ -367,5 +369,6 @@ pub async fn create_profile_from_merchant_account( is_network_tokenization_enabled: request.is_network_tokenization_enabled, is_auto_retries_enabled: request.is_auto_retries_enabled.unwrap_or_default(), max_auto_retries_enabled: request.max_auto_retries_enabled.map(i16::from), + is_click_to_pay_enabled: request.is_click_to_pay_enabled, })) } diff --git a/migrations/2024-12-04-072648_add_is_click_to_pay_enabled/down.sql b/migrations/2024-12-04-072648_add_is_click_to_pay_enabled/down.sql new file mode 100644 index 0000000000..8ff46e69d6 --- /dev/null +++ b/migrations/2024-12-04-072648_add_is_click_to_pay_enabled/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE business_profile DROP COLUMN IF EXISTS is_click_to_pay_enabled; \ No newline at end of file diff --git a/migrations/2024-12-04-072648_add_is_click_to_pay_enabled/up.sql b/migrations/2024-12-04-072648_add_is_click_to_pay_enabled/up.sql new file mode 100644 index 0000000000..3adb84258b --- /dev/null +++ b/migrations/2024-12-04-072648_add_is_click_to_pay_enabled/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS is_click_to_pay_enabled BOOLEAN NOT NULL DEFAULT FALSE; \ No newline at end of file