diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs index 6dc9f3425a..3b437b703b 100644 --- a/crates/common_utils/src/consts.rs +++ b/crates/common_utils/src/consts.rs @@ -43,12 +43,6 @@ pub fn default_payouts_list_limit() -> u32 { 10 } -/// Error message for Authentication Error from the connector -pub const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the connector"; - -/// Error message when Refund request has been voided. -pub const REFUND_VOIDED: &str = "Refund request has been voided."; - /// surcharge percentage maximum precision length pub const SURCHARGE_PERCENTAGE_PRECISION_LENGTH: u8 = 2; diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs index c4c026b8fe..911251d224 100644 --- a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs +++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs @@ -1,7 +1,7 @@ pub mod transformers; use crate::{ - constants::headers, + constants::{self,headers}, types::ResponseRouterData, utils::{self, PaymentMethodDataType, RefundsRequestData}, }; @@ -35,7 +35,10 @@ use hyperswitch_domain_models::{ }, }; use hyperswitch_interfaces::{ - api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation,ConnectorSpecifications}, + api::{ + self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications, + ConnectorValidation, + }, configs::Connectors, errors, events::connector_api_logs::ConnectorEvent, @@ -215,7 +218,7 @@ impl ConnectorCommon for Bankofamerica { router_env::logger::info!(connector_response=?response); let error_message = if res.status_code == 401 { - consts::CONNECTOR_UNAUTHORIZED_ERROR + constants::CONNECTOR_UNAUTHORIZED_ERROR } else { hyperswitch_interfaces::consts::NO_ERROR_MESSAGE }; diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs index 97026edf79..e8c69e16d4 100644 --- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs @@ -1,4 +1,5 @@ use crate::{ + constants, types::{RefundsResponseRouterData, ResponseRouterData}, unimplemented_payment_method, utils::{ @@ -2069,8 +2070,8 @@ impl TryFrom> if status == BankofamericaRefundStatus::Voided { Err(get_error_response( &Some(BankOfAmericaErrorInformation { - message: Some(consts::REFUND_VOIDED.to_string()), - reason: Some(consts::REFUND_VOIDED.to_string()), + message: Some(constants::REFUND_VOIDED.to_string()), + reason: Some(constants::REFUND_VOIDED.to_string()), details: None, }), &None, diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs index 045301f727..0bddf72e79 100644 --- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs +++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs @@ -75,7 +75,7 @@ use transformers as cybersource; use url::Url; use crate::{ - constants::headers, + constants::{self,headers}, types::ResponseRouterData, utils::{ self, convert_amount, PaymentMethodDataType, PaymentsAuthorizeRequestData, @@ -182,7 +182,7 @@ impl ConnectorCommon for Cybersource { > = res.response.parse_struct("Cybersource ErrorResponse"); let error_message = if res.status_code == 401 { - consts::CONNECTOR_UNAUTHORIZED_ERROR + constants::CONNECTOR_UNAUTHORIZED_ERROR } else { hyperswitch_interfaces::consts::NO_ERROR_MESSAGE }; diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs index 852b8fa63c..46e1e747ee 100644 --- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs @@ -59,6 +59,7 @@ use crate::utils::PayoutsData; use crate::types::PayoutsResponseRouterData; use crate::{ + constants, types::{RefundsResponseRouterData, ResponseRouterData}, unimplemented_payment_method, utils::{ @@ -3556,8 +3557,8 @@ impl TryFrom> if status == CybersourceRefundStatus::Voided { Err(get_error_response( &Some(CybersourceErrorInformation { - message: Some(consts::REFUND_VOIDED.to_string()), - reason: Some(consts::REFUND_VOIDED.to_string()), + message: Some(constants::REFUND_VOIDED.to_string()), + reason: Some(constants::REFUND_VOIDED.to_string()), details: None, }), &None, diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs index 11964a5872..49a88ae003 100644 --- a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs +++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs @@ -61,7 +61,7 @@ use transformers as wellsfargo; use url::Url; use crate::{ - constants::headers, + constants::{headers,self}, types::ResponseRouterData, utils::{self, convert_amount, PaymentMethodDataType, RefundsRequestData}, }; @@ -163,7 +163,7 @@ impl ConnectorCommon for Wellsfargo { > = res.response.parse_struct("Wellsfargo ErrorResponse"); let error_message = if res.status_code == 401 { - consts::CONNECTOR_UNAUTHORIZED_ERROR + constants::CONNECTOR_UNAUTHORIZED_ERROR } else { hyperswitch_interfaces::consts::NO_ERROR_MESSAGE }; diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs index 2d21028ca8..8f15fe92b2 100644 --- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs @@ -4,6 +4,7 @@ use masking::{ExposeInterface, PeekInterface, Secret}; use serde_json::Value; use crate::{ + constants, types::{RefundsResponseRouterData, ResponseRouterData}, unimplemented_payment_method, utils::{ @@ -2203,8 +2204,8 @@ impl TryFrom> if status == WellsfargoRefundStatus::Voided { Err(get_error_response( &Some(WellsfargoErrorInformation { - message: Some(consts::REFUND_VOIDED.to_string()), - reason: Some(consts::REFUND_VOIDED.to_string()), + message: Some(constants::REFUND_VOIDED.to_string()), + reason: Some(constants::REFUND_VOIDED.to_string()), details: None, }), &None, diff --git a/crates/hyperswitch_connectors/src/constants.rs b/crates/hyperswitch_connectors/src/constants.rs index 3d99f8d167..378521af69 100644 --- a/crates/hyperswitch_connectors/src/constants.rs +++ b/crates/hyperswitch_connectors/src/constants.rs @@ -32,3 +32,11 @@ pub(crate) mod headers { /// Unsupported response type error message pub const UNSUPPORTED_ERROR_MESSAGE: &str = "Unsupported response type"; + +/// Error message for Authentication Error from the connector +pub const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the connector"; + +/// Error message when Refund request has been voided. +pub const REFUND_VOIDED: &str = "Refund request has been voided."; + +pub const LOW_BALANCE_ERROR_MESSAGE: &str = "Insufficient balance in the payment method"; \ No newline at end of file