mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-12-09 07:17:29 +08:00
feat(payments_v2): payment intent diesel and domain models changes v2 (#5783)
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:
@@ -46,6 +46,8 @@ use tracing_futures::Instrument;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub use self::ext_traits::{OptionExt, ValidateCall};
|
||||
#[cfg(feature = "v1")]
|
||||
use crate::core::webhooks as webhooks_core;
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
use crate::types::storage;
|
||||
use crate::{
|
||||
@@ -53,7 +55,7 @@ use crate::{
|
||||
core::{
|
||||
authentication::types::ExternalThreeDSConnectorMetadata,
|
||||
errors::{self, CustomResult, RouterResult, StorageErrorExt},
|
||||
payments as payments_core, webhooks as webhooks_core,
|
||||
payments as payments_core,
|
||||
},
|
||||
logger,
|
||||
routes::{metrics, SessionState},
|
||||
@@ -165,6 +167,7 @@ pub fn get_payout_attempt_id(payout_id: impl std::fmt::Display, attempt_count: i
|
||||
format!("{payout_id}_{attempt_count}")
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
pub async fn find_payment_intent_from_payment_id_type(
|
||||
state: &SessionState,
|
||||
payment_id_type: payments::PaymentIdType,
|
||||
@@ -228,6 +231,7 @@ pub async fn find_payment_intent_from_payment_id_type(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
pub async fn find_payment_intent_from_refund_id_type(
|
||||
state: &SessionState,
|
||||
refund_id_type: webhooks::RefundIdType,
|
||||
@@ -274,6 +278,7 @@ pub async fn find_payment_intent_from_refund_id_type(
|
||||
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
pub async fn find_payment_intent_from_mandate_id_type(
|
||||
state: &SessionState,
|
||||
mandate_id_type: webhooks::MandateIdType,
|
||||
@@ -313,6 +318,7 @@ pub async fn find_payment_intent_from_mandate_id_type(
|
||||
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
pub async fn find_mca_from_authentication_id_type(
|
||||
state: &SessionState,
|
||||
authentication_id_type: webhooks::AuthenticationIdType,
|
||||
@@ -528,6 +534,7 @@ pub async fn get_mca_from_payout_attempt(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
pub async fn get_mca_from_object_reference_id(
|
||||
state: &SessionState,
|
||||
object_reference_id: webhooks::ObjectReferenceId,
|
||||
@@ -1051,6 +1058,26 @@ pub fn check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata(
|
||||
.unwrap_or(true)
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn trigger_payments_webhook<F, Op, D>(
|
||||
merchant_account: domain::MerchantAccount,
|
||||
business_profile: domain::BusinessProfile,
|
||||
key_store: &domain::MerchantKeyStore,
|
||||
payment_data: D,
|
||||
customer: Option<domain::Customer>,
|
||||
state: &SessionState,
|
||||
operation: Op,
|
||||
) -> RouterResult<()>
|
||||
where
|
||||
F: Send + Clone + Sync,
|
||||
Op: Debug,
|
||||
D: payments_core::OperationSessionGetters<F>,
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn trigger_payments_webhook<F, Op, D>(
|
||||
merchant_account: domain::MerchantAccount,
|
||||
@@ -1067,7 +1094,8 @@ where
|
||||
D: payments_core::OperationSessionGetters<F>,
|
||||
{
|
||||
let status = payment_data.get_payment_intent().status;
|
||||
let payment_id = payment_data.get_payment_intent().payment_id.clone();
|
||||
let payment_id = payment_data.get_payment_intent().get_id().to_owned();
|
||||
|
||||
let captures = payment_data
|
||||
.get_multiple_capture_data()
|
||||
.map(|multiple_capture_data| {
|
||||
|
||||
Reference in New Issue
Block a user