Skip to content

Commit 6f395bf

Browse files
Debarati GhatakDebarati Ghatak
authored andcommitted
feat(core): add additional fields to authentication table
1 parent 7b9f486 commit 6f395bf

File tree

26 files changed

+334
-57
lines changed

26 files changed

+334
-57
lines changed

crates/diesel_models/src/authentication.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use common_utils::encryption::Encryption;
22
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
3+
use masking::Secret;
34
use serde::{self, Deserialize, Serialize};
45
use serde_json;
56

@@ -61,6 +62,10 @@ pub struct Authentication {
6162
pub browser_info: Option<serde_json::Value>,
6263
pub email: Option<Encryption>,
6364
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
65+
pub challenge_code: Option<String>,
66+
pub challenge_cancel: Option<String>,
67+
pub challenge_code_reason: Option<String>,
68+
pub message_extension: Option<Secret<serde_json::Value>>,
6469
}
6570

6671
impl Authentication {
@@ -121,6 +126,10 @@ pub struct AuthenticationNew {
121126
pub browser_info: Option<serde_json::Value>,
122127
pub email: Option<Encryption>,
123128
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
129+
pub challenge_code: Option<String>,
130+
pub challenge_cancel: Option<String>,
131+
pub challenge_code_reason: Option<String>,
132+
pub message_extension: Option<Secret<serde_json::Value>>,
124133
}
125134

126135
#[derive(Debug)]
@@ -167,11 +176,17 @@ pub enum AuthenticationUpdate {
167176
authentication_status: common_enums::AuthenticationStatus,
168177
ds_trans_id: Option<String>,
169178
eci: Option<String>,
179+
challenge_code: Option<String>,
180+
challenge_cancel: Option<String>,
181+
challenge_code_reason: Option<String>,
182+
message_extension: Option<Secret<serde_json::Value>>,
170183
},
171184
PostAuthenticationUpdate {
172185
trans_status: common_enums::TransactionStatus,
173186
eci: Option<String>,
174187
authentication_status: common_enums::AuthenticationStatus,
188+
challenge_cancel: Option<String>,
189+
challenge_code_reason: Option<String>,
175190
},
176191
ErrorUpdate {
177192
error_message: Option<String>,
@@ -227,6 +242,10 @@ pub struct AuthenticationUpdateInternal {
227242
pub browser_info: Option<serde_json::Value>,
228243
pub email: Option<Encryption>,
229244
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
245+
pub challenge_code: Option<String>,
246+
pub challenge_cancel: Option<String>,
247+
pub challenge_code_reason: Option<String>,
248+
pub message_extension: Option<Secret<serde_json::Value>>,
230249
}
231250

232251
impl Default for AuthenticationUpdateInternal {
@@ -267,6 +286,10 @@ impl Default for AuthenticationUpdateInternal {
267286
browser_info: Default::default(),
268287
email: Default::default(),
269288
profile_acquirer_id: Default::default(),
289+
challenge_code: Default::default(),
290+
challenge_cancel: Default::default(),
291+
challenge_code_reason: Default::default(),
292+
message_extension: Default::default(),
270293
}
271294
}
272295
}
@@ -309,6 +332,10 @@ impl AuthenticationUpdateInternal {
309332
browser_info,
310333
email,
311334
profile_acquirer_id,
335+
challenge_code,
336+
challenge_cancel,
337+
challenge_code_reason,
338+
message_extension,
312339
} = self;
313340
Authentication {
314341
connector_authentication_id: connector_authentication_id
@@ -350,6 +377,10 @@ impl AuthenticationUpdateInternal {
350377
browser_info: browser_info.or(source.browser_info),
351378
email: email.or(source.email),
352379
profile_acquirer_id: profile_acquirer_id.or(source.profile_acquirer_id),
380+
challenge_code: challenge_code.or(source.challenge_code),
381+
challenge_cancel: challenge_cancel.or(source.challenge_cancel),
382+
challenge_code_reason: challenge_code_reason.or(source.challenge_code_reason),
383+
message_extension: message_extension.or(source.message_extension),
353384
..source
354385
}
355386
}
@@ -438,6 +469,10 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
438469
authentication_status,
439470
ds_trans_id,
440471
eci,
472+
challenge_code,
473+
challenge_cancel,
474+
challenge_code_reason,
475+
message_extension,
441476
} => Self {
442477
trans_status: Some(trans_status),
443478
authentication_type: Some(authentication_type),
@@ -450,16 +485,24 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
450485
authentication_status: Some(authentication_status),
451486
ds_trans_id,
452487
eci,
488+
challenge_code,
489+
challenge_cancel,
490+
challenge_code_reason,
491+
message_extension,
453492
..Default::default()
454493
},
455494
AuthenticationUpdate::PostAuthenticationUpdate {
456495
trans_status,
457496
eci,
458497
authentication_status,
498+
challenge_cancel,
499+
challenge_code_reason,
459500
} => Self {
460501
trans_status: Some(trans_status),
461502
eci,
462503
authentication_status: Some(authentication_status),
504+
challenge_cancel,
505+
challenge_code_reason,
463506
..Default::default()
464507
},
465508
AuthenticationUpdate::PreAuthenticationVersionCallUpdate {

crates/diesel_models/src/schema.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ diesel::table! {
137137
email -> Nullable<Bytea>,
138138
#[max_length = 128]
139139
profile_acquirer_id -> Nullable<Varchar>,
140+
challenge_code -> Nullable<Varchar>,
141+
challenge_cancel -> Nullable<Varchar>,
142+
challenge_code_reason -> Nullable<Varchar>,
143+
message_extension -> Nullable<Jsonb>,
140144
}
141145
}
142146

crates/diesel_models/src/schema_v2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ diesel::table! {
137137
email -> Nullable<Bytea>,
138138
#[max_length = 128]
139139
profile_acquirer_id -> Nullable<Varchar>,
140+
challenge_code -> Nullable<Varchar>,
141+
challenge_cancel -> Nullable<Varchar>,
142+
challenge_code_reason -> Nullable<Varchar>,
143+
message_extension -> Nullable<Jsonb>,
140144
}
141145
}
142146

0 commit comments

Comments
 (0)