mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
feat(connector): [Adyen] implement Alipay HK for Adyen (#1547)
This commit is contained in:
@ -233,6 +233,7 @@ bancontact_card = {country = "BE", currency = "EUR"}
|
||||
ach = {country = "US", currency = "USD"}
|
||||
bacs = {country = "UK", currency = "GBP"}
|
||||
sepa = {country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT", currency = "EUR"}
|
||||
ali_pay_hk = {country = "HK", currency = "HKD"}
|
||||
|
||||
[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" }
|
||||
|
||||
@ -416,6 +416,7 @@ pub enum PaymentMethodType {
|
||||
Affirm,
|
||||
AfterpayClearpay,
|
||||
AliPay,
|
||||
AliPayHk,
|
||||
ApplePay,
|
||||
Bacs,
|
||||
BancontactCard,
|
||||
|
||||
@ -840,6 +840,8 @@ pub struct BankDebitBilling {
|
||||
pub enum WalletData {
|
||||
/// The wallet data for Ali Pay redirect
|
||||
AliPayRedirect(AliPayRedirection),
|
||||
/// The wallet data for Ali Pay HK redirect
|
||||
AliPayHkRedirect(AliPayHkRedirection),
|
||||
/// The wallet data for Apple pay
|
||||
ApplePay(ApplePayWalletData),
|
||||
/// Wallet data for apple pay redirect flow
|
||||
@ -903,6 +905,9 @@ pub struct PaypalRedirection {}
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct AliPayRedirection {}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct AliPayHkRedirection {}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct MobilePayRedirection {}
|
||||
|
||||
|
||||
@ -261,6 +261,7 @@ pub enum AdyenPaymentMethod<'a> {
|
||||
AdyenPaypal(Box<AdyenPaypal>),
|
||||
AfterPay(Box<AdyenPayLaterData>),
|
||||
AliPay(Box<AliPayData>),
|
||||
AliPayHk(Box<AliPayHkData>),
|
||||
ApplePay(Box<AdyenApplePay>),
|
||||
BancontactCard(Box<BancontactCardData>),
|
||||
Blik(Box<BlikRedirectionData>),
|
||||
@ -613,6 +614,12 @@ pub struct AliPayData {
|
||||
payment_type: PaymentType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AliPayHkData {
|
||||
#[serde(rename = "type")]
|
||||
payment_type: PaymentType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AdyenGPay {
|
||||
#[serde(rename = "type")]
|
||||
@ -666,6 +673,8 @@ pub enum PaymentType {
|
||||
Affirm,
|
||||
Afterpaytouch,
|
||||
Alipay,
|
||||
#[serde(rename = "alipay_hk")]
|
||||
AlipayHk,
|
||||
Applepay,
|
||||
Blik,
|
||||
Eps,
|
||||
@ -1088,6 +1097,12 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
|
||||
};
|
||||
Ok(AdyenPaymentMethod::AliPay(Box::new(alipay_data)))
|
||||
}
|
||||
api_models::payments::WalletData::AliPayHkRedirect(_) => {
|
||||
let alipay_hk_data = AliPayHkData {
|
||||
payment_type: PaymentType::AlipayHk,
|
||||
};
|
||||
Ok(AdyenPaymentMethod::AliPayHk(Box::new(alipay_hk_data)))
|
||||
}
|
||||
api_models::payments::WalletData::MbWayRedirect(data) => {
|
||||
let mbway_data = MbwayData {
|
||||
payment_type: PaymentType::Mbway,
|
||||
|
||||
@ -164,6 +164,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::AddressDetails,
|
||||
api_models::payments::BankDebitData,
|
||||
api_models::payments::AliPayRedirection,
|
||||
api_models::payments::AliPayHkRedirection,
|
||||
api_models::payments::MbWayRedirection,
|
||||
api_models::payments::MobilePayRedirection,
|
||||
api_models::payments::WeChatPayRedirection,
|
||||
|
||||
@ -132,6 +132,29 @@ async fn should_make_adyen_klarna_mandate_payment(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn should_make_adyen_alipay_hk_payment(c: WebDriver) -> Result<(), WebDriverError> {
|
||||
let conn = AdyenSeleniumTest {};
|
||||
conn.make_redirection_payment(
|
||||
c,
|
||||
vec![
|
||||
Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/162"))),
|
||||
Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
|
||||
Event::EitherOr(
|
||||
Assert::IsPresent("Payment Method Not Available"),
|
||||
vec![Event::Assert(Assert::IsPresent(
|
||||
" (Note: these error messages are not visible on the live platform) ",
|
||||
))],
|
||||
vec![
|
||||
Event::Trigger(Trigger::Click(By::Css("button[value='authorised']"))),
|
||||
Event::Assert(Assert::IsPresent("succeeded")),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn should_make_adyen_gpay_payment_test() {
|
||||
@ -168,4 +191,10 @@ fn should_make_adyen_3ds_payment_success_test() {
|
||||
tester!(should_make_adyen_3ds_payment_success);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn should_make_adyen_alipay_hk_payment_test() {
|
||||
tester!(should_make_adyen_alipay_hk_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
|
||||
|
||||
@ -676,6 +676,7 @@ pub enum PaymentMethodType {
|
||||
Affirm,
|
||||
AfterpayClearpay,
|
||||
AliPay,
|
||||
AliPayHk,
|
||||
ApplePay,
|
||||
Bacs,
|
||||
BancontactCard,
|
||||
|
||||
@ -1793,6 +1793,9 @@
|
||||
"AliPayRedirection": {
|
||||
"type": "object"
|
||||
},
|
||||
"AliPayHkRedirection": {
|
||||
"type": "object"
|
||||
},
|
||||
"AmountInfo": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@ -8114,6 +8117,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ali_pay_hk"
|
||||
],
|
||||
"properties": {
|
||||
"ali_pay_hk": {
|
||||
"$ref": "#/components/schemas/AliPayHkRedirection"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user