Skip to content

Commit a3baaf4

Browse files
Comment changes and OpenApi spec changes
1 parent 810ae36 commit a3baaf4

File tree

8 files changed

+126
-34
lines changed

8 files changed

+126
-34
lines changed

api-reference-v2/openapi_spec.json

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7929,6 +7929,7 @@
79297929
"aci",
79307930
"adyen",
79317931
"airwallex",
7932+
"archipel",
79327933
"authorizedotnet",
79337934
"bambora",
79347935
"bamboraapac",
@@ -10949,6 +10950,50 @@
1094910950
}
1095010951
}
1095110952
},
10953+
"GenericTokenizationRequest": {
10954+
"type": "object",
10955+
"required": [
10956+
"customer_id",
10957+
"token_request"
10958+
],
10959+
"properties": {
10960+
"customer_id": {
10961+
"type": "string",
10962+
"description": "Customer ID for which the tokenization is requested",
10963+
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8"
10964+
},
10965+
"token_request": {
10966+
"type": "object",
10967+
"description": "Request for tokenization which contains the data to be tokenized"
10968+
}
10969+
}
10970+
},
10971+
"GenericTokenizationResponse": {
10972+
"type": "object",
10973+
"required": [
10974+
"id",
10975+
"created_at",
10976+
"flag"
10977+
],
10978+
"properties": {
10979+
"id": {
10980+
"type": "string",
10981+
"description": "Unique identifier returned by the tokenization service",
10982+
"example": "12345_tok_01926c58bc6e77c09e809964e72af8c8"
10983+
},
10984+
"created_at": {
10985+
"type": "string",
10986+
"format": "date-time",
10987+
"description": "Created time of the tokenization id",
10988+
"example": "2024-02-24T11:04:09.922Z"
10989+
},
10990+
"flag": {
10991+
"type": "string",
10992+
"description": "Status of the tokenization id created",
10993+
"example": "enabled"
10994+
}
10995+
}
10996+
},
1095210997
"GiftCardAdditionalData": {
1095310998
"oneOf": [
1095410999
{
@@ -13804,7 +13849,8 @@
1380413849
"trigger_api",
1380513850
"display_bank_transfer_information",
1380613851
"display_wait_screen",
13807-
"collect_otp"
13852+
"collect_otp",
13853+
"redirect_inside_popup"
1380813854
]
1380913855
},
1381013856
"NoThirdPartySdkSessionResponse": {
@@ -18118,6 +18164,11 @@
1811818164
"type": "boolean",
1811918165
"description": "Indicates if 3ds challenge is forced",
1812018166
"nullable": true
18167+
},
18168+
"is_iframe_redirection_enabled": {
18169+
"type": "boolean",
18170+
"description": "Indicates if the redirection has to open in the iframe",
18171+
"nullable": true
1812118172
}
1812218173
},
1812318174
"additionalProperties": false
@@ -18289,6 +18340,11 @@
1828918340
],
1829018341
"default": "no_three_ds",
1829118342
"nullable": true
18343+
},
18344+
"is_iframe_redirection_enabled": {
18345+
"type": "boolean",
18346+
"description": "Indicates if the redirection has to open in the iframe",
18347+
"nullable": true
1829218348
}
1829318349
}
1829418350
},
@@ -20091,6 +20147,11 @@
2009120147
],
2009220148
"nullable": true
2009320149
},
20150+
"is_iframe_redirection_enabled": {
20151+
"type": "boolean",
20152+
"description": "Indicates if the redirection has to open in the iframe",
20153+
"nullable": true
20154+
},
2009420155
"is_external_vault_enabled": {
2009520156
"type": "boolean",
2009620157
"description": "Indicates if external vault is enabled or not.",
@@ -20354,6 +20415,11 @@
2035420415
],
2035520416
"nullable": true
2035620417
},
20418+
"is_iframe_redirection_enabled": {
20419+
"type": "boolean",
20420+
"description": "Indicates if the redirection has to open in the iframe",
20421+
"nullable": true
20422+
},
2035720423
"is_external_vault_enabled": {
2035820424
"type": "boolean",
2035920425
"description": "Indicates if external vault is enabled or not.",
@@ -21435,6 +21501,7 @@
2143521501
"aci",
2143621502
"adyen",
2143721503
"airwallex",
21504+
"archipel",
2143821505
"authorizedotnet",
2143921506
"bankofamerica",
2144021507
"billwerk",

crates/api_models/src/payment_methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,7 @@ pub struct PaymentMethodsSessionUpdateRequest {
28842884

28852885
/// Contains data to be passed on to tokenization service ( if present ) to create token_id for given JSON data
28862886
#[schema(value_type = Option<serde_json::Value>)]
2887-
pub tokenization_data: Option<masking::Secret<serde_json::Value>>,
2887+
pub tokenization_data: Option<pii::SecretSerdeValue>,
28882888
}
28892889

28902890
#[cfg(feature = "v2")]
@@ -2951,7 +2951,7 @@ pub struct PaymentMethodSessionResponse {
29512951

29522952
/// Contains data to be passed on to tokenization service ( if present ) to create token_id for given JSON data
29532953
#[schema(value_type = Option<serde_json::Value>)]
2954-
pub tokenization_data: Option<masking::Secret<serde_json::Value>>,
2954+
pub tokenization_data: Option<pii::SecretSerdeValue>,
29552955

29562956
/// The iso timestamp when the session will expire
29572957
/// Trying to retrieve the session or any operations on the session after this time will result in an error

crates/api_models/src/tokenization.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,23 @@ use utoipa::{schema, ToSchema};
88
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
99
#[derive(Debug, Serialize, Deserialize, ToSchema)]
1010
pub struct GenericTokenizationResponse {
11+
/// Unique identifier returned by the tokenization service
1112
#[schema(value_type = String, example = "12345_tok_01926c58bc6e77c09e809964e72af8c8")]
1213
pub id: GlobalTokenId,
14+
/// Created time of the tokenization id
1315
#[schema(value_type = PrimitiveDateTime,example = "2024-02-24T11:04:09.922Z")]
1416
pub created_at: PrimitiveDateTime,
17+
/// Status of the tokenization id created
1518
#[schema(value_type = String,example = "enabled")]
1619
pub flag: common_enums::TokenizationFlag,
1720
}
1821
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
1922
#[derive(Debug, Serialize, Deserialize, ToSchema)]
2023
pub struct GenericTokenizationRequest {
21-
// Customer ID for which the tokenization is requested
24+
/// Customer ID for which the tokenization is requested
2225
#[schema(value_type = String, example = "12345_cus_01926c58bc6e77c09e809964e72af8c8")]
2326
pub customer_id: GlobalCustomerId,
24-
// Request for tokenization which contains the data to be tokenized
27+
/// Request for tokenization which contains the data to be tokenized
2528
#[schema(value_type = Object,example = json!({ "city": "NY", "unit": "245" }))]
2629
pub token_request: masking::Secret<serde_json::Value>,
2730
}
28-
29-
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
30-
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone)]
31-
pub struct TokenizationQueryParameters {
32-
// Parameter to view tokenization data or not
33-
pub reveal: Option<bool>,
34-
}

crates/diesel_models/src/payment_methods_session.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use common_utils::pii;
2+
13
#[cfg(feature = "v2")]
24
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
35
pub struct PaymentMethodSession {
@@ -6,7 +8,7 @@ pub struct PaymentMethodSession {
68
pub billing: Option<common_utils::encryption::Encryption>,
79
pub psp_tokenization: Option<common_types::payment_methods::PspTokenization>,
810
pub network_tokenization: Option<common_types::payment_methods::NetworkTokenization>,
9-
pub tokenization_data: Option<masking::Secret<serde_json::Value>>,
11+
pub tokenization_data: Option<pii::SecretSerdeValue>,
1012
pub return_url: Option<common_utils::types::Url>,
1113
#[serde(with = "common_utils::custom_serde::iso8601")]
1214
pub expires_at: time::PrimitiveDateTime,

crates/diesel_models/src/query.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ pub mod relay;
3939
pub mod reverse_lookup;
4040
pub mod role;
4141
pub mod routing_algorithm;
42+
#[cfg(feature = "tokenization_v2")]
43+
pub mod tokenization;
4244
pub mod unified_translations;
4345
pub mod user;
4446
pub mod user_authentication_method;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#[cfg(feature = "v2")]
2+
use common_enums;
3+
#[cfg(feature = "v2")]
4+
use common_utils::{
5+
id_type::{GlobalTokenId, MerchantId},
6+
tokenization as tokenization_utils,
7+
};
8+
#[cfg(feature = "v2")]
9+
use diesel::{
10+
associations::HasTable,
11+
deserialize::FromSqlRow,
12+
expression::AsExpression,
13+
pg::Pg,
14+
serialize::{Output, ToSql},
15+
sql_types::{Jsonb, Text},
16+
AsChangeset, Identifiable, Insertable, Queryable, Selectable,
17+
};
18+
#[cfg(feature = "v2")]
19+
use serde::{Deserialize, Serialize};
20+
#[cfg(feature = "v2")]
21+
use time::PrimitiveDateTime;
22+
23+
#[cfg(feature = "v2")]
24+
use crate::{query::generics, schema_v2::tokenization, PgPooledConn, StorageResult, tokenization as tokenization_diesel};
25+
26+
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
27+
impl tokenization_diesel::Tokenization {
28+
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Self> {
29+
generics::generic_insert(conn, self).await
30+
}
31+
32+
pub async fn find_by_id(
33+
conn: &PgPooledConn,
34+
id: &common_utils::id_type::GlobalTokenId,
35+
) -> StorageResult<Self> {
36+
use diesel::ExpressionMethods;
37+
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
38+
conn,
39+
tokenization::dsl::id.eq(id.to_owned()),
40+
)
41+
.await
42+
}
43+
}

crates/diesel_models/src/tokenization.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ pub struct Tokenization {
3737
pub version: common_enums::enums::ApiVersion,
3838
}
3939

40-
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
41-
impl Tokenization {
42-
pub async fn find_by_id(
43-
conn: &PgPooledConn,
44-
id: &common_utils::id_type::GlobalTokenId,
45-
) -> StorageResult<Self> {
46-
use diesel::ExpressionMethods;
47-
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
48-
conn,
49-
tokenization::dsl::id.eq(id.to_owned()),
50-
)
51-
.await
52-
}
53-
}
54-
5540
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
5641
#[derive(Clone, Debug, Insertable)]
5742
#[diesel(table_name = tokenization)]
@@ -66,12 +51,7 @@ pub struct TokenizationNew {
6651
pub flag: common_enums::enums::TokenizationFlag,
6752
}
6853

69-
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
70-
impl Tokenization {
71-
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Self> {
72-
generics::generic_insert(conn, self).await
73-
}
74-
}
54+
7555

7656
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
7757
#[derive(Clone, Debug, AsChangeset)]

crates/openapi/src/openapi_v2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ Never share your secret api keys. Keep them guarded and secure.
729729
api_models::process_tracker::revenue_recovery::RevenueRecoveryResponse,
730730
api_models::enums::ProcessTrackerStatus,
731731
routes::payments::ForceSync,
732+
api_models::tokenization::GenericTokenizationRequest,
733+
api_models::tokenization::GenericTokenizationResponse,
732734
)),
733735
modifiers(&SecurityAddon)
734736
)]

0 commit comments

Comments
 (0)