diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index 494a0bbebe..f4bc2d1cdb 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -1,5 +1,6 @@ use std::collections::HashMap; +use common_utils::pii; use error_stack::{report, IntoReport, ResultExt}; use masking::Secret; use once_cell::sync::Lazy; @@ -212,7 +213,11 @@ impl CardData for api::Card { Secret::new(year[year.len() - 2..].to_string()) } fn get_card_issuer(&self) -> Result { - get_card_issuer(self.card_number.peek().clone().as_str()) + let card: Secret = self + .card_number + .clone() + .map(|card| card.split_whitespace().collect()); + get_card_issuer(card.peek().clone().as_str()) } } diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs index 7531ba7750..4fadac89da 100644 --- a/crates/router/src/connector/worldline/transformers.rs +++ b/crates/router/src/connector/worldline/transformers.rs @@ -127,6 +127,7 @@ impl TryFrom for Gateway { utils::CardIssuer::AmericanExpress => Ok(Self::Amex), utils::CardIssuer::Master => Ok(Self::MasterCard), utils::CardIssuer::Discover => Ok(Self::Discover), + utils::CardIssuer::Visa => Ok(Self::Visa), _ => Err(errors::ConnectorError::NotSupported { payment_method: format!("{issuer}"), connector: "worldline", diff --git a/crates/router/tests/connectors/worldline.rs b/crates/router/tests/connectors/worldline.rs index 6d72b0696b..4a10abe309 100644 --- a/crates/router/tests/connectors/worldline.rs +++ b/crates/router/tests/connectors/worldline.rs @@ -98,7 +98,7 @@ async fn should_requires_manual_authorization() { enums::CaptureMethod::Manual, ); let response = WorldlineTest {} - .make_payment(authorize_data, WorldlineTest::get_payment_info()) + .authorize_payment(authorize_data, WorldlineTest::get_payment_info()) .await; assert_eq!(response.unwrap().status, enums::AttemptStatus::Authorized); } @@ -133,7 +133,10 @@ async fn should_throw_not_implemented_for_unsupported_issuer() { .await; assert_eq!( *response.unwrap_err().current_context(), - errors::ConnectorError::NotImplemented(String::from("Payment Method")) + errors::ConnectorError::NotSupported { + payment_method: "Maestro".to_string(), + connector: "worldline" + } ) } @@ -195,7 +198,7 @@ async fn should_sync_manual_auth_payment() { enums::CaptureMethod::Manual, ); let response = connector - .make_payment(authorize_data, WorldlineTest::get_payment_info()) + .authorize_payment(authorize_data, WorldlineTest::get_payment_info()) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Authorized); @@ -261,7 +264,7 @@ async fn should_capture_authorized_payment() { enums::CaptureMethod::Manual, ); let response = connector - .make_payment(authorize_data, WorldlineTest::get_payment_info()) + .authorize_payment(authorize_data, WorldlineTest::get_payment_info()) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Authorized); @@ -300,7 +303,7 @@ async fn should_cancel_unauthorized_payment() { enums::CaptureMethod::Manual, ); let response = connector - .make_payment(authorize_data, WorldlineTest::get_payment_info()) + .authorize_payment(authorize_data, WorldlineTest::get_payment_info()) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Authorized); @@ -360,7 +363,7 @@ async fn should_fail_refund_with_invalid_payment_status() { enums::CaptureMethod::Manual, ); let response = connector - .make_payment(authorize_data, WorldlineTest::get_payment_info()) + .authorize_payment(authorize_data, WorldlineTest::get_payment_info()) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Authorized);