From 1a8753485c52329f2be40dbaa9ba77c90e8262ed Mon Sep 17 00:00:00 2001 From: Arjun Karthik Date: Wed, 1 Mar 2023 16:08:11 +0530 Subject: [PATCH] fix(connector): fix wordline card number validation issue (#695) --- .../router/src/connector/worldline/transformers.rs | 5 ++++- crates/router/tests/connectors/worldline.rs | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs index 4fadac89da..511efe511b 100644 --- a/crates/router/src/connector/worldline/transformers.rs +++ b/crates/router/src/connector/worldline/transformers.rs @@ -150,7 +150,10 @@ fn make_card_request( ); let expiry_date: Secret = Secret::new(secret_value); let card = Card { - card_number: ccard.card_number.clone(), + card_number: ccard + .card_number + .clone() + .map(|card| card.split_whitespace().collect()), cardholder_name: ccard.card_holder_name.clone(), cvv: ccard.card_cvc.clone(), expiry_date, diff --git a/crates/router/tests/connectors/worldline.rs b/crates/router/tests/connectors/worldline.rs index 4a10abe309..d70faaa424 100644 --- a/crates/router/tests/connectors/worldline.rs +++ b/crates/router/tests/connectors/worldline.rs @@ -91,7 +91,7 @@ impl WorldlineTest { #[actix_web::test] async fn should_requires_manual_authorization() { let authorize_data = WorldlineTest::get_payment_authorize_data( - "4012000033330026", + "5424 1802 7979 1732", "10", "25", "123", @@ -143,7 +143,7 @@ async fn should_throw_not_implemented_for_unsupported_issuer() { #[actix_web::test] async fn should_throw_missing_required_field_for_country() { let authorize_data = WorldlineTest::get_payment_authorize_data( - "4012000033330026", + "4012 0000 3333 0026", "10", "2025", "123", @@ -191,7 +191,7 @@ async fn should_fail_payment_for_invalid_cvc() { async fn should_sync_manual_auth_payment() { let connector = WorldlineTest {}; let authorize_data = WorldlineTest::get_payment_authorize_data( - "4012000033330026", + "4012 0000 3333 0026", "10", "2025", "123", @@ -257,7 +257,7 @@ async fn should_sync_auto_auth_payment() { async fn should_capture_authorized_payment() { let connector = WorldlineTest {}; let authorize_data = WorldlineTest::get_payment_authorize_data( - "4012000033330026", + "4012 0000 3333 0026", "10", "2025", "123", @@ -296,7 +296,7 @@ async fn should_fail_capture_payment() { async fn should_cancel_unauthorized_payment() { let connector = WorldlineTest {}; let authorize_data = WorldlineTest::get_payment_authorize_data( - "4012000033330026", + "4012 0000 3333 0026", "10", "25", "123", @@ -356,7 +356,7 @@ async fn should_fail_cancel_with_invalid_payment_id() { async fn should_fail_refund_with_invalid_payment_status() { let connector = WorldlineTest {}; let authorize_data = WorldlineTest::get_payment_authorize_data( - "4012000033330026", + "4012 0000 3333 0026", "10", "25", "123",