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): [Adyen] implement Touch n Go for Adyen (#1588)
AkshayaFoiger8e45e734c879
diff --git a/config/config.example.toml b/config/config.example.tomlindex c352ac83ac..c380e87286 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -320,10 +320,10 @@ payout_eligibility = true # Defaults the eligibility of a payout method to tru[pm_filters.adyen]online_banking_fpx = {country = "MY", currency = "MYR"}online_banking_thailand = {country = "TH", currency = "THB"}+touch_n_go = {country = "MY", currency = "MYR"}[bank_config.online_banking_fpx]-adyen = { banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,may_bank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"}-+adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,may_bank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"[bank_config.online_banking_thailand]-adyen = {banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"}\ No newline at end of file+adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"\ No newline at end of filediff --git a/config/development.toml b/config/development.tomlindex 694beb54ad..ad80fd3d31 100644--- a/config/development.toml+++ b/config/development.toml@@ -195,10 +195,10 @@ adyen = { banks = "blik_psp,place_zipko,m_bank,pay_with_ing,santander_przelew24,stripe = { banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_pekao_sa,banki_spbdzielcze,blik,bnp_paribas,boz,citi,credit_agricole,e_transfer_pocztowy24,getin_bank,idea_bank,inteligo,mbank_mtransfer,nest_przelew,noble_pay,pbac_z_ipko,plus_bank,santander_przelew24,toyota_bank,volkswagen_bank" }[bank_config.online_banking_fpx]-adyen = { banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,may_bank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"}+adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,may_bank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"[bank_config.online_banking_thailand]-adyen = {banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"}+adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"[pm_filters.default]google_pay = { country = "AL,DZ,AS,AO,AG,AR,AU,AT,AZ,BH,BY,BE,BR,BG,CA,CL,CO,HR,CZ,DK,DO,EG,EE,FI,FR,DE,GR,HK,HU,IN,ID,IE,IL,IT,JP,JO,KZ,KE,KW,LV,LB,LT,LU,MY,MX,NL,NZ,NO,OM,PK,PA,PE,PH,PL,PT,QA,RO,RU,SA,SG,SK,ZA,ES,LK,SE,CH,TW,TH,TR,UA,AE,GB,US,UY,VN" }@@ -258,6 +258,7 @@ momo = {country = "VN", currency = "VND"}gcash = {country = "PH", currency = "PHP"}online_banking_fpx = {country = "MY", currency = "MYR"}online_banking_thailand = {country = "TH", currency = "THB"}+touch_n_go = {country = "MY", currency = "MYR"}[pm_filters.braintree]paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex 19478f7d12..fb409a66ce 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -203,9 +203,10 @@ payout_eligibility = true[pm_filters.adyen]online_banking_fpx = {country = "MY", currency = "MYR"}online_banking_thailand = {country = "TH", currency = "THB"}+touch_n_go = {country = "MY", currency = "MYR"}[bank_config.online_banking_fpx]-adyen = { banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,may_bank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"}+adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,may_bank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"[bank_config.online_banking_thailand]-adyen = {banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"}\ No newline at end of file+adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"\ No newline at end of filediff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex c9de0ceb53..dd630b8905 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -1000,6 +1000,8 @@ pub enum WalletData {TwintRedirect {},/// Wallet data for Vipps RedirectionVippsRedirect {},+ /// The wallet data for Touch n Go Redirection+ TouchNGoRedirect(Box<TouchNGoRedirection>),/// The wallet data for WeChat Pay RedirectionWeChatPayRedirect(Box<WeChatPayRedirection>),/// The wallet data for WeChat Pay@@ -1100,6 +1102,9 @@ pub struct PayPalWalletData {pub token: String,}+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]+pub struct TouchNGoRedirection {}+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]pub struct GpayTokenizationData {/// The type of the tokendiff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 3c40aa1145..19644bba59 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -597,6 +597,7 @@ pub enum PaymentMethodType {Sepa,Sofort,Swish,+ TouchNGo,Trustly,Twint,UpiCollect,diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rsindex 1ec390fa05..94fc602b00 100644--- a/crates/common_enums/src/transformers.rs+++ b/crates/common_enums/src/transformers.rs@@ -1585,6 +1585,7 @@ impl From<PaymentMethodType> for PaymentMethod {PaymentMethodType::Vipps => Self::Wallet,PaymentMethodType::Walley => Self::PayLater,PaymentMethodType::WeChatPay => Self::Wallet,+ PaymentMethodType::TouchNGo => Self::Wallet,}}}diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rsindex bffe1cc849..891e1c8f60 100644--- a/crates/router/src/connector/adyen/transformers.rs+++ b/crates/router/src/connector/adyen/transformers.rs@@ -323,6 +323,8 @@ pub enum AdyenPaymentMethod<'a> {MobilePay(Box<MobilePayData>),#[serde(rename = "momo_wallet")]Momo(Box<MomoData>),+ #[serde(rename = "touchngo")]+ TouchNGo(Box<TouchNGoData>),OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>),OnlineBankingFinland(Box<OnlineBankingFinlandData>),OnlineBankingPoland(Box<OnlineBankingPolandData>),@@ -749,6 +751,9 @@ pub struct GcashData {}#[derive(Debug, Clone, Serialize, Deserialize)]pub struct MomoData {}+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct TouchNGoData {}+#[derive(Debug, Clone, Serialize, Deserialize)]pub struct AdyenGPay {#[serde(rename = "type")]@@ -863,6 +868,8 @@ pub enum PaymentType {#[serde(rename = "networkToken")]NetworkToken,Trustly,+ #[serde(rename = "touchngo")]+ TouchNGo,Walley,#[serde(rename = "wechatpayWeb")]WeChatPayWeb,@@ -1390,6 +1397,10 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {let momo_data = MomoData {};Ok(AdyenPaymentMethod::Momo(Box::new(momo_data)))}+ api_models::payments::WalletData::TouchNGoRedirect(_) => {+ let touch_n_go_data = TouchNGoData {};+ Ok(AdyenPaymentMethod::TouchNGo(Box::new(touch_n_go_data)))+ }api_models::payments::WalletData::MbWayRedirect(data) => {let mbway_data = MbwayData {payment_type: PaymentType::Mbway,diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rsindex ceb2897538..1e1d2c45be 100644--- a/crates/router/src/openapi.rs+++ b/crates/router/src/openapi.rs@@ -178,6 +178,7 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::AliPayQr,api_models::payments::AliPayRedirection,api_models::payments::MomoRedirection,+ api_models::payments::TouchNGoRedirection,api_models::payments::GcashRedirection,api_models::payments::KakaoPayRedirection,api_models::payments::AliPayHkRedirection,diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 525c045388..32e02792a3 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -177,6 +177,7 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {| api_enums::PaymentMethodType::SamsungPay| api_enums::PaymentMethodType::Twint| api_enums::PaymentMethodType::Vipps+ | api_enums::PaymentMethodType::TouchNGo| api_enums::PaymentMethodType::WeChatPay| api_enums::PaymentMethodType::GoPay| api_enums::PaymentMethodType::Gcashdiff --git a/crates/router/tests/connectors/adyen_uk_ui.rs b/crates/router/tests/connectors/adyen_uk_ui.rsindex 2482326aaf..b8fb90fb1a 100644--- a/crates/router/tests/connectors/adyen_uk_ui.rs+++ b/crates/router/tests/connectors/adyen_uk_ui.rs@@ -593,6 +593,21 @@ async fn should_make_adyen_online_banking_thailand_payment(Ok(())}+async fn should_make_adyen_touch_n_go_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {+ let conn = AdyenSeleniumTest {};+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/185"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Click(By::Css("button[value='authorised']"))),+ Event::Assert(Assert::IsPresent("succeeded")),+ ],+ )+ .await?;+ Ok(())+}+#[test]#[serial]#[ignore]@@ -773,4 +788,8 @@ fn should_make_adyen_online_banking_thailand_payment_test() {tester!(should_make_adyen_online_banking_thailand_payment);}-// https://hs-payments-test.netlify.app/paypal-redirect?amount=70.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=USD&apikey=dev_uFpxA0r6jjbVaxHSY3X0BZLL3erDUzvg3i51abwB1Bknu3fdiPxw475DQgnByn1z+#[test]+#[serial]+fn should_make_adyen_touch_n_go_payment_test() {+ tester!(should_make_adyen_touch_n_go_payment);+}diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.jsonindex e1a40ba791..bfeccebf67 100644--- a/openapi/openapi_spec.json+++ b/openapi/openapi_spec.json@@ -7225,6 +7225,7 @@"sepa","sofort","swish",+ "touch_n_go","trustly","twint","upi_collect",@@ -9739,6 +9740,9 @@}}},+ "TouchNGoRedirection": {+ "type": "object"+ },"UpdateApiKeyRequest": {"type": "object","description": "The request body for updating an API Key.",@@ -10013,6 +10017,17 @@}}},+ {+ "type": "object",+ "required": [+ "touch_n_go_redirect"+ ],+ "properties": {+ "touch_n_go_redirect": {+ "$ref": "#/components/schemas/TouchNGoRedirection"+ }+ }+ },{"type": "object","required": [