Skip to content

Commit

Permalink
cyber-wf-boa
Browse files Browse the repository at this point in the history
  • Loading branch information
awasthi21 committed Jan 3, 2025
1 parent 15d646b commit b2e44ea
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
6 changes: 0 additions & 6 deletions crates/common_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 6 additions & 3 deletions crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod transformers;

use crate::{
constants::headers,
constants::{self,headers},
types::ResponseRouterData,
utils::{self, PaymentMethodDataType, RefundsRequestData},
};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{
constants,
types::{RefundsResponseRouterData, ResponseRouterData},
unimplemented_payment_method,
utils::{
Expand Down Expand Up @@ -2069,8 +2070,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, BankOfAmericaRsyncResponse>>
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,
Expand Down
4 changes: 2 additions & 2 deletions crates/hyperswitch_connectors/src/connectors/cybersource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use crate::utils::PayoutsData;
use crate::types::PayoutsResponseRouterData;

use crate::{
constants,
types::{RefundsResponseRouterData, ResponseRouterData},
unimplemented_payment_method,
utils::{
Expand Down Expand Up @@ -3556,8 +3557,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, CybersourceRsyncResponse>>
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,
Expand Down
4 changes: 2 additions & 2 deletions crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use masking::{ExposeInterface, PeekInterface, Secret};
use serde_json::Value;

use crate::{
constants,
types::{RefundsResponseRouterData, ResponseRouterData},
unimplemented_payment_method,
utils::{
Expand Down Expand Up @@ -2203,8 +2204,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, WellsfargoRsyncResponse>>
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,
Expand Down
8 changes: 8 additions & 0 deletions crates/hyperswitch_connectors/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

0 comments on commit b2e44ea

Please sign in to comment.