From 829a20cc933267551e49565d06eb08e03e5f13bb Mon Sep 17 00:00:00 2001 From: spritianeja03 <146620839+spritianeja03@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:56:24 +0530 Subject: [PATCH] refactor(connector): Move connectors Forte, Nexinets, Payeezy, Payu and Zen from Router to Hyperswitch Connector Trait (#6261) Co-authored-by: Spriti Aneja Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- Cargo.lock | 1 + crates/common_utils/src/consts.rs | 4 + crates/hyperswitch_connectors/Cargo.toml | 1 + .../hyperswitch_connectors/src/connectors.rs | 12 +- .../src/connectors}/forte.rs | 323 +++++++------ .../src/connectors}/forte/transformers.rs | 144 +++--- .../src/connectors}/nexinets.rs | 371 ++++++++------- .../src/connectors}/nexinets/transformers.rs | 302 ++++++------- .../src/connectors}/payeezy.rs | 308 ++++++------- .../src/connectors}/payeezy/transformers.rs | 300 ++++++------ .../src/connectors}/payu.rs | 425 ++++++++--------- .../src/connectors}/payu/transformers.rs | 128 +++--- .../src/connectors}/zen.rs | 356 +++++++-------- .../src/connectors}/zen/transformers.rs | 427 +++++++++--------- .../hyperswitch_connectors/src/constants.rs | 3 + .../src/default_implementations.rs | 210 +++++++-- .../src/default_implementations_v2.rs | 154 ++++++- crates/hyperswitch_connectors/src/utils.rs | 98 ++++ crates/router/src/connector.rs | 28 +- .../connector_integration_v2_impls.rs | 110 ----- crates/router/src/core/payments/flows.rs | 154 ------- 21 files changed, 1912 insertions(+), 1947 deletions(-) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/forte.rs (69%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/forte/transformers.rs (79%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/nexinets.rs (65%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/nexinets/transformers.rs (67%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/payeezy.rs (63%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/payeezy/transformers.rs (57%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/payu.rs (61%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/payu/transformers.rs (82%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/zen.rs (64%) rename crates/{router/src/connector => hyperswitch_connectors/src/connectors}/zen/transformers.rs (71%) diff --git a/Cargo.lock b/Cargo.lock index 347d4e587979..9ccedba3c39b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3997,6 +3997,7 @@ dependencies = [ "hyperswitch_interfaces", "image", "masking", + "mime", "once_cell", "qrcode", "rand", diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rs index 21e5866aea00..5fc2fea9c8b2 100644 --- a/crates/common_utils/src/consts.rs +++ b/crates/common_utils/src/consts.rs @@ -118,6 +118,10 @@ pub const CELL_IDENTIFIER_LENGTH: u8 = 5; /// General purpose base64 engine pub const BASE64_ENGINE: base64::engine::GeneralPurpose = base64::engine::general_purpose::STANDARD; + +/// URL Safe base64 engine +pub const BASE64_ENGINE_URL_SAFE: base64::engine::GeneralPurpose = + base64::engine::general_purpose::URL_SAFE; /// Regex for matching a domain /// Eg - /// http://www.example.com diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml index 2676f6372230..86d6da446ee7 100644 --- a/crates/hyperswitch_connectors/Cargo.toml +++ b/crates/hyperswitch_connectors/Cargo.toml @@ -20,6 +20,7 @@ error-stack = "0.4.1" hex = "0.4.3" http = "0.2.12" image = { version = "0.25.1", default-features = false, features = ["png"] } +mime = "0.3.17" once_cell = "1.19.0" qrcode = "0.14.0" rand = "0.8.5" diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs index ddd9fa861a61..3e8857e8d313 100644 --- a/crates/hyperswitch_connectors/src/connectors.rs +++ b/crates/hyperswitch_connectors/src/connectors.rs @@ -10,11 +10,15 @@ pub mod dlocal; pub mod fiserv; pub mod fiservemea; pub mod fiuu; +pub mod forte; pub mod globepay; pub mod helcim; pub mod mollie; +pub mod nexinets; pub mod nexixpay; pub mod novalnet; +pub mod payeezy; +pub mod payu; pub mod powertranz; pub mod square; pub mod stax; @@ -23,12 +27,14 @@ pub mod thunes; pub mod tsys; pub mod volt; pub mod worldline; +pub mod zen; pub use self::{ bambora::Bambora, billwerk::Billwerk, bitpay::Bitpay, cashtocode::Cashtocode, coinbase::Coinbase, cryptopay::Cryptopay, deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, - globepay::Globepay, helcim::Helcim, mollie::Mollie, nexixpay::Nexixpay, novalnet::Novalnet, - powertranz::Powertranz, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys, - volt::Volt, worldline::Worldline, + forte::Forte, globepay::Globepay, helcim::Helcim, mollie::Mollie, nexinets::Nexinets, + nexixpay::Nexixpay, novalnet::Novalnet, payeezy::Payeezy, payu::Payu, powertranz::Powertranz, + square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys, volt::Volt, + worldline::Worldline, zen::Zen, }; diff --git a/crates/router/src/connector/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rs similarity index 69% rename from crates/router/src/connector/forte.rs rename to crates/hyperswitch_connectors/src/connectors/forte.rs index 5ffa3a589c31..fd5c7792887c 100644 --- a/crates/router/src/connector/forte.rs +++ b/crates/hyperswitch_connectors/src/connectors/forte.rs @@ -1,38 +1,55 @@ pub mod transformers; +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; use base64::Engine; +use common_enums::enums; use common_utils::{ - request::RequestContent, + consts::BASE64_ENGINE, + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector}, }; -use diesel_models::enums; use error_stack::{report, ResultExt}; -use masking::PeekInterface; -use transformers as forte; - -use super::utils::convert_amount; -use crate::{ - configs::settings, - connector::{ - utils as connector_utils, - utils::{PaymentsSyncRequestData, RefundsRequestData}, +use hyperswitch_domain_models::{ + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, }, - consts, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, + }, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + consts::NO_ERROR_CODE, + errors, + events::connector_api_logs::ConnectorEvent, + types::{self, Response}, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::{Mask, PeekInterface}; +use transformers as forte; + +use crate::{ + constants::headers, + types::ResponseRouterData, + utils::{ + construct_not_supported_error_report, convert_amount, PaymentsSyncRequestData, + RefundsRequestData, }, - utils::BytesExt, }; + #[derive(Clone)] pub struct Forte { amount_converter: &'static (dyn AmountConvertor + Sync), @@ -59,12 +76,8 @@ impl api::RefundExecute for Forte {} impl api::RefundSync for Forte {} impl api::PaymentToken for Forte {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Forte +impl ConnectorIntegration + for Forte { } pub const AUTH_ORG_ID_HEADER: &str = "X-Forte-Auth-Organization-Id"; @@ -75,9 +88,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let content_type = ConnectorCommon::common_get_content_type(self); let mut common_headers = self.get_auth_header(&req.connector_auth_type)?; common_headers.push(( @@ -97,14 +110,14 @@ impl ConnectorCommon for Forte { "application/json" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.forte.base_url.as_ref() } fn get_auth_header( &self, - auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { let auth = forte::ForteAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let raw_basic_token = format!( @@ -112,7 +125,7 @@ impl ConnectorCommon for Forte { auth.api_access_id.peek(), auth.api_secret_key.peek() ); - let basic_token = format!("Basic {}", consts::BASE64_ENGINE.encode(raw_basic_token)); + let basic_token = format!("Basic {}", BASE64_ENGINE.encode(raw_basic_token)); Ok(vec![ ( headers::AUTHORIZATION.to_string(), @@ -141,7 +154,7 @@ impl ConnectorCommon for Forte { let code = response .response .response_code - .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()); + .unwrap_or_else(|| NO_ERROR_CODE.to_string()); Ok(ErrorResponse { status_code: res.status_code, code, @@ -163,38 +176,22 @@ impl ConnectorValidation for Forte { match capture_method { enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual => Ok(()), enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_supported_error_report(capture_method, self.id()), + construct_not_supported_error_report(capture_method, self.id()), ), } } } -impl ConnectorIntegration - for Forte -{ -} +impl ConnectorIntegration for Forte {} -impl ConnectorIntegration - for Forte -{ -} +impl ConnectorIntegration for Forte {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Forte -{ +impl ConnectorIntegration for Forte { fn build_request( &self, - _req: &types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err( errors::ConnectorError::NotImplemented("Setup Mandate flow for Forte".to_string()) .into(), @@ -202,14 +199,12 @@ impl } } -impl ConnectorIntegration - for Forte -{ +impl ConnectorIntegration for Forte { fn get_headers( &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -219,8 +214,8 @@ impl ConnectorIntegration CustomResult { let auth: forte::ForteAuthType = forte::ForteAuthType::try_from(&req.connector_auth_type)?; Ok(format!( @@ -233,8 +228,8 @@ impl ConnectorIntegration CustomResult { let amount = convert_amount( self.amount_converter, @@ -249,12 +244,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsAuthorizeType::get_url( self, req, connectors, )?) @@ -271,10 +266,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: forte::FortePaymentsResponse = res .response .parse_struct("Forte AuthorizeResponse") @@ -283,7 +278,7 @@ impl ConnectorIntegration - for Forte -{ +impl ConnectorIntegration for Forte { fn get_headers( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -316,8 +309,8 @@ impl ConnectorIntegration CustomResult { let auth: forte::ForteAuthType = forte::ForteAuthType::try_from(&req.connector_auth_type)?; let txn_id = PaymentsSyncRequestData::get_connector_transaction_id(&req.request) @@ -333,12 +326,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) + RequestBuilder::new() + .method(Method::Get) .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) @@ -347,10 +340,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: forte::FortePaymentsSyncResponse = res .response .parse_struct("forte PaymentsSyncResponse") @@ -359,7 +352,7 @@ impl ConnectorIntegration - for Forte -{ +impl ConnectorIntegration for Forte { fn get_headers( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -392,8 +383,8 @@ impl ConnectorIntegration CustomResult { let auth: forte::ForteAuthType = forte::ForteAuthType::try_from(&req.connector_auth_type)?; Ok(format!( @@ -406,8 +397,8 @@ impl ConnectorIntegration CustomResult { let connector_req = forte::ForteCaptureRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -415,12 +406,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Put) + RequestBuilder::new() + .method(Method::Put) .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsCaptureType::get_headers( @@ -435,10 +426,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: forte::ForteCaptureResponse = res .response .parse_struct("Forte PaymentsCaptureResponse") @@ -447,7 +438,7 @@ impl ConnectorIntegration - for Forte -{ +impl ConnectorIntegration for Forte { fn get_headers( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -479,8 +468,8 @@ impl ConnectorIntegration CustomResult { let auth: forte::ForteAuthType = forte::ForteAuthType::try_from(&req.connector_auth_type)?; Ok(format!( @@ -493,8 +482,8 @@ impl ConnectorIntegration CustomResult { let connector_req = forte::ForteCancelRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -502,12 +491,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Put) + RequestBuilder::new() + .method(Method::Put) .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) @@ -520,10 +509,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: forte::ForteCancelResponse = res .response .parse_struct("forte CancelResponse") @@ -532,7 +521,7 @@ impl ConnectorIntegration for Forte { +impl ConnectorIntegration for Forte { fn get_headers( &self, - req: &types::RefundsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -563,8 +552,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { let auth: forte::ForteAuthType = forte::ForteAuthType::try_from(&req.connector_auth_type)?; Ok(format!( @@ -577,8 +566,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let refund_amount = convert_amount( self.amount_converter, @@ -593,11 +582,11 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) .url(&types::RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::RefundExecuteType::get_headers( @@ -612,10 +601,10 @@ impl ConnectorIntegration, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: forte::RefundResponse = res .response .parse_struct("forte RefundResponse") @@ -624,7 +613,7 @@ impl ConnectorIntegration for Forte { +impl ConnectorIntegration for Forte { fn get_headers( &self, - req: &types::RefundSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -655,8 +644,8 @@ impl ConnectorIntegration CustomResult { let auth: forte::ForteAuthType = forte::ForteAuthType::try_from(&req.connector_auth_type)?; Ok(format!( @@ -670,12 +659,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) + RequestBuilder::new() + .method(Method::Get) .url(&types::RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::RefundSyncType::get_headers(self, req, connectors)?) @@ -685,10 +674,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: forte::RefundSyncResponse = res .response .parse_struct("forte RefundSyncResponse") @@ -697,7 +686,7 @@ impl ConnectorIntegration, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Ok(api::IncomingWebhookEvent::EventNotSupported) + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Ok(IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } diff --git a/crates/router/src/connector/forte/transformers.rs b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs similarity index 79% rename from crates/router/src/connector/forte/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/forte/transformers.rs index 79b90d685eef..d04ea7bfee4e 100644 --- a/crates/router/src/connector/forte/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs @@ -1,14 +1,24 @@ use cards::CardNumber; +use common_enums::enums; use common_utils::types::FloatMajorUnit; +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{ConnectorAuthType, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::ResponseId, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::errors; use masking::{PeekInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{ - self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData, RouterData, + types::{PaymentsCaptureResponseRouterData, RefundsResponseRouterData, ResponseRouterData}, + utils::{ + self, AddressDetailsData, CardData as _PaymentsAuthorizeRequestData, + PaymentsAuthorizeRequestData, RouterData as _, }, - core::errors, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, }; #[derive(Debug, Serialize)] @@ -90,7 +100,7 @@ impl TryFrom<&ForteRouterData<&types::PaymentsAuthorizeRouterData>> for FortePay ))? } match item.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + PaymentMethodData::Card(ref ccard) => { let action = match item.request.is_auto_capture()? { true => ForteAction::Sale, false => ForteAction::Authorize, @@ -120,23 +130,23 @@ impl TryFrom<&ForteRouterData<&types::PaymentsAuthorizeRouterData>> for FortePay card, }) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment {} - | domain::PaymentMethodData::Reward {} - | domain::PaymentMethodData::RealTimePayment(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::OpenBanking(_) - | domain::PaymentMethodData::CardToken(_) - | domain::PaymentMethodData::NetworkToken(_) - | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { + PaymentMethodData::CardRedirect(_) + | PaymentMethodData::Wallet(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankDebit(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | PaymentMethodData::MandatePayment {} + | PaymentMethodData::Reward {} + | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::Upi(_) + | PaymentMethodData::Voucher(_) + | PaymentMethodData::GiftCard(_) + | PaymentMethodData::OpenBanking(_) + | PaymentMethodData::CardToken(_) + | PaymentMethodData::NetworkToken(_) + | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Forte"), ))? @@ -153,11 +163,11 @@ pub struct ForteAuthType { pub(super) api_secret_key: Secret, } -impl TryFrom<&types::ConnectorAuthType> for ForteAuthType { +impl TryFrom<&ConnectorAuthType> for ForteAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { + fn try_from(auth_type: &ConnectorAuthType) -> Result { match auth_type { - types::ConnectorAuthType::MultiAuthKey { + ConnectorAuthType::MultiAuthKey { api_key, key1, api_secret, @@ -196,17 +206,15 @@ impl From for enums::AttemptStatus { } } -impl ForeignFrom<(ForteResponseCode, ForteAction)> for enums::AttemptStatus { - fn foreign_from((response_code, action): (ForteResponseCode, ForteAction)) -> Self { - match response_code { - ForteResponseCode::A01 => match action { - ForteAction::Authorize => Self::Authorized, - ForteAction::Sale => Self::Pending, - ForteAction::Verify => Self::Charged, - }, - ForteResponseCode::A05 | ForteResponseCode::A06 => Self::Authorizing, - _ => Self::Failure, - } +fn get_status(response_code: ForteResponseCode, action: ForteAction) -> enums::AttemptStatus { + match response_code { + ForteResponseCode::A01 => match action { + ForteAction::Authorize => enums::AttemptStatus::Authorized, + ForteAction::Sale => enums::AttemptStatus::Pending, + ForteAction::Verify => enums::AttemptStatus::Charged, + }, + ForteResponseCode::A05 | ForteResponseCode::A06 => enums::AttemptStatus::Authorizing, + _ => enums::AttemptStatus::Failure, } } @@ -277,21 +285,20 @@ pub struct ForteMeta { pub auth_id: String, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { let response_code = item.response.response.response_code; let action = item.response.action; let transaction_id = &item.response.transaction_id; Ok(Self { - status: enums::AttemptStatus::foreign_from((response_code, action)), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(transaction_id.to_string()), + status: get_status(response_code, action), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(transaction_id.to_string()), redirection_data: None, mandate_reference: None, connector_metadata: Some(serde_json::json!(ForteMeta { @@ -323,24 +330,18 @@ pub struct FortePaymentsSyncResponse { pub response: ResponseStatus, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - FortePaymentsSyncResponse, - T, - types::PaymentsResponseData, - >, + item: ResponseRouterData, ) -> Result { let transaction_id = &item.response.transaction_id; Ok(Self { status: enums::AttemptStatus::from(item.response.status), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(transaction_id.to_string()), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(transaction_id.to_string()), redirection_data: None, mandate_reference: None, connector_metadata: Some(serde_json::json!(ForteMeta { @@ -398,18 +399,18 @@ pub struct ForteCaptureResponse { pub response: CaptureResponseStatus, } -impl TryFrom> +impl TryFrom> for types::PaymentsCaptureRouterData { type Error = error_stack::Report; fn try_from( - item: types::PaymentsCaptureResponseRouterData, + item: PaymentsCaptureResponseRouterData, ) -> Result { let transaction_id = &item.response.transaction_id; Ok(Self { status: enums::AttemptStatus::from(item.response.response.response_code), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(transaction_id.clone()), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(transaction_id.clone()), redirection_data: None, mandate_reference: None, connector_metadata: Some(serde_json::json!(ForteMeta { @@ -466,19 +467,18 @@ pub struct ForteCancelResponse { pub response: CancelResponseStatus, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { let transaction_id = &item.response.transaction_id; Ok(Self { status: enums::AttemptStatus::from(item.response.response.response_code), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(transaction_id.to_string()), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(transaction_id.to_string()), redirection_data: None, mandate_reference: None, connector_metadata: Some(serde_json::json!(ForteMeta { @@ -561,15 +561,15 @@ pub struct RefundResponse { pub response: ResponseStatus, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_id, refund_status: enums::RefundStatus::from(item.response.response.response_code), }), @@ -584,15 +584,15 @@ pub struct RefundSyncResponse { transaction_id: String, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_id, refund_status: enums::RefundStatus::from(item.response.status), }), diff --git a/crates/router/src/connector/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs similarity index 65% rename from crates/router/src/connector/nexinets.rs rename to crates/hyperswitch_connectors/src/connectors/nexinets.rs index 113b2924fec3..902afe34134b 100644 --- a/crates/router/src/connector/nexinets.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs @@ -1,32 +1,53 @@ pub mod transformers; -use std::fmt::Debug; - -use common_utils::request::RequestContent; +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; +use common_enums::enums; +use common_utils::{ + errors::CustomResult, + ext_traits::ByteSliceExt, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::{report, ResultExt}; -use transformers as nexinets; - -use crate::{ - configs::settings, - connector::{ - utils as connector_utils, - utils::{to_connector_meta, PaymentMethodDataType, PaymentsSyncRequestData}, +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, }, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, }, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - storage::enums, - ErrorResponse, Response, + PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType, + RefundExecuteType, RefundSyncType, Response, + }, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::Mask; +use transformers as nexinets; + +use crate::{ + constants::headers, + types::ResponseRouterData, + utils::{ + construct_not_implemented_error_report, is_mandate_supported, to_connector_meta, + PaymentMethodDataType, PaymentsSyncRequestData, }, - utils::BytesExt, }; #[derive(Debug, Clone)] @@ -60,9 +81,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), @@ -82,14 +103,14 @@ impl ConnectorCommon for Nexinets { "application/json" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.nexinets.base_url.as_ref() } fn get_auth_header( &self, - auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { let auth = nexinets::NexinetsAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; Ok(vec![( @@ -152,7 +173,7 @@ impl ConnectorValidation for Nexinets { match capture_method { enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual => Ok(()), enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_implemented_error_report(capture_method, self.id()), + construct_not_implemented_error_report(capture_method, self.id()), ), } } @@ -160,7 +181,7 @@ impl ConnectorValidation for Nexinets { fn validate_mandate_payment( &self, pm_type: Option, - pm_data: types::domain::payments::PaymentMethodData, + pm_data: PaymentMethodData, ) -> CustomResult<(), errors::ConnectorError> { let mandate_supported_pmd = std::collections::HashSet::from([ PaymentMethodDataType::Card, @@ -170,36 +191,22 @@ impl ConnectorValidation for Nexinets { PaymentMethodDataType::Giropay, PaymentMethodDataType::Ideal, ]); - connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) + is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) } } -impl ConnectorIntegration - for Nexinets -{ -} +impl ConnectorIntegration for Nexinets {} -impl ConnectorIntegration - for Nexinets -{ -} +impl ConnectorIntegration for Nexinets {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Nexinets +impl ConnectorIntegration + for Nexinets { fn build_request( &self, - _req: &types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err( errors::ConnectorError::NotImplemented("Setup Mandate flow for Nexinets".to_string()) .into(), @@ -207,14 +214,12 @@ impl } } -impl ConnectorIntegration - for Nexinets -{ +impl ConnectorIntegration for Nexinets { fn get_headers( &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -224,8 +229,8 @@ impl ConnectorIntegration CustomResult { let url = if req.request.capture_method == Some(enums::CaptureMethod::Automatic) { format!("{}/orders/debit", self.base_url(connectors)) @@ -237,8 +242,8 @@ impl ConnectorIntegration CustomResult { let connector_req = nexinets::NexinetsPaymentsRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -246,20 +251,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsAuthorizeType::get_request_body( + .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) + .set_body(PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), @@ -268,10 +269,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: nexinets::NexinetsPreAuthOrDebitResponse = res .response .parse_struct("Nexinets PaymentsAuthorizeResponse") @@ -280,7 +281,7 @@ impl ConnectorIntegration - for Nexinets -{ +impl ConnectorIntegration for Nexinets { fn get_headers( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -313,8 +312,8 @@ impl ConnectorIntegration CustomResult { let meta: nexinets::NexinetsPaymentsMetadata = to_connector_meta(req.request.connector_meta.clone())?; @@ -334,25 +333,25 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) + .headers(PaymentsSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsSyncRouterData, + data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: nexinets::NexinetsPaymentResponse = res .response .parse_struct("nexinets NexinetsPaymentResponse") @@ -361,7 +360,7 @@ impl ConnectorIntegration - for Nexinets -{ +impl ConnectorIntegration for Nexinets { fn get_headers( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -394,8 +391,8 @@ impl ConnectorIntegration CustomResult { let meta: nexinets::NexinetsPaymentsMetadata = to_connector_meta(req.request.connector_meta.clone())?; @@ -409,8 +406,8 @@ impl ConnectorIntegration CustomResult { let connector_req = nexinets::NexinetsCaptureOrVoidRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -418,18 +415,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsCaptureType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsCaptureType::get_request_body( + .headers(PaymentsCaptureType::get_headers(self, req, connectors)?) + .set_body(PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), @@ -438,10 +433,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: nexinets::NexinetsPaymentResponse = res .response .parse_struct("NexinetsPaymentResponse") @@ -450,7 +445,7 @@ impl ConnectorIntegration - for Nexinets -{ +impl ConnectorIntegration for Nexinets { fn get_headers( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -483,8 +476,8 @@ impl ConnectorIntegration CustomResult { let meta: nexinets::NexinetsPaymentsMetadata = to_connector_meta(req.request.connector_meta.clone())?; @@ -498,8 +491,8 @@ impl ConnectorIntegration CustomResult { let connector_req = nexinets::NexinetsCaptureOrVoidRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -507,16 +500,14 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) - .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) - .set_body(types::PaymentsVoidType::get_request_body( - self, req, connectors, - )?) + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsVoidType::get_url(self, req, connectors)?) + .headers(PaymentsVoidType::get_headers(self, req, connectors)?) + .set_body(PaymentsVoidType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) @@ -524,10 +515,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: nexinets::NexinetsPaymentResponse = res .response .parse_struct("NexinetsPaymentResponse") @@ -536,7 +527,7 @@ impl ConnectorIntegration - for Nexinets -{ +impl ConnectorIntegration for Nexinets { fn get_headers( &self, - req: &types::RefundsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -569,8 +558,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { let meta: nexinets::NexinetsPaymentsMetadata = to_connector_meta(req.request.connector_metadata.clone())?; @@ -584,8 +573,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = nexinets::NexinetsRefundRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -593,29 +582,25 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) - .set_body(types::RefundExecuteType::get_request_body( - self, req, connectors, - )?) + .headers(RefundExecuteType::get_headers(self, req, connectors)?) + .set_body(RefundExecuteType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, - data: &types::RefundsRouterData, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: nexinets::NexinetsRefundResponse = res .response .parse_struct("nexinets RefundResponse") @@ -624,7 +609,7 @@ impl ConnectorIntegration for Nexinets { +impl ConnectorIntegration for Nexinets { fn get_headers( &self, - req: &types::RefundSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -655,8 +640,8 @@ impl ConnectorIntegration CustomResult { let transaction_id = req .request @@ -674,25 +659,25 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::RefundSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundSyncType::get_headers(self, req, connectors)?) + .headers(RefundSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::RefundSyncRouterData, + data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: nexinets::NexinetsRefundResponse = res .response .parse_struct("nexinets RefundSyncResponse") @@ -701,7 +686,7 @@ impl ConnectorIntegration, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Ok(api::IncomingWebhookEvent::EventNotSupported) + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Ok(IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } @@ -743,12 +728,8 @@ impl api::IncomingWebhook for Nexinets { impl api::PaymentToken for Nexinets {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Nexinets +impl ConnectorIntegration + for Nexinets { // Not Implemented (R) } diff --git a/crates/router/src/connector/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs similarity index 67% rename from crates/router/src/connector/nexinets/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs index 6cf35f5d87df..eeb24233bef2 100644 --- a/crates/router/src/connector/nexinets/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs @@ -1,20 +1,33 @@ use base64::Engine; use cards::CardNumber; -use common_utils::errors::CustomResult; -use domain::PaymentMethodData; +use common_enums::{enums, AttemptStatus}; +use common_utils::{consts, errors::CustomResult, request::Method}; use error_stack::ResultExt; +use hyperswitch_domain_models::{ + payment_method_data::{ + ApplePayWalletData, BankRedirectData, Card, PaymentMethodData, WalletData, + }, + router_data::{ConnectorAuthType, RouterData}, + router_flow_types::{Execute, RSync}, + router_request_types::ResponseId, + router_response_types::{ + MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData, + }, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + RefundsRouterData, + }, +}; +use hyperswitch_interfaces::errors; use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; use url::Url; use crate::{ - connector::utils::{ - self, CardData, PaymentsAuthorizeRequestData, PaymentsCancelRequestData, WalletData, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{ + self, CardData, PaymentsAuthorizeRequestData, PaymentsCancelRequestData, WalletData as _, }, - consts, - core::errors, - services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, }; #[derive(Debug, Serialize)] @@ -163,9 +176,9 @@ pub struct ApplepayPaymentMethod { token_type: String, } -impl TryFrom<&types::PaymentsAuthorizeRouterData> for NexinetsPaymentsRequest { +impl TryFrom<&PaymentsAuthorizeRouterData> for NexinetsPaymentsRequest { type Error = error_stack::Report; - fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { + fn try_from(item: &PaymentsAuthorizeRouterData) -> Result { let return_url = item.request.router_return_url.clone(); let nexinets_async = NexinetsAsyncDetails { success_url: return_url.clone(), @@ -195,11 +208,11 @@ pub struct NexinetsAuthType { pub(super) api_key: Secret, } -impl TryFrom<&types::ConnectorAuthType> for NexinetsAuthType { +impl TryFrom<&ConnectorAuthType> for NexinetsAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { + fn try_from(auth_type: &ConnectorAuthType) -> Result { match auth_type { - types::ConnectorAuthType::BodyKey { api_key, key1 } => { + ConnectorAuthType::BodyKey { api_key, key1 } => { let auth_key = format!("{}:{}", key1.peek(), api_key.peek()); let auth_header = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_key)); Ok(Self { @@ -224,48 +237,48 @@ pub enum NexinetsPaymentStatus { Aborted, } -impl ForeignFrom<(NexinetsPaymentStatus, NexinetsTransactionType)> for enums::AttemptStatus { - fn foreign_from((status, method): (NexinetsPaymentStatus, NexinetsTransactionType)) -> Self { - match status { - NexinetsPaymentStatus::Success => match method { - NexinetsTransactionType::Preauth => Self::Authorized, - NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => Self::Charged, - NexinetsTransactionType::Cancel => Self::Voided, - }, - NexinetsPaymentStatus::Declined - | NexinetsPaymentStatus::Failure - | NexinetsPaymentStatus::Expired - | NexinetsPaymentStatus::Aborted => match method { - NexinetsTransactionType::Preauth => Self::AuthorizationFailed, - NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => { - Self::CaptureFailed - } - NexinetsTransactionType::Cancel => Self::VoidFailed, - }, - NexinetsPaymentStatus::Ok => match method { - NexinetsTransactionType::Preauth => Self::Authorized, - _ => Self::Pending, - }, - NexinetsPaymentStatus::Pending => Self::AuthenticationPending, - NexinetsPaymentStatus::InProgress => Self::Pending, - } +fn get_status(status: NexinetsPaymentStatus, method: NexinetsTransactionType) -> AttemptStatus { + match status { + NexinetsPaymentStatus::Success => match method { + NexinetsTransactionType::Preauth => AttemptStatus::Authorized, + NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => { + AttemptStatus::Charged + } + NexinetsTransactionType::Cancel => AttemptStatus::Voided, + }, + NexinetsPaymentStatus::Declined + | NexinetsPaymentStatus::Failure + | NexinetsPaymentStatus::Expired + | NexinetsPaymentStatus::Aborted => match method { + NexinetsTransactionType::Preauth => AttemptStatus::AuthorizationFailed, + NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => { + AttemptStatus::CaptureFailed + } + NexinetsTransactionType::Cancel => AttemptStatus::VoidFailed, + }, + NexinetsPaymentStatus::Ok => match method { + NexinetsTransactionType::Preauth => AttemptStatus::Authorized, + _ => AttemptStatus::Pending, + }, + NexinetsPaymentStatus::Pending => AttemptStatus::AuthenticationPending, + NexinetsPaymentStatus::InProgress => AttemptStatus::Pending, } } -impl TryFrom<&common_enums::enums::BankNames> for NexinetsBIC { +impl TryFrom<&enums::BankNames> for NexinetsBIC { type Error = error_stack::Report; - fn try_from(bank: &common_enums::enums::BankNames) -> Result { + fn try_from(bank: &enums::BankNames) -> Result { match bank { - common_enums::enums::BankNames::AbnAmro => Ok(Self::AbnAmro), - common_enums::enums::BankNames::AsnBank => Ok(Self::AsnBank), - common_enums::enums::BankNames::Bunq => Ok(Self::Bunq), - common_enums::enums::BankNames::Ing => Ok(Self::Ing), - common_enums::enums::BankNames::Knab => Ok(Self::Knab), - common_enums::enums::BankNames::Rabobank => Ok(Self::Rabobank), - common_enums::enums::BankNames::Regiobank => Ok(Self::Regiobank), - common_enums::enums::BankNames::SnsBank => Ok(Self::SnsBank), - common_enums::enums::BankNames::TriodosBank => Ok(Self::TriodosBank), - common_enums::enums::BankNames::VanLanschot => Ok(Self::VanLanschot), + enums::BankNames::AbnAmro => Ok(Self::AbnAmro), + enums::BankNames::AsnBank => Ok(Self::AsnBank), + enums::BankNames::Bunq => Ok(Self::Bunq), + enums::BankNames::Ing => Ok(Self::Ing), + enums::BankNames::Knab => Ok(Self::Knab), + enums::BankNames::Rabobank => Ok(Self::Rabobank), + enums::BankNames::Regiobank => Ok(Self::Regiobank), + enums::BankNames::SnsBank => Ok(Self::SnsBank), + enums::BankNames::TriodosBank => Ok(Self::TriodosBank), + enums::BankNames::VanLanschot => Ok(Self::VanLanschot), _ => Err(errors::ConnectorError::FlowNotSupported { flow: bank.to_string(), connector: "Nexinets".to_string(), @@ -311,24 +324,12 @@ pub struct NexinetsPaymentsMetadata { pub psync_flow: NexinetsTransactionType, } -impl - TryFrom< - types::ResponseRouterData< - F, - NexinetsPreAuthOrDebitResponse, - T, - types::PaymentsResponseData, - >, - > for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - NexinetsPreAuthOrDebitResponse, - T, - types::PaymentsResponseData, - >, + item: ResponseRouterData, ) -> Result { let transaction = match item.response.transactions.first() { Some(order) => order, @@ -343,11 +344,11 @@ impl let redirection_data = item .response .redirect_url - .map(|url| services::RedirectForm::from((url, services::Method::Get))); + .map(|url| RedirectForm::from((url, Method::Get))); let resource_id = match item.response.transaction_type.clone() { - NexinetsTransactionType::Preauth => types::ResponseId::NoResponseId, + NexinetsTransactionType::Preauth => ResponseId::NoResponseId, NexinetsTransactionType::Debit => { - types::ResponseId::ConnectorTransactionId(transaction.transaction_id.clone()) + ResponseId::ConnectorTransactionId(transaction.transaction_id.clone()) } _ => Err(errors::ConnectorError::ResponseHandlingFailed)?, }; @@ -355,17 +356,14 @@ impl .response .payment_instrument .payment_instrument_id - .map(|id| types::MandateReference { + .map(|id| MandateReference { connector_mandate_id: Some(id.expose()), payment_method_id: None, mandate_metadata: None, }); Ok(Self { - status: enums::AttemptStatus::foreign_from(( - transaction.status.clone(), - item.response.transaction_type, - )), - response: Ok(types::PaymentsResponseData::TransactionResponse { + status: get_status(transaction.status.clone(), item.response.transaction_type), + response: Ok(PaymentsResponseData::TransactionResponse { resource_id, redirection_data, mandate_reference, @@ -393,9 +391,9 @@ pub struct NexinetsOrder { pub order_id: String, } -impl TryFrom<&types::PaymentsCaptureRouterData> for NexinetsCaptureOrVoidRequest { +impl TryFrom<&PaymentsCaptureRouterData> for NexinetsCaptureOrVoidRequest { type Error = error_stack::Report; - fn try_from(item: &types::PaymentsCaptureRouterData) -> Result { + fn try_from(item: &PaymentsCaptureRouterData) -> Result { Ok(Self { initial_amount: item.request.amount_to_capture, currency: item.request.currency, @@ -403,9 +401,9 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for NexinetsCaptureOrVoidRequest } } -impl TryFrom<&types::PaymentsCancelRouterData> for NexinetsCaptureOrVoidRequest { +impl TryFrom<&PaymentsCancelRouterData> for NexinetsCaptureOrVoidRequest { type Error = error_stack::Report; - fn try_from(item: &types::PaymentsCancelRouterData) -> Result { + fn try_from(item: &PaymentsCancelRouterData) -> Result { Ok(Self { initial_amount: item.request.get_amount()?, currency: item.request.get_currency()?, @@ -423,13 +421,12 @@ pub struct NexinetsPaymentResponse { pub transaction_type: NexinetsTransactionType, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { let transaction_id = Some(item.response.transaction_id.clone()); let connector_metadata = serde_json::to_value(NexinetsPaymentsMetadata { @@ -440,16 +437,13 @@ impl .change_context(errors::ConnectorError::ResponseHandlingFailed)?; let resource_id = match item.response.transaction_type.clone() { NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => { - types::ResponseId::ConnectorTransactionId(item.response.transaction_id) + ResponseId::ConnectorTransactionId(item.response.transaction_id) } - _ => types::ResponseId::NoResponseId, + _ => ResponseId::NoResponseId, }; Ok(Self { - status: enums::AttemptStatus::foreign_from(( - item.response.status, - item.response.transaction_type, - )), - response: Ok(types::PaymentsResponseData::TransactionResponse { + status: get_status(item.response.status, item.response.transaction_type), + response: Ok(PaymentsResponseData::TransactionResponse { resource_id, redirection_data: None, mandate_reference: None, @@ -473,9 +467,9 @@ pub struct NexinetsRefundRequest { pub currency: enums::Currency, } -impl TryFrom<&types::RefundsRouterData> for NexinetsRefundRequest { +impl TryFrom<&RefundsRouterData> for NexinetsRefundRequest { type Error = error_stack::Report; - fn try_from(item: &types::RefundsRouterData) -> Result { + fn try_from(item: &RefundsRouterData) -> Result { Ok(Self { initial_amount: item.request.refund_amount, currency: item.request.currency, @@ -521,15 +515,15 @@ impl From for enums::RefundStatus { } } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_id, refund_status: enums::RefundStatus::from(item.response.status), }), @@ -538,15 +532,15 @@ impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_id, refund_status: enums::RefundStatus::from(item.response.status), }), @@ -571,7 +565,7 @@ pub struct OrderErrorDetails { } fn get_payment_details_and_product( - item: &types::PaymentsAuthorizeRouterData, + item: &PaymentsAuthorizeRouterData, ) -> Result< (Option, NexinetsProduct), error_stack::Report, @@ -583,9 +577,9 @@ fn get_payment_details_and_product( )), PaymentMethodData::Wallet(wallet) => Ok(get_wallet_details(wallet)?), PaymentMethodData::BankRedirect(bank_redirect) => match bank_redirect { - domain::BankRedirectData::Eps { .. } => Ok((None, NexinetsProduct::Eps)), - domain::BankRedirectData::Giropay { .. } => Ok((None, NexinetsProduct::Giropay)), - domain::BankRedirectData::Ideal { bank_name, .. } => Ok(( + BankRedirectData::Eps { .. } => Ok((None, NexinetsProduct::Eps)), + BankRedirectData::Giropay { .. } => Ok((None, NexinetsProduct::Giropay)), + BankRedirectData::Ideal { bank_name, .. } => Ok(( Some(NexinetsPaymentDetails::BankRedirects(Box::new( NexinetsBankRedirects { bic: bank_name @@ -595,21 +589,21 @@ fn get_payment_details_and_product( ))), NexinetsProduct::Ideal, )), - domain::BankRedirectData::Sofort { .. } => Ok((None, NexinetsProduct::Sofort)), - domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Bizum { .. } - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::LocalBankRedirect {} => { + BankRedirectData::Sofort { .. } => Ok((None, NexinetsProduct::Sofort)), + BankRedirectData::BancontactCard { .. } + | BankRedirectData::Blik { .. } + | BankRedirectData::Bizum { .. } + | BankRedirectData::Interac { .. } + | BankRedirectData::OnlineBankingCzechRepublic { .. } + | BankRedirectData::OnlineBankingFinland { .. } + | BankRedirectData::OnlineBankingPoland { .. } + | BankRedirectData::OnlineBankingSlovakia { .. } + | BankRedirectData::OpenBankingUk { .. } + | BankRedirectData::Przelewy24 { .. } + | BankRedirectData::Trustly { .. } + | BankRedirectData::OnlineBankingFpx { .. } + | BankRedirectData::OnlineBankingThailand { .. } + | BankRedirectData::LocalBankRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))? @@ -638,8 +632,8 @@ fn get_payment_details_and_product( } fn get_card_data( - item: &types::PaymentsAuthorizeRouterData, - card: &domain::payments::Card, + item: &PaymentsAuthorizeRouterData, + card: &Card, ) -> Result { let (card_data, cof_contract) = match item.request.is_mandate_payment() { true => { @@ -666,10 +660,10 @@ fn get_card_data( } fn get_applepay_details( - wallet_data: &domain::WalletData, - applepay_data: &domain::ApplePayWalletData, + wallet_data: &WalletData, + applepay_data: &ApplePayWalletData, ) -> CustomResult { - let payment_data = wallet_data.get_wallet_token_as_json("Apple Pay".to_string())?; + let payment_data = WalletData::get_wallet_token_as_json(wallet_data, "Apple Pay".to_string())?; Ok(ApplePayDetails { payment_data, payment_method: ApplepayPaymentMethod { @@ -681,9 +675,7 @@ fn get_applepay_details( }) } -fn get_card_details( - req_card: &domain::payments::Card, -) -> Result { +fn get_card_details(req_card: &Card) -> Result { Ok(CardDetails { card_number: req_card.card_number.clone(), expiry_month: req_card.card_exp_month.clone(), @@ -693,14 +685,14 @@ fn get_card_details( } fn get_wallet_details( - wallet: &domain::WalletData, + wallet: &WalletData, ) -> Result< (Option, NexinetsProduct), error_stack::Report, > { match wallet { - domain::WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)), - domain::WalletData::ApplePay(applepay_data) => Ok(( + WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)), + WalletData::ApplePay(applepay_data) => Ok(( Some(NexinetsPaymentDetails::Wallet(Box::new( NexinetsWalletDetails::ApplePayToken(Box::new(get_applepay_details( wallet, @@ -709,32 +701,32 @@ fn get_wallet_details( ))), NexinetsProduct::Applepay, )), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect { .. } - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::Paze(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect { .. } - | domain::WalletData::VippsRedirect { .. } - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented( + WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect { .. } + | WalletData::GooglePay(_) + | WalletData::GooglePayRedirect(_) + | WalletData::GooglePayThirdPartySdk(_) + | WalletData::MbWayRedirect(_) + | WalletData::MobilePayRedirect(_) + | WalletData::PaypalSdk(_) + | WalletData::Paze(_) + | WalletData::SamsungPay(_) + | WalletData::TwintRedirect { .. } + | WalletData::VippsRedirect { .. } + | WalletData::TouchNGoRedirect(_) + | WalletData::WeChatPayRedirect(_) + | WalletData::WeChatPayQr(_) + | WalletData::CashappQr(_) + | WalletData::SwishQr(_) + | WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))?, } diff --git a/crates/router/src/connector/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rs similarity index 63% rename from crates/router/src/connector/payeezy.rs rename to crates/hyperswitch_connectors/src/connectors/payeezy.rs index 5783cf1bc14f..cb22d0cb7b03 100644 --- a/crates/router/src/connector/payeezy.rs +++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs @@ -1,34 +1,49 @@ -mod transformers; - -use std::fmt::Debug; +pub mod transformers; +use api_models::webhooks::IncomingWebhookEvent; use base64::Engine; -use common_utils::request::RequestContent; -use diesel_models::enums; +use common_enums::{CaptureMethod, PaymentMethodType}; +use common_utils::{ + errors::CustomResult, + ext_traits::ByteSliceExt, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::{report, ResultExt}; -use masking::ExposeInterface; +use hyperswitch_domain_models::{ + router_data::{AccessToken, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, + }, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + RefundsRouterData, + }, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, + types::{ + PaymentsAuthorizeType, PaymentsCaptureType, PaymentsVoidType, RefundExecuteType, Response, + }, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::{ExposeInterface, Mask}; use rand::distributions::DistString; use ring::hmac; use transformers as payeezy; use crate::{ - configs::settings, - connector::utils as connector_utils, - consts, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, - }, - types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, - }, - utils::BytesExt, + constants::headers, types::ResponseRouterData, utils::construct_not_implemented_error_report, }; #[derive(Debug, Clone)] @@ -40,9 +55,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let auth = payeezy::PayeezyAuthType::try_from(&req.connector_auth_type)?; let request_payload = self .get_request_body(req, connectors)? @@ -66,7 +81,7 @@ where let key = hmac::Key::new(hmac::HMAC_SHA256, auth.api_secret.expose().as_bytes()); let tag = hmac::sign(&key, signature_string.expose().as_bytes()); let hmac_sign = hex::encode(tag); - let signature_value = consts::BASE64_ENGINE_URL_SAFE.encode(hmac_sign); + let signature_value = common_utils::consts::BASE64_ENGINE_URL_SAFE.encode(hmac_sign); Ok(vec![ ( headers::CONTENT_TYPE.to_string(), @@ -100,7 +115,7 @@ impl ConnectorCommon for Payeezy { "application/json" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.payeezy.base_url.as_ref() } @@ -138,14 +153,14 @@ impl ConnectorCommon for Payeezy { impl ConnectorValidation for Payeezy { fn validate_capture_method( &self, - capture_method: Option, - _pmt: Option, + capture_method: Option, + _pmt: Option, ) -> CustomResult<(), errors::ConnectorError> { let capture_method = capture_method.unwrap_or_default(); match capture_method { - enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual => Ok(()), - enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_implemented_error_report(capture_method, self.id()), + CaptureMethod::Automatic | CaptureMethod::Manual => Ok(()), + CaptureMethod::ManualMultiple | CaptureMethod::Scheduled => Err( + construct_not_implemented_error_report(capture_method, self.id()), ), } } @@ -154,22 +169,12 @@ impl ConnectorValidation for Payeezy { impl api::Payment for Payeezy {} impl api::MandateSetup for Payeezy {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Payeezy -{ +impl ConnectorIntegration for Payeezy { fn build_request( &self, - _req: &types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err( errors::ConnectorError::NotImplemented("Setup Mandate flow for Payeezy".to_string()) .into(), @@ -179,26 +184,20 @@ impl impl api::PaymentToken for Payeezy {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Payeezy +impl ConnectorIntegration + for Payeezy { // Not Implemented (R) } impl api::PaymentVoid for Payeezy {} -impl ConnectorIntegration - for Payeezy -{ +impl ConnectorIntegration for Payeezy { fn get_headers( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -208,8 +207,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -221,8 +220,8 @@ impl ConnectorIntegration CustomResult { let connector_req = payeezy::PayeezyCaptureOrVoidRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -230,27 +229,25 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) - .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) - .set_body(types::PaymentsVoidType::get_request_body( - self, req, connectors, - )?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsVoidType::get_url(self, req, connectors)?) + .headers(PaymentsVoidType::get_headers(self, req, connectors)?) + .set_body(PaymentsVoidType::get_request_body(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsCancelRouterData, + data: &PaymentsCancelRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: payeezy::PayeezyPaymentsResponse = res .response .parse_struct("Payeezy PaymentsResponse") @@ -259,7 +256,7 @@ impl ConnectorIntegration - for Payeezy -{ -} +impl ConnectorIntegration for Payeezy {} impl api::PaymentSync for Payeezy {} -impl ConnectorIntegration - for Payeezy -{ +impl ConnectorIntegration for Payeezy { // default implementation of build_request method will be executed } impl api::PaymentCapture for Payeezy {} -impl ConnectorIntegration - for Payeezy -{ +impl ConnectorIntegration for Payeezy { fn get_headers( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -308,8 +298,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -321,8 +311,8 @@ impl ConnectorIntegration CustomResult { let router_obj = payeezy::PayeezyRouterData::try_from(( &self.get_currency_unit(), @@ -337,17 +327,15 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) - .headers(types::PaymentsCaptureType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsCaptureType::get_request_body( + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsCaptureType::get_url(self, req, connectors)?) + .headers(PaymentsCaptureType::get_headers(self, req, connectors)?) + .set_body(PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), @@ -356,10 +344,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: payeezy::PayeezyPaymentsResponse = res .response .parse_struct("Payeezy PaymentsResponse") @@ -368,7 +356,7 @@ impl ConnectorIntegration - for Payeezy -{ +impl ConnectorIntegration for Payeezy { //TODO: implement sessions flow } impl api::PaymentAuthorize for Payeezy {} -impl ConnectorIntegration - for Payeezy -{ +impl ConnectorIntegration for Payeezy { fn get_headers( &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -412,16 +396,16 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}v1/transactions", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::PaymentsAuthorizeRouterData, - _connectors: &settings::Connectors, + req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, ) -> CustomResult { let router_obj = payeezy::PayeezyRouterData::try_from(( &self.get_currency_unit(), @@ -436,19 +420,15 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsAuthorizeType::get_request_body( + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) + .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) + .set_body(PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), @@ -457,10 +437,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: payeezy::PayeezyPaymentsResponse = res .response .parse_struct("payeezy Response") @@ -469,7 +449,7 @@ impl ConnectorIntegration - for Payeezy -{ +impl ConnectorIntegration for Payeezy { fn get_headers( &self, - req: &types::RefundsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -507,8 +485,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -520,8 +498,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let router_obj = payeezy::PayeezyRouterData::try_from(( &self.get_currency_unit(), @@ -535,28 +513,24 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) - .set_body(types::RefundExecuteType::get_request_body( - self, req, connectors, - )?) + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&RefundExecuteType::get_url(self, req, connectors)?) + .headers(RefundExecuteType::get_headers(self, req, connectors)?) + .set_body(RefundExecuteType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, - data: &types::RefundsRouterData, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { // Parse the response into a payeezy::RefundResponse let response: payeezy::RefundResponse = res .response @@ -567,12 +541,12 @@ impl ConnectorIntegration for Payeezy { +impl ConnectorIntegration for Payeezy { // default implementation of build_request method will be executed } #[async_trait::async_trait] -impl api::IncomingWebhook for Payeezy { +impl IncomingWebhook for Payeezy { fn get_webhook_object_reference_id( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Ok(api::IncomingWebhookEvent::EventNotSupported) + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Ok(IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs similarity index 57% rename from crates/router/src/connector/payeezy/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs index 685bf3c0fbb0..47c5c40363e5 100644 --- a/crates/router/src/connector/payeezy/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs @@ -1,32 +1,43 @@ use cards::CardNumber; -use common_utils::ext_traits::Encode; +use common_enums::{enums, AttemptStatus, CaptureMethod, Currency, PaymentMethod}; +use common_utils::{errors::ParsingError, ext_traits::Encode}; use error_stack::ResultExt; +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{ConnectorAuthType, RouterData}, + router_flow_types::Execute, + router_request_types::ResponseId, + router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + RefundsRouterData, + }, +}; +use hyperswitch_interfaces::{api::CurrencyUnit, errors::ConnectorError}; use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{self, CardData, RouterData}, - core::errors, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{ + get_amount_as_string, get_unimplemented_payment_method_error_message, to_connector_meta, + CardData, CardIssuer, RouterData as _, + }, }; + #[derive(Debug, Serialize)] pub struct PayeezyRouterData { pub amount: String, pub router_data: T, } -impl TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for PayeezyRouterData { - type Error = error_stack::Report; +impl TryFrom<(&CurrencyUnit, Currency, i64, T)> for PayeezyRouterData { + type Error = error_stack::Report; fn try_from( - (currency_unit, currency, amount, router_data): ( - &api::CurrencyUnit, - enums::Currency, - i64, - T, - ), + (currency_unit, currency, amount, router_data): (&CurrencyUnit, Currency, i64, T), ) -> Result { - let amount = utils::get_amount_as_string(currency_unit, amount, currency)?; + let amount = get_amount_as_string(currency_unit, amount, currency)?; Ok(Self { amount, router_data, @@ -53,20 +64,20 @@ pub enum PayeezyCardType { Discover, } -impl TryFrom for PayeezyCardType { - type Error = error_stack::Report; - fn try_from(issuer: utils::CardIssuer) -> Result { +impl TryFrom for PayeezyCardType { + type Error = error_stack::Report; + fn try_from(issuer: CardIssuer) -> Result { match issuer { - utils::CardIssuer::AmericanExpress => Ok(Self::AmericanExpress), - utils::CardIssuer::Master => Ok(Self::Mastercard), - utils::CardIssuer::Discover => Ok(Self::Discover), - utils::CardIssuer::Visa => Ok(Self::Visa), - - utils::CardIssuer::Maestro - | utils::CardIssuer::DinersClub - | utils::CardIssuer::JCB - | utils::CardIssuer::CarteBlanche => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Payeezy"), + CardIssuer::AmericanExpress => Ok(Self::AmericanExpress), + CardIssuer::Master => Ok(Self::Mastercard), + CardIssuer::Discover => Ok(Self::Discover), + CardIssuer::Visa => Ok(Self::Visa), + + CardIssuer::Maestro + | CardIssuer::DinersClub + | CardIssuer::JCB + | CardIssuer::CarteBlanche => Err(ConnectorError::NotImplemented( + get_unimplemented_payment_method_error_message("Payeezy"), ))?, } } @@ -118,36 +129,36 @@ pub enum Initiator { CardHolder, } -impl TryFrom<&PayeezyRouterData<&types::PaymentsAuthorizeRouterData>> for PayeezyPaymentsRequest { - type Error = error_stack::Report; +impl TryFrom<&PayeezyRouterData<&PaymentsAuthorizeRouterData>> for PayeezyPaymentsRequest { + type Error = error_stack::Report; fn try_from( - item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>, + item: &PayeezyRouterData<&PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.payment_method { - diesel_models::enums::PaymentMethod::Card => get_card_specific_payment_data(item), - - diesel_models::enums::PaymentMethod::CardRedirect - | diesel_models::enums::PaymentMethod::PayLater - | diesel_models::enums::PaymentMethod::Wallet - | diesel_models::enums::PaymentMethod::BankRedirect - | diesel_models::enums::PaymentMethod::BankTransfer - | diesel_models::enums::PaymentMethod::Crypto - | diesel_models::enums::PaymentMethod::BankDebit - | diesel_models::enums::PaymentMethod::Reward - | 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()) + PaymentMethod::Card => get_card_specific_payment_data(item), + + PaymentMethod::CardRedirect + | PaymentMethod::PayLater + | PaymentMethod::Wallet + | PaymentMethod::BankRedirect + | PaymentMethod::BankTransfer + | PaymentMethod::Crypto + | PaymentMethod::BankDebit + | PaymentMethod::Reward + | PaymentMethod::RealTimePayment + | PaymentMethod::Upi + | PaymentMethod::Voucher + | PaymentMethod::OpenBanking + | PaymentMethod::GiftCard => { + Err(ConnectorError::NotImplemented("Payment methods".to_string()).into()) } } } } fn get_card_specific_payment_data( - item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>, -) -> Result> { + item: &PayeezyRouterData<&PaymentsAuthorizeRouterData>, +) -> Result> { let merchant_ref = item.router_data.attempt_id.to_string(); let method = PayeezyPaymentMethodType::CreditCard; let amount = item.amount.clone(); @@ -167,11 +178,9 @@ fn get_card_specific_payment_data( }) } fn get_transaction_type_and_stored_creds( - item: &types::PaymentsAuthorizeRouterData, -) -> Result< - (PayeezyTransactionType, Option), - error_stack::Report, -> { + item: &PaymentsAuthorizeRouterData, +) -> Result<(PayeezyTransactionType, Option), error_stack::Report> +{ let connector_mandate_id = item.request.mandate_id.as_ref().and_then(|mandate_ids| { match mandate_ids.mandate_reference_id.clone() { Some(api_models::payments::MandateReferenceId::ConnectorMandateId( @@ -203,36 +212,32 @@ fn get_transaction_type_and_stored_creds( ) } else { match item.request.capture_method { - Some(diesel_models::enums::CaptureMethod::Manual) => { - Ok((PayeezyTransactionType::Authorize, None)) - } - Some(diesel_models::enums::CaptureMethod::Automatic) => { - Ok((PayeezyTransactionType::Purchase, None)) + Some(CaptureMethod::Manual) => Ok((PayeezyTransactionType::Authorize, None)), + Some(CaptureMethod::Automatic) => Ok((PayeezyTransactionType::Purchase, None)), + + Some(CaptureMethod::ManualMultiple) | Some(CaptureMethod::Scheduled) | None => { + Err(ConnectorError::FlowNotSupported { + flow: item.request.capture_method.unwrap_or_default().to_string(), + connector: "Payeezy".to_string(), + }) } - - Some(diesel_models::enums::CaptureMethod::ManualMultiple) - | Some(diesel_models::enums::CaptureMethod::Scheduled) - | None => Err(errors::ConnectorError::FlowNotSupported { - flow: item.request.capture_method.unwrap_or_default().to_string(), - connector: "Payeezy".to_string(), - }), }? }; Ok((transaction_type, stored_credentials)) } fn is_mandate_payment( - item: &types::PaymentsAuthorizeRouterData, + item: &PaymentsAuthorizeRouterData, connector_mandate_id: Option<&String>, ) -> bool { item.request.setup_mandate_details.is_some() || connector_mandate_id.is_some() } fn get_payment_method_data( - item: &PayeezyRouterData<&types::PaymentsAuthorizeRouterData>, -) -> Result> { + item: &PayeezyRouterData<&PaymentsAuthorizeRouterData>, +) -> Result> { match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref card) => { + PaymentMethodData::Card(ref card) => { let card_type = PayeezyCardType::try_from(card.get_card_issuer()?)?; let payeezy_card = PayeezyCard { card_type, @@ -247,25 +252,25 @@ fn get_payment_method_data( Ok(PayeezyPaymentMethod::PayeezyCard(payeezy_card)) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::RealTimePayment(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::OpenBanking(_) - | domain::PaymentMethodData::CardToken(_) - | domain::PaymentMethodData::NetworkToken(_) - | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Payeezy"), + PaymentMethodData::CardRedirect(_) + | PaymentMethodData::Wallet(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankDebit(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::Upi(_) + | PaymentMethodData::Voucher(_) + | PaymentMethodData::GiftCard(_) + | PaymentMethodData::OpenBanking(_) + | PaymentMethodData::CardToken(_) + | PaymentMethodData::NetworkToken(_) + | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { + Err(ConnectorError::NotImplemented( + get_unimplemented_payment_method_error_message("Payeezy"), ))? } } @@ -278,10 +283,10 @@ pub struct PayeezyAuthType { pub(super) merchant_token: Secret, } -impl TryFrom<&types::ConnectorAuthType> for PayeezyAuthType { - type Error = error_stack::Report; - fn try_from(item: &types::ConnectorAuthType) -> Result { - if let types::ConnectorAuthType::SignatureKey { +impl TryFrom<&ConnectorAuthType> for PayeezyAuthType { + type Error = error_stack::Report; + fn try_from(item: &ConnectorAuthType) -> Result { + if let ConnectorAuthType::SignatureKey { api_key, key1, api_secret, @@ -293,7 +298,7 @@ impl TryFrom<&types::ConnectorAuthType> for PayeezyAuthType { merchant_token: key1.to_owned(), }) } else { - Err(errors::ConnectorError::FailedToObtainAuthType.into()) + Err(ConnectorError::FailedToObtainAuthType.into()) } } } @@ -341,16 +346,12 @@ pub struct PayeezyCaptureOrVoidRequest { currency_code: String, } -impl TryFrom<&PayeezyRouterData<&types::PaymentsCaptureRouterData>> - for PayeezyCaptureOrVoidRequest -{ - type Error = error_stack::Report; - fn try_from( - item: &PayeezyRouterData<&types::PaymentsCaptureRouterData>, - ) -> Result { +impl TryFrom<&PayeezyRouterData<&PaymentsCaptureRouterData>> for PayeezyCaptureOrVoidRequest { + type Error = error_stack::Report; + fn try_from(item: &PayeezyRouterData<&PaymentsCaptureRouterData>) -> Result { let metadata: PayeezyPaymentsMetadata = - utils::to_connector_meta(item.router_data.request.connector_meta.clone()) - .change_context(errors::ConnectorError::RequestEncodingFailed)?; + to_connector_meta(item.router_data.request.connector_meta.clone()) + .change_context(ConnectorError::RequestEncodingFailed)?; Ok(Self { transaction_type: PayeezyTransactionType::Capture, amount: item.amount.clone(), @@ -360,18 +361,18 @@ impl TryFrom<&PayeezyRouterData<&types::PaymentsCaptureRouterData>> } } -impl TryFrom<&types::PaymentsCancelRouterData> for PayeezyCaptureOrVoidRequest { - type Error = error_stack::Report; - fn try_from(item: &types::PaymentsCancelRouterData) -> Result { +impl TryFrom<&PaymentsCancelRouterData> for PayeezyCaptureOrVoidRequest { + type Error = error_stack::Report; + fn try_from(item: &PaymentsCancelRouterData) -> Result { let metadata: PayeezyPaymentsMetadata = - utils::to_connector_meta(item.request.connector_meta.clone()) - .change_context(errors::ConnectorError::RequestEncodingFailed)?; + to_connector_meta(item.request.connector_meta.clone()) + .change_context(ConnectorError::RequestEncodingFailed)?; Ok(Self { transaction_type: PayeezyTransactionType::Void, amount: item .request .amount - .ok_or(errors::ConnectorError::RequestEncodingFailed)? + .ok_or(ConnectorError::RequestEncodingFailed)? .to_string(), currency_code: item.request.currency.unwrap_or_default().to_string(), transaction_tag: metadata.transaction_tag, @@ -397,39 +398,38 @@ pub struct PayeezyPaymentsMetadata { transaction_tag: String, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { - type Error = error_stack::Report; + type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { let metadata = item .response .transaction_tag .map(|txn_tag| construct_payeezy_payments_metadata(txn_tag).encode_to_value()) .transpose() - .change_context(errors::ConnectorError::ResponseHandlingFailed)?; + .change_context(ConnectorError::ResponseHandlingFailed)?; let mandate_reference = item .response .stored_credentials .map(|credentials| credentials.cardbrand_original_transaction_id) - .map(|id| types::MandateReference { + .map(|id| MandateReference { connector_mandate_id: Some(id.expose()), payment_method_id: None, mandate_metadata: None, }); - let status = enums::AttemptStatus::foreign_from(( + let status = get_status( item.response.transaction_status, item.response.transaction_type, - )); + ); Ok(Self { status, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( item.response.transaction_id.clone(), ), redirection_data: None, @@ -449,26 +449,28 @@ impl } } -impl ForeignFrom<(PayeezyPaymentStatus, PayeezyTransactionType)> for enums::AttemptStatus { - fn foreign_from((status, method): (PayeezyPaymentStatus, PayeezyTransactionType)) -> Self { - match status { - PayeezyPaymentStatus::Approved => match method { - PayeezyTransactionType::Authorize => Self::Authorized, - PayeezyTransactionType::Capture - | PayeezyTransactionType::Purchase - | PayeezyTransactionType::Recurring => Self::Charged, - PayeezyTransactionType::Void => Self::Voided, - PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => Self::Pending, - }, - PayeezyPaymentStatus::Declined | PayeezyPaymentStatus::NotProcessed => match method { - PayeezyTransactionType::Capture => Self::CaptureFailed, - PayeezyTransactionType::Authorize - | PayeezyTransactionType::Purchase - | PayeezyTransactionType::Recurring => Self::AuthorizationFailed, - PayeezyTransactionType::Void => Self::VoidFailed, - PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => Self::Pending, - }, - } +fn get_status(status: PayeezyPaymentStatus, method: PayeezyTransactionType) -> AttemptStatus { + match status { + PayeezyPaymentStatus::Approved => match method { + PayeezyTransactionType::Authorize => AttemptStatus::Authorized, + PayeezyTransactionType::Capture + | PayeezyTransactionType::Purchase + | PayeezyTransactionType::Recurring => AttemptStatus::Charged, + PayeezyTransactionType::Void => AttemptStatus::Voided, + PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => { + AttemptStatus::Pending + } + }, + PayeezyPaymentStatus::Declined | PayeezyPaymentStatus::NotProcessed => match method { + PayeezyTransactionType::Capture => AttemptStatus::CaptureFailed, + PayeezyTransactionType::Authorize + | PayeezyTransactionType::Purchase + | PayeezyTransactionType::Recurring => AttemptStatus::AuthorizationFailed, + PayeezyTransactionType::Void => AttemptStatus::VoidFailed, + PayeezyTransactionType::Refund | PayeezyTransactionType::Pending => { + AttemptStatus::Pending + } + }, } } @@ -482,14 +484,12 @@ pub struct PayeezyRefundRequest { currency_code: String, } -impl TryFrom<&PayeezyRouterData<&types::RefundsRouterData>> for PayeezyRefundRequest { - type Error = error_stack::Report; - fn try_from( - item: &PayeezyRouterData<&types::RefundsRouterData>, - ) -> Result { +impl TryFrom<&PayeezyRouterData<&RefundsRouterData>> for PayeezyRefundRequest { + type Error = error_stack::Report; + fn try_from(item: &PayeezyRouterData<&RefundsRouterData>) -> Result { let metadata: PayeezyPaymentsMetadata = - utils::to_connector_meta(item.router_data.request.connector_metadata.clone()) - .change_context(errors::ConnectorError::RequestEncodingFailed)?; + to_connector_meta(item.router_data.request.connector_metadata.clone()) + .change_context(ConnectorError::RequestEncodingFailed)?; Ok(Self { transaction_type: PayeezyTransactionType::Refund, amount: item.amount.clone(), @@ -538,15 +538,13 @@ pub struct RefundResponse { pub gateway_message: String, } -impl TryFrom> - for types::RefundsRouterData -{ - type Error = error_stack::Report; +impl TryFrom> for RefundsRouterData { + type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_id, refund_status: enums::RefundStatus::from(item.response.transaction_status), }), diff --git a/crates/router/src/connector/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rs similarity index 61% rename from crates/router/src/connector/payu.rs rename to crates/hyperswitch_connectors/src/connectors/payu.rs index 4ff317d1f713..05f983b8fbbd 100644 --- a/crates/router/src/connector/payu.rs +++ b/crates/hyperswitch_connectors/src/connectors/payu.rs @@ -1,30 +1,49 @@ pub mod transformers; -use std::fmt::Debug; - -use common_utils::request::RequestContent; -use diesel_models::enums; +use api_models::webhooks::IncomingWebhookEvent; +use common_enums::enums; +use common_utils::{ + errors::CustomResult, + ext_traits::ByteSliceExt, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::{report, ResultExt}; -use masking::PeekInterface; -use transformers as payu; - -use crate::{ - configs::settings, - connector::utils as connector_utils, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, +use hyperswitch_domain_models::{ + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, + }, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, }, - utils::BytesExt, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, + types::{ + PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType, + RefreshTokenType, RefundExecuteType, RefundSyncType, Response, + }, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::{Mask, PeekInterface}; +use transformers as payu; + +use crate::{ + constants::headers, + types::{RefreshTokenRouterData, ResponseRouterData}, + utils::construct_not_supported_error_report, }; #[derive(Debug, Clone)] @@ -36,9 +55,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut headers = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), @@ -67,14 +86,14 @@ impl ConnectorCommon for Payu { "application/json" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.payu.base_url.as_ref() } fn get_auth_header( &self, - auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { let auth = payu::PayuAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; Ok(vec![( @@ -85,7 +104,7 @@ impl ConnectorCommon for Payu { fn build_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { let response: payu::PayuErrorResponse = res @@ -117,7 +136,7 @@ impl ConnectorValidation for Payu { match capture_method { enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual => Ok(()), enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_supported_error_report(capture_method, self.id()), + construct_not_supported_error_report(capture_method, self.id()), ), } } @@ -126,22 +145,12 @@ impl ConnectorValidation for Payu { impl api::Payment for Payu {} impl api::MandateSetup for Payu {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Payu -{ +impl ConnectorIntegration for Payu { fn build_request( &self, - _req: &types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err( errors::ConnectorError::NotImplemented("Setup Mandate flow for Payu".to_string()) .into(), @@ -151,26 +160,20 @@ impl impl api::PaymentToken for Payu {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Payu +impl ConnectorIntegration + for Payu { // Not Implemented (R) } impl api::PaymentVoid for Payu {} -impl ConnectorIntegration - for Payu -{ +impl ConnectorIntegration for Payu { fn get_headers( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -180,8 +183,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = &req.request.connector_transaction_id; Ok(format!( @@ -193,23 +196,23 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Delete) - .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Delete) + .url(&PaymentsVoidType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) + .headers(PaymentsVoidType::get_headers(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, - data: &types::PaymentsCancelRouterData, + data: &PaymentsCancelRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: payu::PayuPaymentsCancelResponse = res .response .parse_struct("PaymentCancelResponse") @@ -218,7 +221,7 @@ impl ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -236,13 +239,11 @@ impl ConnectorIntegration - for Payu -{ +impl ConnectorIntegration for Payu { fn get_url( &self, - _req: &types::RefreshTokenRouterData, - connectors: &settings::Connectors, + _req: &RefreshTokenRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}{}", @@ -257,21 +258,19 @@ impl ConnectorIntegration CustomResult)>, errors::ConnectorError> { + _req: &RefreshTokenRouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![( headers::CONTENT_TYPE.to_string(), - types::RefreshTokenType::get_content_type(self) - .to_string() - .into(), + RefreshTokenType::get_content_type(self).to_string().into(), )]) } fn get_request_body( &self, - req: &types::RefreshTokenRouterData, - _connectors: &settings::Connectors, + req: &RefreshTokenRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = payu::PayuAuthUpdateRequest::try_from(req)?; @@ -280,18 +279,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefreshTokenRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { let req = Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .attach_default_headers() - .headers(types::RefreshTokenType::get_headers(self, req, connectors)?) - .url(&types::RefreshTokenType::get_url(self, req, connectors)?) - .set_body(types::RefreshTokenType::get_request_body( - self, req, connectors, - )?) + .headers(RefreshTokenType::get_headers(self, req, connectors)?) + .url(&RefreshTokenType::get_url(self, req, connectors)?) + .set_body(RefreshTokenType::get_request_body(self, req, connectors)?) .build(), ); @@ -299,10 +296,10 @@ impl ConnectorIntegration, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: payu::PayuAuthUpdateResponse = res .response .parse_struct("payu PayuAuthUpdateResponse") @@ -311,7 +308,7 @@ impl ConnectorIntegration, ) -> CustomResult { let response: payu::PayuAccessTokenErrorResponse = res @@ -344,14 +341,12 @@ impl ConnectorIntegration - for Payu -{ +impl ConnectorIntegration for Payu { fn get_headers( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -361,8 +356,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = req .request @@ -379,32 +374,32 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) + .headers(PaymentsSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsSyncRouterData, + data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: payu::PayuPaymentsSyncResponse = res .response .parse_struct("payu OrderResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -414,7 +409,7 @@ impl ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -422,14 +417,12 @@ impl ConnectorIntegration - for Payu -{ +impl ConnectorIntegration for Payu { fn get_headers( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -439,8 +432,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}{}{}{}", @@ -453,8 +446,8 @@ impl ConnectorIntegration CustomResult { let connector_req = payu::PayuPaymentsCaptureRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -462,18 +455,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Put) - .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Put) + .url(&PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsCaptureType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsCaptureType::get_request_body( + .headers(PaymentsCaptureType::get_headers(self, req, connectors)?) + .set_body(PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), @@ -482,17 +473,17 @@ impl ConnectorIntegration, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: payu::PayuPaymentsCaptureResponse = res .response .parse_struct("payu CaptureResponse") .change_context(errors::ConnectorError::RequestEncodingFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -502,7 +493,7 @@ impl ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -511,22 +502,18 @@ impl ConnectorIntegration - for Payu -{ +impl ConnectorIntegration for Payu { //TODO: implement sessions flow } impl api::PaymentAuthorize for Payu {} -impl ConnectorIntegration - for Payu -{ +impl ConnectorIntegration for Payu { fn get_headers( &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -536,8 +523,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}{}", @@ -548,8 +535,8 @@ impl ConnectorIntegration CustomResult { let connector_req = payu::PayuPaymentsRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -557,24 +544,16 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &RouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsAuthorizeType::get_request_body( + .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) + .set_body(PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), @@ -583,17 +562,17 @@ impl ConnectorIntegration, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: payu::PayuPaymentsResponse = res .response .parse_struct("PayuPaymentsResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -603,7 +582,7 @@ impl ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -614,12 +593,12 @@ impl api::Refund for Payu {} impl api::RefundExecute for Payu {} impl api::RefundSync for Payu {} -impl ConnectorIntegration for Payu { +impl ConnectorIntegration for Payu { fn get_headers( &self, - req: &types::RefundsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -629,8 +608,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}{}{}{}", @@ -643,8 +622,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = payu::PayuRefundRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -652,36 +631,32 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) - .set_body(types::RefundExecuteType::get_request_body( - self, req, connectors, - )?) + .headers(RefundExecuteType::get_headers(self, req, connectors)?) + .set_body(RefundExecuteType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, - data: &types::RefundsRouterData, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { + res: Response, + ) -> CustomResult, errors::ConnectorError> { let response: payu::RefundResponse = res .response .parse_struct("payu RefundResponse") .change_context(errors::ConnectorError::RequestEncodingFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -691,19 +666,19 @@ impl ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) } } -impl ConnectorIntegration for Payu { +impl ConnectorIntegration for Payu { fn get_headers( &self, - req: &types::RefundSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -713,8 +688,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}{}{}{}", @@ -727,32 +702,32 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::RefundSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundSyncType::get_headers(self, req, connectors)?) + .headers(RefundSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::RefundSyncRouterData, + data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: payu::RefundSyncResponse = res.response .parse_struct("payu RefundResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -762,7 +737,7 @@ impl ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -770,24 +745,24 @@ impl ConnectorIntegration, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Ok(api::IncomingWebhookEvent::EventNotSupported) + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Ok(IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } diff --git a/crates/router/src/connector/payu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs similarity index 82% rename from crates/router/src/connector/payu/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/payu/transformers.rs index 5365fc74ef2e..7b3792c0e24b 100644 --- a/crates/router/src/connector/payu/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs @@ -1,14 +1,25 @@ use base64::Engine; -use common_utils::pii::{Email, IpAddress}; +use common_enums::enums; +use common_utils::{ + consts::BASE64_ENGINE, + pii::{Email, IpAddress}, +}; use error_stack::ResultExt; +use hyperswitch_domain_models::{ + payment_method_data::{PaymentMethodData, WalletData}, + router_data::{AccessToken, ConnectorAuthType, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::ResponseId, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::errors; +use masking::Secret; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::AccessTokenRequestInfo, - consts, - core::errors, - pii::Secret, - types::{self, api, domain, storage::enums}, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::AccessTokenRequestInfo as _, }; const WALLET_IDENTIFIER: &str = "PBL"; @@ -70,7 +81,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest { fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result { let auth_type = PayuAuthType::try_from(&item.connector_auth_type)?; let payment_method = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Ok(PayuPaymentMethod { + PaymentMethodData::Card(ccard) => Ok(PayuPaymentMethod { pay_method: PayuPaymentMethodData::Card(PayuCard::Card { number: ccard.card_number, expiration_month: ccard.card_exp_month, @@ -78,19 +89,19 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest { cvv: ccard.card_cvc, }), }), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::GooglePay(data) => Ok(PayuPaymentMethod { + PaymentMethodData::Wallet(wallet_data) => match wallet_data { + WalletData::GooglePay(data) => Ok(PayuPaymentMethod { pay_method: PayuPaymentMethodData::Wallet({ PayuWallet { value: PayuWalletCode::Ap, wallet_type: WALLET_IDENTIFIER.to_string(), authorization_code: Secret::new( - consts::BASE64_ENGINE.encode(data.tokenization_data.token), + BASE64_ENGINE.encode(data.tokenization_data.token), ), } }), }), - domain::WalletData::ApplePay(data) => Ok(PayuPaymentMethod { + WalletData::ApplePay(data) => Ok(PayuPaymentMethod { pay_method: PayuPaymentMethodData::Wallet({ PayuWallet { value: PayuWalletCode::Jp, @@ -140,11 +151,11 @@ pub struct PayuAuthType { pub(super) merchant_pos_id: Secret, } -impl TryFrom<&types::ConnectorAuthType> for PayuAuthType { +impl TryFrom<&ConnectorAuthType> for PayuAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { + fn try_from(auth_type: &ConnectorAuthType) -> Result { match auth_type { - types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { + ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { api_key: api_key.to_owned(), merchant_pos_id: key1.to_owned(), }), @@ -188,20 +199,17 @@ pub struct PayuPaymentsResponse { pub ext_order_id: Option, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { Ok(Self { status: enums::AttemptStatus::from(item.response.status.status_code), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.order_id.clone(), - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order_id.clone()), redirection_data: None, mandate_reference: None, connector_metadata: None, @@ -241,24 +249,17 @@ pub struct PayuPaymentsCaptureResponse { status: PayuPaymentStatusData, } -impl - TryFrom< - types::ResponseRouterData, - > for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - PayuPaymentsCaptureResponse, - T, - types::PaymentsResponseData, - >, + item: ResponseRouterData, ) -> Result { Ok(Self { status: enums::AttemptStatus::from(item.response.status.status_code.clone()), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::NoResponseId, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::NoResponseId, redirection_data: None, mandate_reference: None, connector_metadata: None, @@ -298,15 +299,15 @@ pub struct PayuAuthUpdateResponse { pub grant_type: String, } -impl TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { Ok(Self { - response: Ok(types::AccessToken { + response: Ok(AccessToken { token: item.response.access_token, expires: item.response.expires_in, }), @@ -323,26 +324,17 @@ pub struct PayuPaymentsCancelResponse { pub status: PayuPaymentStatusData, } -impl - TryFrom< - types::ResponseRouterData, - > for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - PayuPaymentsCancelResponse, - T, - types::PaymentsResponseData, - >, + item: ResponseRouterData, ) -> Result { Ok(Self { status: enums::AttemptStatus::from(item.response.status.status_code.clone()), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.order_id.clone(), - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.order_id.clone()), redirection_data: None, mandate_reference: None, connector_metadata: None, @@ -457,18 +449,12 @@ pub struct PayuPaymentsSyncResponse { properties: Option>, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - PayuPaymentsSyncResponse, - T, - types::PaymentsResponseData, - >, + item: ResponseRouterData, ) -> Result { let order = match item.response.orders.first() { Some(order) => order, @@ -476,8 +462,8 @@ impl }; Ok(Self { status: enums::AttemptStatus::from(order.status.clone()), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(order.order_id.clone()), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(order.order_id.clone()), redirection_data: None, mandate_reference: None, connector_metadata: None, @@ -569,16 +555,16 @@ pub struct RefundResponse { refund: PayuRefundResponseData, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let refund_status = enums::RefundStatus::from(item.response.refund.status); Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.refund.refund_id, refund_status, }), @@ -591,19 +577,19 @@ impl TryFrom> pub struct RefundSyncResponse { refunds: Vec, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let refund = match item.response.refunds.first() { Some(refund) => refund, _ => Err(errors::ConnectorError::ResponseHandlingFailed)?, }; Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: refund.refund_id.clone(), refund_status: enums::RefundStatus::from(refund.status.clone()), }), diff --git a/crates/router/src/connector/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rs similarity index 64% rename from crates/router/src/connector/zen.rs rename to crates/hyperswitch_connectors/src/connectors/zen.rs index 2d522dbdf1bd..a90b10fbd866 100644 --- a/crates/router/src/connector/zen.rs +++ b/crates/hyperswitch_connectors/src/connectors/zen.rs @@ -2,34 +2,52 @@ pub mod transformers; use std::fmt::Debug; -use common_utils::{crypto, ext_traits::ByteSliceExt, request::RequestContent}; +use api_models::webhooks::IncomingWebhookEvent; +use common_enums::{CallConnectorAction, PaymentAction}; +use common_utils::{ + crypto, + errors::CustomResult, + ext_traits::{ByteSliceExt, BytesExt}, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::ResultExt; -use masking::{PeekInterface, Secret}; -use transformers as zen; -use uuid::Uuid; - -use self::transformers::{ZenPaymentStatus, ZenWebhookTxnType}; -use crate::{ - configs::settings, - consts, - core::{ - errors::{self, CustomResult}, - payments, +use hyperswitch_domain_models::{ + api::ApplicationResponse, + payment_method_data::PaymentMethodData, + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, }, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - domain, ErrorResponse, Response, + PaymentsAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData, + RefundsRouterData, }, - utils::BytesExt, }; +use hyperswitch_interfaces::{ + api::{ + self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse, + ConnectorValidation, + }, + configs::Connectors, + consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, + errors, + events::connector_api_logs::ConnectorEvent, + types::{PaymentsAuthorizeType, PaymentsSyncType, RefundExecuteType, RefundSyncType, Response}, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::{Mask, PeekInterface, Secret}; +use transformers::{self as zen, ZenPaymentStatus, ZenWebhookTxnType}; +use uuid::Uuid; + +use crate::{constants::headers, types::ResponseRouterData}; #[derive(Debug, Clone)] pub struct Zen; @@ -48,7 +66,7 @@ impl api::RefundExecute for Zen {} impl api::RefundSync for Zen {} impl Zen { - fn get_default_header() -> (String, request::Maskable) { + fn get_default_header() -> (String, masking::Maskable) { ("request-id".to_string(), Uuid::new_v4().to_string().into()) } } @@ -59,9 +77,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut headers = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), @@ -87,14 +105,14 @@ impl ConnectorCommon for Zen { mime::APPLICATION_JSON.essence_str() } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.zen.base_url.as_ref() } fn get_auth_header( &self, - auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { let auth = zen::ZenAuthType::try_from(auth_type)?; Ok(vec![( headers::AUTHORIZATION.to_string(), @@ -120,13 +138,9 @@ impl ConnectorCommon for Zen { code: response .error .clone() - .map_or(consts::NO_ERROR_CODE.to_string(), |error| error.code), + .map_or(NO_ERROR_CODE.to_string(), |error| error.code), message: response.error.map_or_else( - || { - response - .message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()) - }, + || response.message.unwrap_or(NO_ERROR_MESSAGE.to_string()), |error| error.message, ), reason: None, @@ -139,7 +153,7 @@ impl ConnectorCommon for Zen { impl ConnectorValidation for Zen { fn validate_psync_reference_id( &self, - _data: &hyperswitch_domain_models::router_request_types::PaymentsSyncData, + _data: &PaymentsSyncData, _is_three_ds: bool, _status: common_enums::enums::AttemptStatus, _connector_meta_data: Option, @@ -149,58 +163,37 @@ impl ConnectorValidation for Zen { } } -impl ConnectorIntegration - for Zen -{ +impl ConnectorIntegration for Zen { //TODO: implement sessions flow } -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Zen +impl ConnectorIntegration + for Zen { // Not Implemented (R) } -impl ConnectorIntegration - for Zen -{ -} +impl ConnectorIntegration for Zen {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Zen -{ +impl ConnectorIntegration for Zen { fn build_request( &self, - _req: &types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("Setup Mandate flow for Zen".to_string()).into()) } } -impl ConnectorIntegration - for Zen -{ +impl ConnectorIntegration for Zen { fn get_headers( &self, - req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut headers = self.build_headers(req, connectors)?; let api_headers = match req.request.payment_method_data { - domain::payments::PaymentMethodData::Wallet(_) => None, + PaymentMethodData::Wallet(_) => None, _ => Some(Self::get_default_header()), }; if let Some(api_header) = api_headers { @@ -215,11 +208,11 @@ impl ConnectorIntegration CustomResult { let endpoint = match &req.request.payment_method_data { - domain::payments::PaymentMethodData::Wallet(_) => { + PaymentMethodData::Wallet(_) => { let base_url = connectors .zen .secondary_base_url @@ -234,8 +227,8 @@ impl ConnectorIntegration CustomResult { let connector_router_data = zen::ZenRouterData::try_from(( &self.get_currency_unit(), @@ -249,20 +242,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsAuthorizeType::get_request_body( + .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) + .set_body(PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), @@ -271,17 +260,17 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: zen::ZenPaymentsResponse = res .response .parse_struct("Zen PaymentsAuthorizeResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -297,14 +286,12 @@ impl ConnectorIntegration - for Zen -{ +impl ConnectorIntegration for Zen { fn get_headers( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut headers = self.build_headers(req, connectors)?; headers.push(Self::get_default_header()); Ok(headers) @@ -316,8 +303,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}v1/transactions/merchant/{}", @@ -328,32 +315,32 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) + .headers(PaymentsSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsSyncRouterData, + data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: zen::ZenPaymentsResponse = res .response .parse_struct("zen PaymentsSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::try_from(types::ResponseRouterData { + RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -369,18 +356,12 @@ impl ConnectorIntegration - for Zen -{ +impl ConnectorIntegration for Zen { fn build_request( &self, - _req: &types::RouterData< - api::Capture, - types::PaymentsCaptureData, - types::PaymentsResponseData, - >, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err(errors::ConnectorError::FlowNotSupported { flow: "Capture".to_owned(), connector: "Zen".to_owned(), @@ -389,14 +370,12 @@ impl ConnectorIntegration - for Zen -{ +impl ConnectorIntegration for Zen { fn build_request( &self, - _req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err(errors::ConnectorError::FlowNotSupported { flow: "Void".to_owned(), connector: "Zen".to_owned(), @@ -405,12 +384,12 @@ impl ConnectorIntegration for Zen { +impl ConnectorIntegration for Zen { fn get_headers( &self, - req: &types::RefundsRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut headers = self.build_headers(req, connectors)?; headers.push(Self::get_default_header()); Ok(headers) @@ -422,8 +401,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + _req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}v1/transactions/refund", @@ -433,8 +412,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_router_data = zen::ZenRouterData::try_from(( &self.get_currency_unit(), @@ -448,29 +427,25 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) - .set_body(types::RefundExecuteType::get_request_body( - self, req, connectors, - )?) + .headers(RefundExecuteType::get_headers(self, req, connectors)?) + .set_body(RefundExecuteType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, - data: &types::RefundsRouterData, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: zen::RefundResponse = res .response .parse_struct("zen RefundResponse") @@ -478,7 +453,7 @@ impl ConnectorIntegration for Zen { +impl ConnectorIntegration for Zen { fn get_headers( &self, - req: &types::RefundSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let mut headers = self.build_headers(req, connectors)?; headers.push(Self::get_default_header()); Ok(headers) @@ -511,8 +486,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}v1/transactions/merchant/{}", @@ -523,25 +498,25 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::RefundSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundSyncType::get_headers(self, req, connectors)?) + .headers(RefundSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::RefundSyncRouterData, + data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: zen::RefundResponse = res .response .parse_struct("zen RefundSyncResponse") @@ -550,7 +525,7 @@ impl ConnectorIntegration, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Ok(Box::new(crypto::Sha256)) } fn get_webhook_source_verification_signature( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult, errors::ConnectorError> { let webhook_body: zen::ZenWebhookSignature = request @@ -590,7 +565,7 @@ impl api::IncomingWebhook for Zen { fn get_webhook_source_verification_message( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, _merchant_id: &common_utils::id_type::MerchantId, _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult, errors::ConnectorError> { @@ -610,7 +585,7 @@ impl api::IncomingWebhook for Zen { async fn verify_webhook_source( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, merchant_id: &common_utils::id_type::MerchantId, connector_webhook_details: Option, _connector_account_details: crypto::Encryptable>, @@ -641,7 +616,7 @@ impl api::IncomingWebhook for Zen { fn get_webhook_object_reference_id( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult { let webhook_body: zen::ZenWebhookObjectReference = request .body @@ -663,8 +638,8 @@ impl api::IncomingWebhook for Zen { fn get_webhook_event_type( &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { let details: zen::ZenWebhookEventType = request .body .parse_struct("ZenWebhookEventType") @@ -672,22 +647,22 @@ impl api::IncomingWebhook for Zen { Ok(match &details.transaction_type { ZenWebhookTxnType::TrtPurchase => match &details.status { - ZenPaymentStatus::Rejected => api::IncomingWebhookEvent::PaymentIntentFailure, - ZenPaymentStatus::Accepted => api::IncomingWebhookEvent::PaymentIntentSuccess, + ZenPaymentStatus::Rejected => IncomingWebhookEvent::PaymentIntentFailure, + ZenPaymentStatus::Accepted => IncomingWebhookEvent::PaymentIntentSuccess, _ => Err(errors::ConnectorError::WebhookEventTypeNotFound)?, }, ZenWebhookTxnType::TrtRefund => match &details.status { - ZenPaymentStatus::Rejected => api::IncomingWebhookEvent::RefundFailure, - ZenPaymentStatus::Accepted => api::IncomingWebhookEvent::RefundSuccess, + ZenPaymentStatus::Rejected => IncomingWebhookEvent::RefundFailure, + ZenPaymentStatus::Accepted => IncomingWebhookEvent::RefundSuccess, _ => Err(errors::ConnectorError::WebhookEventTypeNotFound)?, }, - ZenWebhookTxnType::Unknown => api::IncomingWebhookEvent::EventNotSupported, + ZenWebhookTxnType::Unknown => IncomingWebhookEvent::EventNotSupported, }) } fn get_webhook_resource_object( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { let reference_object: serde_json::Value = serde_json::from_slice(request.body) .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?; @@ -695,29 +670,26 @@ impl api::IncomingWebhook for Zen { } fn get_webhook_api_response( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult, errors::ConnectorError> - { - Ok(services::api::ApplicationResponse::Json( - serde_json::json!({ - "status": "ok" - }), - )) + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult, errors::ConnectorError> { + Ok(ApplicationResponse::Json(serde_json::json!({ + "status": "ok" + }))) } } -impl services::ConnectorRedirectResponse for Zen { +impl ConnectorRedirectResponse for Zen { fn get_flow_type( &self, _query_params: &str, _json_payload: Option, - action: services::PaymentAction, - ) -> CustomResult { + action: PaymentAction, + ) -> CustomResult { match action { - services::PaymentAction::PSync - | services::PaymentAction::CompleteAuthorize - | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => { - Ok(payments::CallConnectorAction::Trigger) + PaymentAction::PSync + | PaymentAction::CompleteAuthorize + | PaymentAction::PaymentAuthenticateCompleteAuthorize => { + Ok(CallConnectorAction::Trigger) } } } diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs similarity index 71% rename from crates/router/src/connector/zen/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/zen/transformers.rs index 799753fd52c1..a564fb4ee601 100644 --- a/crates/router/src/connector/zen/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs @@ -1,20 +1,39 @@ use cards::CardNumber; -use common_utils::{ext_traits::ValueExt, pii}; +use common_enums::enums; +use common_utils::{ + errors::CustomResult, + ext_traits::{OptionExt, ValueExt}, + pii::{self}, + request::Method, +}; use error_stack::ResultExt; +use hyperswitch_domain_models::{ + payment_method_data::{ + BankDebitData, BankRedirectData, BankTransferData, Card, CardRedirectData, GiftCardData, + PayLaterData, PaymentMethodData, VoucherData, WalletData, + }, + router_data::{ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::{BrowserInformation, ResponseId}, + router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::{ + api, + consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, + errors, +}; use masking::{ExposeInterface, PeekInterface, Secret}; use ring::digest; use serde::{Deserialize, Serialize}; use strum::Display; use crate::{ - connector::utils::{ - self, BrowserInformationData, CardData, PaymentsAuthorizeRequestData, RouterData, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{ + self, BrowserInformationData, CardData, ForeignTryFrom, PaymentsAuthorizeRequestData, + RouterData as _, }, - consts, - core::errors::{self, CustomResult}, - services::{self, Method}, - types::{self, api, domain, storage::enums, transformers::ForeignTryFrom}, - utils::OptionExt, }; #[derive(Debug, Serialize)] @@ -41,10 +60,10 @@ pub struct ZenAuthType { pub(super) api_key: Secret, } -impl TryFrom<&types::ConnectorAuthType> for ZenAuthType { +impl TryFrom<&ConnectorAuthType> for ZenAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - if let types::ConnectorAuthType::HeaderKey { api_key } = auth_type { + fn try_from(auth_type: &ConnectorAuthType) -> Result { + if let ConnectorAuthType::HeaderKey { api_key } = auth_type { Ok(Self { api_key: api_key.to_owned(), }) @@ -191,18 +210,10 @@ pub struct WalletSessionData { pub pay_wall_secret: Option>, } -impl - TryFrom<( - &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, - )> for ZenPaymentsRequest -{ +impl TryFrom<(&ZenRouterData<&types::PaymentsAuthorizeRouterData>, &Card)> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( - value: ( - &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::Card, - ), + value: (&ZenRouterData<&types::PaymentsAuthorizeRouterData>, &Card), ) -> Result { let (item, ccard) = value; let browser_info = item.router_data.request.get_browser_info()?; @@ -245,14 +256,14 @@ impl impl TryFrom<( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::VoucherData, + &VoucherData, )> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( value: ( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::VoucherData, + &VoucherData, ), ) -> Result { let (item, voucher_data) = value; @@ -266,20 +277,20 @@ impl return_url: item.router_data.request.get_router_return_url()?, }); let payment_channel = match voucher_data { - domain::VoucherData::Boleto { .. } => ZenPaymentChannels::PclBoacompraBoleto, - domain::VoucherData::Efecty => ZenPaymentChannels::PclBoacompraEfecty, - domain::VoucherData::PagoEfectivo => ZenPaymentChannels::PclBoacompraPagoefectivo, - domain::VoucherData::RedCompra => ZenPaymentChannels::PclBoacompraRedcompra, - domain::VoucherData::RedPagos => ZenPaymentChannels::PclBoacompraRedpagos, - domain::VoucherData::Oxxo { .. } - | domain::VoucherData::Alfamart { .. } - | domain::VoucherData::Indomaret { .. } - | domain::VoucherData::SevenEleven { .. } - | domain::VoucherData::Lawson { .. } - | domain::VoucherData::MiniStop { .. } - | domain::VoucherData::FamilyMart { .. } - | domain::VoucherData::Seicomart { .. } - | domain::VoucherData::PayEasy { .. } => Err(errors::ConnectorError::NotImplemented( + VoucherData::Boleto { .. } => ZenPaymentChannels::PclBoacompraBoleto, + VoucherData::Efecty => ZenPaymentChannels::PclBoacompraEfecty, + VoucherData::PagoEfectivo => ZenPaymentChannels::PclBoacompraPagoefectivo, + VoucherData::RedCompra => ZenPaymentChannels::PclBoacompraRedcompra, + VoucherData::RedPagos => ZenPaymentChannels::PclBoacompraRedpagos, + VoucherData::Oxxo { .. } + | VoucherData::Alfamart { .. } + | VoucherData::Indomaret { .. } + | VoucherData::SevenEleven { .. } + | VoucherData::Lawson { .. } + | VoucherData::MiniStop { .. } + | VoucherData::FamilyMart { .. } + | VoucherData::Seicomart { .. } + | VoucherData::PayEasy { .. } => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ))?, }; @@ -299,14 +310,14 @@ impl impl TryFrom<( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &Box, + &Box, )> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( value: ( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &Box, + &Box, ), ) -> Result { let (item, bank_transfer_data) = value; @@ -320,22 +331,22 @@ impl return_url: item.router_data.request.get_router_return_url()?, }); let payment_channel = match **bank_transfer_data { - domain::BankTransferData::MultibancoBankTransfer { .. } => { + BankTransferData::MultibancoBankTransfer { .. } => { ZenPaymentChannels::PclBoacompraMultibanco } - domain::BankTransferData::Pix { .. } => ZenPaymentChannels::PclBoacompraPix, - domain::BankTransferData::Pse { .. } => ZenPaymentChannels::PclBoacompraPse, - domain::BankTransferData::SepaBankTransfer { .. } - | domain::BankTransferData::AchBankTransfer { .. } - | domain::BankTransferData::BacsBankTransfer { .. } - | domain::BankTransferData::PermataBankTransfer { .. } - | domain::BankTransferData::BcaBankTransfer { .. } - | domain::BankTransferData::BniVaBankTransfer { .. } - | domain::BankTransferData::BriVaBankTransfer { .. } - | domain::BankTransferData::CimbVaBankTransfer { .. } - | domain::BankTransferData::DanamonVaBankTransfer { .. } - | domain::BankTransferData::LocalBankTransfer { .. } - | domain::BankTransferData::MandiriVaBankTransfer { .. } => { + BankTransferData::Pix { .. } => ZenPaymentChannels::PclBoacompraPix, + BankTransferData::Pse { .. } => ZenPaymentChannels::PclBoacompraPse, + BankTransferData::SepaBankTransfer { .. } + | BankTransferData::AchBankTransfer { .. } + | BankTransferData::BacsBankTransfer { .. } + | BankTransferData::PermataBankTransfer { .. } + | BankTransferData::BcaBankTransfer { .. } + | BankTransferData::BniVaBankTransfer { .. } + | BankTransferData::BriVaBankTransfer { .. } + | BankTransferData::CimbVaBankTransfer { .. } + | BankTransferData::DanamonVaBankTransfer { .. } + | BankTransferData::LocalBankTransfer { .. } + | BankTransferData::MandiriVaBankTransfer { .. } => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ))? @@ -437,14 +448,14 @@ impl impl TryFrom<( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &WalletData, )> for ZenPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, wallet_data): ( &ZenRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &WalletData, ), ) -> Result { let amount = item.amount.to_owned(); @@ -453,7 +464,7 @@ impl .parse_value("SessionObject") .change_context(errors::ConnectorError::RequestEncodingFailed)?; let (specified_payment_channel, session_data) = match wallet_data { - domain::WalletData::ApplePayRedirect(_) => ( + WalletData::ApplePayRedirect(_) => ( ZenPaymentChannels::PclApplepay, session .apple_pay @@ -461,7 +472,7 @@ impl wallet_name: "Apple Pay".to_string(), })?, ), - domain::WalletData::GooglePayRedirect(_) => ( + WalletData::GooglePayRedirect(_) => ( ZenPaymentChannels::PclGooglepay, session .google_pay @@ -469,32 +480,32 @@ impl wallet_name: "Google Pay".to_string(), })?, ), - domain::WalletData::WeChatPayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::GooglePay(_) - | domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalSdk(_) - | domain::WalletData::Paze(_) - | domain::WalletData::SamsungPay(_) - | domain::WalletData::TwintRedirect {} - | domain::WalletData::VippsRedirect {} - | domain::WalletData::TouchNGoRedirect(_) - | domain::WalletData::CashappQr(_) - | domain::WalletData::SwishQr(_) - | domain::WalletData::WeChatPayQr(_) - | domain::WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented( + WalletData::WeChatPayRedirect(_) + | WalletData::PaypalRedirect(_) + | WalletData::ApplePay(_) + | WalletData::GooglePay(_) + | WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | WalletData::GooglePayThirdPartySdk(_) + | WalletData::MbWayRedirect(_) + | WalletData::MobilePayRedirect(_) + | WalletData::PaypalSdk(_) + | WalletData::Paze(_) + | WalletData::SamsungPay(_) + | WalletData::TwintRedirect {} + | WalletData::VippsRedirect {} + | WalletData::TouchNGoRedirect(_) + | WalletData::CashappQr(_) + | WalletData::SwishQr(_) + | WalletData::WeChatPayQr(_) + | WalletData::Mifinity(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ))?, }; @@ -625,7 +636,7 @@ fn get_item_object( } fn get_browser_details( - browser_info: &types::BrowserInformation, + browser_info: &BrowserInformation, ) -> CustomResult { let screen_height = browser_info .screen_height @@ -669,36 +680,28 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment item: &ZenRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match &item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(card) => Self::try_from((item, card)), - domain::PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, wallet_data)), - domain::PaymentMethodData::Voucher(voucher_data) => { - Self::try_from((item, voucher_data)) - } - domain::PaymentMethodData::BankTransfer(bank_transfer_data) => { + PaymentMethodData::Card(card) => Self::try_from((item, card)), + PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, wallet_data)), + PaymentMethodData::Voucher(voucher_data) => Self::try_from((item, voucher_data)), + PaymentMethodData::BankTransfer(bank_transfer_data) => { Self::try_from((item, bank_transfer_data)) } - domain::PaymentMethodData::BankRedirect(bank_redirect_data) => { + PaymentMethodData::BankRedirect(bank_redirect_data) => { Self::try_from(bank_redirect_data) } - domain::PaymentMethodData::PayLater(paylater_data) => Self::try_from(paylater_data), - domain::PaymentMethodData::BankDebit(bank_debit_data) => { - Self::try_from(bank_debit_data) - } - domain::PaymentMethodData::CardRedirect(car_redirect_data) => { - Self::try_from(car_redirect_data) - } - domain::PaymentMethodData::GiftCard(gift_card_data) => { - Self::try_from(gift_card_data.as_ref()) - } - domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::RealTimePayment(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::OpenBanking(_) - | domain::PaymentMethodData::CardToken(_) - | domain::PaymentMethodData::NetworkToken(_) - | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { + PaymentMethodData::PayLater(paylater_data) => Self::try_from(paylater_data), + PaymentMethodData::BankDebit(bank_debit_data) => Self::try_from(bank_debit_data), + PaymentMethodData::CardRedirect(car_redirect_data) => Self::try_from(car_redirect_data), + PaymentMethodData::GiftCard(gift_card_data) => Self::try_from(gift_card_data.as_ref()), + PaymentMethodData::Crypto(_) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::Upi(_) + | PaymentMethodData::OpenBanking(_) + | PaymentMethodData::CardToken(_) + | PaymentMethodData::NetworkToken(_) + | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ))? @@ -707,28 +710,28 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment } } -impl TryFrom<&domain::BankRedirectData> for ZenPaymentsRequest { +impl TryFrom<&BankRedirectData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::BankRedirectData) -> Result { + fn try_from(value: &BankRedirectData) -> Result { match value { - domain::BankRedirectData::Ideal { .. } - | domain::BankRedirectData::Sofort { .. } - | domain::BankRedirectData::BancontactCard { .. } - | domain::BankRedirectData::Blik { .. } - | domain::BankRedirectData::Trustly { .. } - | domain::BankRedirectData::Eps { .. } - | domain::BankRedirectData::Giropay { .. } - | domain::BankRedirectData::Przelewy24 { .. } - | domain::BankRedirectData::Bizum {} - | domain::BankRedirectData::Interac { .. } - | domain::BankRedirectData::OnlineBankingCzechRepublic { .. } - | domain::BankRedirectData::OnlineBankingFinland { .. } - | domain::BankRedirectData::OnlineBankingPoland { .. } - | domain::BankRedirectData::OnlineBankingSlovakia { .. } - | domain::BankRedirectData::OpenBankingUk { .. } - | domain::BankRedirectData::OnlineBankingFpx { .. } - | domain::BankRedirectData::OnlineBankingThailand { .. } - | domain::BankRedirectData::LocalBankRedirect {} => { + BankRedirectData::Ideal { .. } + | BankRedirectData::Sofort { .. } + | BankRedirectData::BancontactCard { .. } + | BankRedirectData::Blik { .. } + | BankRedirectData::Trustly { .. } + | BankRedirectData::Eps { .. } + | BankRedirectData::Giropay { .. } + | BankRedirectData::Przelewy24 { .. } + | BankRedirectData::Bizum {} + | BankRedirectData::Interac { .. } + | BankRedirectData::OnlineBankingCzechRepublic { .. } + | BankRedirectData::OnlineBankingFinland { .. } + | BankRedirectData::OnlineBankingPoland { .. } + | BankRedirectData::OnlineBankingSlovakia { .. } + | BankRedirectData::OpenBankingUk { .. } + | BankRedirectData::OnlineBankingFpx { .. } + | BankRedirectData::OnlineBankingThailand { .. } + | BankRedirectData::LocalBankRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) @@ -738,66 +741,60 @@ impl TryFrom<&domain::BankRedirectData> for ZenPaymentsRequest { } } -impl TryFrom<&domain::payments::PayLaterData> for ZenPaymentsRequest { +impl TryFrom<&PayLaterData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::payments::PayLaterData) -> Result { + fn try_from(value: &PayLaterData) -> Result { match value { - domain::payments::PayLaterData::KlarnaRedirect { .. } - | domain::payments::PayLaterData::KlarnaSdk { .. } - | domain::payments::PayLaterData::AffirmRedirect {} - | domain::payments::PayLaterData::AfterpayClearpayRedirect { .. } - | domain::payments::PayLaterData::PayBrightRedirect {} - | domain::payments::PayLaterData::WalleyRedirect {} - | domain::payments::PayLaterData::AlmaRedirect {} - | domain::payments::PayLaterData::AtomeRedirect {} => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Zen"), - ) - .into()) - } + PayLaterData::KlarnaRedirect { .. } + | PayLaterData::KlarnaSdk { .. } + | PayLaterData::AffirmRedirect {} + | PayLaterData::AfterpayClearpayRedirect { .. } + | PayLaterData::PayBrightRedirect {} + | PayLaterData::WalleyRedirect {} + | PayLaterData::AlmaRedirect {} + | PayLaterData::AtomeRedirect {} => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Zen"), + ) + .into()), } } } -impl TryFrom<&domain::BankDebitData> for ZenPaymentsRequest { +impl TryFrom<&BankDebitData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::BankDebitData) -> Result { + fn try_from(value: &BankDebitData) -> Result { match value { - domain::BankDebitData::AchBankDebit { .. } - | domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Zen"), - ) - .into()) - } + BankDebitData::AchBankDebit { .. } + | BankDebitData::SepaBankDebit { .. } + | BankDebitData::BecsBankDebit { .. } + | BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Zen"), + ) + .into()), } } } -impl TryFrom<&domain::payments::CardRedirectData> for ZenPaymentsRequest { +impl TryFrom<&CardRedirectData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::payments::CardRedirectData) -> Result { + fn try_from(value: &CardRedirectData) -> Result { match value { - domain::payments::CardRedirectData::Knet {} - | domain::payments::CardRedirectData::Benefit {} - | domain::payments::CardRedirectData::MomoAtm {} - | domain::payments::CardRedirectData::CardRedirect {} => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Zen"), - ) - .into()) - } + CardRedirectData::Knet {} + | CardRedirectData::Benefit {} + | CardRedirectData::MomoAtm {} + | CardRedirectData::CardRedirect {} => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Zen"), + ) + .into()), } } } -impl TryFrom<&domain::GiftCardData> for ZenPaymentsRequest { +impl TryFrom<&GiftCardData> for ZenPaymentsRequest { type Error = error_stack::Report; - fn try_from(value: &domain::GiftCardData) -> Result { + fn try_from(value: &GiftCardData) -> Result { match value { - domain::GiftCardData::PaySafeCard {} | domain::GiftCardData::Givex(_) => { + GiftCardData::PaySafeCard {} | GiftCardData::Givex(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Zen"), ) @@ -879,29 +876,24 @@ pub struct ZenMerchantActionData { redirect_url: url::Url, } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { match item.response { - ZenPaymentsResponse::ApiResponse(response) => { - Self::try_from(types::ResponseRouterData { - response, - data: item.data, - http_code: item.http_code, - }) - } - ZenPaymentsResponse::CheckoutResponse(response) => { - Self::try_from(types::ResponseRouterData { - response, - data: item.data, - http_code: item.http_code, - }) - } + ZenPaymentsResponse::ApiResponse(response) => Self::try_from(ResponseRouterData { + response, + data: item.data, + http_code: item.http_code, + }), + ZenPaymentsResponse::CheckoutResponse(response) => Self::try_from(ResponseRouterData { + response, + data: item.data, + http_code: item.http_code, + }), } } } @@ -912,14 +904,14 @@ fn get_zen_response( ) -> CustomResult< ( enums::AttemptStatus, - Option, - types::PaymentsResponseData, + Option, + PaymentsResponseData, ), errors::ConnectorError, > { let redirection_data_action = response.merchant_action.map(|merchant_action| { ( - services::RedirectForm::from((merchant_action.data.redirect_url, Method::Get)), + RedirectForm::from((merchant_action.data.redirect_url, Method::Get)), merchant_action.action, ) }); @@ -929,14 +921,14 @@ fn get_zen_response( }; let status = enums::AttemptStatus::foreign_try_from((response.status, action))?; let error = if utils::is_payment_failure(status) { - Some(types::ErrorResponse { + Some(ErrorResponse { code: response .reject_code - .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), + .unwrap_or_else(|| NO_ERROR_CODE.to_string()), message: response .reject_reason .clone() - .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()), reason: response.reject_reason, status_code, attempt_status: Some(status), @@ -945,8 +937,8 @@ fn get_zen_response( } else { None }; - let payment_response_data = types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(response.id.clone()), + let payment_response_data = PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(response.id.clone()), redirection_data, mandate_reference: None, connector_metadata: None, @@ -958,12 +950,12 @@ fn get_zen_response( Ok((status, error, payment_response_data)) } -impl TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - value: types::ResponseRouterData, + value: ResponseRouterData, ) -> Result { let (status, error, payment_response_data) = get_zen_response(value.response.clone(), value.http_code)?; @@ -976,21 +968,21 @@ impl TryFrom TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - value: types::ResponseRouterData, + value: ResponseRouterData, ) -> Result { - let redirection_data = Some(services::RedirectForm::from(( + let redirection_data = Some(RedirectForm::from(( value.response.redirect_url, Method::Get, ))); Ok(Self { status: enums::AttemptStatus::AuthenticationPending, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::NoResponseId, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::NoResponseId, redirection_data, mandate_reference: None, connector_metadata: None, @@ -1054,12 +1046,12 @@ pub struct RefundResponse { reject_reason: Option, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let (error, refund_response_data) = get_zen_refund_response(item.response, item.http_code)?; Ok(Self { @@ -1072,18 +1064,17 @@ impl TryFrom> fn get_zen_refund_response( response: RefundResponse, status_code: u16, -) -> CustomResult<(Option, types::RefundsResponseData), errors::ConnectorError> -{ +) -> CustomResult<(Option, RefundsResponseData), errors::ConnectorError> { let refund_status = enums::RefundStatus::from(response.status); let error = if utils::is_refund_failure(refund_status) { - Some(types::ErrorResponse { + Some(ErrorResponse { code: response .reject_code - .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), + .unwrap_or_else(|| NO_ERROR_CODE.to_string()), message: response .reject_reason .clone() - .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()), reason: response.reject_reason, status_code, attempt_status: None, @@ -1092,23 +1083,21 @@ fn get_zen_refund_response( } else { None }; - let refund_response_data = types::RefundsResponseData { + let refund_response_data = RefundsResponseData { connector_refund_id: response.id, refund_status, }; Ok((error, refund_response_data)) } -impl TryFrom> - for types::RefundsRouterData -{ +impl TryFrom> for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let refund_status = enums::RefundStatus::from(item.response.status); Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }), diff --git a/crates/hyperswitch_connectors/src/constants.rs b/crates/hyperswitch_connectors/src/constants.rs index 6c579977005d..7ee75ddc4d1e 100644 --- a/crates/hyperswitch_connectors/src/constants.rs +++ b/crates/hyperswitch_connectors/src/constants.rs @@ -1,6 +1,7 @@ /// Header Constants pub(crate) mod headers { pub(crate) const API_KEY: &str = "API-KEY"; + pub(crate) const APIKEY: &str = "apikey"; pub(crate) const API_TOKEN: &str = "Api-Token"; pub(crate) const AUTHORIZATION: &str = "Authorization"; pub(crate) const CONTENT_TYPE: &str = "Content-Type"; @@ -8,7 +9,9 @@ pub(crate) mod headers { pub(crate) const IDEMPOTENCY_KEY: &str = "Idempotency-Key"; pub(crate) const MESSAGE_SIGNATURE: &str = "Message-Signature"; pub(crate) const MERCHANT_ID: &str = "Merchant-ID"; + pub(crate) const NONCE: &str = "nonce"; pub(crate) const TIMESTAMP: &str = "Timestamp"; + pub(crate) const TOKEN: &str = "token"; pub(crate) const X_ACCEPT_VERSION: &str = "X-Accept-Version"; pub(crate) const X_CC_API_KEY: &str = "X-CC-Api-Key"; pub(crate) const X_CC_VERSION: &str = "X-CC-Version"; diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs index 1e411ded76f2..abdaf1e92c45 100644 --- a/crates/hyperswitch_connectors/src/default_implementations.rs +++ b/crates/hyperswitch_connectors/src/default_implementations.rs @@ -101,10 +101,14 @@ default_imp_for_authorize_session_token!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -112,7 +116,8 @@ default_imp_for_authorize_session_token!( connectors::Volt, connectors::Thunes, connectors::Tsys, - connectors::Worldline + connectors::Worldline, + connectors::Zen ); macro_rules! default_imp_for_calculate_tax { @@ -140,15 +145,20 @@ default_imp_for_calculate_tax!( connectors::Dlocal, connectors::Fiserv, connectors::Fiservemea, + connectors::Forte, connectors::Helcim, connectors::Stax, connectors::Square, connectors::Novalnet, connectors::Mollie, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Fiuu, connectors::Globepay, connectors::Worldline, + connectors::Zen, connectors::Powertranz, connectors::Thunes, connectors::Tsys, @@ -181,16 +191,21 @@ default_imp_for_session_update!( connectors::Dlocal, connectors::Fiserv, connectors::Fiservemea, + connectors::Forte, connectors::Helcim, connectors::Stax, connectors::Square, connectors::Taxjar, connectors::Mollie, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Fiuu, connectors::Globepay, connectors::Worldline, + connectors::Zen, connectors::Powertranz, connectors::Thunes, connectors::Tsys, @@ -224,12 +239,16 @@ default_imp_for_post_session_tokens!( connectors::Square, connectors::Fiserv, connectors::Fiservemea, + connectors::Forte, connectors::Helcim, connectors::Stax, connectors::Taxjar, connectors::Mollie, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Fiuu, connectors::Globepay, connectors::Worldline, @@ -237,7 +256,8 @@ default_imp_for_post_session_tokens!( connectors::Thunes, connectors::Tsys, connectors::Deutschebank, - connectors::Volt + connectors::Volt, + connectors::Zen ); use crate::connectors; @@ -267,16 +287,21 @@ default_imp_for_complete_authorize!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, + connectors::Payeezy, + connectors::Payu, connectors::Stax, connectors::Square, connectors::Taxjar, connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_incremental_authorization { @@ -307,10 +332,14 @@ default_imp_for_incremental_authorization!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -319,7 +348,8 @@ default_imp_for_incremental_authorization!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_create_customer { @@ -350,18 +380,23 @@ default_imp_for_create_customer!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Mollie, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Square, connectors::Taxjar, connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_connector_redirect_response { @@ -393,9 +428,13 @@ default_imp_for_connector_redirect_response!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Stax, connectors::Square, @@ -434,9 +473,13 @@ default_imp_for_pre_processing_steps!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -445,7 +488,8 @@ default_imp_for_pre_processing_steps!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_post_processing_steps{ @@ -476,10 +520,14 @@ default_imp_for_post_processing_steps!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -488,7 +536,8 @@ default_imp_for_post_processing_steps!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_approve { @@ -519,10 +568,14 @@ default_imp_for_approve!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -531,7 +584,8 @@ default_imp_for_approve!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_reject { @@ -562,10 +616,14 @@ default_imp_for_reject!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -574,7 +632,8 @@ default_imp_for_reject!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_webhook_source_verification { @@ -605,10 +664,14 @@ default_imp_for_webhook_source_verification!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -617,7 +680,8 @@ default_imp_for_webhook_source_verification!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_accept_dispute { @@ -649,10 +713,14 @@ default_imp_for_accept_dispute!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -661,7 +729,8 @@ default_imp_for_accept_dispute!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_submit_evidence { @@ -692,10 +761,14 @@ default_imp_for_submit_evidence!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -704,7 +777,8 @@ default_imp_for_submit_evidence!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_defend_dispute { @@ -735,10 +809,14 @@ default_imp_for_defend_dispute!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -747,7 +825,8 @@ default_imp_for_defend_dispute!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_file_upload { @@ -787,10 +866,14 @@ default_imp_for_file_upload!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -799,7 +882,8 @@ default_imp_for_file_upload!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -832,10 +916,14 @@ default_imp_for_payouts_create!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -844,7 +932,8 @@ default_imp_for_payouts_create!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -877,10 +966,14 @@ default_imp_for_payouts_retrieve!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -889,7 +982,8 @@ default_imp_for_payouts_retrieve!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -922,10 +1016,14 @@ default_imp_for_payouts_eligibility!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -934,7 +1032,8 @@ default_imp_for_payouts_eligibility!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -967,10 +1066,14 @@ default_imp_for_payouts_fulfill!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -979,7 +1082,8 @@ default_imp_for_payouts_fulfill!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -1012,10 +1116,14 @@ default_imp_for_payouts_cancel!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1024,7 +1132,8 @@ default_imp_for_payouts_cancel!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -1057,10 +1166,14 @@ default_imp_for_payouts_quote!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1069,7 +1182,8 @@ default_imp_for_payouts_quote!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -1102,10 +1216,14 @@ default_imp_for_payouts_recipient!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1114,7 +1232,8 @@ default_imp_for_payouts_recipient!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -1147,10 +1266,14 @@ default_imp_for_payouts_recipient_account!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1159,7 +1282,8 @@ default_imp_for_payouts_recipient_account!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1192,10 +1316,14 @@ default_imp_for_frm_sale!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1204,7 +1332,8 @@ default_imp_for_frm_sale!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1237,10 +1366,14 @@ default_imp_for_frm_checkout!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1249,7 +1382,8 @@ default_imp_for_frm_checkout!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1282,10 +1416,14 @@ default_imp_for_frm_transaction!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1294,7 +1432,8 @@ default_imp_for_frm_transaction!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1327,10 +1466,14 @@ default_imp_for_frm_fulfillment!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1339,7 +1482,8 @@ default_imp_for_frm_fulfillment!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1372,10 +1516,14 @@ default_imp_for_frm_record_return!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1384,7 +1532,8 @@ default_imp_for_frm_record_return!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_revoking_mandates { @@ -1414,10 +1563,14 @@ default_imp_for_revoking_mandates!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1426,5 +1579,6 @@ default_imp_for_revoking_mandates!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs index 54c0b6a82890..5b0edb55ef17 100644 --- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs +++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs @@ -217,10 +217,14 @@ default_imp_for_new_connector_integration_payment!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -229,7 +233,8 @@ default_imp_for_new_connector_integration_payment!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_refund { @@ -261,10 +266,14 @@ default_imp_for_new_connector_integration_refund!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -273,7 +282,8 @@ default_imp_for_new_connector_integration_refund!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_connector_access_token { @@ -300,10 +310,14 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -312,7 +326,8 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_accept_dispute { @@ -345,10 +360,14 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -357,7 +376,8 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_submit_evidence { @@ -389,10 +409,14 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -401,7 +425,8 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_defend_dispute { @@ -433,10 +458,14 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -445,7 +474,8 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_file_upload { @@ -487,10 +517,14 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -499,7 +533,8 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -533,10 +568,14 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -545,7 +584,8 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -579,10 +619,14 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -591,7 +635,8 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -625,10 +670,14 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -637,7 +686,8 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -671,10 +721,14 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -683,7 +737,8 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -717,10 +772,14 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -729,7 +788,8 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -763,10 +823,14 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -775,7 +839,8 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -809,10 +874,14 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -821,7 +890,8 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "payouts")] @@ -855,10 +925,14 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -867,7 +941,8 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_webhook_source_verification { @@ -899,10 +974,14 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -911,7 +990,8 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -945,10 +1025,14 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -957,7 +1041,8 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -991,10 +1076,14 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1003,7 +1092,8 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1037,10 +1127,14 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1049,7 +1143,8 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1083,10 +1178,14 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1095,7 +1194,8 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); #[cfg(feature = "frm")] @@ -1129,10 +1229,14 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1141,7 +1245,8 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); macro_rules! default_imp_for_new_connector_integration_revoking_mandates { @@ -1172,10 +1277,14 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Fiserv, connectors::Fiservemea, connectors::Fiuu, + connectors::Forte, connectors::Globepay, connectors::Helcim, connectors::Novalnet, + connectors::Nexinets, connectors::Nexixpay, + connectors::Payeezy, + connectors::Payu, connectors::Powertranz, connectors::Mollie, connectors::Stax, @@ -1184,5 +1293,6 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Thunes, connectors::Tsys, connectors::Worldline, - connectors::Volt + connectors::Volt, + connectors::Zen ); diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index 0134253f2f95..652ec82c5ed8 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -32,6 +32,8 @@ use once_cell::sync::Lazy; use regex::Regex; use serde::Serializer; +use crate::types::RefreshTokenRouterData; + type Error = error_stack::Report; pub(crate) fn construct_not_supported_error_report( @@ -45,6 +47,15 @@ pub(crate) fn construct_not_supported_error_report( .into() } +pub(crate) fn to_currency_base_unit_with_zero_decimal_check( + amount: i64, + currency: enums::Currency, +) -> Result> { + currency + .to_currency_base_unit_with_zero_decimal_check(amount) + .change_context(errors::ConnectorError::RequestEncodingFailed) +} + pub(crate) fn get_amount_as_string( currency_unit: &api::CurrencyUnit, amount: i64, @@ -193,6 +204,16 @@ pub(crate) fn is_payment_failure(status: AttemptStatus) -> bool { } } +pub fn is_refund_failure(status: enums::RefundStatus) -> bool { + match status { + common_enums::RefundStatus::Failure | common_enums::RefundStatus::TransactionFailure => { + true + } + common_enums::RefundStatus::ManualReview + | common_enums::RefundStatus::Pending + | common_enums::RefundStatus::Success => false, + } +} // TODO: Make all traits as `pub(crate) trait` once all connectors are moved. pub trait RouterData { fn get_billing(&self) -> Result<&Address, Error>; @@ -892,6 +913,19 @@ static CARD_REGEX: Lazy>> = Lazy map }); +pub trait AccessTokenRequestInfo { + fn get_request_id(&self) -> Result, Error>; +} + +impl AccessTokenRequestInfo for RefreshTokenRouterData { + fn get_request_id(&self) -> Result, Error> { + self.request + .id + .clone() + .ok_or_else(missing_field_err("request.id")) + } +} + pub trait AddressDetailsData { fn get_first_name(&self) -> Result<&Secret, Error>; fn get_last_name(&self) -> Result<&Secret, Error>; @@ -2051,3 +2085,67 @@ impl From for PaymentMethodDataType { } } } +pub trait ApplePay { + fn get_applepay_decoded_payment_data(&self) -> Result, Error>; +} + +impl ApplePay for hyperswitch_domain_models::payment_method_data::ApplePayWalletData { + fn get_applepay_decoded_payment_data(&self) -> Result, Error> { + let token = Secret::new( + String::from_utf8(BASE64_ENGINE.decode(&self.payment_data).change_context( + errors::ConnectorError::InvalidWalletToken { + wallet_name: "Apple Pay".to_string(), + }, + )?) + .change_context(errors::ConnectorError::InvalidWalletToken { + wallet_name: "Apple Pay".to_string(), + })?, + ); + Ok(token) + } +} + +pub trait WalletData { + fn get_wallet_token(&self) -> Result, Error>; + fn get_wallet_token_as_json(&self, wallet_name: String) -> Result + where + T: serde::de::DeserializeOwned; + fn get_encoded_wallet_token(&self) -> Result; +} + +impl WalletData for hyperswitch_domain_models::payment_method_data::WalletData { + fn get_wallet_token(&self) -> Result, Error> { + match self { + Self::GooglePay(data) => Ok(Secret::new(data.tokenization_data.token.clone())), + Self::ApplePay(data) => Ok(data.get_applepay_decoded_payment_data()?), + Self::PaypalSdk(data) => Ok(Secret::new(data.token.clone())), + _ => Err(errors::ConnectorError::InvalidWallet.into()), + } + } + fn get_wallet_token_as_json(&self, wallet_name: String) -> Result + where + T: serde::de::DeserializeOwned, + { + serde_json::from_str::(self.get_wallet_token()?.peek()) + .change_context(errors::ConnectorError::InvalidWalletToken { wallet_name }) + } + + fn get_encoded_wallet_token(&self) -> Result { + match self { + Self::GooglePay(_) => { + let json_token: serde_json::Value = + self.get_wallet_token_as_json("Google Pay".to_owned())?; + let token_as_vec = serde_json::to_vec(&json_token).change_context( + errors::ConnectorError::InvalidWalletToken { + wallet_name: "Google Pay".to_string(), + }, + )?; + let encoded_token = BASE64_ENGINE.encode(token_as_vec); + Ok(encoded_token) + } + _ => Err( + errors::ConnectorError::NotImplemented("SELECTED PAYMENT METHOD".to_owned()).into(), + ), + } + } +} diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs index c0c64d76415a..d8d834e759ab 100644 --- a/crates/router/src/connector.rs +++ b/crates/router/src/connector.rs @@ -14,7 +14,6 @@ pub mod datatrans; #[cfg(feature = "dummy_connector")] pub mod dummyconnector; pub mod ebanx; -pub mod forte; pub mod globalpay; pub mod gocardless; pub mod gpayments; @@ -24,18 +23,15 @@ pub mod klarna; pub mod mifinity; pub mod multisafepay; pub mod netcetera; -pub mod nexinets; pub mod nmi; pub mod noon; pub mod nuvei; pub mod opayo; pub mod opennode; pub mod paybox; -pub mod payeezy; pub mod payme; pub mod payone; pub mod paypal; -pub mod payu; pub mod placetopay; pub mod plaid; pub mod prophetpay; @@ -52,7 +48,6 @@ pub mod wellsfargo; pub mod wellsfargopayout; pub mod wise; pub mod worldpay; -pub mod zen; pub mod zsl; pub use hyperswitch_connectors::connectors::{ @@ -60,10 +55,12 @@ pub use hyperswitch_connectors::connectors::{ cashtocode::Cashtocode, coinbase, coinbase::Coinbase, cryptopay, cryptopay::Cryptopay, deutschebank, deutschebank::Deutschebank, digitalvirgo, digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, fiserv, fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, - globepay, globepay::Globepay, helcim, helcim::Helcim, mollie, mollie::Mollie, nexixpay, - nexixpay::Nexixpay, novalnet, novalnet::Novalnet, powertranz, powertranz::Powertranz, square, - square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, thunes, thunes::Thunes, tsys, - tsys::Tsys, volt, volt::Volt, worldline, worldline::Worldline, + forte, forte::Forte, globepay, globepay::Globepay, helcim, helcim::Helcim, mollie, + mollie::Mollie, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, novalnet, + novalnet::Novalnet, payeezy, payeezy::Payeezy, payu, payu::Payu, powertranz, + powertranz::Powertranz, square, square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, + thunes, thunes::Thunes, tsys, tsys::Tsys, volt, volt::Volt, worldline, worldline::Worldline, + zen, zen::Zen, }; #[cfg(feature = "dummy_connector")] @@ -72,13 +69,12 @@ pub use self::{ aci::Aci, adyen::Adyen, adyenplatform::Adyenplatform, airwallex::Airwallex, authorizedotnet::Authorizedotnet, bamboraapac::Bamboraapac, bankofamerica::Bankofamerica, bluesnap::Bluesnap, boku::Boku, braintree::Braintree, checkout::Checkout, - cybersource::Cybersource, datatrans::Datatrans, ebanx::Ebanx, forte::Forte, - globalpay::Globalpay, gocardless::Gocardless, gpayments::Gpayments, iatapay::Iatapay, - itaubank::Itaubank, klarna::Klarna, mifinity::Mifinity, multisafepay::Multisafepay, - netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon, nuvei::Nuvei, opayo::Opayo, - opennode::Opennode, paybox::Paybox, payeezy::Payeezy, payme::Payme, payone::Payone, - paypal::Paypal, payu::Payu, placetopay::Placetopay, plaid::Plaid, prophetpay::Prophetpay, + cybersource::Cybersource, datatrans::Datatrans, ebanx::Ebanx, globalpay::Globalpay, + gocardless::Gocardless, gpayments::Gpayments, iatapay::Iatapay, itaubank::Itaubank, + klarna::Klarna, mifinity::Mifinity, multisafepay::Multisafepay, netcetera::Netcetera, nmi::Nmi, + noon::Noon, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, paybox::Paybox, payme::Payme, + payone::Payone, paypal::Paypal, placetopay::Placetopay, plaid::Plaid, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, riskified::Riskified, shift4::Shift4, signifyd::Signifyd, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay, wellsfargo::Wellsfargo, - wellsfargopayout::Wellsfargopayout, wise::Wise, worldpay::Worldpay, zen::Zen, zsl::Zsl, + wellsfargopayout::Wellsfargopayout, wise::Wise, worldpay::Worldpay, zsl::Zsl, }; 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 4e900321f95a..80a06bbc482b 100644 --- a/crates/router/src/core/payments/connector_integration_v2_impls.rs +++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs @@ -704,7 +704,6 @@ default_imp_for_new_connector_integration_payment!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -714,18 +713,15 @@ default_imp_for_new_connector_integration_payment!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -740,7 +736,6 @@ default_imp_for_new_connector_integration_payment!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -776,7 +771,6 @@ default_imp_for_new_connector_integration_refund!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -786,18 +780,15 @@ default_imp_for_new_connector_integration_refund!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -811,7 +802,6 @@ default_imp_for_new_connector_integration_refund!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -842,7 +832,6 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -852,18 +841,15 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -877,7 +863,6 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -930,7 +915,6 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -940,18 +924,15 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -965,7 +946,6 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1000,7 +980,6 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1010,18 +989,15 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1035,7 +1011,6 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1054,7 +1029,6 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1064,18 +1038,15 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1089,7 +1060,6 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1135,7 +1105,6 @@ default_imp_for_new_connector_integration_file_upload!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1145,18 +1114,15 @@ default_imp_for_new_connector_integration_file_upload!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1170,7 +1136,6 @@ default_imp_for_new_connector_integration_file_upload!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1296,7 +1261,6 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1306,18 +1270,15 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1331,7 +1292,6 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1369,7 +1329,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1379,18 +1338,15 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1404,7 +1360,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1442,7 +1397,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1452,18 +1406,15 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1477,7 +1428,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1515,7 +1465,6 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1525,18 +1474,15 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1550,7 +1496,6 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1588,7 +1533,6 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1598,18 +1542,15 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1623,7 +1564,6 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1661,7 +1601,6 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1671,18 +1610,15 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1696,7 +1632,6 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1734,7 +1669,6 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1744,18 +1678,15 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1769,7 +1700,6 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1807,7 +1737,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1817,18 +1746,15 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1842,7 +1768,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -1878,7 +1803,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1888,18 +1812,15 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1913,7 +1834,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -2039,7 +1959,6 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2049,18 +1968,15 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -2074,7 +1990,6 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -2112,7 +2027,6 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2122,18 +2036,15 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -2147,7 +2058,6 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -2185,7 +2095,6 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2195,18 +2104,15 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -2220,7 +2126,6 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -2258,7 +2163,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2268,18 +2172,15 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -2293,7 +2194,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -2331,7 +2231,6 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2341,18 +2240,15 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -2366,7 +2262,6 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); @@ -2401,7 +2296,6 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2411,18 +2305,15 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -2436,7 +2327,6 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Wellsfargo, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Plaid ); diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs index 700fff16cf58..3078cf722568 100644 --- a/crates/router/src/core/payments/flows.rs +++ b/crates/router/src/core/payments/flows.rs @@ -212,7 +212,6 @@ default_imp_for_complete_authorize!( connector::Checkout, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Gocardless, connector::Gpayments, connector::Iatapay, @@ -221,13 +220,10 @@ default_imp_for_complete_authorize!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Noon, connector::Opayo, connector::Opennode, - connector::Payeezy, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Rapyd, @@ -240,7 +236,6 @@ default_imp_for_complete_authorize!( connector::Wise, connector::Wellsfargo, connector::Wellsfargopayout, - connector::Zen, connector::Zsl ); macro_rules! default_imp_for_webhook_source_verification { @@ -284,7 +279,6 @@ default_imp_for_webhook_source_verification!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -294,17 +288,14 @@ default_imp_for_webhook_source_verification!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -320,7 +311,6 @@ default_imp_for_webhook_source_verification!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -366,7 +356,6 @@ default_imp_for_create_customer!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gpayments, connector::Iatapay, @@ -375,18 +364,15 @@ default_imp_for_create_customer!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -401,7 +387,6 @@ default_imp_for_create_customer!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -444,7 +429,6 @@ default_imp_for_connector_redirect_response!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Gocardless, connector::Gpayments, connector::Iatapay, @@ -453,12 +437,9 @@ default_imp_for_connector_redirect_response!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Opayo, connector::Opennode, - connector::Payeezy, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -606,7 +587,6 @@ default_imp_for_accept_dispute!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -616,18 +596,15 @@ default_imp_for_accept_dispute!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -643,7 +620,6 @@ default_imp_for_accept_dispute!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -709,7 +685,6 @@ default_imp_for_file_upload!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -719,17 +694,14 @@ default_imp_for_file_upload!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -745,7 +717,6 @@ default_imp_for_file_upload!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -789,7 +760,6 @@ default_imp_for_submit_evidence!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -799,17 +769,14 @@ default_imp_for_submit_evidence!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -825,7 +792,6 @@ default_imp_for_submit_evidence!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -870,7 +836,6 @@ default_imp_for_defend_dispute!( connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Forte, connector::Gocardless, connector::Gpayments, connector::Iatapay, @@ -879,17 +844,14 @@ default_imp_for_defend_dispute!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -906,7 +868,6 @@ default_imp_for_defend_dispute!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -966,21 +927,17 @@ default_imp_for_pre_processing_steps!( connector::Ebanx, connector::Iatapay, connector::Itaubank, - connector::Forte, connector::Globalpay, connector::Gpayments, connector::Klarna, connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Noon, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -993,7 +950,6 @@ default_imp_for_pre_processing_steps!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1034,21 +990,17 @@ default_imp_for_post_processing_steps!( connector::Ebanx, connector::Iatapay, connector::Itaubank, - connector::Forte, connector::Globalpay, connector::Gpayments, connector::Klarna, connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Noon, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payone, - connector::Payu, connector::Placetopay, connector::Prophetpay, connector::Rapyd, @@ -1059,7 +1011,6 @@ default_imp_for_post_processing_steps!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl, connector::Razorpay ); @@ -1188,7 +1139,6 @@ default_imp_for_payouts_create!( connector::Checkout, connector::Cybersource, connector::Datatrans, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1198,17 +1148,14 @@ default_imp_for_payouts_create!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1222,7 +1169,6 @@ default_imp_for_payouts_create!( connector::Wellsfargo, connector::Wellsfargopayout, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1269,7 +1215,6 @@ default_imp_for_payouts_retrieve!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1279,17 +1224,14 @@ default_imp_for_payouts_retrieve!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1305,7 +1247,6 @@ default_imp_for_payouts_retrieve!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1353,7 +1294,6 @@ default_imp_for_payouts_eligibility!( connector::Checkout, connector::Cybersource, connector::Datatrans, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1363,18 +1303,15 @@ default_imp_for_payouts_eligibility!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1389,7 +1326,6 @@ default_imp_for_payouts_eligibility!( connector::Wellsfargo, connector::Wellsfargopayout, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1432,7 +1368,6 @@ default_imp_for_payouts_fulfill!( connector::Braintree, connector::Checkout, connector::Datatrans, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1442,16 +1377,13 @@ default_imp_for_payouts_fulfill!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1465,7 +1397,6 @@ default_imp_for_payouts_fulfill!( connector::Wellsfargo, connector::Wellsfargopayout, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1510,7 +1441,6 @@ default_imp_for_payouts_cancel!( connector::Checkout, connector::Cybersource, connector::Datatrans, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1520,18 +1450,15 @@ default_imp_for_payouts_cancel!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1545,7 +1472,6 @@ default_imp_for_payouts_cancel!( connector::Wellsfargo, connector::Wellsfargopayout, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1591,7 +1517,6 @@ default_imp_for_payouts_quote!( connector::Checkout, connector::Cybersource, connector::Datatrans, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1601,18 +1526,15 @@ default_imp_for_payouts_quote!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1627,7 +1549,6 @@ default_imp_for_payouts_quote!( connector::Wellsfargo, connector::Wellsfargopayout, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1673,7 +1594,6 @@ default_imp_for_payouts_recipient!( connector::Checkout, connector::Cybersource, connector::Datatrans, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1683,18 +1603,15 @@ default_imp_for_payouts_recipient!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1708,7 +1625,6 @@ default_imp_for_payouts_recipient!( connector::Wellsfargo, connector::Wellsfargopayout, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1758,7 +1674,6 @@ default_imp_for_payouts_recipient_account!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1768,18 +1683,15 @@ default_imp_for_payouts_recipient_account!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1794,7 +1706,6 @@ default_imp_for_payouts_recipient_account!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1840,7 +1751,6 @@ default_imp_for_approve!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1850,18 +1760,15 @@ default_imp_for_approve!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1877,7 +1784,6 @@ default_imp_for_approve!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -1923,7 +1829,6 @@ default_imp_for_reject!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -1933,18 +1838,15 @@ default_imp_for_reject!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -1960,7 +1862,6 @@ default_imp_for_reject!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2097,7 +1998,6 @@ default_imp_for_frm_sale!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2107,18 +2007,15 @@ default_imp_for_frm_sale!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2132,7 +2029,6 @@ default_imp_for_frm_sale!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2180,7 +2076,6 @@ default_imp_for_frm_checkout!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2190,18 +2085,15 @@ default_imp_for_frm_checkout!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2215,7 +2107,6 @@ default_imp_for_frm_checkout!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2263,7 +2154,6 @@ default_imp_for_frm_transaction!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2273,18 +2163,15 @@ default_imp_for_frm_transaction!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2298,7 +2185,6 @@ default_imp_for_frm_transaction!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2346,7 +2232,6 @@ default_imp_for_frm_fulfillment!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2356,18 +2241,15 @@ default_imp_for_frm_fulfillment!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2381,7 +2263,6 @@ default_imp_for_frm_fulfillment!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2429,7 +2310,6 @@ default_imp_for_frm_record_return!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2439,18 +2319,15 @@ default_imp_for_frm_record_return!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2464,7 +2341,6 @@ default_imp_for_frm_record_return!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2509,7 +2385,6 @@ default_imp_for_incremental_authorization!( connector::Checkout, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2519,18 +2394,15 @@ default_imp_for_incremental_authorization!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2545,7 +2417,6 @@ default_imp_for_incremental_authorization!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2588,7 +2459,6 @@ default_imp_for_revoking_mandates!( connector::Checkout, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2598,17 +2468,14 @@ default_imp_for_revoking_mandates!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Nuvei, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2622,7 +2489,6 @@ default_imp_for_revoking_mandates!( connector::Trustpay, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2828,7 +2694,6 @@ default_imp_for_authorize_session_token!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2838,17 +2703,14 @@ default_imp_for_authorize_session_token!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nmi, connector::Noon, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2864,7 +2726,6 @@ default_imp_for_authorize_session_token!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2908,7 +2769,6 @@ default_imp_for_calculate_tax!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2918,18 +2778,15 @@ default_imp_for_calculate_tax!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nuvei, connector::Nmi, connector::Noon, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, connector::Paypal, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -2945,7 +2802,6 @@ default_imp_for_calculate_tax!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -2989,7 +2845,6 @@ default_imp_for_session_update!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -2999,17 +2854,14 @@ default_imp_for_session_update!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nuvei, connector::Nmi, connector::Noon, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -3025,7 +2877,6 @@ default_imp_for_session_update!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl ); @@ -3069,7 +2920,6 @@ default_imp_for_post_session_tokens!( connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Forte, connector::Globalpay, connector::Gocardless, connector::Gpayments, @@ -3079,17 +2929,14 @@ default_imp_for_post_session_tokens!( connector::Mifinity, connector::Multisafepay, connector::Netcetera, - connector::Nexinets, connector::Nuvei, connector::Nmi, connector::Noon, connector::Opayo, connector::Opennode, connector::Paybox, - connector::Payeezy, connector::Payme, connector::Payone, - connector::Payu, connector::Placetopay, connector::Plaid, connector::Prophetpay, @@ -3105,6 +2952,5 @@ default_imp_for_post_session_tokens!( connector::Wellsfargopayout, connector::Wise, connector::Worldpay, - connector::Zen, connector::Zsl );