mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
feat(core): implemented platform merchant account (#6882)
Co-authored-by: Narayanbhat166 <narayan.bhat@juspay.in>
This commit is contained in:
@ -278,6 +278,10 @@ pub enum StripeErrorCode {
|
||||
InvalidTenant,
|
||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "HE_01", message = "Failed to convert amount to {amount_type} type")]
|
||||
AmountConversionFailed { amount_type: &'static str },
|
||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "Platform Bad Request")]
|
||||
PlatformBadRequest,
|
||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "Platform Unauthorized Request")]
|
||||
PlatformUnauthorizedRequest,
|
||||
// [#216]: https://github.com/juspay/hyperswitch/issues/216
|
||||
// Implement the remaining stripe error codes
|
||||
|
||||
@ -678,6 +682,8 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
|
||||
errors::ApiErrorResponse::AmountConversionFailed { amount_type } => {
|
||||
Self::AmountConversionFailed { amount_type }
|
||||
}
|
||||
errors::ApiErrorResponse::PlatformAccountAuthNotSupported => Self::PlatformBadRequest,
|
||||
errors::ApiErrorResponse::InvalidPlatformOperation => Self::PlatformUnauthorizedRequest,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -687,7 +693,7 @@ impl actix_web::ResponseError for StripeErrorCode {
|
||||
use reqwest::StatusCode;
|
||||
|
||||
match self {
|
||||
Self::Unauthorized => StatusCode::UNAUTHORIZED,
|
||||
Self::Unauthorized | Self::PlatformUnauthorizedRequest => StatusCode::UNAUTHORIZED,
|
||||
Self::InvalidRequestUrl | Self::GenericNotFoundError { .. } => StatusCode::NOT_FOUND,
|
||||
Self::ParameterUnknown { .. } | Self::HyperswitchUnprocessableEntity { .. } => {
|
||||
StatusCode::UNPROCESSABLE_ENTITY
|
||||
@ -751,6 +757,7 @@ impl actix_web::ResponseError for StripeErrorCode {
|
||||
| Self::CurrencyConversionFailed
|
||||
| Self::PaymentMethodDeleteFailed
|
||||
| Self::ExtendedCardInfoNotFound
|
||||
| Self::PlatformBadRequest
|
||||
| Self::LinkConfigurationError { .. } => StatusCode::BAD_REQUEST,
|
||||
Self::RefundFailed
|
||||
| Self::PayoutFailed
|
||||
|
||||
@ -92,6 +92,7 @@ pub async fn payment_intents_create(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
eligible_connectors,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&auth::HeaderAuth(auth::ApiKeyAuth),
|
||||
@ -162,6 +163,7 @@ pub async fn payment_intents_retrieve(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
@ -240,6 +242,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
@ -316,6 +319,7 @@ pub async fn payment_intents_update(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
eligible_connectors,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
@ -401,6 +405,7 @@ pub async fn payment_intents_confirm(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
eligible_connectors,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
@ -472,6 +477,7 @@ pub async fn payment_intents_capture(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&auth::HeaderAuth(auth::ApiKeyAuth),
|
||||
@ -547,6 +553,7 @@ pub async fn payment_intents_cancel(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
|
||||
@ -78,6 +78,7 @@ pub async fn setup_intents_create(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&auth::HeaderAuth(auth::ApiKeyAuth),
|
||||
@ -148,6 +149,7 @@ pub async fn setup_intents_retrieve(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
@ -224,6 +226,7 @@ pub async fn setup_intents_update(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
@ -301,6 +304,7 @@ pub async fn setup_intents_confirm(
|
||||
payments::CallConnectorAction::Trigger,
|
||||
None,
|
||||
hyperswitch_domain_models::payments::HeaderPayload::default(),
|
||||
auth.platform_merchant_account,
|
||||
)
|
||||
},
|
||||
&*auth_type,
|
||||
|
||||
Reference in New Issue
Block a user