Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): [Network Tokenization] pre network tokenization #6873

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -18131,6 +18131,10 @@
"type": "object",
"description": "Product authentication ids",
"nullable": true
},
"is_tokenize_before_payment_enabled": {
"type": "boolean",
"description": "Indicates if network tokenization before first payment is enabled or not"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -18164,7 +18168,8 @@
"is_tax_connector_enabled",
"is_network_tokenization_enabled",
"should_collect_cvv_during_payment",
"is_click_to_pay_enabled"
"is_click_to_pay_enabled",
"is_tokenize_before_payment_enabled"
],
"properties": {
"merchant_id": {
Expand Down Expand Up @@ -18355,6 +18360,10 @@
"type": "object",
"description": "Product authentication ids",
"nullable": true
},
"is_tokenize_before_payment_enabled": {
"type": "boolean",
"description": "Indicates if network tokenization before first payment is enabled or not"
}
}
},
Expand Down
11 changes: 10 additions & 1 deletion api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -22432,6 +22432,10 @@
"type": "object",
"description": "Product authentication ids",
"nullable": true
},
"is_tokenize_before_payment_enabled": {
"type": "boolean",
"description": "Indicates if network tokenization before first payment is enabled or not"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -22465,7 +22469,8 @@
"is_tax_connector_enabled",
"is_network_tokenization_enabled",
"is_auto_retries_enabled",
"is_click_to_pay_enabled"
"is_click_to_pay_enabled",
"is_tokenize_before_payment_enabled"
],
"properties": {
"merchant_id": {
Expand Down Expand Up @@ -22673,6 +22678,10 @@
"type": "object",
"description": "Product authentication ids",
"nullable": true
},
"is_tokenize_before_payment_enabled": {
"type": "boolean",
"description": "Indicates if network tokenization before first payment is enabled or not"
}
}
},
Expand Down
22 changes: 22 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,10 @@ pub struct ProfileCreate {
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<HashMap<String, id_type::MerchantConnectorAccountId>>,

/// Indicates if network tokenization before first payment is enabled or not
#[serde(default)]
pub is_tokenize_before_payment_enabled: bool,
}

#[nutype::nutype(
Expand Down Expand Up @@ -2090,6 +2094,10 @@ pub struct ProfileCreate {
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<HashMap<String, id_type::MerchantConnectorAccountId>>,

/// Indicates if network tokenization before first payment is enabled or not
#[serde(default)]
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -2226,6 +2234,9 @@ pub struct ProfileResponse {
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<serde_json::Value>,

/// Indicates if network tokenization before first payment is enabled or not
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -2349,6 +2360,9 @@ pub struct ProfileResponse {
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<serde_json::Value>,

/// Indicates if network tokenization before first payment is enabled or not
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -2479,6 +2493,10 @@ pub struct ProfileUpdate {
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<HashMap<String, id_type::MerchantConnectorAccountId>>,

/// Indicates if network tokenization before first payment is enabled or not
#[schema(default = false, example = false)]
pub is_tokenize_before_payment_enabled: Option<bool>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -2590,6 +2608,10 @@ pub struct ProfileUpdate {
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<HashMap<String, id_type::MerchantConnectorAccountId>>,

/// Indicates if network tokenization before first payment is enabled or not
#[schema(default = false, example = false)]
pub is_tokenize_before_payment_enabled: Option<bool>,
}

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
Expand Down
6 changes: 6 additions & 0 deletions crates/diesel_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub struct Profile {
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -104,6 +105,7 @@ pub struct ProfileNew {
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: Option<bool>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -146,6 +148,7 @@ pub struct ProfileUpdateInternal {
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: Option<bool>,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: Option<bool>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -187,6 +190,7 @@ impl ProfileUpdateInternal {
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
is_tokenize_before_payment_enabled,
} = self;
Profile {
profile_id: source.profile_id,
Expand Down Expand Up @@ -250,6 +254,8 @@ impl ProfileUpdateInternal {
.unwrap_or(source.is_click_to_pay_enabled),
authentication_product_ids: authentication_product_ids
.or(source.authentication_product_ids),
is_tokenize_before_payment_enabled: is_tokenize_before_payment_enabled
.unwrap_or(source.is_tokenize_before_payment_enabled),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ diesel::table! {
max_auto_retries_enabled -> Nullable<Int2>,
is_click_to_pay_enabled -> Bool,
authentication_product_ids -> Nullable<Jsonb>,
is_tokenize_before_payment_enabled -> Bool,
}
}

Expand Down
27 changes: 27 additions & 0 deletions crates/hyperswitch_domain_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub struct Profile {
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -102,6 +103,7 @@ pub struct ProfileSetter {
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -151,6 +153,7 @@ impl From<ProfileSetter> for Profile {
max_auto_retries_enabled: value.max_auto_retries_enabled,
is_click_to_pay_enabled: value.is_click_to_pay_enabled,
authentication_product_ids: value.authentication_product_ids,
is_tokenize_before_payment_enabled: value.is_tokenize_before_payment_enabled,
}
}
}
Expand Down Expand Up @@ -202,6 +205,7 @@ pub struct ProfileGeneralUpdate {
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: Option<bool>,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: Option<bool>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -266,6 +270,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
is_tokenize_before_payment_enabled,
} = *update;

Self {
Expand Down Expand Up @@ -305,6 +310,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
is_tokenize_before_payment_enabled,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
Expand Down Expand Up @@ -346,6 +352,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
Expand Down Expand Up @@ -385,6 +392,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
Expand Down Expand Up @@ -424,6 +432,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
Expand Down Expand Up @@ -463,6 +472,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
Expand Down Expand Up @@ -502,6 +512,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
}
}
Expand Down Expand Up @@ -560,6 +571,7 @@ impl super::behaviour::Conversion for Profile {
max_auto_retries_enabled: self.max_auto_retries_enabled,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
is_tokenize_before_payment_enabled: self.is_tokenize_before_payment_enabled,
})
}

Expand Down Expand Up @@ -630,6 +642,7 @@ impl super::behaviour::Conversion for Profile {
max_auto_retries_enabled: item.max_auto_retries_enabled,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
is_tokenize_before_payment_enabled: item.is_network_tokenization_enabled,
})
}
.await
Expand Down Expand Up @@ -684,6 +697,7 @@ impl super::behaviour::Conversion for Profile {
max_auto_retries_enabled: self.max_auto_retries_enabled,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
is_tokenize_before_payment_enabled: Some(self.is_tokenize_before_payment_enabled),
})
}
}
Expand Down Expand Up @@ -730,6 +744,7 @@ pub struct Profile {
pub is_network_tokenization_enabled: bool,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -772,6 +787,7 @@ pub struct ProfileSetter {
pub is_network_tokenization_enabled: bool,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
pub is_tokenize_before_payment_enabled: bool,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -821,6 +837,7 @@ impl From<ProfileSetter> for Profile {
is_network_tokenization_enabled: value.is_network_tokenization_enabled,
is_click_to_pay_enabled: value.is_click_to_pay_enabled,
authentication_product_ids: value.authentication_product_ids,
is_tokenize_before_payment_enabled: value.is_tokenize_before_payment_enabled,
}
}
}
Expand Down Expand Up @@ -973,6 +990,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids,
is_tokenize_before_payment_enabled: None,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
Expand Down Expand Up @@ -1016,6 +1034,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
Expand Down Expand Up @@ -1057,6 +1076,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
Expand Down Expand Up @@ -1098,6 +1118,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
Expand Down Expand Up @@ -1139,6 +1160,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
Expand Down Expand Up @@ -1180,6 +1202,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
Expand Down Expand Up @@ -1221,6 +1244,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_tokenize_before_payment_enabled: None,
},
}
}
Expand Down Expand Up @@ -1282,6 +1306,7 @@ impl super::behaviour::Conversion for Profile {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
is_tokenize_before_payment_enabled: self.is_tokenize_before_payment_enabled,
})
}

Expand Down Expand Up @@ -1352,6 +1377,7 @@ impl super::behaviour::Conversion for Profile {
is_network_tokenization_enabled: item.is_network_tokenization_enabled,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
is_tokenize_before_payment_enabled: item.is_tokenize_before_payment_enabled,
})
}
.await
Expand Down Expand Up @@ -1409,6 +1435,7 @@ impl super::behaviour::Conversion for Profile {
max_auto_retries_enabled: None,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
is_tokenize_before_payment_enabled: self.is_tokenize_before_payment_enabled,
})
}
}
Loading
Loading