refactor: remove code related to temp locker (#2640)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Abhishek Marrivagu
2023-10-19 15:06:53 +05:30
committed by GitHub
parent 14c0821b80
commit cc0b422632
9 changed files with 13 additions and 42 deletions

View File

@ -754,13 +754,6 @@ pub struct DeleteTokenizeByTokenRequest {
pub service_name: String, pub service_name: String,
} }
#[derive(Debug, serde::Serialize)] // Blocked: Yet to be implemented by `basilisk`
pub struct DeleteTokenizeByDateRequest {
pub buffer_minutes: i32,
pub service_name: String,
pub max_rows: i32,
}
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize)]
pub struct GetTokenizePayloadResponse { pub struct GetTokenizePayloadResponse {
pub lookup_key: String, pub lookup_key: String,

View File

@ -13,9 +13,8 @@ default = ["kv_store", "stripe", "oltp", "olap", "accounts_cache", "dummy_connec
s3 = ["dep:aws-sdk-s3", "dep:aws-config"] s3 = ["dep:aws-sdk-s3", "dep:aws-config"]
kms = ["external_services/kms", "dep:aws-config"] kms = ["external_services/kms", "dep:aws-config"]
email = ["external_services/email", "dep:aws-config"] email = ["external_services/email", "dep:aws-config"]
basilisk = ["kms"]
stripe = ["dep:serde_qs"] stripe = ["dep:serde_qs"]
release = ["kms", "stripe", "basilisk", "s3", "email","accounts_cache"] release = ["kms", "stripe", "s3", "email","accounts_cache"]
olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap"] olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap"]
oltp = ["data_models/oltp", "storage_impl/oltp"] oltp = ["data_models/oltp", "storage_impl/oltp"]
kv_store = ["scheduler/kv_store"] kv_store = ["scheduler/kv_store"]

View File

@ -49,7 +49,7 @@ impl Default for super::settings::Locker {
Self { Self {
host: "localhost".into(), host: "localhost".into(),
mock_locker: true, mock_locker: true,
basilisk_host: "localhost".into(),
locker_signing_key_id: "1".into(), locker_signing_key_id: "1".into(),
redis_temp_locker_encryption_key: "".into(), redis_temp_locker_encryption_key: "".into(),
} }

View File

@ -411,7 +411,6 @@ pub struct Secrets {
pub struct Locker { pub struct Locker {
pub host: String, pub host: String,
pub mock_locker: bool, pub mock_locker: bool,
pub basilisk_host: String,
pub locker_signing_key_id: String, pub locker_signing_key_id: String,
pub redis_temp_locker_encryption_key: String, pub redis_temp_locker_encryption_key: String,
} }

View File

@ -56,10 +56,10 @@ impl super::settings::Locker {
})?; })?;
when( when(
!self.mock_locker && self.basilisk_host.is_default_or_empty(), self.redis_temp_locker_encryption_key.is_default_or_empty(),
|| { || {
Err(ApplicationError::InvalidConfigurationValueError( Err(ApplicationError::InvalidConfigurationValueError(
"basilisk host must not be empty when mock locker is disabled".into(), "redis_temp_locker_encryption_key must not be empty".into(),
)) ))
}, },
)?; )?;

View File

@ -2010,7 +2010,8 @@ pub async fn get_lookup_key_from_locker(
.change_context(errors::ApiErrorResponse::InternalServerError) .change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Get Card Details Failed")?; .attach_printable("Get Card Details Failed")?;
let card = card_detail.clone(); let card = card_detail.clone();
let resp = BasiliskCardSupport::create_payment_method_data_in_temp_locker(
let resp = TempLockerCardSupport::create_payment_method_data_in_temp_locker(
state, state,
payment_token, payment_token,
card, card,
@ -2062,9 +2063,9 @@ pub async fn get_lookup_key_for_payout_method(
} }
} }
pub struct BasiliskCardSupport; pub struct TempLockerCardSupport;
impl BasiliskCardSupport { impl TempLockerCardSupport {
#[instrument(skip_all)] #[instrument(skip_all)]
async fn create_payment_method_data_in_temp_locker( async fn create_payment_method_data_in_temp_locker(
state: &routes::AppState, state: &routes::AppState,

View File

@ -580,21 +580,6 @@ pub fn get_card_detail(
} }
//------------------------------------------------TokenizeService------------------------------------------------ //------------------------------------------------TokenizeService------------------------------------------------
pub fn mk_crud_locker_request(
locker: &settings::Locker,
path: &str,
req: api::TokenizePayloadEncrypted,
) -> CustomResult<services::Request, errors::VaultError> {
let body = utils::Encode::<api::TokenizePayloadEncrypted>::encode_to_value(&req)
.change_context(errors::VaultError::RequestEncodingFailed)?;
let mut url = locker.basilisk_host.to_owned();
url.push_str(path);
let mut request = services::Request::new(services::Method::Post, &url);
request.add_default_headers();
request.add_header(headers::CONTENT_TYPE, "application/json".into());
request.set_body(body.to_string());
Ok(request)
}
pub fn mk_card_value1( pub fn mk_card_value1(
card_number: cards::CardNumber, card_number: cards::CardNumber,

View File

@ -110,7 +110,6 @@ pub(super) fn create_client(
pub fn proxy_bypass_urls(locker: &Locker) -> Vec<String> { pub fn proxy_bypass_urls(locker: &Locker) -> Vec<String> {
let locker_host = locker.host.to_owned(); let locker_host = locker.host.to_owned();
let basilisk_host = locker.basilisk_host.to_owned();
vec![ vec![
format!("{locker_host}/cards/add"), format!("{locker_host}/cards/add"),
format!("{locker_host}/cards/retrieve"), format!("{locker_host}/cards/retrieve"),
@ -118,10 +117,6 @@ pub fn proxy_bypass_urls(locker: &Locker) -> Vec<String> {
format!("{locker_host}/card/addCard"), format!("{locker_host}/card/addCard"),
format!("{locker_host}/card/getCard"), format!("{locker_host}/card/getCard"),
format!("{locker_host}/card/deleteCard"), format!("{locker_host}/card/deleteCard"),
format!("{basilisk_host}/tokenize"),
format!("{basilisk_host}/tokenize/get"),
format!("{basilisk_host}/tokenize/delete"),
format!("{basilisk_host}/tokenize/delete/token"),
] ]
} }

View File

@ -1,12 +1,11 @@
use api_models::enums as api_enums; use api_models::enums as api_enums;
pub use api_models::payment_methods::{ pub use api_models::payment_methods::{
CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CustomerPaymentMethod, CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CustomerPaymentMethod,
CustomerPaymentMethodsListResponse, DeleteTokenizeByDateRequest, DeleteTokenizeByTokenRequest, CustomerPaymentMethodsListResponse, GetTokenizePayloadRequest, GetTokenizePayloadResponse,
GetTokenizePayloadRequest, GetTokenizePayloadResponse, PaymentMethodCreate, PaymentMethodCreate, PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodList,
PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodList, PaymentMethodListRequest, PaymentMethodListRequest, PaymentMethodListResponse, PaymentMethodResponse,
PaymentMethodListResponse, PaymentMethodResponse, PaymentMethodUpdate, PaymentMethodsData, PaymentMethodUpdate, PaymentMethodsData, TokenizePayloadEncrypted, TokenizePayloadRequest,
TokenizePayloadEncrypted, TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1, TokenizedWalletValue2,
TokenizedWalletValue1, TokenizedWalletValue2,
}; };
use error_stack::report; use error_stack::report;