feat: Implement subscriptions workflow and incoming webhook support (#9400)

Co-authored-by: Prajjwal kumar <write2prajjwal@gmail.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Prajjwal Kumar <prajjwal.kumar@juspay.in>
This commit is contained in:
Gaurav Rawat
2025-10-03 21:31:21 +05:30
committed by GitHub
parent e186a0f4f4
commit 32dd9e10e3
12 changed files with 381 additions and 52 deletions

View File

@ -44,6 +44,8 @@ use serde_json::Value;
use tracing_futures::Instrument;
pub use self::ext_traits::{OptionExt, ValidateCall};
#[cfg(feature = "v1")]
use crate::core::subscription::subscription_handler::SubscriptionHandler;
use crate::{
consts,
core::{
@ -459,7 +461,6 @@ pub async fn get_mca_from_payment_intent(
}
}
}
#[cfg(feature = "payouts")]
pub async fn get_mca_from_payout_attempt(
state: &SessionState,
@ -639,6 +640,22 @@ pub async fn get_mca_from_object_reference_id(
)
.await
}
webhooks::ObjectReferenceId::SubscriptionId(subscription_id_type) => {
#[cfg(feature = "v1")]
{
let subscription_handler = SubscriptionHandler::new(state, merchant_context);
let mut subscription_with_handler = subscription_handler
.find_subscription(subscription_id_type)
.await?;
subscription_with_handler.get_mca(connector_name).await
}
#[cfg(feature = "v2")]
{
let _db = db;
todo!()
}
}
#[cfg(feature = "payouts")]
webhooks::ObjectReferenceId::PayoutId(payout_id_type) => {
get_mca_from_payout_attempt(state, merchant_context, payout_id_type, connector_name)