mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	fix(connector): fix wordline tests and visa card issuer support (#688)
This commit is contained in:
		| @ -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<CardIssuer, Error> { | ||||
|         get_card_issuer(self.card_number.peek().clone().as_str()) | ||||
|         let card: Secret<String, pii::CardNumber> = self | ||||
|             .card_number | ||||
|             .clone() | ||||
|             .map(|card| card.split_whitespace().collect()); | ||||
|         get_card_issuer(card.peek().clone().as_str()) | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -127,6 +127,7 @@ impl TryFrom<utils::CardIssuer> 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", | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Arjun Karthik
					Arjun Karthik