diff --git a/config/development.toml b/config/development.toml index eb94426292..8016d71208 100644 --- a/config/development.toml +++ b/config/development.toml @@ -246,6 +246,7 @@ bizum = {country = "ES", currency = "EUR"} go_pay = {country = "ID", currency = "IDR"} kakao_pay = {country = "KR", currency = "KRW"} gcash = {country = "PH", currency = "PHP"} +momo = {country = "VN", currency = "VND"} [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/payments.rs b/crates/api_models/src/payments.rs index ef5f9afa80..74eadbbb2a 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -952,6 +952,8 @@ pub enum WalletData { AliPayRedirect(AliPayRedirection), /// The wallet data for Ali Pay HK redirect AliPayHkRedirect(AliPayHkRedirection), + /// The wallet data for Momo redirect + MomoRedirect(MomoRedirection), /// The wallet data for KakaoPay redirect KakaoPayRedirect(KakaoPayRedirection), /// The wallet data for GoPay redirect @@ -1046,6 +1048,9 @@ 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 MomoRedirection {} + #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] pub struct KakaoPayRedirection {} diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs index 23456f53ea..ae812202ef 100644 --- a/crates/common_enums/src/enums.rs +++ b/crates/common_enums/src/enums.rs @@ -270,6 +270,7 @@ pub enum Currency { USD, UYU, UZS, + VND, YER, ZAR, } @@ -381,6 +382,7 @@ impl Currency { Self::USD => "840", Self::UYU => "858", Self::UZS => "860", + Self::VND => "704", Self::YER => "886", Self::ZAR => "710", } @@ -578,6 +580,7 @@ pub enum PaymentMethodType { KakaoPay, MbWay, MobilePay, + Momo, Multibanco, OnlineBankingCzechRepublic, OnlineBankingFinland, diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs index 4d2e1b2e58..86a9ba0cdf 100644 --- a/crates/common_enums/src/transformers.rs +++ b/crates/common_enums/src/transformers.rs @@ -1561,6 +1561,7 @@ impl From for PaymentMethod { PaymentMethodType::KakaoPay => Self::Wallet, PaymentMethodType::MbWay => Self::Wallet, PaymentMethodType::MobilePay => Self::Wallet, + PaymentMethodType::Momo => Self::Wallet, PaymentMethodType::Multibanco => Self::BankTransfer, PaymentMethodType::Interac => Self::BankRedirect, PaymentMethodType::OnlineBankingCzechRepublic => Self::BankRedirect, diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 4ec7c616e9..624e543814 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -295,6 +295,8 @@ pub enum AdyenPaymentMethod<'a> { Mandate(Box), Mbway(Box), MobilePay(Box), + #[serde(rename = "momo_wallet")] + Momo(Box), OnlineBankingCzechRepublic(Box), OnlineBankingFinland(Box), OnlineBankingPoland(Box), @@ -653,6 +655,9 @@ pub struct KakaoPayData {} #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GcashData {} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct MomoData {} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AdyenGPay { #[serde(rename = "type")] @@ -735,6 +740,8 @@ pub enum PaymentType { Kakaopay, Mbway, MobilePay, + #[serde(rename = "momo_wallet")] + Momo, #[serde(rename = "onlineBanking_CZ")] OnlineBankingCzechRepublic, #[serde(rename = "ebanking_FI")] @@ -1218,6 +1225,10 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> { let gcash_data = GcashData {}; 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) => { let mbway_data = MbwayData { payment_type: PaymentType::Mbway, diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs index 74773958a1..f692ed6c52 100644 --- a/crates/router/src/openapi.rs +++ b/crates/router/src/openapi.rs @@ -170,6 +170,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::BankDebitData, api_models::payments::AliPayQr, api_models::payments::AliPayRedirection, + api_models::payments::MomoRedirection, api_models::payments::GcashRedirection, api_models::payments::KakaoPayRedirection, api_models::payments::AliPayHkRedirection, diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 0ca51fe51d..e2deed52b5 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -179,6 +179,7 @@ impl ForeignFrom for api_enums::PaymentMethod { | api_enums::PaymentMethodType::WeChatPay | api_enums::PaymentMethodType::GoPay | api_enums::PaymentMethodType::Gcash + | api_enums::PaymentMethodType::Momo | api_enums::PaymentMethodType::KakaoPay => Self::Wallet, api_enums::PaymentMethodType::Affirm | api_enums::PaymentMethodType::AfterpayClearpay diff --git a/migrations/2023-06-26-124254_add_vnd_to_currency_enum/down.sql b/migrations/2023-06-26-124254_add_vnd_to_currency_enum/down.sql new file mode 100644 index 0000000000..c7c9cbeb40 --- /dev/null +++ b/migrations/2023-06-26-124254_add_vnd_to_currency_enum/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +SELECT 1; \ No newline at end of file diff --git a/migrations/2023-06-26-124254_add_vnd_to_currency_enum/up.sql b/migrations/2023-06-26-124254_add_vnd_to_currency_enum/up.sql new file mode 100644 index 0000000000..be3306f661 --- /dev/null +++ b/migrations/2023-06-26-124254_add_vnd_to_currency_enum/up.sql @@ -0,0 +1,2 @@ +-- Your SQL goes here +ALTER TYPE "Currency" ADD VALUE IF NOT EXISTS 'VND' AFTER 'UZS'; \ No newline at end of file diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index d1dfb1550b..40009e4c9d 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -3607,6 +3607,7 @@ "USD", "UYU", "UZS", + "VND", "YER", "ZAR" ] @@ -5775,6 +5776,9 @@ "MobilePayRedirection": { "type": "object" }, + "MomoRedirection": { + "type": "object" + }, "MultibancoBillingDetails": { "type": "object", "required": [ @@ -6824,6 +6828,7 @@ "kakao_pay", "mb_way", "mobile_pay", + "momo", "multibanco", "online_banking_czech_republic", "online_banking_finland", @@ -8925,6 +8930,17 @@ } } }, + { + "type": "object", + "required": [ + "momo_redirect" + ], + "properties": { + "momo_redirect": { + "$ref": "#/components/schemas/MomoRedirection" + } + } + }, { "type": "object", "required": [