feat(connector): [Adyen] implement Momo for Adyen (#1583)

Co-authored-by: Sangamesh Kulkarni <59434228+Sangamesh26@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2023-07-19 13:32:58 +05:30
committed by GitHub
parent 54f7ab7ae1
commit 96933f2636
10 changed files with 43 additions and 0 deletions

View File

@ -246,6 +246,7 @@ bizum = {country = "ES", currency = "EUR"}
go_pay = {country = "ID", currency = "IDR"} go_pay = {country = "ID", currency = "IDR"}
kakao_pay = {country = "KR", currency = "KRW"} kakao_pay = {country = "KR", currency = "KRW"}
gcash = {country = "PH", currency = "PHP"} gcash = {country = "PH", currency = "PHP"}
momo = {country = "VN", currency = "VND"}
[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

@ -952,6 +952,8 @@ pub enum WalletData {
AliPayRedirect(AliPayRedirection), AliPayRedirect(AliPayRedirection),
/// The wallet data for Ali Pay HK redirect /// The wallet data for Ali Pay HK redirect
AliPayHkRedirect(AliPayHkRedirection), AliPayHkRedirect(AliPayHkRedirection),
/// The wallet data for Momo redirect
MomoRedirect(MomoRedirection),
/// The wallet data for KakaoPay redirect /// The wallet data for KakaoPay redirect
KakaoPayRedirect(KakaoPayRedirection), KakaoPayRedirect(KakaoPayRedirection),
/// The wallet data for GoPay redirect /// The wallet data for GoPay redirect
@ -1046,6 +1048,9 @@ pub struct AliPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AliPayHkRedirection {} pub struct AliPayHkRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct MomoRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct KakaoPayRedirection {} pub struct KakaoPayRedirection {}

View File

@ -270,6 +270,7 @@ pub enum Currency {
USD, USD,
UYU, UYU,
UZS, UZS,
VND,
YER, YER,
ZAR, ZAR,
} }
@ -381,6 +382,7 @@ impl Currency {
Self::USD => "840", Self::USD => "840",
Self::UYU => "858", Self::UYU => "858",
Self::UZS => "860", Self::UZS => "860",
Self::VND => "704",
Self::YER => "886", Self::YER => "886",
Self::ZAR => "710", Self::ZAR => "710",
} }
@ -578,6 +580,7 @@ pub enum PaymentMethodType {
KakaoPay, KakaoPay,
MbWay, MbWay,
MobilePay, MobilePay,
Momo,
Multibanco, Multibanco,
OnlineBankingCzechRepublic, OnlineBankingCzechRepublic,
OnlineBankingFinland, OnlineBankingFinland,

View File

@ -1561,6 +1561,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::KakaoPay => Self::Wallet, PaymentMethodType::KakaoPay => Self::Wallet,
PaymentMethodType::MbWay => Self::Wallet, PaymentMethodType::MbWay => Self::Wallet,
PaymentMethodType::MobilePay => Self::Wallet, PaymentMethodType::MobilePay => Self::Wallet,
PaymentMethodType::Momo => Self::Wallet,
PaymentMethodType::Multibanco => Self::BankTransfer, PaymentMethodType::Multibanco => Self::BankTransfer,
PaymentMethodType::Interac => Self::BankRedirect, PaymentMethodType::Interac => Self::BankRedirect,
PaymentMethodType::OnlineBankingCzechRepublic => Self::BankRedirect, PaymentMethodType::OnlineBankingCzechRepublic => Self::BankRedirect,

View File

@ -295,6 +295,8 @@ pub enum AdyenPaymentMethod<'a> {
Mandate(Box<AdyenMandate>), Mandate(Box<AdyenMandate>),
Mbway(Box<MbwayData>), Mbway(Box<MbwayData>),
MobilePay(Box<MobilePayData>), MobilePay(Box<MobilePayData>),
#[serde(rename = "momo_wallet")]
Momo(Box<MomoData>),
OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>), OnlineBankingCzechRepublic(Box<OnlineBankingCzechRepublicData>),
OnlineBankingFinland(Box<OnlineBankingFinlandData>), OnlineBankingFinland(Box<OnlineBankingFinlandData>),
OnlineBankingPoland(Box<OnlineBankingPolandData>), OnlineBankingPoland(Box<OnlineBankingPolandData>),
@ -653,6 +655,9 @@ pub struct KakaoPayData {}
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GcashData {} pub struct GcashData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MomoData {}
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdyenGPay { pub struct AdyenGPay {
#[serde(rename = "type")] #[serde(rename = "type")]
@ -735,6 +740,8 @@ pub enum PaymentType {
Kakaopay, Kakaopay,
Mbway, Mbway,
MobilePay, MobilePay,
#[serde(rename = "momo_wallet")]
Momo,
#[serde(rename = "onlineBanking_CZ")] #[serde(rename = "onlineBanking_CZ")]
OnlineBankingCzechRepublic, OnlineBankingCzechRepublic,
#[serde(rename = "ebanking_FI")] #[serde(rename = "ebanking_FI")]
@ -1218,6 +1225,10 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
let gcash_data = GcashData {}; let gcash_data = GcashData {};
Ok(AdyenPaymentMethod::Gcash(Box::new(gcash_data))) Ok(AdyenPaymentMethod::Gcash(Box::new(gcash_data)))
} }
api_models::payments::WalletData::MomoRedirect(_) => {
let momo_data = MomoData {};
Ok(AdyenPaymentMethod::Momo(Box::new(momo_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

@ -170,6 +170,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::BankDebitData, api_models::payments::BankDebitData,
api_models::payments::AliPayQr, api_models::payments::AliPayQr,
api_models::payments::AliPayRedirection, api_models::payments::AliPayRedirection,
api_models::payments::MomoRedirection,
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

@ -179,6 +179,7 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::WeChatPay | api_enums::PaymentMethodType::WeChatPay
| api_enums::PaymentMethodType::GoPay | api_enums::PaymentMethodType::GoPay
| api_enums::PaymentMethodType::Gcash | api_enums::PaymentMethodType::Gcash
| api_enums::PaymentMethodType::Momo
| api_enums::PaymentMethodType::KakaoPay => Self::Wallet, | api_enums::PaymentMethodType::KakaoPay => Self::Wallet,
api_enums::PaymentMethodType::Affirm api_enums::PaymentMethodType::Affirm
| api_enums::PaymentMethodType::AfterpayClearpay | api_enums::PaymentMethodType::AfterpayClearpay

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
SELECT 1;

View File

@ -0,0 +1,2 @@
-- Your SQL goes here
ALTER TYPE "Currency" ADD VALUE IF NOT EXISTS 'VND' AFTER 'UZS';

View File

@ -3607,6 +3607,7 @@
"USD", "USD",
"UYU", "UYU",
"UZS", "UZS",
"VND",
"YER", "YER",
"ZAR" "ZAR"
] ]
@ -5775,6 +5776,9 @@
"MobilePayRedirection": { "MobilePayRedirection": {
"type": "object" "type": "object"
}, },
"MomoRedirection": {
"type": "object"
},
"MultibancoBillingDetails": { "MultibancoBillingDetails": {
"type": "object", "type": "object",
"required": [ "required": [
@ -6824,6 +6828,7 @@
"kakao_pay", "kakao_pay",
"mb_way", "mb_way",
"mobile_pay", "mobile_pay",
"momo",
"multibanco", "multibanco",
"online_banking_czech_republic", "online_banking_czech_republic",
"online_banking_finland", "online_banking_finland",
@ -8925,6 +8930,17 @@
} }
} }
}, },
{
"type": "object",
"required": [
"momo_redirect"
],
"properties": {
"momo_redirect": {
"$ref": "#/components/schemas/MomoRedirection"
}
}
},
{ {
"type": "object", "type": "object",
"required": [ "required": [