refactor(router): domain and diesel model changes for merchant_connector_account create v2 flow (#5462)

This commit is contained in:
Sai Harsha Vardhan
2024-08-01 17:27:39 +05:30
committed by GitHub
parent b4e7717055
commit 85209d12ae
36 changed files with 2105 additions and 472 deletions

View File

@ -136,6 +136,10 @@ pub async fn create_link_token(
.and_then(|address| address.country)
.map(|country| country.to_string());
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "merchant_connector_account_v2")
))]
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
@ -149,6 +153,12 @@ pub async fn create_link_token(
id: merchant_account.get_id().get_string_repr().to_owned(),
})?;
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
let merchant_connector_account = {
let _ = billing_country;
todo!()
};
let auth_type = helpers::get_connector_auth_type(merchant_connector_account)?;
let router_data = pm_auth_types::LinkTokenRouterData {
@ -231,6 +241,10 @@ pub async fn exchange_token_core(
let connector = PaymentAuthConnectorData::get_connector_by_name(connector_name)?;
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "merchant_connector_account_v2")
))]
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
@ -244,6 +258,14 @@ pub async fn exchange_token_core(
id: merchant_account.get_id().get_string_repr().to_owned(),
})?;
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
let merchant_connector_account: domain::MerchantConnectorAccount = {
let _ = merchant_account;
let _ = connector;
let _ = key_store;
todo!()
};
let auth_type = helpers::get_connector_auth_type(merchant_connector_account.clone())?;
let access_token = get_access_token_from_exchange_api(
@ -273,7 +295,7 @@ pub async fn exchange_token_core(
state,
bank_account_details_resp,
(connector_name, access_token),
merchant_connector_account.merchant_connector_id,
merchant_connector_account.get_id(),
))
.await?;
@ -716,6 +738,10 @@ pub async fn retrieve_payment_method_from_auth_service(
.await
.to_not_found_response(ApiErrorResponse::MerchantAccountNotFound)?;
#[cfg(all(
any(feature = "v1", feature = "v2"),
not(feature = "merchant_connector_account_v2")
))]
let mca = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@ -731,6 +757,13 @@ pub async fn retrieve_payment_method_from_auth_service(
"error while fetching merchant_connector_account from merchant_id and connector name",
)?;
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
let mca = {
let _ = merchant_account;
let _ = connector;
todo!()
};
let auth_type = pm_auth_helpers::get_connector_auth_type(mca)?;
let BankAccountAccessCreds::AccessToken(access_token) =