feat(connectors): [Iatapay] add payment methods (#4968)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2024-06-13 09:15:09 +05:30
committed by GitHub
parent 27ca8be0da
commit 0e059e7d84
74 changed files with 588 additions and 43 deletions

View File

@ -1437,6 +1437,7 @@ mod payment_method_data_serde {
| PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankRedirect(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::GiftCard(_)
@ -1485,6 +1486,8 @@ pub enum PaymentMethodData {
BankDebit(BankDebitData),
#[schema(title = "BankTransfer")]
BankTransfer(Box<BankTransferData>),
#[schema(title = "RealTimePayment")]
RealTimePayment(Box<RealTimePaymentData>),
#[schema(title = "Crypto")]
Crypto(CryptoData),
#[schema(title = "MandatePayment")]
@ -1518,6 +1521,7 @@ impl GetAddressFromPaymentMethodData for PaymentMethodData {
Self::Voucher(voucher_data) => voucher_data.get_billing_address(),
Self::Crypto(_)
| Self::Reward
| Self::RealTimePayment(_)
| Self::Upi(_)
| Self::GiftCard(_)
| Self::CardToken(_)
@ -1552,6 +1556,7 @@ impl PaymentMethodData {
Self::BankRedirect(_) => Some(api_enums::PaymentMethod::BankRedirect),
Self::BankDebit(_) => Some(api_enums::PaymentMethod::BankDebit),
Self::BankTransfer(_) => Some(api_enums::PaymentMethod::BankTransfer),
Self::RealTimePayment(_) => Some(api_enums::PaymentMethod::RealTimePayment),
Self::Crypto(_) => Some(api_enums::PaymentMethod::Crypto),
Self::Reward => Some(api_enums::PaymentMethod::Reward),
Self::Upi(_) => Some(api_enums::PaymentMethod::Upi),
@ -1651,6 +1656,7 @@ impl GetPaymentMethodType for BankRedirectData {
Self::OnlineBankingThailand { .. } => {
api_enums::PaymentMethodType::OnlineBankingThailand
}
Self::LocalBankRedirect { .. } => api_enums::PaymentMethodType::LocalBankRedirect,
}
}
}
@ -1693,6 +1699,17 @@ impl GetPaymentMethodType for CryptoData {
}
}
impl GetPaymentMethodType for RealTimePaymentData {
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
match self {
Self::Fps {} => api_enums::PaymentMethodType::Fps,
Self::DuitNow {} => api_enums::PaymentMethodType::DuitNow,
Self::PromptPay {} => api_enums::PaymentMethodType::PromptPay,
Self::VietQr {} => api_enums::PaymentMethodType::VietQr,
}
}
}
impl GetPaymentMethodType for UpiData {
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
match self {
@ -1803,6 +1820,7 @@ pub enum AdditionalPaymentData {
BankDebit {},
MandatePayment {},
Reward {},
RealTimePayment {},
Upi {},
GiftCard {},
Voucher {},
@ -1948,6 +1966,7 @@ pub enum BankRedirectData {
#[schema(value_type = BankNames)]
issuer: common_enums::BankNames,
},
LocalBankRedirect {},
}
impl GetAddressFromPaymentMethodData for BankRedirectData {
@ -2057,6 +2076,7 @@ impl GetAddressFromPaymentMethodData for BankRedirectData {
} => get_billing_address_inner(Some(billing_details), None, None),
Self::Trustly { country } => get_billing_address_inner(None, Some(country), None),
Self::OnlineBankingFpx { .. }
| Self::LocalBankRedirect {}
| Self::OnlineBankingThailand { .. }
| Self::Bizum {}
| Self::OnlineBankingPoland { .. }
@ -2266,6 +2286,15 @@ pub enum BankTransferData {
},
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum RealTimePaymentData {
Fps {},
DuitNow {},
PromptPay {},
VietQr {},
}
impl GetAddressFromPaymentMethodData for BankTransferData {
fn get_billing_address(&self) -> Option<Address> {
match self {
@ -2734,6 +2763,7 @@ where
| PaymentMethodDataResponse::GiftCard {}
| PaymentMethodDataResponse::PayLater {}
| PaymentMethodDataResponse::Paypal {}
| PaymentMethodDataResponse::RealTimePayment {}
| PaymentMethodDataResponse::Upi {}
| PaymentMethodDataResponse::Wallet {}
| PaymentMethodDataResponse::BankTransfer {}
@ -2764,6 +2794,7 @@ pub enum PaymentMethodDataResponse {
BankDebit {},
MandatePayment {},
Reward {},
RealTimePayment {},
Upi {},
Voucher {},
GiftCard {},
@ -3880,6 +3911,7 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
AdditionalPaymentData::BankDebit {} => Self::BankDebit {},
AdditionalPaymentData::MandatePayment {} => Self::MandatePayment {},
AdditionalPaymentData::Reward {} => Self::Reward {},
AdditionalPaymentData::RealTimePayment {} => Self::RealTimePayment {},
AdditionalPaymentData::Upi {} => Self::Upi {},
AdditionalPaymentData::BankTransfer {} => Self::BankTransfer {},
AdditionalPaymentData::Voucher {} => Self::Voucher {},

View File

@ -116,6 +116,7 @@ impl EuclidDirFilter for ConnectorSelection {
DirKeyKind::VoucherType,
DirKeyKind::CardRedirectType,
DirKeyKind::BankTransferType,
DirKeyKind::RealTimePaymentType,
];
}

View File

@ -41,6 +41,7 @@ impl EuclidDirFilter for SurchargeDecisionConfigs {
DirKeyKind::BankRedirectType,
DirKeyKind::BankDebitType,
DirKeyKind::CryptoType,
DirKeyKind::RealTimePaymentType,
];
}