feat(core): use redis as temp locker instead of basilisk (#2789)

This commit is contained in:
Abhishek Marrivagu
2023-11-08 13:12:28 +05:30
committed by GitHub
parent 9cc8b93070
commit 6678689265
23 changed files with 553 additions and 530 deletions

View File

@ -399,6 +399,7 @@ pub async fn get_token_pm_type_mandate_details(
request: &api::PaymentsRequest,
mandate_type: Option<api::MandateTransactionType>,
merchant_account: &domain::MerchantAccount,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<(
Option<String>,
Option<storage_enums::PaymentMethod>,
@ -427,7 +428,13 @@ pub async fn get_token_pm_type_mandate_details(
recurring_mandate_payment_data,
payment_method_type_,
mandate_connector,
) = get_token_for_recurring_mandate(state, request, merchant_account).await?;
) = get_token_for_recurring_mandate(
state,
request,
merchant_account,
merchant_key_store,
)
.await?;
Ok((
token_,
payment_method_,
@ -452,6 +459,7 @@ pub async fn get_token_for_recurring_mandate(
state: &AppState,
req: &api::PaymentsRequest,
merchant_account: &domain::MerchantAccount,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<(
Option<String>,
Option<storage_enums::PaymentMethod>,
@ -501,7 +509,9 @@ pub async fn get_token_for_recurring_mandate(
};
if let diesel_models::enums::PaymentMethod::Card = payment_method.payment_method {
let _ = cards::get_lookup_key_from_locker(state, &token, &payment_method).await?;
let _ =
cards::get_lookup_key_from_locker(state, &token, &payment_method, merchant_key_store)
.await?;
if let Some(payment_method_from_request) = req.payment_method {
let pm: storage_enums::PaymentMethod = payment_method_from_request;
if pm != payment_method.payment_method {
@ -1320,6 +1330,7 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>(
operation: BoxedOperation<'a, F, R, Ctx>,
state: &'a AppState,
payment_data: &mut PaymentData<F>,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<(
BoxedOperation<'a, F, R, Ctx>,
Option<api::PaymentMethodData>,
@ -1373,6 +1384,7 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>(
let (pm, supplementary_data) = vault::Vault::get_payment_method_data_from_locker(
state,
&hyperswitch_token,
merchant_key_store,
)
.await
.attach_printable(
@ -1402,6 +1414,7 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>(
&updated_pm,
payment_data.payment_intent.customer_id.to_owned(),
enums::PaymentMethod::Card,
merchant_key_store,
)
.await?;
Some(updated_pm)
@ -1442,6 +1455,7 @@ pub async fn make_pm_data<'a, F: Clone, R, Ctx: PaymentMethodRetrieve>(
state,
&payment_data.payment_intent,
&payment_data.payment_attempt,
merchant_key_store,
)
.await?;
@ -1461,6 +1475,7 @@ pub async fn store_in_vault_and_generate_ppmt(
payment_intent: &PaymentIntent,
payment_attempt: &PaymentAttempt,
payment_method: enums::PaymentMethod,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<String> {
let router_token = vault::Vault::store_payment_method_data_in_locker(
state,
@ -1468,6 +1483,7 @@ pub async fn store_in_vault_and_generate_ppmt(
payment_method_data,
payment_intent.customer_id.to_owned(),
payment_method,
merchant_key_store,
)
.await?;
let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token");
@ -1491,6 +1507,7 @@ pub async fn store_payment_method_data_in_vault(
payment_intent: &PaymentIntent,
payment_method: enums::PaymentMethod,
payment_method_data: &api::PaymentMethodData,
merchant_key_store: &domain::MerchantKeyStore,
) -> RouterResult<Option<String>> {
if should_store_payment_method_data_in_vault(
&state.conf.temp_locker_enable_config,
@ -1503,6 +1520,7 @@ pub async fn store_payment_method_data_in_vault(
payment_intent,
payment_attempt,
payment_method,
merchant_key_store,
)
.await?;