feat(connector): [Adyen] implement Touch n Go for Adyen (#1588)

Co-authored-by: Sangamesh Kulkarni <59434228+Sangamesh26@users.noreply.github.com>
Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
This commit is contained in:
AkshayaFoiger
2023-07-20 23:59:22 +05:30
committed by GitHub
parent 0589c572c4
commit 8e45e734c8
11 changed files with 64 additions and 8 deletions

View File

@ -320,10 +320,10 @@ payout_eligibility = true # Defaults the eligibility of a payout method to tru
[pm_filters.adyen] [pm_filters.adyen]
online_banking_fpx = {country = "MY", currency = "MYR"} online_banking_fpx = {country = "MY", currency = "MYR"}
online_banking_thailand = {country = "TH", currency = "THB"} online_banking_thailand = {country = "TH", currency = "THB"}
touch_n_go = {country = "MY", currency = "MYR"}
[bank_config.online_banking_fpx] [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] [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"

View File

@ -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" } 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] [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] [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] [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" } 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"} gcash = {country = "PH", currency = "PHP"}
online_banking_fpx = {country = "MY", currency = "MYR"} online_banking_fpx = {country = "MY", currency = "MYR"}
online_banking_thailand = {country = "TH", currency = "THB"} online_banking_thailand = {country = "TH", currency = "THB"}
touch_n_go = {country = "MY", currency = "MYR"}
[pm_filters.braintree] [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" } 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" }

View File

@ -203,9 +203,10 @@ payout_eligibility = true
[pm_filters.adyen] [pm_filters.adyen]
online_banking_fpx = {country = "MY", currency = "MYR"} online_banking_fpx = {country = "MY", currency = "MYR"}
online_banking_thailand = {country = "TH", currency = "THB"} online_banking_thailand = {country = "TH", currency = "THB"}
touch_n_go = {country = "MY", currency = "MYR"}
[bank_config.online_banking_fpx] [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] [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"

View File

@ -1000,6 +1000,8 @@ pub enum WalletData {
TwintRedirect {}, TwintRedirect {},
/// Wallet data for Vipps Redirection /// Wallet data for Vipps Redirection
VippsRedirect {}, VippsRedirect {},
/// The wallet data for Touch n Go Redirection
TouchNGoRedirect(Box<TouchNGoRedirection>),
/// The wallet data for WeChat Pay Redirection /// The wallet data for WeChat Pay Redirection
WeChatPayRedirect(Box<WeChatPayRedirection>), WeChatPayRedirect(Box<WeChatPayRedirection>),
/// The wallet data for WeChat Pay /// The wallet data for WeChat Pay
@ -1100,6 +1102,9 @@ pub struct PayPalWalletData {
pub token: String, 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)] #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GpayTokenizationData { pub struct GpayTokenizationData {
/// The type of the token /// The type of the token

View File

@ -597,6 +597,7 @@ pub enum PaymentMethodType {
Sepa, Sepa,
Sofort, Sofort,
Swish, Swish,
TouchNGo,
Trustly, Trustly,
Twint, Twint,
UpiCollect, UpiCollect,

View File

@ -1585,6 +1585,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::Vipps => Self::Wallet, PaymentMethodType::Vipps => Self::Wallet,
PaymentMethodType::Walley => Self::PayLater, PaymentMethodType::Walley => Self::PayLater,
PaymentMethodType::WeChatPay => Self::Wallet, PaymentMethodType::WeChatPay => Self::Wallet,
PaymentMethodType::TouchNGo => Self::Wallet,
} }
} }
} }

View File

@ -323,6 +323,8 @@ pub enum AdyenPaymentMethod<'a> {
MobilePay(Box<MobilePayData>), MobilePay(Box<MobilePayData>),
#[serde(rename = "momo_wallet")] #[serde(rename = "momo_wallet")]
Momo(Box<MomoData>), Momo(Box<MomoData>),
#[serde(rename = "touchngo")]
TouchNGo(Box<TouchNGoData>),
OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>), OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>),
OnlineBankingFinland(Box<OnlineBankingFinlandData>), OnlineBankingFinland(Box<OnlineBankingFinlandData>),
OnlineBankingPoland(Box<OnlineBankingPolandData>), OnlineBankingPoland(Box<OnlineBankingPolandData>),
@ -749,6 +751,9 @@ pub struct GcashData {}
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MomoData {} pub struct MomoData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TouchNGoData {}
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdyenGPay { pub struct AdyenGPay {
#[serde(rename = "type")] #[serde(rename = "type")]
@ -863,6 +868,8 @@ pub enum PaymentType {
#[serde(rename = "networkToken")] #[serde(rename = "networkToken")]
NetworkToken, NetworkToken,
Trustly, Trustly,
#[serde(rename = "touchngo")]
TouchNGo,
Walley, Walley,
#[serde(rename = "wechatpayWeb")] #[serde(rename = "wechatpayWeb")]
WeChatPayWeb, WeChatPayWeb,
@ -1390,6 +1397,10 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
let momo_data = MomoData {}; let momo_data = MomoData {};
Ok(AdyenPaymentMethod::Momo(Box::new(momo_data))) 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) => { api_models::payments::WalletData::MbWayRedirect(data) => {
let mbway_data = MbwayData { let mbway_data = MbwayData {
payment_type: PaymentType::Mbway, payment_type: PaymentType::Mbway,

View File

@ -178,6 +178,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::AliPayQr, api_models::payments::AliPayQr,
api_models::payments::AliPayRedirection, api_models::payments::AliPayRedirection,
api_models::payments::MomoRedirection, api_models::payments::MomoRedirection,
api_models::payments::TouchNGoRedirection,
api_models::payments::GcashRedirection, api_models::payments::GcashRedirection,
api_models::payments::KakaoPayRedirection, api_models::payments::KakaoPayRedirection,
api_models::payments::AliPayHkRedirection, api_models::payments::AliPayHkRedirection,

View File

@ -177,6 +177,7 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::SamsungPay | api_enums::PaymentMethodType::SamsungPay
| api_enums::PaymentMethodType::Twint | api_enums::PaymentMethodType::Twint
| api_enums::PaymentMethodType::Vipps | api_enums::PaymentMethodType::Vipps
| api_enums::PaymentMethodType::TouchNGo
| api_enums::PaymentMethodType::WeChatPay | api_enums::PaymentMethodType::WeChatPay
| api_enums::PaymentMethodType::GoPay | api_enums::PaymentMethodType::GoPay
| api_enums::PaymentMethodType::Gcash | api_enums::PaymentMethodType::Gcash

View File

@ -593,6 +593,21 @@ async fn should_make_adyen_online_banking_thailand_payment(
Ok(()) 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] #[test]
#[serial] #[serial]
#[ignore] #[ignore]
@ -773,4 +788,8 @@ fn should_make_adyen_online_banking_thailand_payment_test() {
tester!(should_make_adyen_online_banking_thailand_payment); tester!(should_make_adyen_online_banking_thailand_payment);
} }
// https://hs-payments-test.netlify.app/paypal-redirect?amount=70.00&country=US&currency=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);
}

View File

@ -7225,6 +7225,7 @@
"sepa", "sepa",
"sofort", "sofort",
"swish", "swish",
"touch_n_go",
"trustly", "trustly",
"twint", "twint",
"upi_collect", "upi_collect",
@ -9739,6 +9740,9 @@
} }
} }
}, },
"TouchNGoRedirection": {
"type": "object"
},
"UpdateApiKeyRequest": { "UpdateApiKeyRequest": {
"type": "object", "type": "object",
"description": "The request body for updating an API Key.", "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", "type": "object",
"required": [ "required": [