Skip to content

Commit b8b20c4

Browse files
feat(router): add api to migrate card from basilisk to rust (#2853)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 62c9cca commit b8b20c4

File tree

24 files changed

+274
-20
lines changed

24 files changed

+274
-20
lines changed

config/config.example.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ kms_encrypted_recon_admin_api_key = "" # Base64-encoded (KMS encrypted) ciph
112112
# like card details
113113
[locker]
114114
host = "" # Locker host
115+
host_rs = "" # Rust Locker host
115116
mock_locker = true # Emulate a locker locally using Postgres
116117
basilisk_host = "" # Basilisk host
117118
locker_signing_key_id = "1" # Key_id to sign basilisk hs locker
@@ -130,6 +131,7 @@ locker_encryption_key2 = "" # public key 2 in pem format, corresponding private
130131
locker_decryption_key1 = "" # private key 1 in pem format, corresponding public key in basilisk
131132
locker_decryption_key2 = "" # private key 2 in pem format, corresponding public key in basilisk
132133
vault_encryption_key = "" # public key in pem format, corresponding private key in basilisk-hs
134+
rust_locker_encryption_key = "" # public key in pem format, corresponding private key in rust locker
133135
vault_private_key = "" # private key in pem format, corresponding public key in basilisk-hs
134136

135137

config/development.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ applepay_endpoint = "DOMAIN SPECIFIC ENDPOINT"
4848

4949
[locker]
5050
host = ""
51+
host_rs = ""
5152
mock_locker = true
5253
basilisk_host = ""
5354

@@ -59,6 +60,7 @@ locker_encryption_key2 = ""
5960
locker_decryption_key1 = ""
6061
locker_decryption_key2 = ""
6162
vault_encryption_key = ""
63+
rust_locker_encryption_key = ""
6264
vault_private_key = ""
6365
tunnel_private_key = ""
6466

config/docker_compose.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ recon_admin_api_key = "recon_test_admin"
4444

4545
[locker]
4646
host = ""
47+
host_rs = ""
4748
mock_locker = true
4849
basilisk_host = ""
4950

@@ -55,6 +56,7 @@ locker_encryption_key2 = ""
5556
locker_decryption_key1 = ""
5657
locker_decryption_key2 = ""
5758
vault_encryption_key = ""
59+
rust_locker_encryption_key = ""
5860
vault_private_key = ""
5961

6062
[redis]

crates/api_models/src/enums.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,9 @@ pub enum RetryAction {
562562
/// Denotes that the payment is requeued
563563
Requeue,
564564
}
565+
566+
#[derive(Clone, Copy)]
567+
pub enum LockerChoice {
568+
Basilisk,
569+
Tartarus,
570+
}

crates/api_models/src/events.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub mod customer;
22
pub mod gsm;
3+
mod locker_migration;
34
pub mod payment;
45
#[cfg(feature = "payouts")]
56
pub mod payouts;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use common_utils::events::ApiEventMetric;
2+
3+
use crate::locker_migration::MigrateCardResponse;
4+
5+
impl ApiEventMetric for MigrateCardResponse {
6+
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
7+
Some(common_utils::events::ApiEventsType::RustLocker)
8+
}
9+
}

crates/api_models/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub mod errors;
1313
pub mod events;
1414
pub mod files;
1515
pub mod gsm;
16+
pub mod locker_migration;
1617
pub mod mandates;
1718
pub mod organization;
1819
pub mod payment_methods;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[derive(Debug, Clone, serde::Serialize)]
2+
#[serde(rename_all = "camelCase")]
3+
pub struct MigrateCardResponse {
4+
pub status_message: String,
5+
pub status_code: String,
6+
pub customers_moved: usize,
7+
pub cards_moved: usize,
8+
}

crates/common_utils/src/events.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub enum ApiEventsType {
4444
Gsm,
4545
// TODO: This has to be removed once the corresponding apiEventTypes are created
4646
Miscellaneous,
47+
RustLocker,
4748
}
4849

4950
impl ApiEventMetric for serde_json::Value {}

crates/router/src/configs/defaults.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ impl Default for super::settings::Locker {
4848
fn default() -> Self {
4949
Self {
5050
host: "localhost".into(),
51+
host_rs: "localhost".into(),
5152
mock_locker: true,
5253
basilisk_host: "localhost".into(),
5354
locker_signing_key_id: "1".into(),

0 commit comments

Comments
 (0)