mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +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"}
|
ach = {country = "US", currency = "USD"}
|
||||||
bacs = {country = "UK", currency = "GBP"}
|
bacs = {country = "UK", currency = "GBP"}
|
||||||
sepa = {country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT", currency = "EUR"}
|
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]
|
[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" }
|
||||||
|
|||||||
@ -416,6 +416,7 @@ pub enum PaymentMethodType {
|
|||||||
Affirm,
|
Affirm,
|
||||||
AfterpayClearpay,
|
AfterpayClearpay,
|
||||||
AliPay,
|
AliPay,
|
||||||
|
AliPayHk,
|
||||||
ApplePay,
|
ApplePay,
|
||||||
Bacs,
|
Bacs,
|
||||||
BancontactCard,
|
BancontactCard,
|
||||||
|
|||||||
@ -840,6 +840,8 @@ pub struct BankDebitBilling {
|
|||||||
pub enum WalletData {
|
pub enum WalletData {
|
||||||
/// The wallet data for Ali Pay redirect
|
/// The wallet data for Ali Pay redirect
|
||||||
AliPayRedirect(AliPayRedirection),
|
AliPayRedirect(AliPayRedirection),
|
||||||
|
/// The wallet data for Ali Pay HK redirect
|
||||||
|
AliPayHkRedirect(AliPayHkRedirection),
|
||||||
/// The wallet data for Apple pay
|
/// The wallet data for Apple pay
|
||||||
ApplePay(ApplePayWalletData),
|
ApplePay(ApplePayWalletData),
|
||||||
/// Wallet data for apple pay redirect flow
|
/// Wallet data for apple pay redirect flow
|
||||||
@ -903,6 +905,9 @@ pub struct PaypalRedirection {}
|
|||||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||||
pub struct AliPayRedirection {}
|
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)]
|
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||||
pub struct MobilePayRedirection {}
|
pub struct MobilePayRedirection {}
|
||||||
|
|
||||||
|
|||||||
@ -261,6 +261,7 @@ pub enum AdyenPaymentMethod<'a> {
|
|||||||
AdyenPaypal(Box<AdyenPaypal>),
|
AdyenPaypal(Box<AdyenPaypal>),
|
||||||
AfterPay(Box<AdyenPayLaterData>),
|
AfterPay(Box<AdyenPayLaterData>),
|
||||||
AliPay(Box<AliPayData>),
|
AliPay(Box<AliPayData>),
|
||||||
|
AliPayHk(Box<AliPayHkData>),
|
||||||
ApplePay(Box<AdyenApplePay>),
|
ApplePay(Box<AdyenApplePay>),
|
||||||
BancontactCard(Box<BancontactCardData>),
|
BancontactCard(Box<BancontactCardData>),
|
||||||
Blik(Box<BlikRedirectionData>),
|
Blik(Box<BlikRedirectionData>),
|
||||||
@ -613,6 +614,12 @@ pub struct AliPayData {
|
|||||||
payment_type: PaymentType,
|
payment_type: PaymentType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct AliPayHkData {
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
payment_type: PaymentType,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct AdyenGPay {
|
pub struct AdyenGPay {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
@ -666,6 +673,8 @@ pub enum PaymentType {
|
|||||||
Affirm,
|
Affirm,
|
||||||
Afterpaytouch,
|
Afterpaytouch,
|
||||||
Alipay,
|
Alipay,
|
||||||
|
#[serde(rename = "alipay_hk")]
|
||||||
|
AlipayHk,
|
||||||
Applepay,
|
Applepay,
|
||||||
Blik,
|
Blik,
|
||||||
Eps,
|
Eps,
|
||||||
@ -1088,6 +1097,12 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
|
|||||||
};
|
};
|
||||||
Ok(AdyenPaymentMethod::AliPay(Box::new(alipay_data)))
|
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) => {
|
api_models::payments::WalletData::MbWayRedirect(data) => {
|
||||||
let mbway_data = MbwayData {
|
let mbway_data = MbwayData {
|
||||||
payment_type: PaymentType::Mbway,
|
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::AddressDetails,
|
||||||
api_models::payments::BankDebitData,
|
api_models::payments::BankDebitData,
|
||||||
api_models::payments::AliPayRedirection,
|
api_models::payments::AliPayRedirection,
|
||||||
|
api_models::payments::AliPayHkRedirection,
|
||||||
api_models::payments::MbWayRedirection,
|
api_models::payments::MbWayRedirection,
|
||||||
api_models::payments::MobilePayRedirection,
|
api_models::payments::MobilePayRedirection,
|
||||||
api_models::payments::WeChatPayRedirection,
|
api_models::payments::WeChatPayRedirection,
|
||||||
|
|||||||
@ -132,6 +132,29 @@ async fn should_make_adyen_klarna_mandate_payment(
|
|||||||
Ok(())
|
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]
|
#[test]
|
||||||
#[serial]
|
#[serial]
|
||||||
fn should_make_adyen_gpay_payment_test() {
|
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);
|
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
|
// 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,
|
Affirm,
|
||||||
AfterpayClearpay,
|
AfterpayClearpay,
|
||||||
AliPay,
|
AliPay,
|
||||||
|
AliPayHk,
|
||||||
ApplePay,
|
ApplePay,
|
||||||
Bacs,
|
Bacs,
|
||||||
BancontactCard,
|
BancontactCard,
|
||||||
|
|||||||
@ -1793,6 +1793,9 @@
|
|||||||
"AliPayRedirection": {
|
"AliPayRedirection": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"AliPayHkRedirection": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"AmountInfo": {
|
"AmountInfo": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@ -8114,6 +8117,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"ali_pay_hk"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ali_pay_hk": {
|
||||||
|
"$ref": "#/components/schemas/AliPayHkRedirection"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
Reference in New Issue
Block a user