mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 02:57:02 +08:00
refactor(merchant_account_v2): recreate id and remove deprecated fields from merchant account (#5493)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -229,24 +229,19 @@ pub async fn construct_refund_router_data<'a, F>(
|
||||
creds_identifier: Option<String>,
|
||||
charges: Option<types::ChargeRefunds>,
|
||||
) -> RouterResult<types::RefundsRouterData<F>> {
|
||||
let profile_id = get_profile_id_from_business_details(
|
||||
payment_intent.business_country,
|
||||
payment_intent.business_label.as_ref(),
|
||||
merchant_account,
|
||||
payment_intent.profile_id.as_ref(),
|
||||
&*state.store,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?;
|
||||
let profile_id = payment_intent
|
||||
.profile_id
|
||||
.as_ref()
|
||||
.get_required_value("profile_id")
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?;
|
||||
|
||||
let merchant_connector_account = helpers::get_merchant_connector_account(
|
||||
state,
|
||||
merchant_account.get_id(),
|
||||
creds_identifier,
|
||||
key_store,
|
||||
&profile_id,
|
||||
profile_id,
|
||||
connector_id,
|
||||
payment_attempt.merchant_connector_id.as_ref(),
|
||||
)
|
||||
@ -524,17 +519,13 @@ pub async fn construct_accept_dispute_router_data<'a>(
|
||||
key_store: &domain::MerchantKeyStore,
|
||||
dispute: &storage::Dispute,
|
||||
) -> RouterResult<types::AcceptDisputeRouterData> {
|
||||
let profile_id = get_profile_id_from_business_details(
|
||||
payment_intent.business_country,
|
||||
payment_intent.business_label.as_ref(),
|
||||
merchant_account,
|
||||
payment_intent.profile_id.as_ref(),
|
||||
&*state.store,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?;
|
||||
let profile_id = payment_intent
|
||||
.profile_id
|
||||
.as_ref()
|
||||
.get_required_value("profile_id")
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?
|
||||
.clone();
|
||||
|
||||
let merchant_connector_account = helpers::get_merchant_connector_account(
|
||||
state,
|
||||
@ -623,17 +614,13 @@ pub async fn construct_submit_evidence_router_data<'a>(
|
||||
submit_evidence_request_data: types::SubmitEvidenceRequestData,
|
||||
) -> RouterResult<types::SubmitEvidenceRouterData> {
|
||||
let connector_id = &dispute.connector;
|
||||
let profile_id = get_profile_id_from_business_details(
|
||||
payment_intent.business_country,
|
||||
payment_intent.business_label.as_ref(),
|
||||
merchant_account,
|
||||
payment_intent.profile_id.as_ref(),
|
||||
&*state.store,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?;
|
||||
let profile_id = payment_intent
|
||||
.profile_id
|
||||
.as_ref()
|
||||
.get_required_value("profile_id")
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?
|
||||
.clone();
|
||||
|
||||
let merchant_connector_account = helpers::get_merchant_connector_account(
|
||||
state,
|
||||
@ -720,17 +707,13 @@ pub async fn construct_upload_file_router_data<'a>(
|
||||
connector_id: &str,
|
||||
file_key: String,
|
||||
) -> RouterResult<types::UploadFileRouterData> {
|
||||
let profile_id = get_profile_id_from_business_details(
|
||||
payment_intent.business_country,
|
||||
payment_intent.business_label.as_ref(),
|
||||
merchant_account,
|
||||
payment_intent.profile_id.as_ref(),
|
||||
&*state.store,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?;
|
||||
let profile_id = payment_intent
|
||||
.profile_id
|
||||
.as_ref()
|
||||
.get_required_value("profile_id")
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?
|
||||
.clone();
|
||||
|
||||
let merchant_connector_account = helpers::get_merchant_connector_account(
|
||||
state,
|
||||
@ -821,17 +804,13 @@ pub async fn construct_defend_dispute_router_data<'a>(
|
||||
) -> RouterResult<types::DefendDisputeRouterData> {
|
||||
let _db = &*state.store;
|
||||
let connector_id = &dispute.connector;
|
||||
let profile_id = get_profile_id_from_business_details(
|
||||
payment_intent.business_country,
|
||||
payment_intent.business_label.as_ref(),
|
||||
merchant_account,
|
||||
payment_intent.profile_id.as_ref(),
|
||||
&*state.store,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?;
|
||||
let profile_id = payment_intent
|
||||
.profile_id
|
||||
.as_ref()
|
||||
.get_required_value("profile_id")
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("profile_id is not set in payment_intent")?
|
||||
.clone();
|
||||
|
||||
let merchant_connector_account = helpers::get_merchant_connector_account(
|
||||
state,
|
||||
@ -1090,6 +1069,10 @@ pub fn get_connector_label(
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "merchant_account_v2")
|
||||
))]
|
||||
/// If profile_id is not passed, use default profile if available, or
|
||||
/// If business_details (business_country and business_label) are passed, get the business_profile
|
||||
/// or return a `MissingRequiredField` error
|
||||
|
||||
Reference in New Issue
Block a user