refactor(core): Add additional parameters in AppState and refactor AppState references (#2123)

Co-authored-by: Kritik Modi <kritik.modi@juspay.in>
Co-authored-by: Kritik Modi <61862301+kritikmodi@users.noreply.github.com>
Co-authored-by: Nitesh Balla <nitesh.balla@juspay.in>
This commit is contained in:
Abhishek Marrivagu
2023-09-18 14:01:03 +05:30
committed by GitHub
parent b39369ced9
commit a0a8ef27b3
46 changed files with 531 additions and 395 deletions

View File

@ -8,7 +8,6 @@ use external_services::kms;
use crate::{
core::errors::{self, api_error_response, utils::StorageErrorExt},
db::StorageInterface,
headers, logger,
routes::AppState,
services, types,
@ -17,7 +16,7 @@ use crate::{
const APPLEPAY_INTERNAL_MERCHANT_NAME: &str = "Applepay_merchant";
pub async fn verify_merchant_creds_for_applepay(
state: &AppState,
state: AppState,
_req: &actix_web::HttpRequest,
body: web::Json<verifications::ApplepayMerchantVerificationRequest>,
kms_config: &kms::KmsConfig,
@ -79,7 +78,7 @@ pub async fn verify_merchant_creds_for_applepay(
.add_certificate_key(Some(key_data))
.build();
let response = services::call_connector_api(state, apple_pay_merch_verification_req).await;
let response = services::call_connector_api(&state, apple_pay_merch_verification_req).await;
utils::log_applepay_verification_response_if_error(&response);
let applepay_response =
@ -89,7 +88,7 @@ pub async fn verify_merchant_creds_for_applepay(
Ok(match applepay_response {
Ok(_) => {
utils::check_existence_and_add_domain_to_db(
state,
&state,
merchant_id,
body.merchant_connector_account_id.clone(),
body.domain_names.clone(),
@ -110,13 +109,14 @@ pub async fn verify_merchant_creds_for_applepay(
}
pub async fn get_verified_apple_domains_with_mid_mca_id(
db: &dyn StorageInterface,
state: AppState,
merchant_id: String,
merchant_connector_id: String,
) -> CustomResult<
services::ApplicationResponse<api_models::verifications::ApplepayVerifiedDomainsResponse>,
api_error_response::ApiErrorResponse,
> {
let db = state.store.as_ref();
let key_store = db
.get_merchant_key_store_by_merchant_id(&merchant_id, &db.get_master_key().to_vec().into())
.await