mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
refactor(router): add the connector_label field to DuplicateMerchantConnectorAccount error message (#1044)
This commit is contained in:
@ -103,8 +103,8 @@ pub enum StripeErrorCode {
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "duplicate merchant account")]
|
||||
DuplicateMerchantAccount,
|
||||
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "duplicate merchant_connector_account")]
|
||||
DuplicateMerchantConnectorAccount,
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "The merchant connector account with the specified connector_label '{connector_label}' already exists in our records")]
|
||||
DuplicateMerchantConnectorAccount { connector_label: String },
|
||||
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "token_already_used", message = "duplicate payment method")]
|
||||
DuplicatePaymentMethod,
|
||||
@ -438,8 +438,8 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
|
||||
}
|
||||
errors::ApiErrorResponse::ReturnUrlUnavailable => Self::ReturnUrlUnavailable,
|
||||
errors::ApiErrorResponse::DuplicateMerchantAccount => Self::DuplicateMerchantAccount,
|
||||
errors::ApiErrorResponse::DuplicateMerchantConnectorAccount => {
|
||||
Self::DuplicateMerchantConnectorAccount
|
||||
errors::ApiErrorResponse::DuplicateMerchantConnectorAccount { connector_label } => {
|
||||
Self::DuplicateMerchantConnectorAccount { connector_label }
|
||||
}
|
||||
errors::ApiErrorResponse::DuplicatePaymentMethod => Self::DuplicatePaymentMethod,
|
||||
errors::ApiErrorResponse::ClientSecretInvalid => Self::PaymentIntentInvalidParameter {
|
||||
@ -521,7 +521,7 @@ impl actix_web::ResponseError for StripeErrorCode {
|
||||
| Self::MandateNotFound
|
||||
| Self::ApiKeyNotFound
|
||||
| Self::DuplicateMerchantAccount
|
||||
| Self::DuplicateMerchantConnectorAccount
|
||||
| Self::DuplicateMerchantConnectorAccount { .. }
|
||||
| Self::DuplicatePaymentMethod
|
||||
| Self::PaymentFailed
|
||||
| Self::VerificationFailed { .. }
|
||||
|
||||
@ -422,7 +422,11 @@ pub async fn create_payment_connector(
|
||||
let mca = store
|
||||
.insert_merchant_connector_account(merchant_connector_account)
|
||||
.await
|
||||
.to_duplicate_response(errors::ApiErrorResponse::DuplicateMerchantConnectorAccount)?;
|
||||
.to_duplicate_response(
|
||||
errors::ApiErrorResponse::DuplicateMerchantConnectorAccount {
|
||||
connector_label: connector_label.clone(),
|
||||
},
|
||||
)?;
|
||||
|
||||
let mca_response = ForeignTryFrom::foreign_try_from(mca)?;
|
||||
|
||||
|
||||
@ -118,8 +118,8 @@ pub enum ApiErrorResponse {
|
||||
DuplicateMandate,
|
||||
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The merchant account with the specified details already exists in our records")]
|
||||
DuplicateMerchantAccount,
|
||||
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The merchant connector account with the specified details already exists in our records")]
|
||||
DuplicateMerchantConnectorAccount,
|
||||
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The merchant connector account with the specified connector_label '{connector_label}' already exists in our records")]
|
||||
DuplicateMerchantConnectorAccount { connector_label: String },
|
||||
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The payment method with the specified details already exists in our records")]
|
||||
DuplicatePaymentMethod,
|
||||
#[error(error_type = ErrorType::DuplicateRequest, code = "HE_01", message = "The payment with the specified payment_id '{payment_id}' already exists in our records")]
|
||||
@ -270,7 +270,7 @@ impl actix_web::ResponseError for ApiErrorResponse {
|
||||
| Self::ApiKeyNotFound
|
||||
| Self::DisputeStatusValidationFailed { .. } => StatusCode::BAD_REQUEST, // 400
|
||||
Self::DuplicateMerchantAccount
|
||||
| Self::DuplicateMerchantConnectorAccount
|
||||
| Self::DuplicateMerchantConnectorAccount { .. }
|
||||
| Self::DuplicatePaymentMethod
|
||||
| Self::DuplicateMandate
|
||||
| Self::DisputeNotFound { .. }
|
||||
@ -409,8 +409,8 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
|
||||
Self::DuplicateRefundRequest => AER::BadRequest(ApiError::new("HE", 1, "Duplicate refund request. Refund already attempted with the refund ID", None)),
|
||||
Self::DuplicateMandate => AER::BadRequest(ApiError::new("HE", 1, "Duplicate mandate request. Mandate already attempted with the Mandate ID", None)),
|
||||
Self::DuplicateMerchantAccount => AER::BadRequest(ApiError::new("HE", 1, "The merchant account with the specified details already exists in our records", None)),
|
||||
Self::DuplicateMerchantConnectorAccount => {
|
||||
AER::BadRequest(ApiError::new("HE", 1, "The merchant connector account with the specified details already exists in our records", None))
|
||||
Self::DuplicateMerchantConnectorAccount { connector_label } => {
|
||||
AER::BadRequest(ApiError::new("HE", 1, format!("The merchant connector account with the specified connector_label '{connector_label}' already exists in our records"), None))
|
||||
}
|
||||
Self::DuplicatePaymentMethod => AER::BadRequest(ApiError::new("HE", 1, "The payment method with the specified details already exists in our records", None)),
|
||||
Self::DuplicatePayment { payment_id } => {
|
||||
|
||||
Reference in New Issue
Block a user