mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
refactor: incorporate hyperswitch_interface into router (#3669)
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
This commit is contained in:
@ -5,8 +5,6 @@ use api_models::{
|
||||
payment_methods::{self, BankAccountAccessCreds},
|
||||
payments::{AddressDetails, BankDebitBilling, BankDebitData, PaymentMethodData},
|
||||
};
|
||||
#[cfg(feature = "hashicorp-vault")]
|
||||
use external_services::hashicorp_vault::{self, decrypt::VaultFetch};
|
||||
use hex;
|
||||
pub mod helpers;
|
||||
pub mod transformers;
|
||||
@ -19,8 +17,6 @@ use common_utils::{
|
||||
};
|
||||
use data_models::payments::PaymentIntent;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
#[cfg(feature = "aws_kms")]
|
||||
pub use external_services::aws_kms;
|
||||
use helpers::PaymentAuthConnectorDataExt;
|
||||
use masking::{ExposeInterface, PeekInterface};
|
||||
use pm_auth::{
|
||||
@ -347,34 +343,13 @@ async fn store_bank_details_in_payment_methods(
|
||||
}
|
||||
}
|
||||
|
||||
let pm_auth_key = async {
|
||||
#[cfg(feature = "hashicorp-vault")]
|
||||
let client =
|
||||
external_services::hashicorp_vault::core::get_hashicorp_client(&state.conf.hc_vault)
|
||||
.await
|
||||
.change_context(ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Failed while creating client")?;
|
||||
|
||||
#[cfg(feature = "hashicorp-vault")]
|
||||
let output = masking::Secret::new(state.conf.payment_method_auth.pm_auth_key.clone())
|
||||
.fetch_inner::<hashicorp_vault::core::Kv2>(client)
|
||||
.await
|
||||
.change_context(ApiErrorResponse::InternalServerError)?
|
||||
.expose();
|
||||
|
||||
#[cfg(not(feature = "hashicorp-vault"))]
|
||||
let output = state.conf.payment_method_auth.pm_auth_key.clone();
|
||||
|
||||
Ok::<_, error_stack::Report<ApiErrorResponse>>(output)
|
||||
}
|
||||
.await?;
|
||||
|
||||
#[cfg(feature = "aws_kms")]
|
||||
let pm_auth_key = aws_kms::core::get_aws_kms_client(&state.conf.kms)
|
||||
.await
|
||||
.decrypt(pm_auth_key)
|
||||
.await
|
||||
.change_context(ApiErrorResponse::InternalServerError)?;
|
||||
let pm_auth_key = state
|
||||
.conf
|
||||
.payment_method_auth
|
||||
.get_inner()
|
||||
.pm_auth_key
|
||||
.clone()
|
||||
.expose();
|
||||
|
||||
let mut update_entries: Vec<(storage::PaymentMethod, storage::PaymentMethodUpdate)> =
|
||||
Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user