feat: fetch merchant key store only once per session (#1400)

Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
Kartikeya Hegde
2023-06-22 14:40:28 +05:30
committed by GitHub
parent 957d5e0f62
commit d321aa1f72
65 changed files with 979 additions and 498 deletions

View File

@ -24,6 +24,7 @@ pub async fn construct_refund_router_data<'a, F>(
state: &'a AppState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
money: (i64, enums::Currency),
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
@ -42,6 +43,7 @@ pub async fn construct_refund_router_data<'a, F>(
merchant_account.merchant_id.as_str(),
&connector_label,
creds_identifier,
key_store,
)
.await?;
@ -238,6 +240,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
dispute: &storage::Dispute,
) -> RouterResult<types::AcceptDisputeRouterData> {
let connector_id = &dispute.connector;
@ -252,6 +255,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
merchant_account.merchant_id.as_str(),
&connector_label,
None,
key_store,
)
.await?;
let auth_type: types::ConnectorAuthType = merchant_connector_account
@ -299,6 +303,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
dispute: &storage::Dispute,
submit_evidence_request_data: types::SubmitEvidenceRequestData,
) -> RouterResult<types::SubmitEvidenceRouterData> {
@ -314,6 +319,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
merchant_account.merchant_id.as_str(),
&connector_label,
None,
key_store,
)
.await?;
let auth_type: types::ConnectorAuthType = merchant_connector_account
@ -359,6 +365,7 @@ pub async fn construct_upload_file_router_data<'a>(
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
create_file_request: &types::api::CreateFileRequest,
connector_id: &str,
file_key: String,
@ -369,6 +376,7 @@ pub async fn construct_upload_file_router_data<'a>(
merchant_account.merchant_id.as_str(),
&connector_label,
None,
key_store,
)
.await?;
let auth_type: types::ConnectorAuthType = merchant_connector_account
@ -418,6 +426,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
dispute: &storage::Dispute,
) -> RouterResult<types::DefendDisputeRouterData> {
let _db = &*state.store;
@ -433,6 +442,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
merchant_account.merchant_id.as_str(),
&connector_label,
None,
key_store,
)
.await?;
let auth_type: types::ConnectorAuthType = merchant_connector_account
@ -478,6 +488,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
pub async fn construct_retrieve_file_router_data<'a>(
state: &'a AppState,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
file_metadata: &storage_models::file::FileMetadata,
connector_id: &str,
) -> RouterResult<types::RetrieveFileRouterData> {
@ -492,6 +503,7 @@ pub async fn construct_retrieve_file_router_data<'a>(
merchant_account.merchant_id.as_str(),
&connector_label,
None,
key_store,
)
.await?;
let auth_type: types::ConnectorAuthType = merchant_connector_account