refactor(payment_intent_v2): payment intent fields refactoring (#5880)

Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-09-20 16:50:53 +05:30
committed by GitHub
parent 00e913c75c
commit 5335f2d21c
48 changed files with 2478 additions and 1620 deletions

View File

@ -220,6 +220,25 @@ pub async fn construct_payout_router_data<'a, F>(
Ok(router_data)
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_refund_router_data<'a, F>(
_state: &'a SessionState,
_connector_id: &str,
_merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
_money: (MinorUnit, enums::Currency),
_payment_intent: &'a storage::PaymentIntent,
_payment_attempt: &storage::PaymentAttempt,
_refund: &'a storage::Refund,
_creds_identifier: Option<String>,
_charges: Option<types::ChargeRefunds>,
) -> RouterResult<types::RefundsRouterData<F>> {
todo!()
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_refund_router_data<'a, F>(
@ -588,6 +607,7 @@ pub fn validate_dispute_stage_and_dispute_status(
)
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
pub async fn construct_accept_dispute_router_data<'a>(
state: &'a SessionState,
@ -681,6 +701,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
Ok(router_data)
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
pub async fn construct_submit_evidence_router_data<'a>(
state: &'a SessionState,
@ -773,6 +794,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
Ok(router_data)
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_upload_file_router_data<'a>(
@ -871,6 +893,18 @@ pub async fn construct_upload_file_router_data<'a>(
Ok(router_data)
}
#[cfg(feature = "v2")]
pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone>(
state: &'a SessionState,
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
payment_data: &mut PaymentData<F>,
merchant_connector_account: &MerchantConnectorAccount,
) -> RouterResult<types::PaymentsTaxCalculationRouterData> {
todo!()
}
#[cfg(feature = "v1")]
pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone>(
state: &'a SessionState,
merchant_account: &domain::MerchantAccount,
@ -978,6 +1012,7 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone
Ok(router_data)
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
pub async fn construct_defend_dispute_router_data<'a>(
state: &'a SessionState,
@ -1459,9 +1494,16 @@ impl GetProfileId for MerchantConnectorAccount {
}
impl GetProfileId for storage::PaymentIntent {
#[cfg(feature = "v1")]
fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.profile_id.as_ref()
}
// TODO: handle this in a better way for v2
#[cfg(feature = "v2")]
fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
Some(&self.profile_id)
}
}
impl<A> GetProfileId for (storage::PaymentIntent, A) {