Skip to content

Commit 89774f3

Browse files
dgeee13Debarati Ghatak
andauthored
feat(core): Added additional authentication fields for 3ds external authentication (#8758)
Co-authored-by: Debarati Ghatak <[email protected]>
1 parent f3c0a9b commit 89774f3

File tree

26 files changed

+382
-61
lines changed

26 files changed

+382
-61
lines changed

crates/diesel_models/src/authentication.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use common_utils::encryption::Encryption;
1+
use common_utils::{encryption::Encryption, pii};
22
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
33
use serde::{self, Deserialize, Serialize};
44
use serde_json;
@@ -61,6 +61,10 @@ pub struct Authentication {
6161
pub browser_info: Option<serde_json::Value>,
6262
pub email: Option<Encryption>,
6363
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
64+
pub challenge_code: Option<String>,
65+
pub challenge_cancel: Option<String>,
66+
pub challenge_code_reason: Option<String>,
67+
pub message_extension: Option<pii::SecretSerdeValue>,
6468
}
6569

6670
impl Authentication {
@@ -121,6 +125,10 @@ pub struct AuthenticationNew {
121125
pub browser_info: Option<serde_json::Value>,
122126
pub email: Option<Encryption>,
123127
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
128+
pub challenge_code: Option<String>,
129+
pub challenge_cancel: Option<String>,
130+
pub challenge_code_reason: Option<String>,
131+
pub message_extension: Option<pii::SecretSerdeValue>,
124132
}
125133

126134
#[derive(Debug)]
@@ -167,11 +175,17 @@ pub enum AuthenticationUpdate {
167175
authentication_status: common_enums::AuthenticationStatus,
168176
ds_trans_id: Option<String>,
169177
eci: Option<String>,
178+
challenge_code: Option<String>,
179+
challenge_cancel: Option<String>,
180+
challenge_code_reason: Option<String>,
181+
message_extension: Option<pii::SecretSerdeValue>,
170182
},
171183
PostAuthenticationUpdate {
172184
trans_status: common_enums::TransactionStatus,
173185
eci: Option<String>,
174186
authentication_status: common_enums::AuthenticationStatus,
187+
challenge_cancel: Option<String>,
188+
challenge_code_reason: Option<String>,
175189
},
176190
ErrorUpdate {
177191
error_message: Option<String>,
@@ -227,6 +241,10 @@ pub struct AuthenticationUpdateInternal {
227241
pub browser_info: Option<serde_json::Value>,
228242
pub email: Option<Encryption>,
229243
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
244+
pub challenge_code: Option<String>,
245+
pub challenge_cancel: Option<String>,
246+
pub challenge_code_reason: Option<String>,
247+
pub message_extension: Option<pii::SecretSerdeValue>,
230248
}
231249

232250
impl Default for AuthenticationUpdateInternal {
@@ -267,6 +285,10 @@ impl Default for AuthenticationUpdateInternal {
267285
browser_info: Default::default(),
268286
email: Default::default(),
269287
profile_acquirer_id: Default::default(),
288+
challenge_code: Default::default(),
289+
challenge_cancel: Default::default(),
290+
challenge_code_reason: Default::default(),
291+
message_extension: Default::default(),
270292
}
271293
}
272294
}
@@ -309,6 +331,10 @@ impl AuthenticationUpdateInternal {
309331
browser_info,
310332
email,
311333
profile_acquirer_id,
334+
challenge_code,
335+
challenge_cancel,
336+
challenge_code_reason,
337+
message_extension,
312338
} = self;
313339
Authentication {
314340
connector_authentication_id: connector_authentication_id
@@ -350,6 +376,10 @@ impl AuthenticationUpdateInternal {
350376
browser_info: browser_info.or(source.browser_info),
351377
email: email.or(source.email),
352378
profile_acquirer_id: profile_acquirer_id.or(source.profile_acquirer_id),
379+
challenge_code: challenge_code.or(source.challenge_code),
380+
challenge_cancel: challenge_cancel.or(source.challenge_cancel),
381+
challenge_code_reason: challenge_code_reason.or(source.challenge_code_reason),
382+
message_extension: message_extension.or(source.message_extension),
353383
..source
354384
}
355385
}
@@ -438,6 +468,10 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
438468
authentication_status,
439469
ds_trans_id,
440470
eci,
471+
challenge_code,
472+
challenge_cancel,
473+
challenge_code_reason,
474+
message_extension,
441475
} => Self {
442476
trans_status: Some(trans_status),
443477
authentication_type: Some(authentication_type),
@@ -450,16 +484,24 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
450484
authentication_status: Some(authentication_status),
451485
ds_trans_id,
452486
eci,
487+
challenge_code,
488+
challenge_cancel,
489+
challenge_code_reason,
490+
message_extension,
453491
..Default::default()
454492
},
455493
AuthenticationUpdate::PostAuthenticationUpdate {
456494
trans_status,
457495
eci,
458496
authentication_status,
497+
challenge_cancel,
498+
challenge_code_reason,
459499
} => Self {
460500
trans_status: Some(trans_status),
461501
eci,
462502
authentication_status: Some(authentication_status),
503+
challenge_cancel,
504+
challenge_code_reason,
463505
..Default::default()
464506
},
465507
AuthenticationUpdate::PreAuthenticationVersionCallUpdate {

crates/diesel_models/src/schema.rs

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

crates/diesel_models/src/schema_v2.rs

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

0 commit comments

Comments
 (0)