diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index 2928208e824e..5dfdcccc681a 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -12704,6 +12704,33 @@ }, "additionalProperties": false }, + "OpenBankingData": { + "oneOf": [ + { + "type": "object", + "required": [ + "open_banking_pis" + ], + "properties": { + "open_banking_pis": { + "type": "object" + } + } + } + ] + }, + "OpenBankingSessionToken": { + "type": "object", + "required": [ + "open_banking_session_token" + ], + "properties": { + "open_banking_session_token": { + "type": "string", + "description": "The session token for OpenBanking Connectors" + } + } + }, "OrderDetails": { "type": "object", "required": [ @@ -13727,7 +13754,8 @@ "real_time_payment", "upi", "voucher", - "gift_card" + "gift_card", + "open_banking" ] }, "PaymentMethodCollectLinkRequest": { @@ -14122,6 +14150,18 @@ "$ref": "#/components/schemas/CardToken" } } + }, + { + "type": "object", + "title": "OpenBanking", + "required": [ + "open_banking" + ], + "properties": { + "open_banking": { + "$ref": "#/components/schemas/OpenBankingData" + } + } } ] }, @@ -14328,6 +14368,17 @@ "type": "object" } } + }, + { + "type": "object", + "required": [ + "open_banking" + ], + "properties": { + "open_banking": { + "type": "object" + } + } } ] }, @@ -14690,7 +14741,8 @@ "seicomart", "pay_easy", "local_bank_transfer", - "mifinity" + "mifinity", + "open_banking_pis" ] }, "PaymentMethodUpdate": { @@ -20161,6 +20213,27 @@ } ] }, + { + "allOf": [ + { + "$ref": "#/components/schemas/OpenBankingSessionToken" + }, + { + "type": "object", + "required": [ + "wallet_name" + ], + "properties": { + "wallet_name": { + "type": "string", + "enum": [ + "open_banking" + ] + } + } + } + ] + }, { "type": "object", "required": [ diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index bcc67100e1c4..f53507fc13a1 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -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), #[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, } +#[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 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), /// The session response structure for Apple Pay ApplePay(Box), + /// 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 { diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs index 129e83ce2b6f..12281350af21 100644 --- a/crates/common_enums/src/enums.rs +++ b/crates/common_enums/src/enums.rs @@ -1569,6 +1569,8 @@ pub enum PaymentMethodType { PayEasy, LocalBankTransfer, Mifinity, + #[serde(rename = "open_banking_pis")] + OpenBankingPIS, } /// Indicates the type of payment method. Eg: 'card', 'wallet', etc. @@ -1606,6 +1608,7 @@ pub enum PaymentMethod { Upi, Voucher, GiftCard, + OpenBanking, } /// The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow. diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rs index fc39cd1cf501..fab570542c8c 100644 --- a/crates/common_enums/src/transformers.rs +++ b/crates/common_enums/src/transformers.rs @@ -1882,6 +1882,7 @@ impl From for PaymentMethod { PaymentMethodType::FamilyMart => Self::Voucher, PaymentMethodType::Seicomart => Self::Voucher, PaymentMethodType::PayEasy => Self::Voucher, + PaymentMethodType::OpenBankingPIS => Self::OpenBanking, } } } diff --git a/crates/connector_configs/src/response_modifier.rs b/crates/connector_configs/src/response_modifier.rs index 38dc4130cf03..06f9d25b65d2 100644 --- a/crates/connector_configs/src/response_modifier.rs +++ b/crates/connector_configs/src/response_modifier.rs @@ -19,6 +19,7 @@ impl ConnectorApiIntegrationPayload { let mut voucher_details: Vec = Vec::new(); let mut gift_card_details: Vec = Vec::new(); let mut card_redirect_details: Vec = Vec::new(); + let mut open_banking_details: Vec = Vec::new(); if let Some(payment_methods_enabled) = response.payment_methods_enabled.clone() { for methods in payment_methods_enabled { @@ -160,6 +161,18 @@ impl ConnectorApiIntegrationPayload { } } } + api_models::enums::PaymentMethod::OpenBanking => { + if let Some(payment_method_types) = methods.payment_method_types { + for method_type in payment_method_types { + open_banking_details.push(Provider { + payment_method_type: method_type.payment_method_type, + accepted_currencies: method_type.accepted_currencies.clone(), + accepted_countries: method_type.accepted_countries.clone(), + payment_experience: method_type.payment_experience, + }) + } + } + } api_models::enums::PaymentMethod::Upi => { if let Some(payment_method_types) = methods.payment_method_types { for method_type in payment_method_types { diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs index 1a54dc9ae0d4..fe39da67a938 100644 --- a/crates/connector_configs/src/transformer.rs +++ b/crates/connector_configs/src/transformer.rs @@ -138,6 +138,7 @@ impl DashboardRequestPayload { | PaymentMethod::Upi | PaymentMethod::Voucher | PaymentMethod::GiftCard + | PaymentMethod::OpenBanking | PaymentMethod::CardRedirect => { if let Some(provider) = payload.provider { let val = Self::transform_payment_method( diff --git a/crates/euclid/src/dssa/graph.rs b/crates/euclid/src/dssa/graph.rs index 008b56285125..13e115153829 100644 --- a/crates/euclid/src/dssa/graph.rs +++ b/crates/euclid/src/dssa/graph.rs @@ -69,6 +69,7 @@ impl cgraph::NodeViz for dir::DirValue { Self::SetupFutureUsage(sfu) => sfu.to_string(), Self::CardRedirectType(crt) => crt.to_string(), Self::RealTimePaymentType(rtpt) => rtpt.to_string(), + Self::OpenBankingType(ob) => ob.to_string(), } } } diff --git a/crates/euclid/src/frontend/ast/lowering.rs b/crates/euclid/src/frontend/ast/lowering.rs index 48a1a0ab8bf0..8a8ba695e9fa 100644 --- a/crates/euclid/src/frontend/ast/lowering.rs +++ b/crates/euclid/src/frontend/ast/lowering.rs @@ -264,6 +264,8 @@ fn lower_comparison_inner( dir::DirKeyKind::UpiType => lower_enum!(UpiType, value), + dir::DirKeyKind::OpenBankingType => lower_enum!(OpenBankingType, value), + dir::DirKeyKind::VoucherType => lower_enum!(VoucherType, value), dir::DirKeyKind::GiftCardType => lower_enum!(GiftCardType, value), diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs index a21ae104882c..8cfdf6567166 100644 --- a/crates/euclid/src/frontend/dir.rs +++ b/crates/euclid/src/frontend/dir.rs @@ -319,6 +319,13 @@ pub enum DirKeyKind { props(Category = "Payment Method Types") )] RealTimePaymentType, + #[serde(rename = "open_banking")] + #[strum( + serialize = "open_banking", + detailed_message = "Supported types of open banking payment method", + props(Category = "Payment Method Types") + )] + OpenBankingType, } pub trait EuclidDirFilter: Sized @@ -367,6 +374,7 @@ impl DirKeyKind { Self::SetupFutureUsage => types::DataType::EnumVariant, Self::CardRedirectType => types::DataType::EnumVariant, Self::RealTimePaymentType => types::DataType::EnumVariant, + Self::OpenBankingType => types::DataType::EnumVariant, } } pub fn get_value_set(&self) -> Option> { @@ -498,6 +506,11 @@ impl DirKeyKind { .map(DirValue::RealTimePaymentType) .collect(), ), + Self::OpenBankingType => Some( + enums::OpenBankingType::iter() + .map(DirValue::OpenBankingType) + .collect(), + ), } } } @@ -565,6 +578,8 @@ pub enum DirValue { CardRedirectType(enums::CardRedirectType), #[serde(rename = "real_time_payment")] RealTimePaymentType(enums::RealTimePaymentType), + #[serde(rename = "open_banking")] + OpenBankingType(enums::OpenBankingType), } impl DirValue { @@ -599,6 +614,7 @@ impl DirValue { Self::VoucherType(_) => (DirKeyKind::VoucherType, None), Self::GiftCardType(_) => (DirKeyKind::GiftCardType, None), Self::RealTimePaymentType(_) => (DirKeyKind::RealTimePaymentType, None), + Self::OpenBankingType(_) => (DirKeyKind::OpenBankingType, None), }; DirKey::new(kind, data) @@ -634,6 +650,7 @@ impl DirValue { Self::SetupFutureUsage(_) => None, Self::CardRedirectType(_) => None, Self::RealTimePaymentType(_) => None, + Self::OpenBankingType(_) => None, } } diff --git a/crates/euclid/src/frontend/dir/enums.rs b/crates/euclid/src/frontend/dir/enums.rs index 5d0defc7357b..0d2f959c702c 100644 --- a/crates/euclid/src/frontend/dir/enums.rs +++ b/crates/euclid/src/frontend/dir/enums.rs @@ -160,6 +160,26 @@ pub enum BankRedirectType { Przelewy24, Trustly, } + +#[derive( + Clone, + Debug, + Hash, + PartialEq, + Eq, + strum::Display, + strum::VariantNames, + strum::EnumIter, + strum::EnumString, + serde::Serialize, + serde::Deserialize, +)] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum OpenBankingType { + OpenBankingPIS, +} + #[derive( Clone, Debug, @@ -350,3 +370,4 @@ collect_variants!(VoucherType); collect_variants!(GiftCardType); collect_variants!(BankTransferType); collect_variants!(CardRedirectType); +collect_variants!(OpenBankingType); diff --git a/crates/euclid/src/frontend/dir/lowering.rs b/crates/euclid/src/frontend/dir/lowering.rs index f91c63a8166e..33d368e96961 100644 --- a/crates/euclid/src/frontend/dir/lowering.rs +++ b/crates/euclid/src/frontend/dir/lowering.rs @@ -168,6 +168,14 @@ impl From for global_enums::PaymentMethodType { } } +impl From for global_enums::PaymentMethodType { + fn from(value: enums::OpenBankingType) -> Self { + match value { + enums::OpenBankingType::OpenBankingPIS => Self::OpenBankingPIS, + } + } +} + impl From for global_enums::PaymentMethodType { fn from(value: enums::CryptoType) -> Self { match value { @@ -238,6 +246,7 @@ fn lower_value(dir_value: dir::DirValue) -> Result EuclidValue::PaymentMethodType(rt.into()), dir::DirValue::BusinessLabel(bl) => EuclidValue::BusinessLabel(bl), dir::DirValue::SetupFutureUsage(sfu) => EuclidValue::SetupFutureUsage(sfu), + dir::DirValue::OpenBankingType(ob) => EuclidValue::PaymentMethodType(ob.into()), }) } diff --git a/crates/euclid/src/frontend/dir/transformers.rs b/crates/euclid/src/frontend/dir/transformers.rs index 3f83ee3db015..3e35bcd391c4 100644 --- a/crates/euclid/src/frontend/dir/transformers.rs +++ b/crates/euclid/src/frontend/dir/transformers.rs @@ -38,6 +38,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet | global_enums::PaymentMethod::RealTimePayment | global_enums::PaymentMethod::Upi | global_enums::PaymentMethod::Voucher + | global_enums::PaymentMethod::OpenBanking | global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported), }, global_enums::PaymentMethodType::Bacs => match self.1 { @@ -53,6 +54,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet | global_enums::PaymentMethod::RealTimePayment | global_enums::PaymentMethod::Upi | global_enums::PaymentMethod::Voucher + | global_enums::PaymentMethod::OpenBanking | global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported), }, global_enums::PaymentMethodType::Becs => Ok(dirval!(BankDebitType = Becs)), @@ -69,6 +71,7 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet | global_enums::PaymentMethod::RealTimePayment | global_enums::PaymentMethod::Upi | global_enums::PaymentMethod::Voucher + | global_enums::PaymentMethod::OpenBanking | global_enums::PaymentMethod::GiftCard => Err(AnalysisErrorType::NotSupported), }, global_enums::PaymentMethodType::AliPay => Ok(dirval!(WalletType = AliPay)), @@ -182,6 +185,9 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet } global_enums::PaymentMethodType::Venmo => Ok(dirval!(WalletType = Venmo)), global_enums::PaymentMethodType::Mifinity => Ok(dirval!(WalletType = Mifinity)), + global_enums::PaymentMethodType::OpenBankingPIS => { + Ok(dirval!(OpenBankingType = OpenBankingPIS)) + } } } } diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs index e92552002b5d..031440ae5412 100644 --- a/crates/euclid_wasm/src/lib.rs +++ b/crates/euclid_wasm/src/lib.rs @@ -263,6 +263,7 @@ pub fn get_variant_values(key: &str) -> Result { dir::DirKeyKind::VoucherType => dir_enums::VoucherType::VARIANTS, dir::DirKeyKind::BankDebitType => dir_enums::BankDebitType::VARIANTS, dir::DirKeyKind::RealTimePaymentType => dir_enums::RealTimePaymentType::VARIANTS, + dir::DirKeyKind::OpenBankingType => dir_enums::OpenBankingType::VARIANTS, dir::DirKeyKind::PaymentAmount | dir::DirKeyKind::Connector diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs index 005e21743d90..49b6951f5f8c 100644 --- a/crates/hyperswitch_domain_models/src/payment_method_data.rs +++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs @@ -22,6 +22,7 @@ pub enum PaymentMethodData { Voucher(VoucherData), GiftCard(Box), CardToken(CardToken), + OpenBanking(OpenBankingData), } #[derive(Debug, Clone, PartialEq, Eq)] @@ -46,6 +47,7 @@ impl PaymentMethodData { Self::Upi(_) => Some(common_enums::PaymentMethod::Upi), Self::Voucher(_) => Some(common_enums::PaymentMethod::Voucher), Self::GiftCard(_) => Some(common_enums::PaymentMethod::GiftCard), + Self::OpenBanking(_) => Some(common_enums::PaymentMethod::OpenBanking), Self::CardToken(_) | Self::MandatePayment => None, } } @@ -318,6 +320,12 @@ pub enum BankRedirectData { LocalBankRedirect {}, } +#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] +#[serde(rename_all = "snake_case")] +pub enum OpenBankingData { + OpenBankingPIS {}, +} + #[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] #[serde(rename_all = "snake_case")] pub struct CryptoData { @@ -495,6 +503,9 @@ impl From for PaymentMethodData { api_models::payments::PaymentMethodData::CardToken(card_token) => { Self::CardToken(From::from(card_token)) } + api_models::payments::PaymentMethodData::OpenBanking(ob_data) => { + Self::OpenBanking(From::from(ob_data)) + } } } } @@ -922,3 +933,11 @@ impl From for RealTimePaymentData { } } } + +impl From for OpenBankingData { + fn from(value: api_models::payments::OpenBankingData) -> Self { + match value { + api_models::payments::OpenBankingData::OpenBankingPIS {} => Self::OpenBankingPIS {}, + } + } +} diff --git a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs index 046866beea55..1263f8f975a6 100644 --- a/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs +++ b/crates/hyperswitch_domain_models/src/router_flow_types/payments.rs @@ -46,3 +46,6 @@ pub struct PreProcessing; #[derive(Debug, Clone)] pub struct IncrementalAuthorization; + +#[derive(Debug, Clone)] +pub struct PostProcessing; diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs index f30e6010cfff..26db7eed01dd 100644 --- a/crates/hyperswitch_domain_models/src/router_request_types.rs +++ b/crates/hyperswitch_domain_models/src/router_request_types.rs @@ -54,7 +54,7 @@ pub struct PaymentsAuthorizeData { pub payment_experience: Option, pub payment_method_type: Option, pub surcharge_details: Option, - pub customer_id: Option, + pub customer_id: Option, pub request_incremental_authorization: bool, pub metadata: Option, pub authentication_data: Option, @@ -336,6 +336,35 @@ impl TryFrom for PaymentsPreProcessingData { }) } } + +#[derive(Debug, Clone)] +pub struct PaymentsPostProcessingData { + pub payment_method_data: PaymentMethodData, + pub customer_id: Option, + pub connector_transaction_id: Option, +} + +impl TryFrom> + for PaymentsPostProcessingData +{ + type Error = error_stack::Report; + + fn try_from( + data: RouterData, + ) -> Result { + Ok(Self { + payment_method_data: data.request.payment_method_data, + connector_transaction_id: match data.response { + Ok(response_types::PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(id), + .. + }) => Some(id.clone()), + _ => None, + }, + customer_id: data.request.customer_id, + }) + } +} #[derive(Debug, Clone)] pub struct CompleteAuthorizeData { pub payment_method_data: Option, diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs index a5c6aafdab13..e41b0aa78b9d 100644 --- a/crates/hyperswitch_domain_models/src/router_response_types.rs +++ b/crates/hyperswitch_domain_models/src/router_response_types.rs @@ -65,6 +65,9 @@ pub enum PaymentsResponseData { error_code: Option, error_message: Option, }, + PostProcessingResponse { + session_token: Option, + }, } #[derive(serde::Serialize, Debug, Clone)] diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs index 0cbf171495be..5b31a6be648e 100644 --- a/crates/kgraph_utils/src/mca.rs +++ b/crates/kgraph_utils/src/mca.rs @@ -143,6 +143,9 @@ fn get_dir_value_payment_method( api_enums::PaymentMethodType::DuitNow => Ok(dirval!(RealTimePaymentType = DuitNow)), api_enums::PaymentMethodType::PromptPay => Ok(dirval!(RealTimePaymentType = PromptPay)), api_enums::PaymentMethodType::VietQr => Ok(dirval!(RealTimePaymentType = VietQr)), + api_enums::PaymentMethodType::OpenBankingPIS => { + Ok(dirval!(OpenBankingType = OpenBankingPIS)) + } } } @@ -416,9 +419,11 @@ fn global_vec_pmt( global_vector.append(collect_global_variants!(GiftCardType)); global_vector.append(collect_global_variants!(BankTransferType)); global_vector.append(collect_global_variants!(CardRedirectType)); + global_vector.append(collect_global_variants!(OpenBankingType)); global_vector.push(dir::DirValue::PaymentMethod( dir::enums::PaymentMethod::Card, )); + let global_vector = global_vector .into_iter() .filter(|global_value| !enabled_pmt.contains(global_value)) diff --git a/crates/kgraph_utils/src/transformers.rs b/crates/kgraph_utils/src/transformers.rs index 1b1bd931200a..758a0dd3de03 100644 --- a/crates/kgraph_utils/src/transformers.rs +++ b/crates/kgraph_utils/src/transformers.rs @@ -103,6 +103,7 @@ impl IntoDirValue for api_enums::PaymentMethod { Self::Voucher => Ok(dirval!(PaymentMethod = Voucher)), Self::GiftCard => Ok(dirval!(PaymentMethod = GiftCard)), Self::CardRedirect => Ok(dirval!(PaymentMethod = CardRedirect)), + Self::OpenBanking => Ok(dirval!(PaymentMethod = OpenBanking)), } } } @@ -158,6 +159,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::RealTimePayment | api_enums::PaymentMethod::Upi | api_enums::PaymentMethod::Voucher + | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( AnalysisErrorType::NotSupported, )), @@ -175,6 +177,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::RealTimePayment | api_enums::PaymentMethod::Upi | api_enums::PaymentMethod::Voucher + | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( AnalysisErrorType::NotSupported, )), @@ -193,6 +196,7 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { | api_enums::PaymentMethod::RealTimePayment | api_enums::PaymentMethod::Upi | api_enums::PaymentMethod::Voucher + | api_enums::PaymentMethod::OpenBanking | api_enums::PaymentMethod::GiftCard => Err(KgraphError::ContextConstructionError( AnalysisErrorType::NotSupported, )), @@ -300,6 +304,9 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) { api_enums::PaymentMethodType::DuitNow => Ok(dirval!(RealTimePaymentType = DuitNow)), api_enums::PaymentMethodType::PromptPay => Ok(dirval!(RealTimePaymentType = PromptPay)), api_enums::PaymentMethodType::VietQr => Ok(dirval!(RealTimePaymentType = VietQr)), + api_enums::PaymentMethodType::OpenBankingPIS => { + Ok(dirval!(OpenBankingType = OpenBankingPIS)) + } } } } diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index d2e669175eb3..233f43b08466 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -557,6 +557,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::PaymentChargeResponse, api_models::refunds::ChargeRefunds, api_models::payments::CustomerDetailsResponse, + api_models::payments::OpenBankingData, + api_models::payments::OpenBankingSessionToken, )), modifiers(&SecurityAddon) )] diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index 81dbbb748e38..62cf9416b24b 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -864,6 +864,7 @@ pub(crate) fn into_stripe_next_action( payments::NextActionData::ThirdPartySdkSessionToken { session_token } => { StripeNextAction::ThirdPartySdkSessionToken { session_token } } + payments::NextActionData::QrCodeInformation { image_data_url, display_to_timestamp, diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index db5ada515299..b5408f600b47 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -418,6 +418,7 @@ pub(crate) fn into_stripe_next_action( payments::NextActionData::ThirdPartySdkSessionToken { session_token } => { StripeNextAction::ThirdPartySdkSessionToken { session_token } } + payments::NextActionData::QrCodeInformation { image_data_url, display_to_timestamp, diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs index c9f81ec722bd..175138add758 100644 --- a/crates/router/src/connector/aci/transformers.rs +++ b/crates/router/src/connector/aci/transformers.rs @@ -447,6 +447,7 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Aci"), diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs index 4fee5ea9bb0d..9122f579656f 100644 --- a/crates/router/src/connector/adyen.rs +++ b/crates/router/src/connector/adyen.rs @@ -223,7 +223,8 @@ impl ConnectorValidation for Adyen { | PaymentMethodType::UpiIntent | PaymentMethodType::VietQr | PaymentMethodType::Mifinity - | PaymentMethodType::LocalBankRedirect => { + | PaymentMethodType::LocalBankRedirect + | PaymentMethodType::OpenBankingPIS => { capture_method_not_supported!(connector, capture_method, payment_method_type) } }, diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 6b0e251691ef..4d3855654ad2 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -1581,6 +1581,7 @@ impl<'a> TryFrom<&AdyenRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Upi(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Adyen"), @@ -2575,6 +2576,7 @@ impl<'a> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotSupported { message: "Network tokenization for payment method".to_string(), diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rs index fcb492bedfa9..9fab84559b54 100644 --- a/crates/router/src/connector/airwallex/transformers.rs +++ b/crates/router/src/connector/airwallex/transformers.rs @@ -204,6 +204,7 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("airwallex"), diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index 651054552f85..33570a782fd8 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -342,6 +342,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CreateCustomerProfileRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("authorizedotnet"), @@ -520,6 +521,7 @@ impl TryFrom<&AuthorizedotnetRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message( @@ -578,6 +580,7 @@ impl | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("authorizedotnet"), diff --git a/crates/router/src/connector/bambora/transformers.rs b/crates/router/src/connector/bambora/transformers.rs index 6bb96f5e9bfc..b2e9b1a032ef 100644 --- a/crates/router/src/connector/bambora/transformers.rs +++ b/crates/router/src/connector/bambora/transformers.rs @@ -185,6 +185,7 @@ impl TryFrom> for Bambora | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("bambora"), diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs index c0434572ce16..34244bbb819b 100644 --- a/crates/router/src/connector/bankofamerica/transformers.rs +++ b/crates/router/src/connector/bankofamerica/transformers.rs @@ -321,6 +321,7 @@ impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("BankOfAmerica"), @@ -395,6 +396,7 @@ impl | common_enums::PaymentMethod::RealTimePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher + | common_enums::PaymentMethod::OpenBanking | common_enums::PaymentMethod::GiftCard => None, }; @@ -1070,6 +1072,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message( @@ -1557,6 +1560,7 @@ impl | common_enums::PaymentMethod::RealTimePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher + | common_enums::PaymentMethod::OpenBanking | common_enums::PaymentMethod::GiftCard => None, }; @@ -1773,6 +1777,7 @@ impl | common_enums::PaymentMethod::RealTimePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher + | common_enums::PaymentMethod::OpenBanking | common_enums::PaymentMethod::GiftCard => None, }; diff --git a/crates/router/src/connector/billwerk/transformers.rs b/crates/router/src/connector/billwerk/transformers.rs index c00303fc5e92..4a4521f31a02 100644 --- a/crates/router/src/connector/billwerk/transformers.rs +++ b/crates/router/src/connector/billwerk/transformers.rs @@ -103,6 +103,7 @@ impl TryFrom<&types::TokenizationRouterData> for BillwerkTokenRequest { | domain::payments::PaymentMethodData::Upi(_) | domain::payments::PaymentMethodData::Voucher(_) | domain::payments::PaymentMethodData::GiftCard(_) + | domain::payments::PaymentMethodData::OpenBanking(_) | domain::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("billwerk"), diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs index d1d5f1d8c9e8..f354bf1c2db7 100644 --- a/crates/router/src/connector/bluesnap/transformers.rs +++ b/crates/router/src/connector/bluesnap/transformers.rs @@ -233,6 +233,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( "Selected payment method via Token flow through bluesnap".to_string(), @@ -397,6 +398,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("bluesnap"), diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rs index a1a239a6e1b0..a8b4d8c0ec2b 100644 --- a/crates/router/src/connector/boku/transformers.rs +++ b/crates/router/src/connector/boku/transformers.rs @@ -92,6 +92,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BokuPaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("boku"), diff --git a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs index d52328a7783b..af50bd10ce77 100644 --- a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs +++ b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs @@ -209,6 +209,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("braintree"), @@ -241,6 +242,7 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>> | api_models::enums::PaymentMethod::RealTimePayment | api_models::enums::PaymentMethod::Upi | api_models::enums::PaymentMethod::Voucher + | api_models::enums::PaymentMethod::OpenBanking | api_models::enums::PaymentMethod::GiftCard => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message( @@ -994,6 +996,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("braintree"), @@ -1584,6 +1587,7 @@ fn get_braintree_redirect_form( | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => Err( errors::ConnectorError::NotImplemented("given payment method".to_owned()), )?, diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs index 7fc34e75f979..717c4afc1956 100644 --- a/crates/router/src/connector/braintree/transformers.rs +++ b/crates/router/src/connector/braintree/transformers.rs @@ -175,6 +175,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("braintree"), diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs index e035c102d209..db09e93701be 100644 --- a/crates/router/src/connector/checkout/transformers.rs +++ b/crates/router/src/connector/checkout/transformers.rs @@ -131,6 +131,7 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest { | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("checkout"), @@ -367,6 +368,7 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("checkout"), diff --git a/crates/router/src/connector/cryptopay/transformers.rs b/crates/router/src/connector/cryptopay/transformers.rs index 215003f8fb2a..c15afd7fd444 100644 --- a/crates/router/src/connector/cryptopay/transformers.rs +++ b/crates/router/src/connector/cryptopay/transformers.rs @@ -78,6 +78,7 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("CryptoPay"), diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 1cd6066ad697..2f286964e3e6 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -214,6 +214,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), @@ -1384,6 +1385,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), @@ -1490,6 +1492,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), @@ -2208,6 +2211,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsPreProcessingRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), @@ -2317,6 +2321,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsCompleteAuthorizeRouterData> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Cybersource"), diff --git a/crates/router/src/connector/datatrans/transformers.rs b/crates/router/src/connector/datatrans/transformers.rs index bb8c85b77da2..9c4ab6cf6a6f 100644 --- a/crates/router/src/connector/datatrans/transformers.rs +++ b/crates/router/src/connector/datatrans/transformers.rs @@ -193,6 +193,7 @@ impl TryFrom<&DatatransRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( connector_utils::get_unimplemented_payment_method_error_message("Datatrans"), diff --git a/crates/router/src/connector/dlocal/transformers.rs b/crates/router/src/connector/dlocal/transformers.rs index b018dbcd2e96..ca18d12a0883 100644 --- a/crates/router/src/connector/dlocal/transformers.rs +++ b/crates/router/src/connector/dlocal/transformers.rs @@ -166,6 +166,7 @@ impl TryFrom<&DlocalRouterData<&types::PaymentsAuthorizeRouterData>> for DlocalP | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( crate::connector::utils::get_unimplemented_payment_method_error_message( diff --git a/crates/router/src/connector/fiserv/transformers.rs b/crates/router/src/connector/fiserv/transformers.rs index eee518187a29..1a149c6af78b 100644 --- a/crates/router/src/connector/fiserv/transformers.rs +++ b/crates/router/src/connector/fiserv/transformers.rs @@ -188,6 +188,7 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("fiserv"), diff --git a/crates/router/src/connector/forte/transformers.rs b/crates/router/src/connector/forte/transformers.rs index 637a3acd1e17..0533d71ffeb3 100644 --- a/crates/router/src/connector/forte/transformers.rs +++ b/crates/router/src/connector/forte/transformers.rs @@ -115,6 +115,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for FortePaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Forte"), diff --git a/crates/router/src/connector/globepay/transformers.rs b/crates/router/src/connector/globepay/transformers.rs index 3cf1204a697c..8974c9f94b97 100644 --- a/crates/router/src/connector/globepay/transformers.rs +++ b/crates/router/src/connector/globepay/transformers.rs @@ -73,6 +73,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for GlobepayPaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("globepay"), diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rs index d31d985500ae..fb27f5138a9c 100644 --- a/crates/router/src/connector/gocardless/transformers.rs +++ b/crates/router/src/connector/gocardless/transformers.rs @@ -246,6 +246,7 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Gocardless"), @@ -415,6 +416,7 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( "Setup Mandate flow for selected payment method through Gocardless".to_string(), diff --git a/crates/router/src/connector/helcim/transformers.rs b/crates/router/src/connector/helcim/transformers.rs index f882b341f63b..2f6cf61e7591 100644 --- a/crates/router/src/connector/helcim/transformers.rs +++ b/crates/router/src/connector/helcim/transformers.rs @@ -163,6 +163,7 @@ impl TryFrom<&types::SetupMandateRouterData> for HelcimVerifyRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Helcim"), @@ -265,6 +266,7 @@ impl TryFrom<&HelcimRouterData<&types::PaymentsAuthorizeRouterData>> for HelcimP | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Helcim"), diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs index 71aeed0f7dd0..1ce07fb49e32 100644 --- a/crates/router/src/connector/iatapay/transformers.rs +++ b/crates/router/src/connector/iatapay/transformers.rs @@ -204,7 +204,8 @@ impl | domain::PaymentMethodData::Reward | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + | domain::PaymentMethodData::CardToken(_) + | domain::PaymentMethodData::OpenBanking(_) => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("iatapay"), ))? diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rs index 4796f15cb64a..fbfb8b71974f 100644 --- a/crates/router/src/connector/klarna.rs +++ b/crates/router/src/connector/klarna.rs @@ -628,7 +628,8 @@ impl | common_enums::PaymentMethodType::Fps | common_enums::PaymentMethodType::DuitNow | common_enums::PaymentMethodType::PromptPay - | common_enums::PaymentMethodType::VietQr, + | common_enums::PaymentMethodType::VietQr + | common_enums::PaymentMethodType::OpenBankingPIS, ) => Err(error_stack::report!(errors::ConnectorError::NotSupported { message: payment_method_type.to_string(), connector: "klarna", @@ -649,6 +650,7 @@ impl | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::GiftCard(_) | domain::PaymentMethodData::CardToken(_) => { Err(report!(errors::ConnectorError::NotImplemented( diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rs index 5d18834de86d..0e52f7d3b50f 100644 --- a/crates/router/src/connector/mifinity/transformers.rs +++ b/crates/router/src/connector/mifinity/transformers.rs @@ -196,6 +196,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Mifinity"), diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs index 2daf83cbacf1..ac0a04de182d 100644 --- a/crates/router/src/connector/multisafepay/transformers.rs +++ b/crates/router/src/connector/multisafepay/transformers.rs @@ -606,6 +606,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("multisafepay"), @@ -786,7 +787,8 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + | domain::PaymentMethodData::CardToken(_) + | domain::PaymentMethodData::OpenBanking(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("multisafepay"), ))? diff --git a/crates/router/src/connector/nexinets/transformers.rs b/crates/router/src/connector/nexinets/transformers.rs index c25da631b715..7e32ae5ebedb 100644 --- a/crates/router/src/connector/nexinets/transformers.rs +++ b/crates/router/src/connector/nexinets/transformers.rs @@ -625,6 +625,7 @@ fn get_payment_details_and_product( | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) + | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))?, diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs index a87b8e6176dd..e0858e16a4a6 100644 --- a/crates/router/src/connector/nmi/transformers.rs +++ b/crates/router/src/connector/nmi/transformers.rs @@ -584,6 +584,7 @@ impl | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nmi"), diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index 6de5ba5e6d12..8336cbf13188 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -352,6 +352,7 @@ impl TryFrom<&NoonRouterData<&types::PaymentsAuthorizeRouterData>> for NoonPayme | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( conn_utils::get_unimplemented_payment_method_error_message("Noon"), diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs index a23a05e34e33..1aa345173570 100644 --- a/crates/router/src/connector/nuvei/transformers.rs +++ b/crates/router/src/connector/nuvei/transformers.rs @@ -995,6 +995,7 @@ where | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), @@ -1196,6 +1197,7 @@ impl TryFrom<(&types::PaymentsCompleteAuthorizeRouterData, Secret)> | Some(domain::PaymentMethodData::Reward) | Some(domain::PaymentMethodData::RealTimePayment(..)) | Some(domain::PaymentMethodData::Upi(..)) + | Some(domain::PaymentMethodData::OpenBanking(_)) | Some(domain::PaymentMethodData::CardToken(..)) | None => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nuvei"), diff --git a/crates/router/src/connector/opayo/transformers.rs b/crates/router/src/connector/opayo/transformers.rs index b6c05dff2d31..5771b45100bd 100644 --- a/crates/router/src/connector/opayo/transformers.rs +++ b/crates/router/src/connector/opayo/transformers.rs @@ -56,6 +56,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for OpayoPaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Opayo"), diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs index c2d8e0dfddb9..8da3e7502bed 100644 --- a/crates/router/src/connector/payeezy/transformers.rs +++ b/crates/router/src/connector/payeezy/transformers.rs @@ -137,6 +137,7 @@ impl TryFrom<&PayeezyRouterData<&types::PaymentsAuthorizeRouterData>> for Payeez | diesel_models::enums::PaymentMethod::RealTimePayment | diesel_models::enums::PaymentMethod::Upi | diesel_models::enums::PaymentMethod::Voucher + | diesel_models::enums::PaymentMethod::OpenBanking | diesel_models::enums::PaymentMethod::GiftCard => { Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()) } @@ -259,6 +260,7 @@ fn get_payment_method_data( | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Payeezy"), ))?, diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs index 47942d7de43e..2ec35b7a7de0 100644 --- a/crates/router/src/connector/payme/transformers.rs +++ b/crates/router/src/connector/payme/transformers.rs @@ -429,6 +429,7 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod { | PaymentMethodData::CardRedirect(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) + | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()) } @@ -673,6 +674,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayRequest { | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) + | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("payme"), ))?, @@ -732,6 +734,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest { | Some(PaymentMethodData::Upi(_)) | Some(PaymentMethodData::Voucher(_)) | Some(PaymentMethodData::GiftCard(_)) + | Some(PaymentMethodData::OpenBanking(_)) | Some(PaymentMethodData::CardToken(_)) | None => { Err(errors::ConnectorError::NotImplemented("Tokenize Flow".to_string()).into()) @@ -771,6 +774,7 @@ impl TryFrom<&types::TokenizationRouterData> for CaptureBuyerRequest { | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) + | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented("Tokenize Flow".to_string()).into()) } diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index 283b6c80a8e6..9718fd5a8ded 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -551,6 +551,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Crypto(_) | domain::PaymentMethodData::Upi(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), diff --git a/crates/router/src/connector/placetopay/transformers.rs b/crates/router/src/connector/placetopay/transformers.rs index 50813a816299..6ecaabd3fe6c 100644 --- a/crates/router/src/connector/placetopay/transformers.rs +++ b/crates/router/src/connector/placetopay/transformers.rs @@ -151,6 +151,7 @@ impl TryFrom<&PlacetopayRouterData<&types::PaymentsAuthorizeRouterData>> | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Placetopay"), diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rs index 6fe1a7173be4..40fe8235956b 100644 --- a/crates/router/src/connector/powertranz/transformers.rs +++ b/crates/router/src/connector/powertranz/transformers.rs @@ -116,6 +116,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotSupported { message: utils::SELECTED_PAYMENT_METHOD.to_string(), diff --git a/crates/router/src/connector/razorpay/transformers.rs b/crates/router/src/connector/razorpay/transformers.rs index 5618c85d531a..8cf328918868 100644 --- a/crates/router/src/connector/razorpay/transformers.rs +++ b/crates/router/src/connector/razorpay/transformers.rs @@ -398,6 +398,7 @@ impl | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()) } diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rs index 80ef0daaf21e..f384d8d296d5 100644 --- a/crates/router/src/connector/shift4/transformers.rs +++ b/crates/router/src/connector/shift4/transformers.rs @@ -247,6 +247,7 @@ where | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Upi(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), @@ -469,6 +470,7 @@ impl TryFrom<&types::RouterData Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Shift4"), diff --git a/crates/router/src/connector/square/transformers.rs b/crates/router/src/connector/square/transformers.rs index 15de18c88904..67be82bb2d91 100644 --- a/crates/router/src/connector/square/transformers.rs +++ b/crates/router/src/connector/square/transformers.rs @@ -174,6 +174,7 @@ impl TryFrom<&types::TokenizationRouterData> for SquareTokenRequest { | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Square"), @@ -290,6 +291,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for SquarePaymentsRequest { | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Square"), diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs index 65ee90830a36..d814deef264c 100644 --- a/crates/router/src/connector/stax/transformers.rs +++ b/crates/router/src/connector/stax/transformers.rs @@ -108,6 +108,7 @@ impl TryFrom<&StaxRouterData<&types::PaymentsAuthorizeRouterData>> for StaxPayme | domain::PaymentMethodData::GiftCard(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Upi(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Stax"), @@ -260,6 +261,7 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest { | domain::PaymentMethodData::GiftCard(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Upi(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Stax"), diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index aa792db04bd4..2524a1aeacff 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -704,6 +704,7 @@ impl TryFrom for StripePaymentMethodType { | enums::PaymentMethodType::OnlineBankingPoland | enums::PaymentMethodType::OnlineBankingSlovakia | enums::PaymentMethodType::OpenBankingUk + | enums::PaymentMethodType::OpenBankingPIS | enums::PaymentMethodType::PagoEfectivo | enums::PaymentMethodType::PayBright | enums::PaymentMethodType::Pse @@ -1330,6 +1331,7 @@ fn create_stripe_payment_method( domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::MandatePayment + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), ) @@ -1706,6 +1708,7 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent | domain::payments::PaymentMethodData::Upi(_) | domain::payments::PaymentMethodData::Voucher(_) | domain::payments::PaymentMethodData::GiftCard(_) + | domain::payments::PaymentMethodData::OpenBanking(_) | domain::payments::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotSupported { message: "Network tokenization for payment method".to_string(), @@ -3281,6 +3284,7 @@ impl | Some(domain::PaymentMethodData::GiftCard(..)) | Some(domain::PaymentMethodData::CardRedirect(..)) | Some(domain::PaymentMethodData::Voucher(..)) + | Some(domain::PaymentMethodData::OpenBanking(..)) | Some(domain::PaymentMethodData::CardToken(..)) | None => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), @@ -3734,6 +3738,7 @@ impl | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::Voucher(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs index 77d85393d29f..85539e253b7b 100644 --- a/crates/router/src/connector/trustpay/transformers.rs +++ b/crates/router/src/connector/trustpay/transformers.rs @@ -433,6 +433,7 @@ impl TryFrom<&TrustpayRouterData<&types::PaymentsAuthorizeRouterData>> for Trust | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("trustpay"), diff --git a/crates/router/src/connector/tsys/transformers.rs b/crates/router/src/connector/tsys/transformers.rs index cea51ce77e19..53561d93a926 100644 --- a/crates/router/src/connector/tsys/transformers.rs +++ b/crates/router/src/connector/tsys/transformers.rs @@ -76,6 +76,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for TsysPaymentsRequest { | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("tsys"), diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index d56de472eb30..3377a946fbdc 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -2668,6 +2668,7 @@ pub enum PaymentMethodDataType { Fps, PromptPay, VietQr, + OpenBanking, } impl From for PaymentMethodDataType { @@ -2848,6 +2849,9 @@ impl From for PaymentMethodDataType { } } domain::payments::PaymentMethodData::CardToken(_) => Self::CardToken, + domain::payments::PaymentMethodData::OpenBanking(data) => match data { + hyperswitch_domain_models::payment_method_data::OpenBankingData::OpenBankingPIS { } => Self::OpenBanking + }, } } } diff --git a/crates/router/src/connector/volt/transformers.rs b/crates/router/src/connector/volt/transformers.rs index 12064fdf0f40..ac55f55d5369 100644 --- a/crates/router/src/connector/volt/transformers.rs +++ b/crates/router/src/connector/volt/transformers.rs @@ -150,6 +150,7 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Volt"), diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs index fe1bcab0bb23..365ddda4d537 100644 --- a/crates/router/src/connector/worldline/transformers.rs +++ b/crates/router/src/connector/worldline/transformers.rs @@ -249,6 +249,7 @@ impl | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("worldline"), diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs index 5caf6b0e1f16..892b66447228 100644 --- a/crates/router/src/connector/worldpay/transformers.rs +++ b/crates/router/src/connector/worldpay/transformers.rs @@ -108,6 +108,7 @@ fn fetch_payment_instrument( | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::CardRedirect(_) | domain::PaymentMethodData::GiftCard(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("worldpay"), ) diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs index 026c39f0e3e9..2562277ee9b4 100644 --- a/crates/router/src/connector/zen/transformers.rs +++ b/crates/router/src/connector/zen/transformers.rs @@ -694,6 +694,7 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment | domain::PaymentMethodData::Reward | domain::PaymentMethodData::RealTimePayment(_) | domain::PaymentMethodData::Upi(_) + | domain::PaymentMethodData::OpenBanking(_) | domain::PaymentMethodData::CardToken(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), diff --git a/crates/router/src/connector/zsl/transformers.rs b/crates/router/src/connector/zsl/transformers.rs index f44d46cd8e07..ada1de0e6188 100644 --- a/crates/router/src/connector/zsl/transformers.rs +++ b/crates/router/src/connector/zsl/transformers.rs @@ -181,7 +181,8 @@ impl TryFrom<&ZslRouterData<&types::PaymentsAuthorizeRouterData>> for ZslPayment | domain::PaymentMethodData::Upi(_) | domain::PaymentMethodData::Voucher(_) | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::CardToken(_) => { + | domain::PaymentMethodData::CardToken(_) + | domain::PaymentMethodData::OpenBanking(_) => { Err(errors::ConnectorError::NotImplemented( connector_utils::get_unimplemented_payment_method_error_message( item.router_data.connector.as_str(), diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs index 0d0eace13e3e..331eb4302117 100644 --- a/crates/router/src/core/fraud_check.rs +++ b/crates/router/src/core/fraud_check.rs @@ -91,6 +91,7 @@ where key_store, customer, &merchant_connector_account, + None, ) .await?; diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs index d897b9e6339e..47ab1810f75f 100644 --- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs +++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs @@ -13,11 +13,14 @@ use crate::{ }, errors, services, types::{ - api::fraud_check::{self as frm_api, FraudCheckConnectorData}, + api::{ + self, + fraud_check::{self as frm_api, FraudCheckConnectorData}, + }, domain, fraud_check::{FraudCheckCheckoutData, FraudCheckResponseData, FrmCheckoutRouterData}, storage::enums as storage_enums, - BrowserInformation, ConnectorAuthType, ResponseId, RouterData, + BrowserInformation, ConnectorAuthType, MerchantRecipientData, ResponseId, RouterData, }, SessionState, }; @@ -34,6 +37,7 @@ impl ConstructFlowSpecificData, merchant_connector_account: &helpers::MerchantConnectorAccountType, + _merchant_recipient_data: Option, ) -> RouterResult> { let status = storage_enums::AttemptStatus::Pending; @@ -135,6 +139,17 @@ impl ConstructFlowSpecificData( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs index b44f2d3d4fc8..2f2631240835 100644 --- a/crates/router/src/core/fraud_check/flows/record_return.rs +++ b/crates/router/src/core/fraud_check/flows/record_return.rs @@ -11,13 +11,13 @@ use crate::{ }, errors, services, types::{ - api::RecordReturn, + api::{self, RecordReturn}, domain, fraud_check::{ FraudCheckRecordReturnData, FraudCheckResponseData, FrmRecordReturnRouterData, }, storage::enums as storage_enums, - ConnectorAuthType, ResponseId, RouterData, + ConnectorAuthType, MerchantRecipientData, ResponseId, RouterData, }, utils, SessionState, }; @@ -34,6 +34,7 @@ impl ConstructFlowSpecificData, merchant_connector_account: &helpers::MerchantConnectorAccountType, + _merchant_recipient_data: Option, ) -> RouterResult> { let status = storage_enums::AttemptStatus::Pending; @@ -107,6 +108,17 @@ impl ConstructFlowSpecificData( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs index 907b941ee67c..fee1964a42a2 100644 --- a/crates/router/src/core/fraud_check/flows/sale_flow.rs +++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs @@ -11,11 +11,11 @@ use crate::{ }, errors, services, types::{ - api::fraud_check as frm_api, + api::{self, fraud_check as frm_api}, domain, fraud_check::{FraudCheckResponseData, FraudCheckSaleData, FrmSaleRouterData}, storage::enums as storage_enums, - ConnectorAuthType, ResponseId, RouterData, + ConnectorAuthType, MerchantRecipientData, ResponseId, RouterData, }, SessionState, }; @@ -32,6 +32,7 @@ impl ConstructFlowSpecificData, merchant_connector_account: &helpers::MerchantConnectorAccountType, + _merchant_recipient_data: Option, ) -> RouterResult> { let status = storage_enums::AttemptStatus::Pending; @@ -116,6 +117,17 @@ impl ConstructFlowSpecificData( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs index dd042a6b5939..c5d00c4a8e97 100644 --- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs +++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs @@ -10,13 +10,13 @@ use crate::{ }, errors, services, types::{ - api::fraud_check as frm_api, + api::{self, fraud_check as frm_api}, domain, fraud_check::{ FraudCheckResponseData, FraudCheckTransactionData, FrmTransactionRouterData, }, storage::enums as storage_enums, - ConnectorAuthType, ResponseId, RouterData, + ConnectorAuthType, MerchantRecipientData, ResponseId, RouterData, }, SessionState, }; @@ -37,6 +37,7 @@ impl _key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + _merchant_recipient_data: Option, ) -> RouterResult< RouterData, > { @@ -120,6 +121,17 @@ impl Ok(router_data) } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index a7a87b6d96e7..00b51b9f09e2 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -71,6 +71,7 @@ pub async fn retrieve_payment_method( pm @ Some(api::PaymentMethodData::RealTimePayment(_)) => Ok((pm.to_owned(), None)), pm @ Some(api::PaymentMethodData::CardRedirect(_)) => Ok((pm.to_owned(), None)), pm @ Some(api::PaymentMethodData::GiftCard(_)) => Ok((pm.to_owned(), None)), + pm @ Some(api::PaymentMethodData::OpenBanking(_)) => Ok((pm.to_owned(), None)), pm_opt @ Some(pm @ api::PaymentMethodData::BankTransfer(_)) => { let payment_token = helpers::store_payment_method_data_in_vault( state, diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index ccca6eaed60c..2e197516ed66 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -27,7 +27,7 @@ use api_models::{ }; use common_utils::{ ext_traits::{AsyncExt, StringExt}, - pii, + id_type, pii, types::{MinorUnit, Surcharge}, }; use diesel_models::{ephemeral_key, fraud_check::FraudCheck}; @@ -41,7 +41,7 @@ pub use hyperswitch_domain_models::{ router_data::RouterData, router_request_types::CustomerDetails, }; -use masking::{ExposeInterface, Secret}; +use masking::{ExposeInterface, PeekInterface, Secret}; use redis_interface::errors::RedisError; use router_env::{instrument, metrics::add_attributes, tracing}; #[cfg(feature = "olap")] @@ -74,6 +74,7 @@ use crate::{ core::{ authentication as authentication_core, errors::{self, CustomResult, RouterResponse, RouterResult}, + payment_methods::cards, utils, }, db::StorageInterface, @@ -285,7 +286,7 @@ where } else { None }; - let router_data = call_connector_service( + let (router_data, mca) = call_connector_service( state, req_state.clone(), &merchant_account, @@ -307,6 +308,9 @@ where ) .await?; + let op_ref = &operation; + let should_trigger_post_processing_flows = is_operation_confirm(&operation); + let operation = Box::new(PaymentResponse); connector_http_status_code = router_data.connector_http_status_code; @@ -326,7 +330,7 @@ where ) .await?; - operation + let mut payment_data = operation .to_post_update_tracker()? .update_tracker( state, @@ -336,7 +340,23 @@ where &key_store, merchant_account.storage_scheme, ) - .await? + .await?; + + if should_trigger_post_processing_flows { + complete_postprocessing_steps_if_required( + state, + &merchant_account, + &key_store, + &customer, + &mca, + &connector, + &mut payment_data, + op_ref, + ) + .await?; + } + + payment_data } ConnectorCallType::Retryable(connectors) => { @@ -357,7 +377,7 @@ where } else { None }; - let router_data = call_connector_service( + let (router_data, mca) = call_connector_service( state, req_state.clone(), &merchant_account, @@ -414,6 +434,9 @@ where }; } + let op_ref = &operation; + let should_trigger_post_processing_flows = is_operation_confirm(&operation); + let operation = Box::new(PaymentResponse); connector_http_status_code = router_data.connector_http_status_code; external_latency = router_data.external_latency; @@ -432,7 +455,7 @@ where ) .await?; - operation + let mut payment_data = operation .to_post_update_tracker()? .update_tracker( state, @@ -442,7 +465,23 @@ where &key_store, merchant_account.storage_scheme, ) - .await? + .await?; + + if should_trigger_post_processing_flows { + complete_postprocessing_steps_if_required( + state, + &merchant_account, + &key_store, + &customer, + &mca, + &connector_data, + &mut payment_data, + op_ref, + ) + .await?; + } + + payment_data } ConnectorCallType::SessionMultiple(connectors) => { @@ -1400,7 +1439,10 @@ pub async fn call_connector_service( frm_suggestion: Option, business_profile: &storage::business_profile::BusinessProfile, is_retry_payment: bool, -) -> RouterResult> +) -> RouterResult<( + RouterData, + helpers::MerchantConnectorAccountType, +)> where F: Send + Clone + Sync, RouterDReq: Send + Sync, @@ -1461,6 +1503,16 @@ where ) .await?; + let merchant_recipient_data = payment_data + .get_merchant_recipient_data( + state, + merchant_account, + key_store, + &merchant_connector_account, + &connector, + ) + .await?; + let mut router_data = payment_data .construct_router_data( state, @@ -1469,6 +1521,7 @@ where key_store, customer, &merchant_connector_account, + merchant_recipient_data, ) .await?; @@ -1611,7 +1664,7 @@ where ) .await?; - let router_data_res = if should_continue_further { + let router_data = if should_continue_further { // The status of payment_attempt and intent will be updated in the previous step // update this in router_data. // This is added because few connector integrations do not update the status, @@ -1629,13 +1682,75 @@ where .await } else { Ok(router_data) - }; + }?; let etime_connector = Instant::now(); let duration_connector = etime_connector.saturating_duration_since(stime_connector); tracing::info!(duration = format!("Duration taken: {}", duration_connector.as_millis())); - router_data_res + Ok((router_data, merchant_connector_account)) +} + +pub async fn get_merchant_bank_data_for_open_banking_connectors( + merchant_connector_account: &helpers::MerchantConnectorAccountType, + key_store: &domain::MerchantKeyStore, + connector: &api::ConnectorData, + state: &SessionState, + merchant_account: &domain::MerchantAccount, +) -> RouterResult> { + let merchant_data = merchant_connector_account + .get_additional_merchant_data() + .get_required_value("additional_merchant_data")? + .into_inner() + .peek() + .clone(); + + let merchant_recipient_data = merchant_data + .parse_value::("AdditionalMerchantData") + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("failed to decode MerchantRecipientData")?; + + let connector_name = enums::Connector::to_string(&connector.connector_name); + let locker_based_connector_list = state.conf.locker_based_open_banking_connectors.clone(); + let contains = locker_based_connector_list + .connector_list + .contains(connector_name.as_str()); + + let recipient_id = helpers::get_recipient_id_for_open_banking(&merchant_recipient_data)?; + let final_recipient_data = if let Some(id) = recipient_id { + if contains { + // Customer Id for OpenBanking connectors will be merchant_id as the account data stored at locker belongs to the merchant + let cust_id = id_type::CustomerId::from(merchant_account.merchant_id.clone().into()) + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to convert to CustomerId")?; + let locker_resp = cards::get_payment_method_from_hs_locker( + state, + key_store, + &cust_id, + merchant_account.merchant_id.as_str(), + id.as_str(), + Some(enums::LockerChoice::HyperswitchCardVault), + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Merchant bank account data could not be fetched from locker")?; + + let parsed: router_types::MerchantAccountData = locker_resp + .peek() + .to_string() + .parse_struct("MerchantAccountData") + .change_context(errors::ApiErrorResponse::InternalServerError)?; + + Some(router_types::MerchantRecipientData::AccountData(parsed)) + } else { + Some(router_types::MerchantRecipientData::ConnectorRecipientId( + Secret::new(id), + )) + } + } else { + None + }; + Ok(final_recipient_data) } async fn blocklist_guard( @@ -1743,6 +1858,7 @@ where key_store, customer, &merchant_connector_account, + None, ) .await?; @@ -1875,6 +1991,7 @@ where key_store, customer, merchant_connector_account, + None, ) .await?; @@ -2043,6 +2160,69 @@ where Ok(router_data_and_should_continue_payment) } +#[allow(clippy::too_many_arguments)] +async fn complete_postprocessing_steps_if_required( + state: &SessionState, + merchant_account: &domain::MerchantAccount, + key_store: &domain::MerchantKeyStore, + customer: &Option, + merchant_conn_account: &helpers::MerchantConnectorAccountType, + connector: &api::ConnectorData, + payment_data: &mut PaymentData, + _operation: &BoxedOperation<'_, F, Q>, +) -> RouterResult> +where + F: Send + Clone + Sync, + RouterDReq: Send + Sync, + + RouterData: Feature + Send, + dyn api::Connector: + services::api::ConnectorIntegration, + PaymentData: ConstructFlowSpecificData, +{ + let mut router_data = payment_data + .construct_router_data( + state, + connector.connector.id(), + merchant_account, + key_store, + customer, + merchant_conn_account, + None, + ) + .await?; + + match payment_data.payment_method_data.clone() { + Some(api_models::payments::PaymentMethodData::OpenBanking( + api_models::payments::OpenBankingData::OpenBankingPIS { .. }, + )) => { + if connector.connector_name == router_types::Connector::Plaid { + router_data = router_data.postprocessing_steps(state, connector).await?; + let token = if let Ok(ref res) = router_data.response { + match res { + router_types::PaymentsResponseData::PostProcessingResponse { + session_token, + } => session_token + .as_ref() + .map(|token| api::SessionToken::OpenBanking(token.clone())), + _ => None, + } + } else { + None + }; + if let Some(t) = token { + payment_data.sessions_token.push(t); + } + + Ok(router_data) + } else { + Ok(router_data) + } + } + _ => Ok(router_data), + } +} + pub fn is_preprocessing_required_for_wallets(connector_name: String) -> bool { connector_name == *"trustpay" || connector_name == *"payme" } diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs index 178b14dde544..fbedca14aeba 100644 --- a/crates/router/src/core/payments/connector_integration_v2_impls.rs +++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs @@ -40,6 +40,8 @@ mod dummy_connector_default_impl { impl api::PaymentsPreProcessingV2 for connector::DummyConnector {} + impl api::PaymentsPostProcessingV2 for connector::DummyConnector {} + impl services::ConnectorIntegrationV2< api::Authorize, @@ -170,6 +172,16 @@ mod dummy_connector_default_impl { { } + impl + services::ConnectorIntegrationV2< + api::PostProcessing, + types::PaymentFlowData, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, + > for connector::DummyConnector + { + } + impl services::ConnectorIntegrationV2< api::AuthorizeSessionToken, @@ -544,6 +556,7 @@ macro_rules! default_imp_for_new_connector_integration_payment { impl api::PaymentTokenV2 for $path::$connector{} impl api::ConnectorCustomerV2 for $path::$connector{} impl api::PaymentsPreProcessingV2 for $path::$connector{} + impl api::PaymentsPostProcessingV2 for $path::$connector{} impl services::ConnectorIntegrationV2 for $path::$connector{} @@ -603,6 +616,12 @@ macro_rules! default_imp_for_new_connector_integration_payment { types::PaymentsPreProcessingData, types::PaymentsResponseData, > for $path::$connector{} + impl services::ConnectorIntegrationV2< + api::PostProcessing, + types::PaymentFlowData, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, + > for $path::$connector{} impl services::ConnectorIntegrationV2< api::AuthorizeSessionToken, diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs index 815b02285dd7..53ca8d02451e 100644 --- a/crates/router/src/core/payments/flows.rs +++ b/crates/router/src/core/payments/flows.rs @@ -25,6 +25,7 @@ use crate::{ }; #[async_trait] +#[allow(clippy::too_many_arguments)] pub trait ConstructFlowSpecificData { async fn construct_router_data<'a>( &self, @@ -34,7 +35,17 @@ pub trait ConstructFlowSpecificData { key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult>; + + async fn get_merchant_recipient_data<'a>( + &self, + state: &SessionState, + merchant_account: &domain::MerchantAccount, + key_store: &domain::MerchantKeyStore, + merchant_connector_account: &helpers::MerchantConnectorAccountType, + connector: &api::ConnectorData, + ) -> RouterResult>; } #[allow(clippy::too_many_arguments)] @@ -110,6 +121,19 @@ pub trait Feature { Ok(self) } + async fn postprocessing_steps<'a>( + self, + _state: &SessionState, + _connector: &api::ConnectorData, + ) -> RouterResult + where + F: Clone, + Self: Sized, + dyn api::Connector: services::ConnectorIntegration, + { + Ok(self) + } + async fn create_connector_customer<'a>( &self, _state: &SessionState, @@ -970,6 +994,21 @@ macro_rules! default_imp_for_pre_processing_steps{ }; } +macro_rules! default_imp_for_post_processing_steps{ + ($($path:ident::$connector:ident),*)=> { + $( + impl api::PaymentsPostProcessing for $path::$connector {} + impl + services::ConnectorIntegration< + api::PostProcessing, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, + > for $path::$connector + {} + )* + }; +} + #[cfg(feature = "dummy_connector")] impl api::PaymentsPreProcessing for connector::DummyConnector {} #[cfg(feature = "dummy_connector")] @@ -1039,6 +1078,86 @@ default_imp_for_pre_processing_steps!( connector::Zsl ); +#[cfg(feature = "dummy_connector")] +impl api::PaymentsPostProcessing for connector::DummyConnector {} +#[cfg(feature = "dummy_connector")] +impl + services::ConnectorIntegration< + api::PostProcessing, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, + > for connector::DummyConnector +{ +} + +default_imp_for_post_processing_steps!( + connector::Adyenplatform, + connector::Adyen, + connector::Airwallex, + connector::Bankofamerica, + connector::Cybersource, + connector::Gocardless, + connector::Nmi, + connector::Nuvei, + connector::Payme, + connector::Paypal, + connector::Shift4, + connector::Stripe, + connector::Trustpay, + connector::Aci, + connector::Authorizedotnet, + connector::Bambora, + connector::Bamboraapac, + connector::Billwerk, + connector::Bitpay, + connector::Bluesnap, + connector::Boku, + connector::Braintree, + connector::Cashtocode, + connector::Checkout, + connector::Coinbase, + connector::Cryptopay, + connector::Datatrans, + connector::Dlocal, + connector::Ebanx, + connector::Iatapay, + connector::Fiserv, + connector::Forte, + connector::Globalpay, + connector::Globepay, + connector::Gpayments, + connector::Helcim, + connector::Klarna, + connector::Mifinity, + connector::Mollie, + connector::Multisafepay, + connector::Netcetera, + connector::Nexinets, + connector::Noon, + connector::Opayo, + connector::Opennode, + connector::Payeezy, + connector::Payone, + connector::Payu, + connector::Placetopay, + connector::Powertranz, + connector::Prophetpay, + connector::Rapyd, + connector::Riskified, + connector::Signifyd, + connector::Square, + connector::Stax, + connector::Threedsecureio, + connector::Tsys, + connector::Volt, + connector::Wise, + connector::Worldline, + connector::Worldpay, + connector::Zen, + connector::Zsl, + connector::Razorpay +); + macro_rules! default_imp_for_payouts { ($($path:ident::$connector:ident),*) => { $( diff --git a/crates/router/src/core/payments/flows/approve_flow.rs b/crates/router/src/core/payments/flows/approve_flow.rs index f4f8409912e5..63224f5b0cf0 100644 --- a/crates/router/src/core/payments/flows/approve_flow.rs +++ b/crates/router/src/core/payments/flows/approve_flow.rs @@ -24,6 +24,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::Approve, @@ -36,9 +37,21 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs index 50cf31730a99..db34c40d928a 100644 --- a/crates/router/src/core/payments/flows/authorize_flow.rs +++ b/crates/router/src/core/payments/flows/authorize_flow.rs @@ -1,4 +1,5 @@ use async_trait::async_trait; +use common_enums as enums; use router_env::metrics::add_attributes; // use router_env::tracing::Instrument; @@ -16,6 +17,7 @@ use crate::{ services, services::api::ConnectorValidation, types::{self, api, domain, storage, transformers::ForeignFrom}, + utils::OptionExt, }; #[async_trait] @@ -34,6 +36,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult< types::RouterData< api::Authorize, @@ -52,9 +55,39 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + state: &SessionState, + merchant_account: &domain::MerchantAccount, + key_store: &domain::MerchantKeyStore, + merchant_connector_account: &helpers::MerchantConnectorAccountType, + connector: &api::ConnectorData, + ) -> RouterResult> { + let payment_method = &self + .payment_attempt + .payment_method + .get_required_value("PaymentMethod")?; + + let data = if *payment_method == enums::PaymentMethod::OpenBanking { + payments::get_merchant_bank_data_for_open_banking_connectors( + merchant_connector_account, + key_store, + connector, + state, + merchant_account, + ) + .await? + } else { + None + }; + + Ok(data) + } } #[async_trait] impl Feature for types::PaymentsAuthorizeRouterData { @@ -170,6 +203,14 @@ impl Feature for types::PaymentsAu authorize_preprocessing_steps(state, &self, true, connector).await } + async fn postprocessing_steps<'a>( + self, + state: &SessionState, + connector: &api::ConnectorData, + ) -> RouterResult { + authorize_postprocessing_steps(state, &self, true, connector).await + } + async fn create_connector_customer<'a>( &self, state: &SessionState, @@ -399,3 +440,53 @@ pub async fn authorize_preprocessing_steps( Ok(router_data.clone()) } } + +pub async fn authorize_postprocessing_steps( + state: &SessionState, + router_data: &types::RouterData, + confirm: bool, + connector: &api::ConnectorData, +) -> RouterResult> { + if confirm { + let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< + api::PostProcessing, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, + > = connector.connector.get_connector_integration(); + + let postprocessing_request_data = + types::PaymentsPostProcessingData::try_from(router_data.to_owned())?; + + let postprocessing_response_data: Result< + types::PaymentsResponseData, + types::ErrorResponse, + > = Err(types::ErrorResponse::default()); + + let postprocessing_router_data = + helpers::router_data_type_conversion::<_, api::PostProcessing, _, _, _, _>( + router_data.clone(), + postprocessing_request_data, + postprocessing_response_data, + ); + + let resp = services::execute_connector_processing_step( + state, + connector_integration, + &postprocessing_router_data, + payments::CallConnectorAction::Trigger, + None, + ) + .await + .to_payment_failed_response()?; + + let authorize_router_data = helpers::router_data_type_conversion::<_, F, _, _, _, _>( + resp.clone(), + router_data.request.to_owned(), + resp.response, + ); + + Ok(authorize_router_data) + } else { + Ok(router_data.clone()) + } +} diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs index d61730117a83..486e8bb75dcc 100644 --- a/crates/router/src/core/payments/flows/cancel_flow.rs +++ b/crates/router/src/core/payments/flows/cancel_flow.rs @@ -24,6 +24,7 @@ impl ConstructFlowSpecificData, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::Void, @@ -36,9 +37,21 @@ impl ConstructFlowSpecificData( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/capture_flow.rs b/crates/router/src/core/payments/flows/capture_flow.rs index 1c4f76d9833b..a7f30f2a41b3 100644 --- a/crates/router/src/core/payments/flows/capture_flow.rs +++ b/crates/router/src/core/payments/flows/capture_flow.rs @@ -24,6 +24,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::Capture, @@ -36,9 +37,21 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs index 6bef7e958595..d3ae67f46c34 100644 --- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs +++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs @@ -28,6 +28,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult< types::RouterData< api::CompleteAuthorize, @@ -46,9 +47,21 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs index 2aa808f95323..3bc05cedb457 100644 --- a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs +++ b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs @@ -27,6 +27,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::IncrementalAuthorization, @@ -39,9 +40,21 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs index d094fe6a21da..cb6c6f50d5ea 100644 --- a/crates/router/src/core/payments/flows/psync_flow.rs +++ b/crates/router/src/core/payments/flows/psync_flow.rs @@ -25,6 +25,7 @@ impl ConstructFlowSpecificData, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult< types::RouterData, > { @@ -39,9 +40,21 @@ impl ConstructFlowSpecificData( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/reject_flow.rs b/crates/router/src/core/payments/flows/reject_flow.rs index cb1dcd5b19f3..501c0a40dab3 100644 --- a/crates/router/src/core/payments/flows/reject_flow.rs +++ b/crates/router/src/core/payments/flows/reject_flow.rs @@ -23,6 +23,7 @@ impl ConstructFlowSpecificData, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::Reject, @@ -35,9 +36,21 @@ impl ConstructFlowSpecificData( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs index 664038454a49..883203ad99ed 100644 --- a/crates/router/src/core/payments/flows/session_flow.rs +++ b/crates/router/src/core/payments/flows/session_flow.rs @@ -39,6 +39,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::Session, @@ -51,9 +52,21 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &routes::SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs index 773677f3e7cf..0d4648b81f46 100644 --- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs +++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs @@ -31,6 +31,7 @@ impl key_store: &domain::MerchantKeyStore, customer: &Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult { Box::pin(transformers::construct_payment_router_data::< api::SetupMandate, @@ -43,9 +44,21 @@ impl key_store, customer, merchant_connector_account, + merchant_recipient_data, )) .await } + + async fn get_merchant_recipient_data<'a>( + &self, + _state: &SessionState, + _merchant_account: &domain::MerchantAccount, + _key_store: &domain::MerchantKeyStore, + _merchant_connector_account: &helpers::MerchantConnectorAccountType, + _connector: &api::ConnectorData, + ) -> RouterResult> { + Ok(None) + } } #[async_trait] diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index da44703732f7..1579322995b5 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -66,8 +66,9 @@ use crate::{ self, enums as storage_enums, ephemeral_key, CardTokenData, CustomerUpdate::Update, }, transformers::{ForeignFrom, ForeignTryFrom}, - AdditionalPaymentMethodConnectorResponse, ErrorResponse, MandateReference, - PaymentsResponseData, RecurringMandatePaymentData, RouterData, + AdditionalMerchantData, AdditionalPaymentMethodConnectorResponse, ErrorResponse, + MandateReference, MerchantAccountData, MerchantRecipientData, PaymentsResponseData, + RecipientIdType, RecurringMandatePaymentData, RouterData, }, utils::{ self, @@ -2429,6 +2430,7 @@ pub fn validate_payment_method_type_against_payment_method( | api_enums::PaymentMethodType::Bizum | api_enums::PaymentMethodType::Interac | api_enums::PaymentMethodType::OpenBankingUk + | api_enums::PaymentMethodType::OpenBankingPIS ), api_enums::PaymentMethod::BankTransfer => matches!( payment_method_type, @@ -2503,6 +2505,10 @@ pub fn validate_payment_method_type_against_payment_method( | api_enums::PaymentMethodType::MomoAtm | api_enums::PaymentMethodType::CardRedirect ), + api_enums::PaymentMethod::OpenBanking => matches!( + payment_method_type, + api_enums::PaymentMethodType::OpenBankingPIS + ), } } @@ -3341,6 +3347,15 @@ impl MerchantConnectorAccountType { Self::CacheVal(_) => None, } } + + pub fn get_additional_merchant_data( + &self, + ) -> Option>> { + match self { + Self::DbVal(db_val) => db_val.additional_merchant_data.clone(), + Self::CacheVal(_) => None, + } + } } /// Query for merchant connector account either by business label or profile id @@ -4024,6 +4039,9 @@ pub async fn get_additional_payment_data( api_models::payments::PaymentMethodData::CardToken(_) => { api_models::payments::AdditionalPaymentData::CardToken {} } + api_models::payments::PaymentMethodData::OpenBanking(_) => { + api_models::payments::AdditionalPaymentData::OpenBanking {} + } } } @@ -4572,6 +4590,11 @@ pub fn get_key_params_for_surcharge_details( gift_card.get_payment_method_type(), None, )), + api_models::payments::PaymentMethodData::OpenBanking(ob_data) => Some(( + common_enums::PaymentMethod::OpenBanking, + ob_data.get_payment_method_type(), + None, + )), api_models::payments::PaymentMethodData::CardToken(_) => None, } } @@ -4669,6 +4692,40 @@ pub fn validate_session_expiry(session_expiry: u32) -> Result<(), errors::ApiErr } } +pub fn get_recipient_id_for_open_banking( + merchant_data: &AdditionalMerchantData, +) -> Result, errors::ApiErrorResponse> { + match merchant_data { + AdditionalMerchantData::OpenBankingRecipientData(data) => match data { + MerchantRecipientData::ConnectorRecipientId(id) => Ok(Some(id.peek().clone())), + MerchantRecipientData::AccountData(acc_data) => match acc_data { + MerchantAccountData::Bacs { + connector_recipient_id, + .. + } => match connector_recipient_id { + Some(RecipientIdType::ConnectorId(id)) => Ok(Some(id.peek().clone())), + Some(RecipientIdType::LockerId(id)) => Ok(Some(id.peek().clone())), + _ => Err(errors::ApiErrorResponse::InvalidConnectorConfiguration { + config: "recipient_id".to_string(), + }), + }, + MerchantAccountData::Iban { + connector_recipient_id, + .. + } => match connector_recipient_id { + Some(RecipientIdType::ConnectorId(id)) => Ok(Some(id.peek().clone())), + Some(RecipientIdType::LockerId(id)) => Ok(Some(id.peek().clone())), + _ => Err(errors::ApiErrorResponse::InvalidConnectorConfiguration { + config: "recipient_id".to_string(), + }), + }, + }, + _ => Err(errors::ApiErrorResponse::InvalidConnectorConfiguration { + config: "recipient_id".to_string(), + }), + }, + } +} // This function validates the intent fulfillment time expiry set by the merchant in the request pub fn validate_intent_fulfillment_expiry( intent_fulfillment_time: u32, diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs index a28b9fe3dd2d..fc075f29799b 100644 --- a/crates/router/src/core/payments/operations/payment_response.rs +++ b/crates/router/src/core/payments/operations/payment_response.rs @@ -1116,6 +1116,7 @@ async fn payment_response_update_tracker( types::PaymentsResponseData::ThreeDSEnrollmentResponse { .. } => { (None, None) } + types::PaymentsResponseData::PostProcessingResponse { .. } => (None, None), types::PaymentsResponseData::IncrementalAuthorizationResponse { .. } => (None, None), @@ -1338,13 +1339,14 @@ async fn payment_response_update_tracker( .in_current_span(), ); - let (payment_intent, _, _) = futures::try_join!( + let (payment_intent, _, payment_attempt) = futures::try_join!( utils::flatten_join_error(payment_intent_fut), utils::flatten_join_error(mandate_update_fut), utils::flatten_join_error(payment_attempt_fut) )?; payment_data.payment_intent = payment_intent; + payment_data.payment_attempt = payment_attempt; router_data.payment_method_status.and_then(|status| { payment_data .payment_method_info diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs index 6160ffacb0a6..bf5ae5aa6350 100644 --- a/crates/router/src/core/payments/retry.rs +++ b/crates/router/src/core/payments/retry.rs @@ -306,7 +306,7 @@ where ) .await?; - payments::call_connector_service( + let (router_data, _mca) = payments::call_connector_service( state, req_state, merchant_account, @@ -323,7 +323,9 @@ where business_profile, true, ) - .await + .await?; + + Ok(router_data) } #[instrument(skip_all)] diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index a5648af427c2..9f9231b1d4ef 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -38,6 +38,7 @@ use crate::{ }; #[instrument(skip_all)] +#[allow(clippy::too_many_arguments)] pub async fn construct_payment_router_data<'a, F, T>( state: &'a SessionState, payment_data: PaymentData, @@ -46,6 +47,7 @@ pub async fn construct_payment_router_data<'a, F, T>( _key_store: &domain::MerchantKeyStore, customer: &'a Option, merchant_connector_account: &helpers::MerchantConnectorAccountType, + merchant_recipient_data: Option, ) -> RouterResult> where T: TryFrom>, @@ -157,7 +159,14 @@ where .payment_attempt .authentication_type .unwrap_or_default(), - connector_meta_data: merchant_connector_account.get_metadata(), + connector_meta_data: if let Some(data) = merchant_recipient_data { + let val = serde_json::to_value(data) + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed while encoding MerchantRecipientData")?; + Some(Secret::new(val)) + } else { + merchant_connector_account.get_metadata() + }, connector_wallets_details: merchant_connector_account.get_connector_wallets_details(), request: T::try_from(additional_data)?, response, @@ -909,7 +918,7 @@ where { // If the operation is confirm, we will send session token response in next action if format!("{operation:?}").eq("PaymentConfirm") { - payment_attempt + let condition1 = payment_attempt .connector .as_ref() .map(|connector| { @@ -924,7 +933,36 @@ where Some(false) } }) - .unwrap_or(false) + .unwrap_or(false); + + // This condition to be triggered for open banking connectors, third party SDK session token will be provided + let condition2 = payment_attempt + .connector + .as_ref() + .map(|connector| matches!(connector.as_str(), "plaid")) + .and_then(|is_connector_supports_third_party_sdk| { + if is_connector_supports_third_party_sdk { + payment_attempt + .payment_method + .map(|pm| matches!(pm, diesel_models::enums::PaymentMethod::OpenBanking)) + .and_then(|first_match| { + payment_attempt + .payment_method_type + .map(|pmt| { + matches!( + pmt, + diesel_models::enums::PaymentMethodType::OpenBankingPIS + ) + }) + .map(|second_match| first_match && second_match) + }) + } else { + Some(false) + } + }) + .unwrap_or(false); + + condition1 || condition2 } else { false } @@ -1297,6 +1335,11 @@ impl TryFrom> for types::PaymentsAuthoriz .map(|customer| customer.clone().into_inner()) }); + let customer_id = additional_data + .customer_data + .as_ref() + .map(|data| data.customer_id.clone()); + let charges = match payment_data.payment_intent.charges { Some(charges) => charges .peek() @@ -1340,7 +1383,7 @@ impl TryFrom> for types::PaymentsAuthoriz router_return_url, webhook_url, complete_authorize_url, - customer_id: None, + customer_id, surcharge_details: payment_data.surcharge_details, request_incremental_authorization: matches!( payment_data diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs index 0d4c525f1047..e91a55e860c8 100644 --- a/crates/router/src/core/payout_link.rs +++ b/crates/router/src/core/payout_link.rs @@ -329,6 +329,7 @@ pub async fn filter_payout_methods( | common_enums::PaymentMethod::RealTimePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher + | common_enums::PaymentMethod::OpenBanking | common_enums::PaymentMethod::GiftCard => continue, } } diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index b5f97a09f703..c5e536de3aa8 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -42,9 +42,10 @@ pub use hyperswitch_domain_models::{ DestinationChargeRefund, DirectChargeRefund, MandateRevokeRequestData, MultipleCaptureRequestData, PaymentMethodTokenizationData, PaymentsApproveData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, - PaymentsIncrementalAuthorizationData, PaymentsPreProcessingData, PaymentsRejectData, - PaymentsSessionData, PaymentsSyncData, RefundsData, ResponseId, RetrieveFileRequestData, - SetupMandateRequestData, SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData, + PaymentsIncrementalAuthorizationData, PaymentsPostProcessingData, + PaymentsPreProcessingData, PaymentsRejectData, PaymentsSessionData, PaymentsSyncData, + RefundsData, ResponseId, RetrieveFileRequestData, SetupMandateRequestData, + SubmitEvidenceRequestData, SyncRequestType, UploadFileRequestData, VerifyWebhookSourceRequestData, }, router_response_types::{ @@ -80,6 +81,8 @@ pub type PaymentsAuthorizeRouterData = RouterData; pub type PaymentsPreProcessingRouterData = RouterData; +pub type PaymentsPostProcessingRouterData = + RouterData; pub type PaymentsAuthorizeSessionTokenRouterData = RouterData; pub type PaymentsCompleteAuthorizeRouterData = @@ -163,6 +166,11 @@ pub type PaymentsPreProcessingType = dyn services::ConnectorIntegration< PaymentsPreProcessingData, PaymentsResponseData, >; +pub type PaymentsPostProcessingType = dyn services::ConnectorIntegration< + api::PostProcessing, + PaymentsPostProcessingData, + PaymentsResponseData, +>; pub type PaymentsCompleteAuthorizeType = dyn services::ConnectorIntegration< api::CompleteAuthorize, CompleteAuthorizeData, diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs index e1dbf452eff9..3c1d8175e8bc 100644 --- a/crates/router/src/types/api/payments.rs +++ b/crates/router/src/types/api/payments.rs @@ -2,10 +2,10 @@ pub use api_models::payments::{ AcceptanceType, Address, AddressDetails, Amount, AuthenticationForStartResponse, Card, CryptoData, CustomerAcceptance, HeaderPayload, MandateAmountData, MandateData, MandateTransactionType, MandateType, MandateValidationFields, NextActionType, OnlineMandate, - PayLaterData, PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, - PaymentListFilters, PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2, - PaymentMethodData, PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, - PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest, + OpenBankingSessionToken, PayLaterData, PaymentIdType, PaymentListConstraints, + PaymentListFilterConstraints, PaymentListFilters, PaymentListFiltersV2, PaymentListResponse, + PaymentListResponseV2, PaymentMethodData, PaymentMethodDataRequest, PaymentMethodDataResponse, + PaymentOp, PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest, PaymentsExternalAuthenticationRequest, PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest, PaymentsRedirectRequest, PaymentsRedirectionResponse, @@ -18,14 +18,14 @@ use error_stack::ResultExt; pub use hyperswitch_domain_models::router_flow_types::payments::{ Approve, Authorize, AuthorizeSessionToken, Balance, Capture, CompleteAuthorize, CreateConnectorCustomer, IncrementalAuthorization, InitPayment, PSync, PaymentMethodToken, - PreProcessing, Reject, Session, SetupMandate, Void, + PostProcessing, PreProcessing, Reject, Session, SetupMandate, Void, }; pub use super::payments_v2::{ ConnectorCustomerV2, MandateSetupV2, PaymentApproveV2, PaymentAuthorizeSessionTokenV2, PaymentAuthorizeV2, PaymentCaptureV2, PaymentIncrementalAuthorizationV2, PaymentRejectV2, PaymentSessionV2, PaymentSyncV2, PaymentTokenV2, PaymentV2, PaymentVoidV2, - PaymentsCompleteAuthorizeV2, PaymentsPreProcessingV2, + PaymentsCompleteAuthorizeV2, PaymentsPostProcessingV2, PaymentsPreProcessingV2, }; use crate::{ core::errors, @@ -172,6 +172,15 @@ pub trait PaymentsPreProcessing: { } +pub trait PaymentsPostProcessing: + api::ConnectorIntegration< + PostProcessing, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, +> +{ +} + pub trait Payment: api_types::ConnectorCommon + api_types::ConnectorValidation @@ -187,6 +196,7 @@ pub trait Payment: + PaymentSession + PaymentToken + PaymentsPreProcessing + + PaymentsPostProcessing + ConnectorCustomer + PaymentIncrementalAuthorization { diff --git a/crates/router/src/types/api/payments_v2.rs b/crates/router/src/types/api/payments_v2.rs index fc490ea3d790..639dc0de5bcc 100644 --- a/crates/router/src/types/api/payments_v2.rs +++ b/crates/router/src/types/api/payments_v2.rs @@ -3,7 +3,7 @@ use hyperswitch_domain_models::{ router_flow_types::payments::{ Approve, Authorize, AuthorizeSessionToken, Capture, CompleteAuthorize, CreateConnectorCustomer, IncrementalAuthorization, PSync, PaymentMethodToken, - PreProcessing, Reject, Session, SetupMandate, Void, + PostProcessing, PreProcessing, Reject, Session, SetupMandate, Void, }, }; @@ -152,6 +152,16 @@ pub trait PaymentsPreProcessingV2: { } +pub trait PaymentsPostProcessingV2: + api::ConnectorIntegrationV2< + PostProcessing, + PaymentFlowData, + types::PaymentsPostProcessingData, + types::PaymentsResponseData, +> +{ +} + pub trait PaymentV2: api_types::ConnectorCommon + api_types::ConnectorValidation @@ -167,6 +177,7 @@ pub trait PaymentV2: + PaymentSessionV2 + PaymentTokenV2 + PaymentsPreProcessingV2 + + PaymentsPostProcessingV2 + ConnectorCustomerV2 + PaymentIncrementalAuthorizationV2 { diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 78c2bf231f2e..9a42916f68d3 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -478,6 +478,7 @@ impl ForeignFrom for api_enums::PaymentMethod { | api_enums::PaymentMethodType::OnlineBankingPoland | api_enums::PaymentMethodType::OnlineBankingSlovakia | api_enums::PaymentMethodType::OpenBankingUk + | api_enums::PaymentMethodType::OpenBankingPIS | api_enums::PaymentMethodType::Przelewy24 | api_enums::PaymentMethodType::Trustly | api_enums::PaymentMethodType::Bizum @@ -556,6 +557,7 @@ impl ForeignTryFrom for api_enums::PaymentMethod { payments::PaymentMethodData::Voucher(..) => Ok(Self::Voucher), payments::PaymentMethodData::GiftCard(..) => Ok(Self::GiftCard), payments::PaymentMethodData::CardRedirect(..) => Ok(Self::CardRedirect), + payments::PaymentMethodData::OpenBanking(..) => Ok(Self::OpenBanking), payments::PaymentMethodData::MandatePayment => { Err(errors::ApiErrorResponse::InvalidRequestData { message: ("Mandate payments cannot have payment_method_data field".to_string()), diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs index 3e2708fb1f43..3af6e277de9e 100644 --- a/crates/router/tests/connectors/cashtocode.rs +++ b/crates/router/tests/connectors/cashtocode.rs @@ -1,4 +1,5 @@ use api_models::payments::{Address, AddressDetails}; +use common_utils::id_type; use router::types::{self, domain, storage::enums}; use crate::{ @@ -41,6 +42,7 @@ impl CashtocodeTest { payment_method_type: Option, payment_method_data: domain::PaymentMethodData, ) -> Option { + let cust_id = id_type::CustomerId::from("John Doe".into()); Some(types::PaymentsAuthorizeData { amount: 1000, currency: enums::Currency::EUR, @@ -66,7 +68,7 @@ impl CashtocodeTest { router_return_url: Some(String::from("https://google.com")), webhook_url: None, complete_authorize_url: None, - customer_id: Some("John Doe".to_owned()), + customer_id: if let Ok(id) = cust_id { Some(id) } else { None }, surcharge_details: None, request_incremental_authorization: false, metadata: None, diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs index b03fee739f70..736c9ae6b536 100644 --- a/crates/router/tests/connectors/utils.rs +++ b/crates/router/tests/connectors/utils.rs @@ -560,6 +560,7 @@ pub trait ConnectorActions: Connector { Ok(types::PaymentsResponseData::ThreeDSEnrollmentResponse { .. }) => None, Ok(types::PaymentsResponseData::MultipleCaptureResponse { .. }) => None, Ok(types::PaymentsResponseData::IncrementalAuthorizationResponse { .. }) => None, + Ok(types::PaymentsResponseData::PostProcessingResponse { .. }) => None, Err(_) => None, } } @@ -1069,6 +1070,7 @@ pub fn get_connector_transaction_id( Ok(types::PaymentsResponseData::ThreeDSEnrollmentResponse { .. }) => None, Ok(types::PaymentsResponseData::MultipleCaptureResponse { .. }) => None, Ok(types::PaymentsResponseData::IncrementalAuthorizationResponse { .. }) => None, + Ok(types::PaymentsResponseData::PostProcessingResponse { .. }) => None, Err(_) => None, } }