mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	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:
		| @ -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) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Gaurav Rawat
					Gaurav Rawat