Skip to content

Commit

Permalink
feat(core): Add product authentication ids in business profile (#6811)
Browse files Browse the repository at this point in the history
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
sahkal and hyperswitch-bot[bot] authored Dec 12, 2024
1 parent e9a5615 commit 1564ad7
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 1 deletion.
10 changes: 10 additions & 0 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17762,6 +17762,11 @@
"description": "Indicates if click to pay is enabled or not.",
"default": false,
"example": false
},
"authentication_product_ids": {
"type": "object",
"description": "Product authentication ids",
"nullable": true
}
},
"additionalProperties": false
Expand Down Expand Up @@ -17981,6 +17986,11 @@
"description": "Indicates if click to pay is enabled or not.",
"default": false,
"example": false
},
"authentication_product_ids": {
"type": "object",
"description": "Product authentication ids",
"nullable": true
}
}
},
Expand Down
10 changes: 10 additions & 0 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -21748,6 +21748,11 @@
"is_click_to_pay_enabled": {
"type": "boolean",
"description": "Indicates if click to pay is enabled or not."
},
"authentication_product_ids": {
"type": "object",
"description": "Product authentication ids",
"nullable": true
}
},
"additionalProperties": false
Expand Down Expand Up @@ -21984,6 +21989,11 @@
"description": "Indicates if click to pay is enabled or not.",
"default": false,
"example": false
},
"authentication_product_ids": {
"type": "object",
"description": "Product authentication ids",
"nullable": true
}
}
},
Expand Down
24 changes: 24 additions & 0 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,10 @@ pub struct ProfileCreate {
/// Indicates if click to pay is enabled or not.
#[serde(default)]
pub is_click_to_pay_enabled: bool,

/// 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>>,
}

#[nutype::nutype(
Expand Down Expand Up @@ -2082,6 +2086,10 @@ pub struct ProfileCreate {
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: bool,

/// 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>>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -2214,6 +2222,10 @@ pub struct ProfileResponse {
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: bool,

/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<serde_json::Value>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -2333,6 +2345,10 @@ pub struct ProfileResponse {
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: bool,

/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub authentication_product_ids: Option<serde_json::Value>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -2459,6 +2475,10 @@ pub struct ProfileUpdate {
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: Option<bool>,

/// 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>>,
}

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -2566,6 +2586,10 @@ pub struct ProfileUpdate {
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: Option<bool>,

/// 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>>,
}

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

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

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

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -183,6 +186,7 @@ impl ProfileUpdateInternal {
is_auto_retries_enabled,
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
} = self;
Profile {
profile_id: source.profile_id,
Expand Down Expand Up @@ -244,6 +248,8 @@ impl ProfileUpdateInternal {
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),
authentication_product_ids: authentication_product_ids
.or(source.authentication_product_ids),
}
}
}
Expand Down Expand Up @@ -299,6 +305,7 @@ pub struct Profile {
pub is_auto_retries_enabled: Option<bool>,
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
}

impl Profile {
Expand Down Expand Up @@ -358,6 +365,7 @@ pub struct ProfileNew {
pub is_auto_retries_enabled: Option<bool>,
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids: Option<serde_json::Value>,
}

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

#[cfg(feature = "v2")]
Expand Down Expand Up @@ -443,6 +452,7 @@ impl ProfileUpdateInternal {
is_auto_retries_enabled,
max_auto_retries_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
} = self;
Profile {
id: source.id,
Expand Down Expand Up @@ -509,6 +519,8 @@ impl ProfileUpdateInternal {
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),
authentication_product_ids: authentication_product_ids
.or(source.authentication_product_ids),
}
}
}
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 @@ -215,6 +215,7 @@ diesel::table! {
is_auto_retries_enabled -> Nullable<Bool>,
max_auto_retries_enabled -> Nullable<Int2>,
is_click_to_pay_enabled -> Bool,
authentication_product_ids -> Nullable<Jsonb>,
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/schema_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ diesel::table! {
is_auto_retries_enabled -> Nullable<Bool>,
max_auto_retries_enabled -> Nullable<Int2>,
is_click_to_pay_enabled -> Bool,
authentication_product_ids -> Nullable<Jsonb>,
}
}

Expand Down
Loading

0 comments on commit 1564ad7

Please sign in to comment.