Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
test(connector): [Noon] Add test for Noon Payment methods (#1714)
Swangi Kumarif06e5dcd63af
diff --git a/.github/testcases/ui_tests.json b/.github/testcases/ui_tests.jsonindex e104c42a2f..8ab5803b5b 100644--- a/.github/testcases/ui_tests.json+++ b/.github/testcases/ui_tests.json@@ -1053,7 +1053,7 @@"id": 176,"name": "noon card success scenario","connector": "noon",- "request": "{\"amount\":10,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://google.com\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10},\"order_category\":\"pay\"}}"+ "request": "{\"amount\":10,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002503\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"},"177": {"id": 177,@@ -1276,5 +1276,17 @@"name": "ACI ALIPAY succes","connector": "aci","request": "{\"amount\":7000,\"currency\":\"EUR\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"AT\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"payment_method\":\"wallet\",\"payment_method_type\":\"ali_pay\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"wallet\":{\"ali_pay_redirect\":{}}}}"+ },+ "214": {+ "id": 214,+ "name": "NOON CARD 3DS MANDATES",+ "connector": "noon",+ "request": "{\"amount\":6540,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002503\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"in sit\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"AED\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"+ },+ "215": {+ "id": 215,+ "name": "card no 3ds mandates",+ "connector": "noon",+ "request": "{\"amount\":6540,\"currency\":\"AED\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":10,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://hs-payments-test.netlify.app/payments\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000002701\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"257\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"in sit\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"AED\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"CA\",\"line3\":\"CA\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"ip_address\":\"127.0.0.1\",\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\",\"order_details\":{\"product_name\":\"test\",\"quantity\":1,\"amount\":10}},\"connector_metadata\":{\"noon\":{\"order_category\":\"pay\"}}}"}}diff --git a/.github/workflows/connector-ui-sanity-tests.yml b/.github/workflows/connector-ui-sanity-tests.ymlindex 85dbf8e8de..d13b545c5c 100644--- a/.github/workflows/connector-ui-sanity-tests.yml+++ b/.github/workflows/connector-ui-sanity-tests.yml@@ -70,7 +70,7 @@ jobs:connector:# do not use more than 2 runners, try to group less time taking connectors together- stripe,airwallex,bluesnap,checkout,trustpay_3ds,payu,authorizedotnet,- - adyen_uk,shift4,worldline,multisafepay,paypal,mollie,aci+ - adyen_uk,shift4,worldline,multisafepay,paypal,mollie,aci,noonsteps:diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rsindex ffc711868e..5213e7466c 100644--- a/crates/router/tests/connectors/main.rs+++ b/crates/router/tests/connectors/main.rs@@ -41,6 +41,7 @@ mod multisafepay_ui;mod nexinets;mod nmi;mod noon;+mod noon_ui;mod nuvei;mod nuvei_ui;mod opayo;diff --git a/crates/router/tests/connectors/noon_ui.rs b/crates/router/tests/connectors/noon_ui.rsnew file mode 100644index 0000000000..39e45b9cbd--- /dev/null+++ b/crates/router/tests/connectors/noon_ui.rs@@ -0,0 +1,94 @@+use serial_test::serial;+use thirtyfour::{prelude::*, WebDriver};++use crate::{selenium::*, tester};++struct NoonSeleniumTest;++impl SeleniumTest for NoonSeleniumTest {+ fn get_connector_name(&self) -> String {+ "noon".to_string()+ }+}++async fn should_make_noon_3ds_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {+ let conn = NoonSeleniumTest {};+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/176"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::SwitchFrame(By::Id("redirectTo3ds1Frame"))),+ Event::Trigger(Trigger::SwitchFrame(By::Css("iframe[frameborder='0']"))),+ Event::Trigger(Trigger::SendKeys(By::Css("input.input-field"), "1234")),+ Event::Trigger(Trigger::Click(By::Css("input.button.primary"))),+ Event::Trigger(Trigger::Sleep(5)),+ Event::Assert(Assert::IsPresent("succeeded")),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_noon_3ds_mandate_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {+ let conn = NoonSeleniumTest {};+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/214"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::SwitchFrame(By::Id("redirectTo3ds1Frame"))),+ Event::Trigger(Trigger::SwitchFrame(By::Css("iframe[frameborder='0']"))),+ Event::Trigger(Trigger::SendKeys(By::Css("input.input-field"), "1234")),+ Event::Trigger(Trigger::Click(By::Css("input.button.primary"))),+ Event::Trigger(Trigger::Sleep(5)),+ Event::Assert(Assert::IsPresent("succeeded")),+ Event::Assert(Assert::IsPresent("Mandate ID")),+ Event::Assert(Assert::IsPresent("man_")), // mandate id starting with man_+ Event::Trigger(Trigger::Click(By::Css("a.btn"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Assert(Assert::IsPresent("succeeded")),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_noon_non_3ds_mandate_payment(+ web_driver: WebDriver,+) -> Result<(), WebDriverError> {+ let conn = NoonSeleniumTest {};+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/215"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Assert(Assert::IsPresent("succeeded")),+ Event::Assert(Assert::IsPresent("Mandate ID")),+ Event::Assert(Assert::IsPresent("man_")), // mandate id starting with man_+ Event::Trigger(Trigger::Click(By::Css("a.btn"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Assert(Assert::IsPresent("succeeded")),+ ],+ )+ .await?;+ Ok(())+}++#[test]+#[serial]+fn should_make_noon_3ds_payment_test() {+ tester!(should_make_noon_3ds_payment);+}++#[test]+#[serial]+fn should_make_noon_3ds_mandate_payment_test() {+ tester!(should_make_noon_3ds_mandate_payment);+}++#[test]+#[serial]+fn should_make_noon_non_3ds_mandate_payment_test() {+ tester!(should_make_noon_non_3ds_mandate_payment);+}