mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
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:
@ -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"}
|
||||
adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"
|
||||
@ -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" }
|
||||
|
||||
@ -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"}
|
||||
adyen.banks = "bangkok_bank,krungsri_bank,krung_thai_bank,the_siam_commercial_bank,kasikorn_bank"
|
||||
@ -1000,6 +1000,8 @@ pub enum WalletData {
|
||||
TwintRedirect {},
|
||||
/// Wallet data for Vipps Redirection
|
||||
VippsRedirect {},
|
||||
/// The wallet data for Touch n Go Redirection
|
||||
TouchNGoRedirect(Box<TouchNGoRedirection>),
|
||||
/// The wallet data for WeChat Pay Redirection
|
||||
WeChatPayRedirect(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 token
|
||||
|
||||
@ -597,6 +597,7 @@ pub enum PaymentMethodType {
|
||||
Sepa,
|
||||
Sofort,
|
||||
Swish,
|
||||
TouchNGo,
|
||||
Trustly,
|
||||
Twint,
|
||||
UpiCollect,
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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::Gcash
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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": [
|
||||
|
||||
Reference in New Issue
Block a user