mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	feat(router): add v2 endpoint retrieve payment aggregate based on merchant profile (#7196)
Co-authored-by: Aniket Burman <aniket.burman@Aniket-Burman-JDXHW2PH34.local> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
		| @ -5408,7 +5408,7 @@ pub async fn get_payment_filters( | ||||
|     )) | ||||
| } | ||||
|  | ||||
| #[cfg(all(feature = "olap", feature = "v1"))] | ||||
| #[cfg(feature = "olap")] | ||||
| pub async fn get_aggregates_for_payments( | ||||
|     state: SessionState, | ||||
|     merchant: domain::MerchantAccount, | ||||
|  | ||||
| @ -1876,8 +1876,7 @@ impl PaymentIntentInterface for KafkaStore { | ||||
|             ) | ||||
|             .await | ||||
|     } | ||||
|  | ||||
|     #[cfg(all(feature = "olap", feature = "v1"))] | ||||
|     #[cfg(feature = "olap")] | ||||
|     async fn get_intent_status_with_count( | ||||
|         &self, | ||||
|         merchant_id: &id_type::MerchantId, | ||||
|  | ||||
| @ -571,6 +571,13 @@ impl Payments { | ||||
|             .service( | ||||
|                 web::resource("/create-intent") | ||||
|                     .route(web::post().to(payments::payments_create_intent)), | ||||
|             ) | ||||
|             .service( | ||||
|                 web::resource("/aggregate").route(web::get().to(payments::get_payments_aggregates)), | ||||
|             ) | ||||
|             .service( | ||||
|                 web::resource("/profile/aggregate") | ||||
|                     .route(web::get().to(payments::get_payments_aggregates_profile)), | ||||
|             ); | ||||
|  | ||||
|         route = | ||||
|  | ||||
| @ -1407,7 +1407,7 @@ pub async fn get_payment_filters_profile( | ||||
| } | ||||
|  | ||||
| #[instrument(skip_all, fields(flow = ?Flow::PaymentsAggregate))] | ||||
| #[cfg(all(feature = "olap", feature = "v1"))] | ||||
| #[cfg(feature = "olap")] | ||||
| pub async fn get_payments_aggregates( | ||||
|     state: web::Data<app::AppState>, | ||||
|     req: actix_web::HttpRequest, | ||||
| @ -2228,6 +2228,35 @@ pub async fn get_payments_aggregates_profile( | ||||
|     )) | ||||
|     .await | ||||
| } | ||||
| #[instrument(skip_all, fields(flow = ?Flow::PaymentsAggregate))] | ||||
| #[cfg(all(feature = "olap", feature = "v2"))] | ||||
| pub async fn get_payments_aggregates_profile( | ||||
|     state: web::Data<app::AppState>, | ||||
|     req: actix_web::HttpRequest, | ||||
|     payload: web::Query<common_utils::types::TimeRange>, | ||||
| ) -> impl Responder { | ||||
|     let flow = Flow::PaymentsAggregate; | ||||
|     let payload = payload.into_inner(); | ||||
|     Box::pin(api::server_wrap( | ||||
|         flow, | ||||
|         state, | ||||
|         &req, | ||||
|         payload, | ||||
|         |state, auth: auth::AuthenticationData, req, _| { | ||||
|             payments::get_aggregates_for_payments( | ||||
|                 state, | ||||
|                 auth.merchant_account, | ||||
|                 Some(vec![auth.profile.get_id().clone()]), | ||||
|                 req, | ||||
|             ) | ||||
|         }, | ||||
|         &auth::JWTAuth { | ||||
|             permission: Permission::ProfilePaymentRead, | ||||
|         }, | ||||
|         api_locking::LockAction::NotApplicable, | ||||
|     )) | ||||
|     .await | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "v2")] | ||||
| /// A private module to hold internal types to be used in route handlers. | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Aniket Burman
					Aniket Burman