mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat(core): Payments core modification for open banking connectors (#3947)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1600,6 +1600,7 @@ mod payment_method_data_serde {
|
||||
| PaymentMethodData::Voucher(_)
|
||||
| PaymentMethodData::Card(_)
|
||||
| PaymentMethodData::MandatePayment
|
||||
| PaymentMethodData::OpenBanking(_)
|
||||
| PaymentMethodData::Wallet(_) => {
|
||||
payment_method_data_request.serialize(serializer)
|
||||
}
|
||||
@ -1657,6 +1658,8 @@ pub enum PaymentMethodData {
|
||||
GiftCard(Box<GiftCardData>),
|
||||
#[schema(title = "CardToken")]
|
||||
CardToken(CardToken),
|
||||
#[schema(title = "OpenBanking")]
|
||||
OpenBanking(OpenBankingData),
|
||||
}
|
||||
|
||||
pub trait GetAddressFromPaymentMethodData {
|
||||
@ -1680,6 +1683,7 @@ impl GetAddressFromPaymentMethodData for PaymentMethodData {
|
||||
| Self::Upi(_)
|
||||
| Self::GiftCard(_)
|
||||
| Self::CardToken(_)
|
||||
| Self::OpenBanking(_)
|
||||
| Self::MandatePayment => None,
|
||||
}
|
||||
}
|
||||
@ -1717,6 +1721,7 @@ impl PaymentMethodData {
|
||||
Self::Upi(_) => Some(api_enums::PaymentMethod::Upi),
|
||||
Self::Voucher(_) => Some(api_enums::PaymentMethod::Voucher),
|
||||
Self::GiftCard(_) => Some(api_enums::PaymentMethod::GiftCard),
|
||||
Self::OpenBanking(_) => Some(api_enums::PaymentMethod::OpenBanking),
|
||||
Self::CardToken(_) | Self::MandatePayment => None,
|
||||
}
|
||||
}
|
||||
@ -1785,6 +1790,14 @@ impl GetPaymentMethodType for PayLaterData {
|
||||
}
|
||||
}
|
||||
|
||||
impl GetPaymentMethodType for OpenBankingData {
|
||||
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
|
||||
match self {
|
||||
Self::OpenBankingPIS {} => api_enums::PaymentMethodType::OpenBankingPIS,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GetPaymentMethodType for BankRedirectData {
|
||||
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
|
||||
match self {
|
||||
@ -1983,6 +1996,7 @@ pub enum AdditionalPaymentData {
|
||||
Voucher {},
|
||||
CardRedirect {},
|
||||
CardToken {},
|
||||
OpenBanking {},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||
@ -2673,6 +2687,12 @@ pub struct SamsungPayWalletData {
|
||||
pub token: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum OpenBankingData {
|
||||
#[serde(rename = "open_banking_pis")]
|
||||
OpenBankingPIS {},
|
||||
}
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct GooglePayWalletData {
|
||||
@ -2946,6 +2966,7 @@ where
|
||||
| PaymentMethodDataResponse::Upi {}
|
||||
| PaymentMethodDataResponse::Wallet {}
|
||||
| PaymentMethodDataResponse::BankTransfer {}
|
||||
| PaymentMethodDataResponse::OpenBanking {}
|
||||
| PaymentMethodDataResponse::Voucher {} => {
|
||||
payment_method_data_response.serialize(serializer)
|
||||
}
|
||||
@ -2979,6 +3000,7 @@ pub enum PaymentMethodDataResponse {
|
||||
GiftCard {},
|
||||
CardRedirect {},
|
||||
CardToken {},
|
||||
OpenBanking {},
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -4146,6 +4168,7 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
|
||||
AdditionalPaymentData::GiftCard {} => Self::GiftCard {},
|
||||
AdditionalPaymentData::CardRedirect {} => Self::CardRedirect {},
|
||||
AdditionalPaymentData::CardToken {} => Self::CardToken {},
|
||||
AdditionalPaymentData::OpenBanking {} => Self::OpenBanking {},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4531,6 +4554,8 @@ pub enum SessionToken {
|
||||
Paypal(Box<PaypalSessionTokenResponse>),
|
||||
/// The session response structure for Apple Pay
|
||||
ApplePay(Box<ApplepaySessionTokenResponse>),
|
||||
/// Session token for OpenBanking PIS flow
|
||||
OpenBanking(OpenBankingSessionToken),
|
||||
/// Whenever there is no session token response or an error in session response
|
||||
NoSessionTokenReceived,
|
||||
}
|
||||
@ -4607,6 +4632,13 @@ pub struct PaypalSessionTokenResponse {
|
||||
pub sdk_next_action: SdkNextAction,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub struct OpenBankingSessionToken {
|
||||
/// The session token for OpenBanking Connectors
|
||||
pub open_banking_session_token: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub struct ApplepaySessionTokenResponse {
|
||||
|
||||
Reference in New Issue
Block a user