mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
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:
committed by
GitHub
parent
14c0821b80
commit
cc0b422632
@ -49,7 +49,7 @@ impl Default for super::settings::Locker {
|
||||
Self {
|
||||
host: "localhost".into(),
|
||||
mock_locker: true,
|
||||
basilisk_host: "localhost".into(),
|
||||
|
||||
locker_signing_key_id: "1".into(),
|
||||
redis_temp_locker_encryption_key: "".into(),
|
||||
}
|
||||
|
||||
@ -411,7 +411,6 @@ pub struct Secrets {
|
||||
pub struct Locker {
|
||||
pub host: String,
|
||||
pub mock_locker: bool,
|
||||
pub basilisk_host: String,
|
||||
pub locker_signing_key_id: String,
|
||||
pub redis_temp_locker_encryption_key: String,
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ impl super::settings::Locker {
|
||||
})?;
|
||||
|
||||
when(
|
||||
!self.mock_locker && self.basilisk_host.is_default_or_empty(),
|
||||
self.redis_temp_locker_encryption_key.is_default_or_empty(),
|
||||
|| {
|
||||
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(),
|
||||
))
|
||||
},
|
||||
)?;
|
||||
|
||||
@ -2010,7 +2010,8 @@ pub async fn get_lookup_key_from_locker(
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Get Card Details Failed")?;
|
||||
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,
|
||||
payment_token,
|
||||
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)]
|
||||
async fn create_payment_method_data_in_temp_locker(
|
||||
state: &routes::AppState,
|
||||
|
||||
@ -580,21 +580,6 @@ pub fn get_card_detail(
|
||||
}
|
||||
|
||||
//------------------------------------------------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(
|
||||
card_number: cards::CardNumber,
|
||||
|
||||
@ -110,7 +110,6 @@ pub(super) fn create_client(
|
||||
|
||||
pub fn proxy_bypass_urls(locker: &Locker) -> Vec<String> {
|
||||
let locker_host = locker.host.to_owned();
|
||||
let basilisk_host = locker.basilisk_host.to_owned();
|
||||
vec![
|
||||
format!("{locker_host}/cards/add"),
|
||||
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/getCard"),
|
||||
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"),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
use api_models::enums as api_enums;
|
||||
pub use api_models::payment_methods::{
|
||||
CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CustomerPaymentMethod,
|
||||
CustomerPaymentMethodsListResponse, DeleteTokenizeByDateRequest, DeleteTokenizeByTokenRequest,
|
||||
GetTokenizePayloadRequest, GetTokenizePayloadResponse, PaymentMethodCreate,
|
||||
PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodList, PaymentMethodListRequest,
|
||||
PaymentMethodListResponse, PaymentMethodResponse, PaymentMethodUpdate, PaymentMethodsData,
|
||||
TokenizePayloadEncrypted, TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2,
|
||||
TokenizedWalletValue1, TokenizedWalletValue2,
|
||||
CustomerPaymentMethodsListResponse, GetTokenizePayloadRequest, GetTokenizePayloadResponse,
|
||||
PaymentMethodCreate, PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodList,
|
||||
PaymentMethodListRequest, PaymentMethodListResponse, PaymentMethodResponse,
|
||||
PaymentMethodUpdate, PaymentMethodsData, TokenizePayloadEncrypted, TokenizePayloadRequest,
|
||||
TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1, TokenizedWalletValue2,
|
||||
};
|
||||
use error_stack::report;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user