mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 01:57:45 +08:00 
			
		
		
		
	feat(multitenancy): add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics (#4630)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
		| @ -155,7 +155,7 @@ pub async fn customer_delete( | ||||
|         state.into_inner(), | ||||
|         &req, | ||||
|         payload, | ||||
|         |state, auth, req, _| { | ||||
|         |state, auth: auth::AuthenticationData, req, _| { | ||||
|             customers::delete_customer(state, auth.merchant_account, req, auth.key_store) | ||||
|         }, | ||||
|         &auth::ApiKeyAuth, | ||||
|  | ||||
| @ -264,6 +264,8 @@ pub enum StripeErrorCode { | ||||
|     PaymentMethodDeleteFailed, | ||||
|     #[error(error_type = StripeErrorType::InvalidRequestError, code = "", message = "Extended card info does not exist")] | ||||
|     ExtendedCardInfoNotFound, | ||||
|     #[error(error_type = StripeErrorType::InvalidRequestError, code = "IR_28", message = "Invalid tenant")] | ||||
|     InvalidTenant, | ||||
|     // [#216]: https://github.com/juspay/hyperswitch/issues/216 | ||||
|     // Implement the remaining stripe error codes | ||||
|  | ||||
| @ -646,6 +648,8 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode { | ||||
|                 Self::InvalidWalletToken { wallet_name } | ||||
|             } | ||||
|             errors::ApiErrorResponse::ExtendedCardInfoNotFound => Self::ExtendedCardInfoNotFound, | ||||
|             errors::ApiErrorResponse::InvalidTenant { tenant_id: _ } | ||||
|             | errors::ApiErrorResponse::MissingTenantId => Self::InvalidTenant, | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -725,7 +729,8 @@ impl actix_web::ResponseError for StripeErrorCode { | ||||
|             | Self::InternalServerError | ||||
|             | Self::MandateActive | ||||
|             | Self::CustomerRedacted | ||||
|             | Self::WebhookProcessingError => StatusCode::INTERNAL_SERVER_ERROR, | ||||
|             | Self::WebhookProcessingError | ||||
|             | Self::InvalidTenant => StatusCode::INTERNAL_SERVER_ERROR, | ||||
|             Self::ReturnUrlUnavailable => StatusCode::SERVICE_UNAVAILABLE, | ||||
|             Self::ExternalConnectorError { status_code, .. } => { | ||||
|                 StatusCode::from_u16(*status_code).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR) | ||||
|  | ||||
| @ -10,7 +10,7 @@ use crate::{ | ||||
|     events::api_logs::ApiEventMetric, | ||||
|     routes::{ | ||||
|         app::{AppStateInfo, ReqState}, | ||||
|         metrics, AppState, | ||||
|         metrics, AppState, SessionState, | ||||
|     }, | ||||
|     services::{self, api, authentication as auth, logger}, | ||||
| }; | ||||
| @ -22,11 +22,11 @@ pub async fn compatibility_api_wrap<'a, 'b, U, T, Q, F, Fut, S, E, E2>( | ||||
|     request: &'a HttpRequest, | ||||
|     payload: T, | ||||
|     func: F, | ||||
|     api_authentication: &dyn auth::AuthenticateAndFetch<U, AppState>, | ||||
|     api_authentication: &dyn auth::AuthenticateAndFetch<U, SessionState>, | ||||
|     lock_action: api_locking::LockAction, | ||||
| ) -> HttpResponse | ||||
| where | ||||
|     F: Fn(AppState, U, T, ReqState) -> Fut, | ||||
|     F: Fn(SessionState, U, T, ReqState) -> Fut, | ||||
|     Fut: Future<Output = CustomResult<api::ApplicationResponse<Q>, E2>>, | ||||
|     E2: ErrorSwitch<E> + std::error::Error + Send + Sync + 'static, | ||||
|     Q: Serialize + std::fmt::Debug + 'a + ApiEventMetric, | ||||
| @ -49,6 +49,7 @@ where | ||||
|         api::server_wrap_util( | ||||
|             &flow, | ||||
|             state.clone().into(), | ||||
|             request.headers(), | ||||
|             req_state, | ||||
|             request, | ||||
|             payload, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jagan
					Jagan