Skip to content

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

feat(connector): [Adyen] implement Alipay HK for Adyen (#1547)

AkshayaFoiger2f9c28938f95
diff --git a/config/development.toml b/config/development.toml
index ce0ca1ce6e..de5878a77b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -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" }
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 60c45f22e8..26e96165ba 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -416,6 +416,7 @@ pub enum PaymentMethodType {
Affirm,
AfterpayClearpay,
AliPay,
+ AliPayHk,
ApplePay,
Bacs,
BancontactCard,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index bbdbe3c76f..2046164644 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -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 {}
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index bf0379eca5..7618c8f879 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -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,
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index e4a4b43986..e3f876beaa 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -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,
diff --git a/crates/router/tests/connectors/adyen_uk_ui.rs b/crates/router/tests/connectors/adyen_uk_ui.rs
index c07a87643f..64658db065 100644
--- a/crates/router/tests/connectors/adyen_uk_ui.rs
+++ b/crates/router/tests/connectors/adyen_uk_ui.rs
@@ -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&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
diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs
index cc6acc4d95..978e414f3a 100644
--- a/crates/storage_models/src/enums.rs
+++ b/crates/storage_models/src/enums.rs
@@ -676,6 +676,7 @@ pub enum PaymentMethodType {
Affirm,
AfterpayClearpay,
AliPay,
+ AliPayHk,
ApplePay,
Bacs,
BancontactCard,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 1aa078e934..68a7128e4b 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -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": [