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
feat(connector): [Mollie] Implement Przelewy24 and BancontactCard Bank Redirects for Mollie connector (#1303)
Swangi Kumarif091be60cc62
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rsindex c8e6dad6db..e4f47ec93a 100644--- a/crates/router/src/connector/mollie/transformers.rs+++ b/crates/router/src/connector/mollie/transformers.rs@@ -1,4 +1,5 @@use api_models::payments;+use common_utils::pii::Email;use error_stack::IntoReport;use masking::Secret;use serde::{Deserialize, Serialize};@@ -46,6 +47,8 @@ pub enum PaymentMethodData {Ideal(Box<IdealMethodData>),Paypal(Box<PaypalMethodData>),Sofort,+ Przelewy24(Box<Przelewy24MethodData>),+ Bancontact,DirectDebit(Box<DirectDebitMethodData>),}@@ -68,6 +71,12 @@ pub struct PaypalMethodData {shipping_address: Option<Address>,}+#[derive(Debug, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct Przelewy24MethodData {+ billing_email: Option<Email>,+}+#[derive(Debug, Serialize)]#[serde(rename_all = "camelCase")]pub struct DirectDebitMethodData {@@ -159,6 +168,12 @@ impl TryFrom<&api_models::payments::BankRedirectData> for PaymentMethodData {})))}api_models::payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort),+ api_models::payments::BankRedirectData::Przelewy24 {+ billing_details, ..+ } => Ok(Self::Przelewy24(Box::new(Przelewy24MethodData {+ billing_email: billing_details.email.clone(),+ }))),+ api_models::payments::BankRedirectData::BancontactCard { .. } => Ok(Self::Bancontact),_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),}}diff --git a/crates/router/tests/connectors/mollie_ui.rs b/crates/router/tests/connectors/mollie_ui.rsindex 61ec5a7acc..15855b8681 100644--- a/crates/router/tests/connectors/mollie_ui.rs+++ b/crates/router/tests/connectors/mollie_ui.rs@@ -130,6 +130,52 @@ async fn should_make_mollie_giropay_payment(c: WebDriver) -> Result<(), WebDriveOk(())}+async fn should_make_mollie_bancontact_card_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = MollieSeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/86"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Assert(Assert::IsPresent("Test profile")),+ Event::Trigger(Trigger::Click(By::Css("input[value='paid']"))),+ Event::Trigger(Trigger::Click(By::Css(+ "button[class='button form__button']",+ ))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_mollie_przelewy24_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = MollieSeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/87"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Assert(Assert::IsPresent("Test profile")),+ Event::Trigger(Trigger::Click(By::Css("input[value='paid']"))),+ Event::Trigger(Trigger::Click(By::Css(+ "button[class='button form__button']",+ ))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}+#[test]#[serial]fn should_make_mollie_paypal_payment_test() {@@ -159,3 +205,15 @@ fn should_make_mollie_eps_payment_test() {fn should_make_mollie_giropay_payment_test() {tester!(should_make_mollie_giropay_payment);}++#[test]+#[serial]+fn should_make_mollie_bancontact_card_payment_test() {+ tester!(should_make_mollie_bancontact_card_payment);+}++#[test]+#[serial]+fn should_make_mollie_przelewy24_payment_test() {+ tester!(should_make_mollie_przelewy24_payment);+}diff --git a/crates/router/tests/connectors/selenium.rs b/crates/router/tests/connectors/selenium.rsindex 5936350dc8..6b54dd661b 100644--- a/crates/router/tests/connectors/selenium.rs+++ b/crates/router/tests/connectors/selenium.rs@@ -504,18 +504,23 @@ pub fn make_capabilities(s: &str) -> Capabilities {}}fn get_chrome_profile_path() -> Result<String, WebDriverError> {- let exe = env::current_exe()?;- let dir = exe.parent().expect("Executable must be in some directory");- let mut base_path = dir- .to_str()- .map(|str| {- let mut fp = str.split(MAIN_SEPARATOR).collect::<Vec<_>>();- fp.truncate(3);- fp.join(&MAIN_SEPARATOR.to_string())- })- .unwrap();- base_path.push_str(r#"/Library/Application\ Support/Google/Chrome/Default"#);- Ok(base_path)+ env::var("CHROME_PROFILE_PATH").map_or_else(+ |_| -> Result<String, WebDriverError> {+ let exe = env::current_exe()?;+ let dir = exe.parent().expect("Executable must be in some directory");+ let mut base_path = dir+ .to_str()+ .map(|str| {+ let mut fp = str.split(MAIN_SEPARATOR).collect::<Vec<_>>();+ fp.truncate(3);+ fp.join(&MAIN_SEPARATOR.to_string())+ })+ .unwrap();+ base_path.push_str(r#"/Library/Application\ Support/Google/Chrome/Default"#);+ Ok(base_path)+ },+ Ok,+ )}fn get_firefox_profile_path() -> Result<String, WebDriverError> {let exe = env::current_exe()?;