mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor(ui_tests): move ui_tests to test_utils crate to reduce development time (#1822)
This commit is contained in:
2
.github/scripts/run_ui_tests.sh
vendored
2
.github/scripts/run_ui_tests.sh
vendored
@ -37,6 +37,6 @@ done
|
||||
|
||||
IN="$INPUT"
|
||||
for i in $(echo $IN | tr "," "\n"); do
|
||||
cargo test --package router --test connectors -- "${i}_ui::" --test-threads=1 >> tests/test_results.log 2>&1
|
||||
cargo test --package test_utils --test connectors -- "${i}_ui::" --test-threads=1 >> tests/test_results.log 2>&1
|
||||
done
|
||||
cat tests/test_results.log
|
||||
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -446,9 +446,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
|
||||
checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"event-listener",
|
||||
@ -4733,14 +4733,25 @@ dependencies = [
|
||||
name = "test_utils"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
"actix-web",
|
||||
"api_models",
|
||||
"async-trait",
|
||||
"awc",
|
||||
"clap",
|
||||
"derive_deref",
|
||||
"masking",
|
||||
"router",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_urlencoded",
|
||||
"serial_test",
|
||||
"thirtyfour",
|
||||
"time 0.3.22",
|
||||
"tokio",
|
||||
"toml 0.7.4",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@ -21,10 +21,10 @@ impl utils::Connector for {{project-name | downcase | pascal_case}}Test {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.{{project-name | downcase}}
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration").into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ use router::{
|
||||
};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use crate::connector_auth::ConnectorAuthentication;
|
||||
use crate::{connector_auth::ConnectorAuthentication, utils};
|
||||
|
||||
fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
|
||||
let auth = ConnectorAuthentication::new()
|
||||
@ -28,7 +28,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
|
||||
status: enums::AttemptStatus::default(),
|
||||
auth_type: enums::AuthenticationType::NoThreeDs,
|
||||
payment_method: enums::PaymentMethod::Card,
|
||||
connector_auth_type: auth.into(),
|
||||
connector_auth_type: utils::to_connector_auth_type(auth.into()),
|
||||
description: Some("This is a test".to_string()),
|
||||
return_url: None,
|
||||
request: types::PaymentsAuthorizeData {
|
||||
@ -105,7 +105,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
|
||||
status: enums::AttemptStatus::default(),
|
||||
payment_method: enums::PaymentMethod::Card,
|
||||
auth_type: enums::AuthenticationType::NoThreeDs,
|
||||
connector_auth_type: auth.into(),
|
||||
connector_auth_type: utils::to_connector_auth_type(auth.into()),
|
||||
description: Some("This is a test".to_string()),
|
||||
return_url: None,
|
||||
request: types::RefundsData {
|
||||
|
||||
@ -32,10 +32,11 @@ impl utils::Connector for AdyenTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.adyen_uk
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,11 @@ impl Connector for AirwallexTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.airwallex
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,11 @@ impl utils::Connector for AuthorizedotnetTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.authorizedotnet
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for BamboraTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.bambora
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl utils::Connector for BitpayTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.bitpay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,11 @@ impl utils::Connector for BluesnapTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.bluesnap
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -18,10 +18,11 @@ impl utils::Connector for BokuTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.boku
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,11 @@ impl utils::Connector for CashtocodeTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.cashtocode
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -19,10 +19,11 @@ impl utils::Connector for CheckoutTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.checkout
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,11 @@ impl utils::Connector for CoinbaseTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.coinbase
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl utils::Connector for CryptopayTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.cryptopay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for Cybersource {
|
||||
}
|
||||
}
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.cybersource
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
fn get_name(&self) -> String {
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for DlocalTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.dlocal
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl utils::Connector for DummyConnectorTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.dummyconnector
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for FiservTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.fiserv
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for ForteTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.forte
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl Connector for Globalpay {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.globalpay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,11 @@ impl utils::Connector for GlobepayTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.globepay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,11 @@ impl Connector for IatapayTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.iatapay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -7,22 +7,15 @@
|
||||
use test_utils::connector_auth;
|
||||
|
||||
mod aci;
|
||||
mod aci_ui;
|
||||
mod adyen;
|
||||
mod adyen_uk_ui;
|
||||
mod airwallex;
|
||||
mod airwallex_ui;
|
||||
mod authorizedotnet;
|
||||
mod authorizedotnet_ui;
|
||||
mod bambora;
|
||||
mod bambora_ui;
|
||||
mod bitpay;
|
||||
mod bluesnap;
|
||||
mod bluesnap_ui;
|
||||
mod boku;
|
||||
mod cashtocode;
|
||||
mod checkout;
|
||||
mod checkout_ui;
|
||||
mod coinbase;
|
||||
mod cryptopay;
|
||||
mod cybersource;
|
||||
@ -32,43 +25,29 @@ mod dummyconnector;
|
||||
mod fiserv;
|
||||
mod forte;
|
||||
mod globalpay;
|
||||
mod globalpay_ui;
|
||||
mod globepay;
|
||||
mod iatapay;
|
||||
mod mollie;
|
||||
mod mollie_ui;
|
||||
mod multisafepay;
|
||||
mod multisafepay_ui;
|
||||
mod nexinets;
|
||||
mod nexinets_ui;
|
||||
mod nmi;
|
||||
mod noon;
|
||||
mod noon_ui;
|
||||
mod nuvei;
|
||||
mod nuvei_ui;
|
||||
mod opayo;
|
||||
mod opennode;
|
||||
mod payeezy;
|
||||
mod payme;
|
||||
mod paypal;
|
||||
mod paypal_ui;
|
||||
mod payu;
|
||||
mod payu_ui;
|
||||
mod powertranz;
|
||||
mod rapyd;
|
||||
mod selenium;
|
||||
mod shift4;
|
||||
mod shift4_ui;
|
||||
mod stax;
|
||||
mod stripe;
|
||||
mod stripe_ui;
|
||||
mod trustpay;
|
||||
mod trustpay_3ds_ui;
|
||||
mod tsys;
|
||||
mod utils;
|
||||
mod wise;
|
||||
mod worldline;
|
||||
mod worldline_ui;
|
||||
mod worldpay;
|
||||
mod zen;
|
||||
mod zen_ui;
|
||||
|
||||
@ -19,10 +19,11 @@ impl utils::Connector for MollieTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.mollie
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl utils::Connector for MultisafepayTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.multisafepay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,11 @@ impl utils::Connector for NexinetsTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.nexinets
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,11 @@ impl utils::Connector for NmiTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.nmi
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,11 @@ impl utils::Connector for NoonTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.noon
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +26,11 @@ impl utils::Connector for NuveiTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.nuvei
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,11 @@ impl utils::Connector for OpayoTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.opayo
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl utils::Connector for OpennodeTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.opennode
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -28,10 +28,11 @@ impl utils::Connector for PayeezyTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.payeezy
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,11 @@ impl utils::Connector for PaymeTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.payme
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl Connector for PaypalTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.paypal
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -18,10 +18,11 @@ impl Connector for Payu {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.payu
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,11 @@ impl utils::Connector for PowertranzTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.powertranz
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for Rapyd {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.rapyd
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,11 @@ impl utils::Connector for Shift4Test {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.shift4
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,11 @@ impl utils::Connector for StaxTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.stax
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ impl utils::Connector for Stripe {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.stripe
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,11 @@ impl utils::Connector for TrustpayTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.trustpay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -23,10 +23,11 @@ impl utils::Connector for TsysTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.tsys
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ use router::{
|
||||
routes, services,
|
||||
types::{self, api, storage::enums, AccessToken, PaymentAddress, RouterData},
|
||||
};
|
||||
use test_utils::connector_auth::ConnectorAuthType;
|
||||
use tokio::sync::oneshot;
|
||||
use wiremock::{Mock, MockServer};
|
||||
|
||||
@ -994,3 +995,33 @@ pub fn get_connector_metadata(
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_connector_auth_type(auth_type: ConnectorAuthType) -> types::ConnectorAuthType {
|
||||
match auth_type {
|
||||
ConnectorAuthType::HeaderKey { api_key } => types::ConnectorAuthType::HeaderKey { api_key },
|
||||
ConnectorAuthType::BodyKey { api_key, key1 } => {
|
||||
types::ConnectorAuthType::BodyKey { api_key, key1 }
|
||||
}
|
||||
ConnectorAuthType::SignatureKey {
|
||||
api_key,
|
||||
key1,
|
||||
api_secret,
|
||||
} => types::ConnectorAuthType::SignatureKey {
|
||||
api_key,
|
||||
key1,
|
||||
api_secret,
|
||||
},
|
||||
ConnectorAuthType::MultiAuthKey {
|
||||
api_key,
|
||||
key1,
|
||||
api_secret,
|
||||
key2,
|
||||
} => types::ConnectorAuthType::MultiAuthKey {
|
||||
api_key,
|
||||
key1,
|
||||
api_secret,
|
||||
key2,
|
||||
},
|
||||
_ => types::ConnectorAuthType::NoKey,
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,10 +29,11 @@ impl utils::Connector for WiseTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.wise
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +26,11 @@ impl utils::Connector for WorldlineTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
ConnectorAuthentication::new()
|
||||
.worldline
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -27,10 +27,11 @@ impl utils::Connector for Worldpay {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.worldpay
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -25,10 +25,11 @@ impl utils::Connector for ZenTest {
|
||||
}
|
||||
|
||||
fn get_auth_token(&self) -> types::ConnectorAuthType {
|
||||
types::ConnectorAuthType::from(
|
||||
utils::to_connector_auth_type(
|
||||
connector_auth::ConnectorAuthentication::new()
|
||||
.zen
|
||||
.expect("Missing connector authentication configuration"),
|
||||
.expect("Missing connector authentication configuration")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -13,13 +13,24 @@ dummy_connector = ["api_models/dummy_connector"]
|
||||
payouts = []
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.3.2", default-features = false, features = ["derive"] }
|
||||
async-trait = "0.1.68"
|
||||
actix-web = "4.3.1"
|
||||
clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] }
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
serde_json = "1.0.96"
|
||||
serde_path_to_error = "0.1.11"
|
||||
toml = "0.7.4"
|
||||
serial_test = "2.0.0"
|
||||
serde_urlencoded = "0.7.1"
|
||||
actix-http = "3.3.1"
|
||||
awc = { version = "3.1.1", features = ["rustls"] }
|
||||
derive_deref = "1.1.1"
|
||||
rand = "0.8.5"
|
||||
thirtyfour = "0.31.0"
|
||||
time = { version = "0.3.21", features = ["macros"] }
|
||||
tokio = "1.28.2"
|
||||
uuid = { version = "1.3.3", features = ["serde", "v4"] }
|
||||
|
||||
# First party crates
|
||||
router = { version = "0.2.0", path = "../router" }
|
||||
api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] }
|
||||
masking = { version = "0.1.0", path = "../masking" }
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use std::{collections::HashMap, env};
|
||||
|
||||
use masking::Secret;
|
||||
use router::types::ConnectorAuthType;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@ -289,3 +288,28 @@ pub struct AutomationConfigs {
|
||||
pub adyen_bancontact_username: Option<String>,
|
||||
pub adyen_bancontact_pass: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, serde::Deserialize)]
|
||||
#[serde(tag = "auth_type")]
|
||||
pub enum ConnectorAuthType {
|
||||
HeaderKey {
|
||||
api_key: Secret<String>,
|
||||
},
|
||||
BodyKey {
|
||||
api_key: Secret<String>,
|
||||
key1: Secret<String>,
|
||||
},
|
||||
SignatureKey {
|
||||
api_key: Secret<String>,
|
||||
key1: Secret<String>,
|
||||
api_secret: Secret<String>,
|
||||
},
|
||||
MultiAuthKey {
|
||||
api_key: Secret<String>,
|
||||
key1: Secret<String>,
|
||||
api_secret: Secret<String>,
|
||||
key2: Secret<String>,
|
||||
},
|
||||
#[default]
|
||||
NoKey,
|
||||
}
|
||||
|
||||
@ -5,8 +5,7 @@ use std::{
|
||||
|
||||
use clap::{arg, command, Parser};
|
||||
use masking::PeekInterface;
|
||||
use router::types::ConnectorAuthType;
|
||||
use test_utils::connector_auth::ConnectorAuthenticationMap;
|
||||
use test_utils::connector_auth::{ConnectorAuthType, ConnectorAuthenticationMap};
|
||||
|
||||
// Just by the name of the connector, this function generates the name of the collection
|
||||
// Example: CONNECTOR_NAME="stripe" -> OUTPUT: postman/stripe.postman_collection.json
|
||||
|
||||
27
crates/test_utils/tests/connectors/main.rs
Normal file
27
crates/test_utils/tests/connectors/main.rs
Normal file
@ -0,0 +1,27 @@
|
||||
#![allow(
|
||||
clippy::expect_used,
|
||||
clippy::panic,
|
||||
clippy::unwrap_in_result,
|
||||
clippy::unwrap_used
|
||||
)]
|
||||
mod aci_ui;
|
||||
mod adyen_uk_ui;
|
||||
mod airwallex_ui;
|
||||
mod authorizedotnet_ui;
|
||||
mod bambora_ui;
|
||||
mod bluesnap_ui;
|
||||
mod checkout_ui;
|
||||
mod globalpay_ui;
|
||||
mod mollie_ui;
|
||||
mod multisafepay_ui;
|
||||
mod nexinets_ui;
|
||||
mod noon_ui;
|
||||
mod nuvei_ui;
|
||||
mod paypal_ui;
|
||||
mod payu_ui;
|
||||
mod selenium;
|
||||
mod shift4_ui;
|
||||
mod stripe_ui;
|
||||
mod trustpay_3ds_ui;
|
||||
mod worldline_ui;
|
||||
mod zen_ui;
|
||||
@ -1,3 +1,10 @@
|
||||
#![allow(
|
||||
clippy::expect_used,
|
||||
clippy::panic,
|
||||
clippy::unwrap_in_result,
|
||||
clippy::missing_panics_doc,
|
||||
clippy::unwrap_used
|
||||
)]
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
env,
|
||||
@ -8,10 +15,9 @@ use std::{
|
||||
|
||||
use async_trait::async_trait;
|
||||
use serde_json::json;
|
||||
use test_utils::connector_auth;
|
||||
use thirtyfour::{components::SelectElement, prelude::*, WebDriver};
|
||||
|
||||
use crate::connector_auth;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Event<'a> {
|
||||
RunIf(Assert<'a>, Vec<Event<'a>>),
|
||||
@ -729,7 +735,6 @@ pub fn should_ignore_test(name: &str) -> bool {
|
||||
.clone();
|
||||
let tests_to_ignore: HashSet<String> =
|
||||
serde_json::from_value(conf).unwrap_or_else(|_| HashSet::new());
|
||||
// let tests_to_ignore = conf.automation_configs.unwrap().tests_to_ignore.unwrap_or_else(|| HashSet::new());
|
||||
let modules: Vec<_> = name.split("::").collect();
|
||||
let file_match = format!("{}::*", <&str>::clone(&modules[1]));
|
||||
let module_name = modules[1..3].join("::");
|
||||
@ -741,6 +746,7 @@ pub fn get_browser() -> String {
|
||||
"firefox".to_string()
|
||||
}
|
||||
|
||||
// based on the browser settings build profile info
|
||||
pub fn make_capabilities(browser: &str) -> Capabilities {
|
||||
match browser {
|
||||
"firefox" => {
|
||||
170
crates/test_utils/tests/sample_auth.toml
Normal file
170
crates/test_utils/tests/sample_auth.toml
Normal file
@ -0,0 +1,170 @@
|
||||
# Copy this file and rename it as `auth.toml`
|
||||
# Each of the connector's section is optional
|
||||
|
||||
[aci]
|
||||
api_key = "Bearer MyApiKey"
|
||||
key1 = "MyEntityId"
|
||||
|
||||
[adyen]
|
||||
api_key = "Bearer MyApiKey"
|
||||
key1 = "MerchantId"
|
||||
api_secret = "Secondary key"
|
||||
|
||||
[authorizedotnet]
|
||||
api_key = "MyMerchantName"
|
||||
key1 = "MyTransactionKey"
|
||||
|
||||
[checkout]
|
||||
api_key = "PublicKey"
|
||||
api_secret = "SecretKey"
|
||||
key1 = "MyProcessingChannelId"
|
||||
|
||||
[cybersource]
|
||||
api_key = "Bearer MyApiKey"
|
||||
key1 = "Merchant id"
|
||||
api_secret = "Secret key"
|
||||
|
||||
[shift4]
|
||||
api_key = "Bearer MyApiKey"
|
||||
|
||||
[worldpay]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
|
||||
[payu]
|
||||
api_key = "Bearer MyApiKey"
|
||||
key1 = "MerchantPosId"
|
||||
|
||||
[globalpay]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
|
||||
[rapyd]
|
||||
api_key = "access_key"
|
||||
key1 = "secret_key"
|
||||
|
||||
[fiserv]
|
||||
api_key = "MyApiKey"
|
||||
key1 = "MerchantID"
|
||||
api_secret = "MySecretKey"
|
||||
|
||||
[worldline]
|
||||
key1 = "Merchant Id"
|
||||
api_key = "API Key"
|
||||
api_secret = "API Secret Key"
|
||||
|
||||
[multisafepay]
|
||||
api_key = "API Key"
|
||||
|
||||
[dlocal]
|
||||
key1 = "key1"
|
||||
api_key = "api_key"
|
||||
api_secret = "secret"
|
||||
|
||||
[bambora]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
|
||||
[nmi]
|
||||
api_key = "NMI API Key"
|
||||
|
||||
[nuvei]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
api_secret = "secret"
|
||||
|
||||
[paypal]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
|
||||
[mollie]
|
||||
api_key = "API Key"
|
||||
|
||||
[forte]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
key2 = "key2"
|
||||
api_secret = "api_secret"
|
||||
|
||||
|
||||
[coinbase]
|
||||
api_key = "API Key"
|
||||
|
||||
[opennode]
|
||||
api_key = "API Key"
|
||||
|
||||
[nexinets]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
|
||||
[payeezy]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
api_secret = "secret"
|
||||
|
||||
[bitpay]
|
||||
api_key = "API Key"
|
||||
|
||||
[iatapay]
|
||||
key1 = "key1"
|
||||
api_key = "api_key"
|
||||
api_secret = "secrect"
|
||||
|
||||
[dummyconnector]
|
||||
api_key = "API Key"
|
||||
|
||||
[noon]
|
||||
api_key = "Application API KEY"
|
||||
api_secret = "Application Identifier"
|
||||
key1 = "Business Identifier"
|
||||
|
||||
[opayo]
|
||||
api_key="API Key"
|
||||
|
||||
[wise]
|
||||
api_key = "API Key"
|
||||
key1 = "Profile ID"
|
||||
|
||||
[automation_configs]
|
||||
hs_base_url="http://localhost:8080"
|
||||
hs_test_browser="firefox"
|
||||
chrome_profile_path=""
|
||||
firefox_profile_path=""
|
||||
pypl_email=""
|
||||
pypl_pass=""
|
||||
gmail_email=""
|
||||
gmail_pass=""
|
||||
|
||||
[payme]
|
||||
# Open api key
|
||||
api_key="seller payme id"
|
||||
key1="payme client key"
|
||||
|
||||
[cryptopay]
|
||||
api_key = "api_key"
|
||||
key1 = "key1"
|
||||
|
||||
[cashtocode]
|
||||
api_key="Classic PMT API Key"
|
||||
key1 = "Evoucher PMT API Key"
|
||||
|
||||
|
||||
[tsys]
|
||||
api_key="device id"
|
||||
key1 = "transaction key"
|
||||
api_secret = "developer id"
|
||||
|
||||
[globepay]
|
||||
api_key = "Partner code"
|
||||
key1 = "Credential code"
|
||||
|
||||
[powertranz]
|
||||
api_key="PowerTranz-PowerTranzPassword"
|
||||
key1 = "PowerTranz-PowerTranzId"
|
||||
|
||||
[stax]
|
||||
api_key="API Key"
|
||||
|
||||
[boku]
|
||||
api_key="API Key"
|
||||
key1 = "transaction key"
|
||||
Reference in New Issue
Block a user