diff --git a/Cargo.lock b/Cargo.lock index 9b0263f99dce..e8315e8049a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4055,6 +4055,7 @@ dependencies = [ "reqwest 0.11.27", "ring 0.17.8", "router_env", + "roxmltree", "serde", "serde_json", "serde_urlencoded", @@ -6676,7 +6677,6 @@ dependencies = [ "ring 0.17.8", "router_derive", "router_env", - "roxmltree", "rust-i18n", "rust_decimal", "rustc-hash", diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml index 5f4def7587aa..664c78a5f45d 100644 --- a/crates/hyperswitch_connectors/Cargo.toml +++ b/crates/hyperswitch_connectors/Cargo.toml @@ -28,6 +28,7 @@ rand = "0.8.5" regex = "1.10.4" reqwest = { version = "0.11.27" } ring = "0.17.8" +roxmltree = "0.19.0" serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0.115" serde_urlencoded = "0.7.1" diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs index fdd87a25e8a5..5b7075cd680a 100644 --- a/crates/hyperswitch_connectors/src/connectors.rs +++ b/crates/hyperswitch_connectors/src/connectors.rs @@ -1,8 +1,10 @@ pub mod airwallex; pub mod amazonpay; pub mod bambora; +pub mod bamboraapac; pub mod billwerk; pub mod bitpay; +pub mod boku; pub mod cashtocode; pub mod coinbase; pub mod cryptopay; @@ -15,6 +17,7 @@ pub mod fiservemea; pub mod fiuu; pub mod forte; pub mod globepay; +pub mod gocardless; pub mod helcim; pub mod inespay; pub mod jpmorgan; @@ -27,6 +30,8 @@ pub mod novalnet; pub mod payeezy; pub mod payu; pub mod powertranz; +pub mod prophetpay; +pub mod rapyd; pub mod razorpay; pub mod redsys; pub mod shift4; @@ -43,13 +48,14 @@ pub mod zen; pub mod zsl; pub use self::{ - airwallex::Airwallex, amazonpay::Amazonpay, bambora::Bambora, billwerk::Billwerk, - bitpay::Bitpay, cashtocode::Cashtocode, coinbase::Coinbase, cryptopay::Cryptopay, - deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, elavon::Elavon, - fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, globepay::Globepay, - helcim::Helcim, inespay::Inespay, jpmorgan::Jpmorgan, mollie::Mollie, - multisafepay::Multisafepay, nexinets::Nexinets, nexixpay::Nexixpay, nomupay::Nomupay, - novalnet::Novalnet, payeezy::Payeezy, payu::Payu, powertranz::Powertranz, razorpay::Razorpay, + airwallex::Airwallex, amazonpay::Amazonpay, bambora::Bambora, bamboraapac::Bamboraapac, + billwerk::Billwerk, bitpay::Bitpay, boku::Boku, cashtocode::Cashtocode, coinbase::Coinbase, + cryptopay::Cryptopay, deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, + elavon::Elavon, fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, + globepay::Globepay, gocardless::Gocardless, helcim::Helcim, inespay::Inespay, + jpmorgan::Jpmorgan, mollie::Mollie, multisafepay::Multisafepay, nexinets::Nexinets, + nexixpay::Nexixpay, nomupay::Nomupay, novalnet::Novalnet, payeezy::Payeezy, payu::Payu, + powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys, volt::Volt, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen, zsl::Zsl, diff --git a/crates/router/src/connector/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs similarity index 70% rename from crates/router/src/connector/bamboraapac.rs rename to crates/hyperswitch_connectors/src/connectors/bamboraapac.rs index 82ed134a9756..16ecee19eea8 100644 --- a/crates/router/src/connector/bamboraapac.rs +++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs @@ -1,28 +1,48 @@ pub mod transformers; +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; +use common_enums::enums; use common_utils::{ - self, - ext_traits::XmlExt, + errors::CustomResult, + ext_traits::{BytesExt, XmlExt}, + request::{Method, Request, RequestBuilder, RequestContent}, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; -use diesel_models::enums; use error_stack::{report, Report, ResultExt}; -use hyperswitch_interfaces::consts; +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + 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, PaymentsCaptureRouterData, PaymentsSyncRouterData, + RefundExecuteRouterData, RefundSyncRouterData, SetupMandateRouterData, + }, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, + errors, + events::connector_api_logs::ConnectorEvent, + types::{self, Response}, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; use transformers as bamboraapac; use crate::{ - configs::settings, - connector::utils as connector_utils, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{self, request, ConnectorIntegration, ConnectorValidation}, - types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, RequestContent, Response, - }, - utils::{self, BytesExt}, + constants::headers, + types::ResponseRouterData, + utils::{self, construct_not_implemented_error_report, convert_amount}, }; #[derive(Clone)] @@ -51,12 +71,8 @@ impl api::RefundExecute for Bamboraapac {} impl api::RefundSync for Bamboraapac {} impl api::PaymentToken for Bamboraapac {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Bamboraapac +impl ConnectorIntegration + for Bamboraapac { // Not Implemented (R) } @@ -67,9 +83,9 @@ where { fn build_headers( &self, - _req: &types::RouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + _req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), @@ -88,7 +104,7 @@ impl ConnectorValidation for Bamboraapac { 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()), ), } } @@ -96,11 +112,11 @@ impl ConnectorValidation for Bamboraapac { fn validate_mandate_payment( &self, _pm_type: Option, - pm_data: types::domain::payments::PaymentMethodData, + pm_data: PaymentMethodData, ) -> CustomResult<(), errors::ConnectorError> { let connector = self.id(); match pm_data { - types::domain::payments::PaymentMethodData::Card(_) => Ok(()), + PaymentMethodData::Card(_) => Ok(()), _ => Err(errors::ConnectorError::NotSupported { message: "mandate payment".to_string(), connector, @@ -123,7 +139,7 @@ impl ConnectorCommon for Bamboraapac { "text/xml" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.bamboraapac.base_url.as_ref() } @@ -146,11 +162,11 @@ impl ConnectorCommon for Bamboraapac { status_code: res.status_code, code: response_data .declined_code - .unwrap_or(consts::NO_ERROR_CODE.to_string()), + .unwrap_or(NO_ERROR_CODE.to_string()), message: response_data .declined_message .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(NO_ERROR_MESSAGE.to_string()), reason: response_data.declined_message, attempt_status: None, connector_transaction_id: None, @@ -165,29 +181,20 @@ impl ConnectorCommon for Bamboraapac { } } -impl ConnectorIntegration - for Bamboraapac -{ +impl ConnectorIntegration for Bamboraapac { //TODO: implement sessions flow } -impl ConnectorIntegration - for Bamboraapac -{ -} +impl ConnectorIntegration for Bamboraapac {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Bamboraapac +impl ConnectorIntegration + for Bamboraapac { fn get_headers( &self, - req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -197,16 +204,16 @@ impl fn get_url( &self, - _req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, + _req: &SetupMandateRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}/sipp.asmx", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::SetupMandateRouterData, - _connectors: &settings::Connectors, + req: &SetupMandateRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = bamboraapac::get_setup_mandate_body(req)?; @@ -215,12 +222,12 @@ impl fn build_request( &self, - req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::SetupMandateType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::SetupMandateType::get_headers(self, req, connectors)?) @@ -233,10 +240,10 @@ impl fn handle_response( &self, - data: &types::SetupMandateRouterData, + data: &SetupMandateRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = html_to_xml_string_conversion( String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, @@ -248,7 +255,7 @@ impl 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, @@ -264,14 +271,12 @@ impl } } -impl ConnectorIntegration - for Bamboraapac -{ +impl ConnectorIntegration for Bamboraapac { 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) } @@ -281,18 +286,18 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}/dts.asmx", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::PaymentsAuthorizeRouterData, - _connectors: &settings::Connectors, + req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, ) -> CustomResult { - let amount = connector_utils::convert_amount( + let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, @@ -306,12 +311,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, )?) @@ -328,10 +333,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = html_to_xml_string_conversion( String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, @@ -343,7 +348,7 @@ impl ConnectorIntegration - for Bamboraapac -{ +impl ConnectorIntegration for Bamboraapac { 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) } @@ -376,16 +379,16 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}/dts.asmx", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::PaymentsSyncRouterData, - _connectors: &settings::Connectors, + req: &PaymentsSyncRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = bamboraapac::get_payment_sync_body(req)?; @@ -394,12 +397,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) @@ -412,10 +415,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = html_to_xml_string_conversion( String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, @@ -427,7 +430,7 @@ impl ConnectorIntegration - for Bamboraapac -{ +impl ConnectorIntegration for Bamboraapac { 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) } @@ -460,18 +461,18 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}/dts.asmx", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::PaymentsCaptureRouterData, - _connectors: &settings::Connectors, + req: &PaymentsCaptureRouterData, + _connectors: &Connectors, ) -> CustomResult { - let amount = connector_utils::convert_amount( + let amount = convert_amount( self.amount_converter, req.request.minor_amount_to_capture, req.request.currency, @@ -485,12 +486,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsCaptureType::get_headers( @@ -505,10 +506,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = html_to_xml_string_conversion( String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, @@ -521,7 +522,7 @@ impl ConnectorIntegration - for Bamboraapac -{ -} +impl ConnectorIntegration for Bamboraapac {} -impl ConnectorIntegration - for Bamboraapac -{ +impl ConnectorIntegration for Bamboraapac { fn get_headers( &self, - req: &types::RefundExecuteRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RefundExecuteRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -559,18 +555,18 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}/dts.asmx", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::RefundExecuteRouterData, - _connectors: &settings::Connectors, + req: &RefundExecuteRouterData, + _connectors: &Connectors, ) -> CustomResult { - let amount = connector_utils::convert_amount( + let amount = convert_amount( self.amount_converter, req.request.minor_refund_amount, req.request.currency, @@ -584,11 +580,11 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) + req: &RefundExecuteRouterData, + 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( @@ -603,10 +599,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = html_to_xml_string_conversion( String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, @@ -619,7 +615,7 @@ impl ConnectorIntegration - for Bamboraapac -{ +impl ConnectorIntegration for Bamboraapac { 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) } @@ -652,16 +646,16 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}/dts.asmx", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::RefundSyncRouterData, - _connectors: &settings::Connectors, + req: &RefundSyncRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = bamboraapac::get_refund_sync_body(req)?; @@ -670,12 +664,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::RefundSyncType::get_headers(self, req, connectors)?) @@ -688,10 +682,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = html_to_xml_string_conversion( String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, @@ -703,7 +697,7 @@ impl ConnectorIntegration, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } 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/bamboraapac/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs similarity index 86% rename from crates/router/src/connector/bamboraapac/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs index 1a254c052a49..f4399d105c5d 100644 --- a/crates/router/src/connector/bamboraapac/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs @@ -1,13 +1,26 @@ +use common_enums::enums; use common_utils::types::MinorUnit; use error_stack::ResultExt; -use hyperswitch_interfaces::consts; +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{ConnectorAuthType, ErrorResponse, RouterData}, + router_request_types::{ + PaymentsAuthorizeData, PaymentsCaptureData, PaymentsSyncData, RefundsData, ResponseId, + SetupMandateRequestData, + }, + router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::{ + consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, + errors, +}; use masking::{PeekInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{self, CardData, PaymentsAuthorizeRequestData, RouterData}, - core::errors, - types::{self, domain, storage::enums, transformers::ForeignFrom}, + types::ResponseRouterData, + utils::{self, CardData as _, PaymentsAuthorizeRequestData, RouterData as _}, }; type Error = error_stack::Report; @@ -92,7 +105,7 @@ fn get_transaction_body( fn get_card_data(req: &types::PaymentsAuthorizeRouterData) -> Result { let card_data = match &req.request.payment_method_data { - domain::PaymentMethodData::Card(card) => { + PaymentMethodData::Card(card) => { let card_holder_name = req.get_billing_full_name()?; if req.request.setup_future_usage == Some(enums::FutureUsage::OffSession) { @@ -132,7 +145,7 @@ fn get_card_data(req: &types::PaymentsAuthorizeRouterData) -> Result { + PaymentMethodData::MandatePayment => { format!( r#" @@ -166,11 +179,11 @@ pub struct BamboraapacAuthType { account_number: Secret, } -impl TryFrom<&types::ConnectorAuthType> for BamboraapacAuthType { +impl TryFrom<&ConnectorAuthType> for BamboraapacAuthType { 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::SignatureKey { + ConnectorAuthType::SignatureKey { api_key, key1, api_secret, @@ -236,21 +249,21 @@ fn get_attempt_status( impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BamboraapacPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, BamboraapacPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, ) -> Result { let response_code = item @@ -277,7 +290,7 @@ impl .submit_single_payment_result .response .credit_card_token; - Some(types::MandateReference { + Some(MandateReference { connector_mandate_id, payment_method_id: None, mandate_metadata: None, @@ -290,8 +303,8 @@ impl if response_code == 0 { Ok(Self { status: get_attempt_status(response_code, item.data.request.capture_method), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( connector_transaction_id.to_owned(), ), redirection_data: Box::new(None), @@ -314,7 +327,7 @@ impl .submit_single_payment_result .response .declined_code - .unwrap_or(consts::NO_ERROR_CODE.to_string()); + .unwrap_or(NO_ERROR_CODE.to_string()); let declined_message = item .response @@ -323,10 +336,10 @@ impl .submit_single_payment_result .response .declined_message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()); + .unwrap_or(NO_ERROR_MESSAGE.to_string()); Ok(Self { status: get_attempt_status(response_code, item.data.request.capture_method), - response: Err(types::ErrorResponse { + response: Err(ErrorResponse { status_code: item.http_code, code, message: declined_message.to_owned(), @@ -344,7 +357,7 @@ pub fn get_setup_mandate_body(req: &types::SetupMandateRouterData) -> Result { + PaymentMethodData::Card(card) => { format!( r#" TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BamboraapacMandateResponse, - types::SetupMandateRequestData, - types::PaymentsResponseData, + SetupMandateRequestData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, BamboraapacMandateResponse, - types::SetupMandateRequestData, - types::PaymentsResponseData, + SetupMandateRequestData, + PaymentsResponseData, >, ) -> Result { let response_code = item @@ -459,10 +472,10 @@ impl if response_code == 0 { Ok(Self { status: enums::AttemptStatus::Charged, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::NoResponseId, + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::NoResponseId, redirection_data: Box::new(None), - mandate_reference: Box::new(Some(types::MandateReference { + mandate_reference: Box::new(Some(MandateReference { connector_mandate_id: Some(connector_mandate_id), payment_method_id: None, mandate_metadata: None, @@ -481,10 +494,10 @@ impl else { Ok(Self { status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { + response: Err(ErrorResponse { status_code: item.http_code, - code: consts::NO_ERROR_CODE.to_string(), - message: consts::NO_ERROR_MESSAGE.to_string(), + code: NO_ERROR_CODE.to_string(), + message: NO_ERROR_MESSAGE.to_string(), reason: None, attempt_status: None, connector_transaction_id: None, @@ -568,21 +581,21 @@ pub struct CaptureResponse { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BamboraapacCaptureResponse, - types::PaymentsCaptureData, - types::PaymentsResponseData, + PaymentsCaptureData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, BamboraapacCaptureResponse, - types::PaymentsCaptureData, - types::PaymentsResponseData, + PaymentsCaptureData, + PaymentsResponseData, >, ) -> Result { let response_code = item @@ -608,8 +621,8 @@ impl if response_code == 0 { Ok(Self { status: enums::AttemptStatus::Charged, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( connector_transaction_id.to_owned(), ), redirection_data: Box::new(None), @@ -632,7 +645,7 @@ impl .submit_single_capture_result .response .declined_code - .unwrap_or(consts::NO_ERROR_CODE.to_string()); + .unwrap_or(NO_ERROR_CODE.to_string()); let declined_message = item .response .body @@ -640,10 +653,10 @@ impl .submit_single_capture_result .response .declined_message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()); + .unwrap_or(NO_ERROR_MESSAGE.to_string()); Ok(Self { status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { + response: Err(ErrorResponse { status_code: item.http_code, code, message: declined_message.to_owned(), @@ -731,34 +744,20 @@ pub struct RefundResponse { declined_message: Option, } -impl ForeignFrom for enums::RefundStatus { - fn foreign_from(item: u8) -> Self { - match item { - 0 => Self::Success, - 1 => Self::Failure, - _ => Self::Pending, - } +fn get_status(item: u8) -> enums::RefundStatus { + match item { + 0 => enums::RefundStatus::Success, + 1 => enums::RefundStatus::Failure, + _ => enums::RefundStatus::Pending, } } -impl - TryFrom< - types::ResponseRouterData< - F, - BamboraapacRefundsResponse, - types::RefundsData, - types::RefundsResponseData, - >, - > for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - BamboraapacRefundsResponse, - types::RefundsData, - types::RefundsResponseData, - >, + item: ResponseRouterData, ) -> Result { let response_code = item .response @@ -776,9 +775,9 @@ impl .receipt; Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: connector_refund_id.to_owned(), - refund_status: enums::RefundStatus::foreign_from(response_code), + refund_status: get_status(response_code), }), ..item.data }) @@ -869,22 +868,16 @@ pub struct SyncResponse { } impl - TryFrom< - types::ResponseRouterData< - F, - BamboraapacSyncResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, - >, - > for types::RouterData + TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, BamboraapacSyncResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, + PaymentsSyncData, + PaymentsResponseData, >, ) -> Result { let response_code = item @@ -907,8 +900,8 @@ impl if response_code == 0 { Ok(Self { status: get_attempt_status(response_code, item.data.request.capture_method), - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( connector_transaction_id.to_owned(), ), redirection_data: Box::new(None), @@ -932,7 +925,7 @@ impl .query_response .response .declined_code - .unwrap_or(consts::NO_ERROR_CODE.to_string()); + .unwrap_or(NO_ERROR_CODE.to_string()); let declined_message = item .response .body @@ -941,10 +934,10 @@ impl .query_response .response .declined_message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()); + .unwrap_or(NO_ERROR_MESSAGE.to_string()); Ok(Self { status: get_attempt_status(response_code, item.data.request.capture_method), - response: Err(types::ErrorResponse { + response: Err(ErrorResponse { status_code: item.http_code, code, message: declined_message.to_owned(), @@ -997,24 +990,12 @@ pub fn get_refund_sync_body(req: &types::RefundSyncRouterData) -> Result Ok(body.as_bytes().to_vec()) } -impl - TryFrom< - types::ResponseRouterData< - F, - BamboraapacSyncResponse, - types::RefundsData, - types::RefundsResponseData, - >, - > for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - BamboraapacSyncResponse, - types::RefundsData, - types::RefundsResponseData, - >, + item: ResponseRouterData, ) -> Result { let response_code = item .response @@ -1033,9 +1014,9 @@ impl .response .receipt; Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id: connector_refund_id.to_owned(), - refund_status: enums::RefundStatus::foreign_from(response_code), + refund_status: get_status(response_code), }), ..item.data }) diff --git a/crates/router/src/connector/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rs similarity index 71% rename from crates/router/src/connector/boku.rs rename to crates/hyperswitch_connectors/src/connectors/boku.rs index a132094693a1..d23d34e47304 100644 --- a/crates/router/src/connector/boku.rs +++ b/crates/hyperswitch_connectors/src/connectors/boku.rs @@ -1,38 +1,52 @@ pub mod transformers; +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; +use common_enums::enums; use common_utils::{ - ext_traits::XmlExt, - request::RequestContent, + errors::CustomResult, + ext_traits::{BytesExt, OptionExt, XmlExt}, + request::{Method, Request, RequestBuilder, RequestContent}, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; -use diesel_models::enums; use error_stack::{report, Report, ResultExt}; -use masking::{ExposeInterface, PeekInterface, Secret, WithType}; +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, 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::{ExposeInterface, Mask, PeekInterface, Secret, WithType}; use ring::hmac; -use router_env::metrics::add_attributes; -use roxmltree; +use router_env::{logger, metrics::add_attributes}; use time::OffsetDateTime; use transformers as boku; -use super::utils as connector_utils; use crate::{ - configs::settings, - consts, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, logger, - routes::metrics, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, - }, - types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, - }, - utils::{BytesExt, OptionExt}, + constants::{headers, UNSUPPORTED_ERROR_MESSAGE}, + metrics, + types::ResponseRouterData, + utils::{construct_not_supported_error_report, convert_amount}, }; #[derive(Clone)] @@ -61,12 +75,8 @@ impl api::RefundExecute for Boku {} impl api::RefundSync for Boku {} impl api::PaymentToken for Boku {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Boku +impl ConnectorIntegration + for Boku { // Not Implemented (R) } @@ -77,9 +87,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let connector_auth = boku::BokuAuthType::try_from(&req.connector_auth_type)?; let boku_url = Self::get_url(self, req, connectors)?; @@ -125,7 +135,7 @@ impl ConnectorCommon for Boku { "text/xml;charset=utf-8" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.boku.base_url.as_ref() } @@ -167,39 +177,24 @@ impl ConnectorValidation for Boku { 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 Boku -{ +impl ConnectorIntegration for Boku { //TODO: implement sessions flow } -impl ConnectorIntegration - for Boku -{ -} +impl ConnectorIntegration for Boku {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Boku -{ +impl ConnectorIntegration for Boku { 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 Boku".to_string()) .into(), @@ -207,19 +202,17 @@ impl } } -impl ConnectorIntegration - for Boku -{ +impl ConnectorIntegration for Boku { 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) } - fn get_http_method(&self) -> services::Method { - services::Method::Post + fn get_http_method(&self) -> Method { + Method::Post } fn get_content_type(&self) -> &'static str { @@ -228,8 +221,8 @@ impl ConnectorIntegration CustomResult { let boku_url = get_country_url( req.connector_meta_data.clone(), @@ -241,10 +234,10 @@ impl ConnectorIntegration CustomResult { - let amount = connector_utils::convert_amount( + let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, @@ -257,12 +250,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, )?) @@ -279,10 +272,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; @@ -291,7 +284,7 @@ impl ConnectorIntegration - for Boku -{ +impl ConnectorIntegration for Boku { 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) } @@ -324,8 +315,8 @@ impl ConnectorIntegration CustomResult { let boku_url = get_country_url( req.connector_meta_data.clone(), @@ -337,8 +328,8 @@ impl ConnectorIntegration CustomResult { let connector_req = boku::BokuPsyncRequest::try_from(req)?; Ok(RequestContent::Xml(Box::new(connector_req))) @@ -346,12 +337,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)?) @@ -364,10 +355,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; @@ -376,7 +367,7 @@ impl ConnectorIntegration - for Boku -{ +impl ConnectorIntegration for Boku { 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) } @@ -409,28 +398,28 @@ impl ConnectorIntegration CustomResult { Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn get_request_body( &self, - _req: &types::PaymentsCaptureRouterData, - _connectors: &settings::Connectors, + _req: &PaymentsCaptureRouterData, + _connectors: &Connectors, ) -> CustomResult { Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) } fn build_request( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsCaptureType::get_headers( @@ -445,10 +434,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response_data = String::from_utf8(res.response.to_vec()) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; @@ -457,7 +446,7 @@ impl ConnectorIntegration - for Boku -{ -} +impl ConnectorIntegration for Boku {} -impl ConnectorIntegration for Boku { +impl ConnectorIntegration for Boku { 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) } @@ -493,8 +479,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { let boku_url = get_country_url( req.connector_meta_data.clone(), @@ -506,10 +492,10 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { - let refund_amount = connector_utils::convert_amount( + let refund_amount = convert_amount( self.amount_converter, req.request.minor_refund_amount, req.request.currency, @@ -522,11 +508,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( @@ -541,10 +527,10 @@ impl ConnectorIntegration, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: boku::RefundResponse = res .response .parse_struct("boku RefundResponse") @@ -553,7 +539,7 @@ impl ConnectorIntegration for Boku { +impl ConnectorIntegration for Boku { 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) } @@ -584,8 +570,8 @@ impl ConnectorIntegration CustomResult { let boku_url = get_country_url( req.connector_meta_data.clone(), @@ -597,8 +583,8 @@ impl ConnectorIntegration CustomResult { let connector_req = boku::BokuRsyncRequest::try_from(req)?; Ok(RequestContent::Xml(Box::new(connector_req))) @@ -606,12 +592,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)?) @@ -624,17 +610,17 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: boku::BokuRsyncResponse = res .response .parse_struct("boku BokuRsyncResponse") .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, @@ -651,24 +637,24 @@ impl ConnectorIntegration, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } @@ -690,7 +676,7 @@ fn get_xml_deserialized( res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { - metrics::RESPONSE_DESERIALIZATION_FAILURE.add( + metrics::CONNECTOR_RESPONSE_DESERIALIZATION_FAILURE.add( &metrics::CONTEXT, 1, &add_attributes([("connector", "boku")]), @@ -711,8 +697,8 @@ fn get_xml_deserialized( logger::error!("UNEXPECTED RESPONSE FROM CONNECTOR: {}", response_data); Ok(ErrorResponse { status_code: res.status_code, - code: consts::NO_ERROR_CODE.to_string(), - message: consts::UNSUPPORTED_ERROR_MESSAGE.to_string(), + code: NO_ERROR_CODE.to_string(), + message: UNSUPPORTED_ERROR_MESSAGE.to_string(), reason: Some(response_data), attempt_status: None, connector_transaction_id: None, diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs similarity index 73% rename from crates/router/src/connector/boku/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/boku/transformers.rs index 4a947284d79d..df1331750378 100644 --- a/crates/router/src/connector/boku/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs @@ -1,16 +1,24 @@ use std::fmt; -use common_utils::types::MinorUnit; +use common_enums::enums; +use common_utils::{request::Method, types::MinorUnit}; +use hyperswitch_domain_models::{ + payment_method_data::{PaymentMethodData, WalletData}, + router_data::{ConnectorAuthType, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::ResponseId, + router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, + types::{self, RefundsRouterData}, +}; +use hyperswitch_interfaces::errors; use masking::Secret; use serde::{Deserialize, Serialize}; use url::Url; use uuid::Uuid; use crate::{ - connector::utils::{self, AddressDetailsData, RouterData}, - core::errors, - services::{self, RedirectForm}, - types::{self, api, domain, storage::enums}, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{self, AddressDetailsData, RouterData as _}, }; #[derive(Debug, Serialize)] @@ -96,25 +104,25 @@ impl TryFrom<&BokuRouterData<&types::PaymentsAuthorizeRouterData>> for BokuPayme item: &BokuRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, &wallet_data)), - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | 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::MobilePayment(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::OpenBanking(_) - | domain::PaymentMethodData::CardToken(_) - | domain::PaymentMethodData::NetworkToken(_) - | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { + PaymentMethodData::Wallet(wallet_data) => Self::try_from((item, &wallet_data)), + PaymentMethodData::Card(_) + | PaymentMethodData::CardRedirect(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankDebit(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) + | 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("boku"), ))? @@ -126,14 +134,14 @@ impl TryFrom<&BokuRouterData<&types::PaymentsAuthorizeRouterData>> for BokuPayme impl TryFrom<( &BokuRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &WalletData, )> for BokuPaymentsRequest { type Error = error_stack::Report; fn try_from( value: ( &BokuRouterData<&types::PaymentsAuthorizeRouterData>, - &domain::WalletData, + &WalletData, ), ) -> Result { let (item_router_data, wallet_data) = value; @@ -162,36 +170,36 @@ impl } } -fn get_wallet_type(wallet_data: &domain::WalletData) -> Result { +fn get_wallet_type(wallet_data: &WalletData) -> Result { match wallet_data { - domain::WalletData::DanaRedirect { .. } => Ok(BokuPaymentType::Dana.to_string()), - domain::WalletData::MomoRedirect { .. } => Ok(BokuPaymentType::Momo.to_string()), - domain::WalletData::GcashRedirect { .. } => Ok(BokuPaymentType::Gcash.to_string()), - domain::WalletData::GoPayRedirect { .. } => Ok(BokuPaymentType::GoPay.to_string()), - domain::WalletData::KakaoPayRedirect { .. } => Ok(BokuPaymentType::Kakaopay.to_string()), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::ApplePay(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::GooglePay(_) - | domain::WalletData::GooglePayRedirect(_) - | domain::WalletData::GooglePayThirdPartySdk(_) - | domain::WalletData::MbWayRedirect(_) - | domain::WalletData::MobilePayRedirect(_) - | domain::WalletData::PaypalRedirect(_) - | 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::DanaRedirect { .. } => Ok(BokuPaymentType::Dana.to_string()), + WalletData::MomoRedirect { .. } => Ok(BokuPaymentType::Momo.to_string()), + WalletData::GcashRedirect { .. } => Ok(BokuPaymentType::Gcash.to_string()), + WalletData::GoPayRedirect { .. } => Ok(BokuPaymentType::GoPay.to_string()), + WalletData::KakaoPayRedirect { .. } => Ok(BokuPaymentType::Kakaopay.to_string()), + WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::ApplePay(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::GooglePay(_) + | WalletData::GooglePayRedirect(_) + | WalletData::GooglePayThirdPartySdk(_) + | WalletData::MbWayRedirect(_) + | WalletData::MobilePayRedirect(_) + | WalletData::PaypalRedirect(_) + | 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("boku"), )), } @@ -202,11 +210,11 @@ pub struct BokuAuthType { pub(super) key_id: Secret, } -impl TryFrom<&types::ConnectorAuthType> for BokuAuthType { +impl TryFrom<&ConnectorAuthType> for BokuAuthType { 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 { merchant_id: key1.to_owned(), key_id: api_key.to_owned(), }), @@ -286,12 +294,12 @@ pub struct SingleChargeResponseData { charge_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 (status, transaction_id, redirection_data) = match item.response { BokuResponse::BeginSingleChargeResponse(response) => get_authorize_response(response), @@ -300,8 +308,8 @@ impl TryFrom Ok(hosted_value .redirect_url - .map(|url| RedirectForm::from((url, services::Method::Get)))), + .map(|url| RedirectForm::from((url, Method::Get)))), None => Err(errors::ConnectorError::MissingConnectorRedirectionPayload { field_name: "redirect_url", }), @@ -372,9 +380,9 @@ impl fmt::Display for BokuRefundReasonCode { } } -impl TryFrom<&BokuRouterData<&types::RefundsRouterData>> for BokuRefundRequest { +impl TryFrom<&BokuRouterData<&RefundsRouterData>> for BokuRefundRequest { type Error = error_stack::Report; - fn try_from(item: &BokuRouterData<&types::RefundsRouterData>) -> Result { + fn try_from(item: &BokuRouterData<&RefundsRouterData>) -> Result { let auth_type = BokuAuthType::try_from(&item.router_data.connector_auth_type)?; let payment_data = Self { refund_amount: item.amount, @@ -408,15 +416,13 @@ fn get_refund_status(status: String) -> 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.charge_id, refund_status: get_refund_status(item.response.refund_status), }), @@ -469,15 +475,13 @@ pub struct SingleRefundResponseData { refund_id: String, } -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.refunds.refund.refund_id, refund_status: get_refund_status(item.response.refunds.refund.refund_status), }), diff --git a/crates/router/src/connector/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rs similarity index 69% rename from crates/router/src/connector/gocardless.rs rename to crates/hyperswitch_connectors/src/connectors/gocardless.rs index 281a1ea5c9b8..becc8749b5d5 100644 --- a/crates/router/src/connector/gocardless.rs +++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs @@ -2,29 +2,50 @@ pub mod transformers; use std::fmt::Debug; -use api_models::enums::enums; -use common_utils::{crypto, ext_traits::ByteSliceExt, request::RequestContent}; +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; +use common_enums::enums; +use common_utils::{ + crypto, + errors::CustomResult, + ext_traits::{ByteSliceExt, BytesExt}, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::ResultExt; -use masking::PeekInterface; -use transformers as gocardless; - -use crate::{ - configs::settings, - connector::utils::{self as connector_utils, PaymentMethodDataType}, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, +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}, + CreateConnectorCustomer, PreProcessing, }, + router_request_types::{ + AccessTokenRequestData, ConnectorCustomerData, PaymentMethodTokenizationData, + PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, + PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData, + }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, + ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsSyncRouterData, + RefundSyncRouterData, RefundsRouterData, SetupMandateRouterData, TokenizationRouterData, }, - utils::BytesExt, +}; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, + types::{self, PaymentsSyncType, Response}, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::{Mask, PeekInterface}; +use transformers as gocardless; + +use crate::{ + constants::headers, + types::ResponseRouterData, + utils::{construct_not_implemented_error_report, is_mandate_supported, PaymentMethodDataType}, }; #[derive(Debug, Clone)] @@ -54,9 +75,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(), @@ -86,14 +107,14 @@ impl ConnectorCommon for Gocardless { "application/json" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.gocardless.base_url.as_ref() } fn get_auth_header( &self, - auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { let auth = gocardless::GocardlessAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; Ok(vec![( @@ -134,33 +155,29 @@ impl ConnectorCommon for Gocardless { } } -impl - ConnectorIntegration< - api::CreateConnectorCustomer, - types::ConnectorCustomerData, - types::PaymentsResponseData, - > for Gocardless +impl ConnectorIntegration + for Gocardless { fn get_headers( &self, - req: &types::ConnectorCustomerRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &ConnectorCustomerRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_url( &self, - _req: &types::ConnectorCustomerRouterData, - connectors: &settings::Connectors, + _req: &ConnectorCustomerRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}/customers", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::ConnectorCustomerRouterData, - _connectors: &settings::Connectors, + req: &ConnectorCustomerRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = gocardless::GocardlessCustomerRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -168,12 +185,12 @@ impl fn build_request( &self, - req: &types::ConnectorCustomerRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &ConnectorCustomerRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::ConnectorCustomerType::get_url( self, req, connectors, )?) @@ -190,21 +207,17 @@ impl fn handle_response( &self, - data: &types::ConnectorCustomerRouterData, + data: &ConnectorCustomerRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult< - types::RouterData< - api::CreateConnectorCustomer, - types::ConnectorCustomerData, - types::PaymentsResponseData, - >, + RouterData, errors::ConnectorError, > where - api::CreateConnectorCustomer: Clone, - types::ConnectorCustomerData: Clone, - types::PaymentsResponseData: Clone, + CreateConnectorCustomer: Clone, + ConnectorCustomerData: Clone, + PaymentsResponseData: Clone, { let response: gocardless::GocardlessCustomerResponse = res .response @@ -214,7 +227,7 @@ impl 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, @@ -230,25 +243,21 @@ impl } } -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Gocardless +impl ConnectorIntegration + for Gocardless { fn get_headers( &self, - req: &types::TokenizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &TokenizationRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_url( &self, - _req: &types::TokenizationRouterData, - connectors: &settings::Connectors, + _req: &TokenizationRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}/customer_bank_accounts", @@ -258,8 +267,8 @@ impl fn get_request_body( &self, - req: &types::TokenizationRouterData, - _connectors: &settings::Connectors, + req: &TokenizationRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = gocardless::GocardlessBankAccountRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -267,12 +276,12 @@ impl fn build_request( &self, - req: &types::TokenizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &TokenizationRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::TokenizationType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::TokenizationType::get_headers(self, req, connectors)?) @@ -285,14 +294,14 @@ impl fn handle_response( &self, - data: &types::TokenizationRouterData, + data: &TokenizationRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult + ) -> CustomResult where - api::PaymentMethodToken: Clone, - types::PaymentMethodTokenizationData: Clone, - types::PaymentsResponseData: Clone, + PaymentMethodToken: Clone, + PaymentMethodTokenizationData: Clone, + PaymentsResponseData: Clone, { let response: gocardless::GocardlessBankAccountResponse = res .response @@ -302,7 +311,7 @@ impl 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, @@ -318,12 +327,8 @@ impl } } -impl - ConnectorIntegration< - api::PreProcessing, - types::PaymentsPreProcessingData, - types::PaymentsResponseData, - > for Gocardless +impl ConnectorIntegration + for Gocardless { } @@ -338,15 +343,16 @@ impl ConnectorValidation for Gocardless { enums::CaptureMethod::Automatic => Ok(()), enums::CaptureMethod::Manual | enums::CaptureMethod::ManualMultiple - | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_implemented_error_report(capture_method, self.id()), - ), + | enums::CaptureMethod::Scheduled => Err(construct_not_implemented_error_report( + capture_method, + self.id(), + )), } } fn validate_mandate_payment( &self, - pm_type: Option, - pm_data: types::domain::payments::PaymentMethodData, + pm_type: Option, + pm_data: PaymentMethodData, ) -> CustomResult<(), errors::ConnectorError> { let mandate_supported_pmd = std::collections::HashSet::from([ PaymentMethodDataType::SepaBankDebit, @@ -354,48 +360,39 @@ impl ConnectorValidation for Gocardless { PaymentMethodDataType::BecsBankDebit, PaymentMethodDataType::BacsBankDebit, ]); - 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 Gocardless -{ +impl ConnectorIntegration for Gocardless { //TODO: implement sessions flow } -impl ConnectorIntegration - for Gocardless -{ -} +impl ConnectorIntegration for Gocardless {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Gocardless +impl ConnectorIntegration + for Gocardless { fn get_headers( &self, - req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_url( &self, - _req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, + _req: &SetupMandateRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}/mandates", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::SetupMandateRouterData, - _connectors: &settings::Connectors, + req: &SetupMandateRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = gocardless::GocardlessMandateRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -403,14 +400,14 @@ impl fn build_request( &self, - req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &SetupMandateRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { // Preprocessing flow is to create mandate, which should to be called only in case of First mandate if req.request.setup_mandate_details.is_some() { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::SetupMandateType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::SetupMandateType::get_headers(self, req, connectors)?) @@ -426,10 +423,10 @@ impl fn handle_response( &self, - data: &types::SetupMandateRouterData, + data: &SetupMandateRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: gocardless::GocardlessMandateResponse = res .response .parse_struct("GocardlessMandateResponse") @@ -438,7 +435,7 @@ impl 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, @@ -454,14 +451,12 @@ impl } } -impl ConnectorIntegration - for Gocardless -{ +impl ConnectorIntegration for Gocardless { 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) } @@ -471,16 +466,16 @@ impl ConnectorIntegration CustomResult { Ok(format!("{}/payments", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::PaymentsAuthorizeRouterData, - _connectors: &settings::Connectors, + req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_router_data = gocardless::GocardlessRouterData::try_from(( &self.get_currency_unit(), @@ -495,12 +490,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, )?) @@ -517,10 +512,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: gocardless::GocardlessPaymentsResponse = res .response .parse_struct("GocardlessPaymentsResponse") @@ -529,7 +524,7 @@ impl ConnectorIntegration - for Gocardless -{ +impl ConnectorIntegration for Gocardless { 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) } @@ -562,8 +555,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}/payments/{}", @@ -577,25 +570,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: gocardless::GocardlessPaymentsResponse = res .response .parse_struct("GocardlessPaymentsResponse") @@ -604,7 +597,7 @@ impl ConnectorIntegration - for Gocardless -{ -} +impl ConnectorIntegration for Gocardless {} -impl ConnectorIntegration - for Gocardless -{ -} +impl ConnectorIntegration for Gocardless {} -impl ConnectorIntegration - for Gocardless -{ +impl ConnectorIntegration for Gocardless { 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) } @@ -647,16 +632,16 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + _req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}/refunds", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::RefundsRouterData, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_router_data = gocardless::GocardlessRouterData::try_from(( &self.get_currency_unit(), @@ -670,11 +655,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( @@ -689,10 +674,10 @@ impl ConnectorIntegration, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: gocardless::RefundResponse = res .response .parse_struct("gocardless RefundResponse") @@ -701,7 +686,7 @@ impl ConnectorIntegration - for Gocardless -{ +impl ConnectorIntegration for Gocardless { fn build_request( &self, - _req: &types::RefundSyncRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + _req: &RefundSyncRouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(None) } } #[async_trait::async_trait] -impl api::IncomingWebhook for Gocardless { +impl IncomingWebhook for Gocardless { fn get_webhook_source_verification_algorithm( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Ok(Box::new(crypto::HmacSha256)) } fn get_webhook_source_verification_signature( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult, errors::ConnectorError> { let signature = request @@ -759,7 +742,7 @@ impl api::IncomingWebhook for Gocardless { 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> { @@ -770,8 +753,8 @@ impl api::IncomingWebhook for Gocardless { fn get_webhook_object_reference_id( &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { let details: gocardless::GocardlessWebhookEvent = request .body .parse_struct("GocardlessWebhookEvent") @@ -785,18 +768,18 @@ impl api::IncomingWebhook for Gocardless { let payment_id = api_models::payments::PaymentIdType::ConnectorTransactionId( link.payment.to_owned(), ); - api::webhooks::ObjectReferenceId::PaymentId(payment_id) + ObjectReferenceId::PaymentId(payment_id) } transformers::WebhooksLink::RefundWebhookLink(link) => { let refund_id = api_models::webhooks::RefundIdType::ConnectorRefundId(link.refund.to_owned()); - api::webhooks::ObjectReferenceId::RefundId(refund_id) + ObjectReferenceId::RefundId(refund_id) } transformers::WebhooksLink::MandateWebhookLink(link) => { let mandate_id = api_models::webhooks::MandateIdType::ConnectorMandateId( link.mandate.to_owned(), ); - api::webhooks::ObjectReferenceId::MandateId(mandate_id) + ObjectReferenceId::MandateId(mandate_id) } }; Ok(reference_id) @@ -804,8 +787,8 @@ impl api::IncomingWebhook for Gocardless { fn get_webhook_event_type( &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { let details: gocardless::GocardlessWebhookEvent = request .body .parse_struct("GocardlessWebhookEvent") @@ -819,41 +802,37 @@ impl api::IncomingWebhook for Gocardless { transformers::PaymentsAction::Created | transformers::PaymentsAction::Submitted | transformers::PaymentsAction::CustomerApprovalGranted => { - api::IncomingWebhookEvent::PaymentIntentProcessing + IncomingWebhookEvent::PaymentIntentProcessing } transformers::PaymentsAction::CustomerApprovalDenied | transformers::PaymentsAction::Failed | transformers::PaymentsAction::Cancelled | transformers::PaymentsAction::LateFailureSettled => { - api::IncomingWebhookEvent::PaymentIntentFailure + IncomingWebhookEvent::PaymentIntentFailure } transformers::PaymentsAction::Confirmed | transformers::PaymentsAction::PaidOut => { - api::IncomingWebhookEvent::PaymentIntentSuccess + IncomingWebhookEvent::PaymentIntentSuccess } transformers::PaymentsAction::SurchargeFeeDebited | transformers::PaymentsAction::ResubmissionRequired => { - api::IncomingWebhookEvent::EventNotSupported + IncomingWebhookEvent::EventNotSupported } }, transformers::WebhookAction::RefundsAction(action) => match action { - transformers::RefundsAction::Failed => api::IncomingWebhookEvent::RefundFailure, - transformers::RefundsAction::Paid => api::IncomingWebhookEvent::RefundSuccess, + transformers::RefundsAction::Failed => IncomingWebhookEvent::RefundFailure, + transformers::RefundsAction::Paid => IncomingWebhookEvent::RefundSuccess, transformers::RefundsAction::RefundSettled | transformers::RefundsAction::FundsReturned - | transformers::RefundsAction::Created => { - api::IncomingWebhookEvent::EventNotSupported - } + | transformers::RefundsAction::Created => IncomingWebhookEvent::EventNotSupported, }, transformers::WebhookAction::MandatesAction(action) => match action { transformers::MandatesAction::Active | transformers::MandatesAction::Reinstated => { - api::IncomingWebhookEvent::MandateActive + IncomingWebhookEvent::MandateActive } transformers::MandatesAction::Expired | transformers::MandatesAction::Cancelled | transformers::MandatesAction::Failed - | transformers::MandatesAction::Consumed => { - api::IncomingWebhookEvent::MandateRevoked - } + | transformers::MandatesAction::Consumed => IncomingWebhookEvent::MandateRevoked, transformers::MandatesAction::Created | transformers::MandatesAction::CustomerApprovalGranted | transformers::MandatesAction::CustomerApprovalSkipped @@ -861,9 +840,7 @@ impl api::IncomingWebhook for Gocardless { | transformers::MandatesAction::Submitted | transformers::MandatesAction::ResubmissionRequested | transformers::MandatesAction::Replaced - | transformers::MandatesAction::Blocked => { - api::IncomingWebhookEvent::EventNotSupported - } + | transformers::MandatesAction::Blocked => IncomingWebhookEvent::EventNotSupported, }, }; Ok(event_type) @@ -871,7 +848,7 @@ impl api::IncomingWebhook for Gocardless { fn get_webhook_resource_object( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { let details: gocardless::GocardlessWebhookEvent = request .body diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs similarity index 76% rename from crates/router/src/connector/gocardless/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs index 579bd77d4d63..25327358e7fe 100644 --- a/crates/router/src/connector/gocardless/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs @@ -1,20 +1,29 @@ use api_models::enums::{CountryAlpha2, UsStatesAbbreviation}; +use common_enums::{AttemptStatus, Currency, RefundStatus}; use common_utils::{ id_type, pii::{self, IpAddress}, }; +use hyperswitch_domain_models::{ + payment_method_data::{BankDebitData, PaymentMethodData}, + router_data::{ConnectorAuthType, PaymentMethodToken, RouterData}, + router_flow_types::refunds::Execute, + router_request_types::{ + ConnectorCustomerData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsSyncData, ResponseId, SetupMandateRequestData, + }, + router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::{api, errors}; use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::{ - connector::utils::{ - self, AddressDetailsData, BrowserInformationData, ConnectorCustomerData, - PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData, RouterData, - }, - core::errors, - types::{ - self, api, domain, storage::enums, transformers::ForeignTryFrom, MandateReference, - ResponseId, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{ + self, AddressDetailsData, BrowserInformationData, CustomerData, ForeignTryFrom, + PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData, RouterData as _, }, }; @@ -23,10 +32,10 @@ pub struct GocardlessRouterData { pub router_data: T, } -impl TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for GocardlessRouterData { +impl TryFrom<(&api::CurrencyUnit, Currency, i64, T)> for GocardlessRouterData { type Error = error_stack::Report; fn try_from( - (_currency_unit, _currency, amount, item): (&api::CurrencyUnit, enums::Currency, i64, T), + (_currency_unit, _currency, amount, item): (&api::CurrencyUnit, Currency, i64, T), ) -> Result { Ok(Self { amount, @@ -127,25 +136,25 @@ pub struct Customers { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, GocardlessCustomerResponse, - types::ConnectorCustomerData, - types::PaymentsResponseData, + ConnectorCustomerData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, GocardlessCustomerResponse, - types::ConnectorCustomerData, - types::PaymentsResponseData, + ConnectorCustomerData, + PaymentsResponseData, >, ) -> Result { Ok(Self { - response: Ok(types::PaymentsResponseData::ConnectorCustomerResponse { + response: Ok(PaymentsResponseData::ConnectorCustomerResponse { connector_customer_id: item.response.customers.id.expose(), }), ..item.data @@ -227,27 +236,27 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount { type Error = error_stack::Report; fn try_from(item: &types::TokenizationRouterData) -> Result { match &item.request.payment_method_data { - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + PaymentMethodData::BankDebit(bank_debit_data) => { Self::try_from((bank_debit_data, item)) } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::RealTimePayment(_) - | domain::PaymentMethodData::MobilePayment(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::OpenBanking(_) - | domain::PaymentMethodData::CardToken(_) - | domain::PaymentMethodData::NetworkToken(_) - | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { + PaymentMethodData::Card(_) + | PaymentMethodData::CardRedirect(_) + | PaymentMethodData::Wallet(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) + | 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("Gocardless"), ) @@ -257,13 +266,13 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount { } } -impl TryFrom<(&domain::BankDebitData, &types::TokenizationRouterData)> for CustomerBankAccount { +impl TryFrom<(&BankDebitData, &types::TokenizationRouterData)> for CustomerBankAccount { type Error = error_stack::Report; fn try_from( - (bank_debit_data, item): (&domain::BankDebitData, &types::TokenizationRouterData), + (bank_debit_data, item): (&BankDebitData, &types::TokenizationRouterData), ) -> Result { match bank_debit_data { - domain::BankDebitData::AchBankDebit { + BankDebitData::AchBankDebit { account_number, routing_number, bank_type, @@ -281,7 +290,7 @@ impl TryFrom<(&domain::BankDebitData, &types::TokenizationRouterData)> for Custo }; Ok(Self::USBankAccount(us_bank_account)) } - domain::BankDebitData::BecsBankDebit { + BankDebitData::BecsBankDebit { account_number, bsb_number, .. @@ -296,7 +305,7 @@ impl TryFrom<(&domain::BankDebitData, &types::TokenizationRouterData)> for Custo }; Ok(Self::AUBankAccount(au_bank_account)) } - domain::BankDebitData::SepaBankDebit { iban, .. } => { + BankDebitData::SepaBankDebit { iban, .. } => { let account_holder_name = item.get_billing_full_name()?; let international_bank_account = InternationalBankAccount { iban: iban.clone(), @@ -304,12 +313,10 @@ impl TryFrom<(&domain::BankDebitData, &types::TokenizationRouterData)> for Custo }; Ok(Self::InternationalBankAccount(international_bank_account)) } - domain::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Gocardless"), - ) - .into()) - } + BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Gocardless"), + ) + .into()), } } } @@ -335,25 +342,25 @@ pub struct CustomerBankAccountResponse { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, GocardlessBankAccountResponse, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, + PaymentMethodTokenizationData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, GocardlessBankAccountResponse, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, + PaymentMethodTokenizationData, + PaymentsResponseData, >, ) -> Result { Ok(Self { - response: Ok(types::PaymentsResponseData::TokenizationResponse { + response: Ok(PaymentsResponseData::TokenizationResponse { token: item.response.customer_bank_accounts.id.expose(), }), ..item.data @@ -397,31 +404,31 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { type Error = error_stack::Report; fn try_from(item: &types::SetupMandateRouterData) -> Result { let (scheme, payer_ip_address) = match &item.request.payment_method_data { - domain::PaymentMethodData::BankDebit(bank_debit_data) => { + PaymentMethodData::BankDebit(bank_debit_data) => { let payer_ip_address = get_ip_if_required(bank_debit_data, item)?; Ok(( GocardlessScheme::try_from(bank_debit_data)?, payer_ip_address, )) } - domain::PaymentMethodData::Card(_) - | domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::Wallet(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | domain::PaymentMethodData::MandatePayment - | domain::PaymentMethodData::Reward - | domain::PaymentMethodData::RealTimePayment(_) - | domain::PaymentMethodData::MobilePayment(_) - | domain::PaymentMethodData::Upi(_) - | domain::PaymentMethodData::Voucher(_) - | domain::PaymentMethodData::GiftCard(_) - | domain::PaymentMethodData::OpenBanking(_) - | domain::PaymentMethodData::CardToken(_) - | domain::PaymentMethodData::NetworkToken(_) - | domain::PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { + PaymentMethodData::Card(_) + | PaymentMethodData::CardRedirect(_) + | PaymentMethodData::Wallet(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | PaymentMethodData::MandatePayment + | PaymentMethodData::Reward + | PaymentMethodData::RealTimePayment(_) + | PaymentMethodData::MobilePayment(_) + | PaymentMethodData::Upi(_) + | PaymentMethodData::Voucher(_) + | PaymentMethodData::GiftCard(_) + | PaymentMethodData::OpenBanking(_) + | PaymentMethodData::CardToken(_) + | PaymentMethodData::NetworkToken(_) + | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( "Setup Mandate flow for selected payment method through Gocardless".to_string(), )) @@ -429,9 +436,8 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { }?; let payment_method_token = item.get_payment_method_token()?; let customer_bank_account = match payment_method_token { - types::PaymentMethodToken::Token(token) => Ok(token), - types::PaymentMethodToken::ApplePayDecrypt(_) - | types::PaymentMethodToken::PazeDecrypt(_) => { + PaymentMethodToken::Token(token) => Ok(token), + PaymentMethodToken::ApplePayDecrypt(_) | PaymentMethodToken::PazeDecrypt(_) => { Err(errors::ConnectorError::NotImplemented( "Setup Mandate flow for selected payment method through Gocardless".to_string(), )) @@ -453,31 +459,29 @@ impl TryFrom<&types::SetupMandateRouterData> for GocardlessMandateRequest { } fn get_ip_if_required( - bank_debit_data: &domain::BankDebitData, + bank_debit_data: &BankDebitData, item: &types::SetupMandateRouterData, ) -> Result>, error_stack::Report> { let ip_address = item.request.get_browser_info()?.get_ip_address()?; match bank_debit_data { - domain::BankDebitData::AchBankDebit { .. } => Ok(Some(ip_address)), - domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } => Ok(None), + BankDebitData::AchBankDebit { .. } => Ok(Some(ip_address)), + BankDebitData::SepaBankDebit { .. } + | BankDebitData::BecsBankDebit { .. } + | BankDebitData::BacsBankDebit { .. } => Ok(None), } } -impl TryFrom<&domain::BankDebitData> for GocardlessScheme { +impl TryFrom<&BankDebitData> for GocardlessScheme { type Error = error_stack::Report; - fn try_from(item: &domain::BankDebitData) -> Result { + fn try_from(item: &BankDebitData) -> Result { match item { - domain::BankDebitData::AchBankDebit { .. } => Ok(Self::Ach), - domain::BankDebitData::SepaBankDebit { .. } => Ok(Self::SepaCore), - domain::BankDebitData::BecsBankDebit { .. } => Ok(Self::Becs), - domain::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - "Setup Mandate flow for selected payment method through Gocardless".to_string(), - ) - .into()) - } + BankDebitData::AchBankDebit { .. } => Ok(Self::Ach), + BankDebitData::SepaBankDebit { .. } => Ok(Self::SepaCore), + BankDebitData::BecsBankDebit { .. } => Ok(Self::Becs), + BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + "Setup Mandate flow for selected payment method through Gocardless".to_string(), + ) + .into()), } } } @@ -494,21 +498,21 @@ pub struct MandateResponse { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, GocardlessMandateResponse, - types::SetupMandateRequestData, - types::PaymentsResponseData, + SetupMandateRequestData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, GocardlessMandateResponse, - types::SetupMandateRequestData, - types::PaymentsResponseData, + SetupMandateRequestData, + PaymentsResponseData, >, ) -> Result { let mandate_reference = Some(MandateReference { @@ -518,7 +522,7 @@ impl connector_mandate_request_reference_id: None, }); Ok(Self { - response: Ok(types::PaymentsResponseData::TransactionResponse { + response: Ok(PaymentsResponseData::TransactionResponse { connector_metadata: None, connector_response_reference_id: None, incremental_authorization_allowed: None, @@ -528,7 +532,7 @@ impl network_txn_id: None, charge_id: None, }), - status: enums::AttemptStatus::Charged, + status: AttemptStatus::Charged, ..item.data }) } @@ -542,7 +546,7 @@ pub struct GocardlessPaymentsRequest { #[derive(Debug, Serialize)] pub struct GocardlessPayment { amount: i64, - currency: enums::Currency, + currency: Currency, description: Option, metadata: PaymentMetaData, links: PaymentLink, @@ -596,11 +600,11 @@ pub struct GocardlessAuthType { pub(super) access_token: Secret, } -impl TryFrom<&types::ConnectorAuthType> for GocardlessAuthType { +impl TryFrom<&ConnectorAuthType> for GocardlessAuthType { 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::HeaderKey { api_key } => Ok(Self { + ConnectorAuthType::HeaderKey { api_key } => Ok(Self { access_token: api_key.to_owned(), }), _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), @@ -621,7 +625,7 @@ pub enum GocardlessPaymentStatus { Failed, } -impl From for enums::AttemptStatus { +impl From for AttemptStatus { fn from(item: GocardlessPaymentStatus) -> Self { match item { GocardlessPaymentStatus::PendingCustomerApproval @@ -648,21 +652,21 @@ pub struct PaymentResponse { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, GocardlessPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, GocardlessPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, ) -> Result { let mandate_reference = MandateReference { @@ -672,8 +676,8 @@ impl connector_mandate_request_reference_id: None, }; Ok(Self { - status: enums::AttemptStatus::from(item.response.payments.status), - response: Ok(types::PaymentsResponseData::TransactionResponse { + status: AttemptStatus::from(item.response.payments.status), + response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(item.response.payments.id), redirection_data: Box::new(None), mandate_reference: Box::new(Some(mandate_reference)), @@ -690,26 +694,21 @@ impl impl TryFrom< - types::ResponseRouterData< - F, - GocardlessPaymentsResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, - >, - > for types::RouterData + ResponseRouterData, + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, GocardlessPaymentsResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, + PaymentsSyncData, + PaymentsResponseData, >, ) -> Result { Ok(Self { - status: enums::AttemptStatus::from(item.response.payments.status), - response: Ok(types::PaymentsResponseData::TransactionResponse { + status: AttemptStatus::from(item.response.payments.status), + response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(item.response.payments.id), redirection_data: Box::new(None), mandate_reference: Box::new(None), @@ -771,17 +770,17 @@ pub struct RefundResponse { 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.id.to_string(), - refund_status: enums::RefundStatus::Pending, + refund_status: RefundStatus::Pending, }), ..item.data }) diff --git a/crates/router/src/connector/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs similarity index 69% rename from crates/router/src/connector/prophetpay.rs rename to crates/hyperswitch_connectors/src/connectors/prophetpay.rs index ef49e716d9a8..b6e16fc23579 100644 --- a/crates/router/src/connector/prophetpay.rs +++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs @@ -2,30 +2,47 @@ pub mod transformers; use std::fmt::Debug; +use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId}; use base64::Engine; -use common_utils::request::RequestContent; +use common_utils::{ + consts::BASE64_ENGINE, + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::{report, ResultExt}; -use masking::PeekInterface; -use transformers as prophetpay; - -use crate::{ - configs::settings, - consts, - 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}, + CompleteAuthorize, + }, + router_request_types::{ + AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData, + PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, + PaymentsSyncData, RefundsData, SetupMandateRequestData, }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCompleteAuthorizeRouterData, + PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, }, - utils::BytesExt, }; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, + errors, + events::connector_api_logs::ConnectorEvent, + types::{self, Response}, + webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, +}; +use masking::{Mask, PeekInterface}; +use transformers as prophetpay; + +use crate::{constants::headers, types::ResponseRouterData}; #[derive(Debug, Clone)] pub struct Prophetpay; @@ -43,12 +60,8 @@ impl api::RefundSync for Prophetpay {} impl api::PaymentToken for Prophetpay {} impl api::payments::PaymentsCompleteAuthorize for Prophetpay {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Prophetpay +impl ConnectorIntegration + for Prophetpay { // Not Implemented (R) } @@ -59,9 +72,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(), @@ -85,19 +98,19 @@ impl ConnectorCommon for Prophetpay { "application/json" } - fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.prophetpay.base_url.as_ref() } fn get_auth_header( &self, - auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { let auth = prophetpay::ProphetpayAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let auth_val = format!("{}:{}", auth.user_name.peek(), auth.password.peek()); - let basic_token = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_val)); + let basic_token = format!("Basic {}", BASE64_ENGINE.encode(auth_val)); Ok(vec![( headers::AUTHORIZATION.to_string(), @@ -120,8 +133,8 @@ impl ConnectorCommon for Prophetpay { Ok(ErrorResponse { status_code: res.status_code, - code: consts::NO_ERROR_CODE.to_string(), - message: consts::NO_ERROR_MESSAGE.to_string(), + code: NO_ERROR_CODE.to_string(), + message: NO_ERROR_MESSAGE.to_string(), reason: Some(response.to_string()), attempt_status: None, connector_transaction_id: None, @@ -133,33 +146,20 @@ impl ConnectorValidation for Prophetpay { //TODO: implement functions when support enabled } -impl ConnectorIntegration - for Prophetpay -{ +impl ConnectorIntegration for Prophetpay { //TODO: implement sessions flow } -impl ConnectorIntegration - for Prophetpay -{ -} +impl ConnectorIntegration for Prophetpay {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Prophetpay +impl ConnectorIntegration + for Prophetpay { 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 Prophetpay".to_string()) .into(), @@ -167,14 +167,12 @@ impl } } -impl ConnectorIntegration - for Prophetpay -{ +impl ConnectorIntegration for Prophetpay { 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) } @@ -184,8 +182,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}hp/api/HostedTokenize/CreateHostedTokenize", @@ -195,8 +193,8 @@ impl ConnectorIntegration CustomResult { let connector_router_data = prophetpay::ProphetpayRouterData::try_from(( &self.get_currency_unit(), @@ -211,12 +209,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, )?) @@ -233,12 +231,12 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult + ) -> CustomResult where - types::PaymentsResponseData: Clone, + PaymentsResponseData: Clone, { let response: prophetpay::ProphetpayTokenResponse = res .response @@ -248,7 +246,7 @@ impl ConnectorIntegration for Prophetpay +impl ConnectorIntegration + for Prophetpay { fn get_headers( &self, - req: &types::PaymentsCompleteAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCompleteAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } @@ -285,8 +279,8 @@ impl fn get_url( &self, - _req: &types::PaymentsCompleteAuthorizeRouterData, - connectors: &settings::Connectors, + _req: &PaymentsCompleteAuthorizeRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}hp/api/Transactions/ProcessTransaction", @@ -296,8 +290,8 @@ impl fn get_request_body( &self, - req: &types::PaymentsCompleteAuthorizeRouterData, - _connectors: &settings::Connectors, + req: &PaymentsCompleteAuthorizeRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_router_data = prophetpay::ProphetpayRouterData::try_from(( &self.get_currency_unit(), @@ -313,12 +307,12 @@ impl fn build_request( &self, - req: &types::PaymentsCompleteAuthorizeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &PaymentsCompleteAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsCompleteAuthorizeType::get_url( self, req, connectors, )?) @@ -335,12 +329,12 @@ impl fn handle_response( &self, - data: &types::PaymentsCompleteAuthorizeRouterData, + data: &PaymentsCompleteAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult + ) -> CustomResult where - types::PaymentsResponseData: Clone, + PaymentsResponseData: Clone, { let response: prophetpay::ProphetpayCompleteAuthResponse = res .response @@ -350,7 +344,7 @@ impl 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, @@ -366,14 +360,12 @@ impl } } -impl ConnectorIntegration - for Prophetpay -{ +impl ConnectorIntegration for Prophetpay { 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) } @@ -383,8 +375,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}hp/api/Transactions/ProcessTransaction", @@ -394,8 +386,8 @@ impl ConnectorIntegration CustomResult { let connector_req = prophetpay::ProphetpaySyncRequest::try_from(req)?; @@ -404,12 +396,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) @@ -422,10 +414,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: prophetpay::ProphetpaySyncResponse = res .response .parse_struct("prophetpay PaymentsSyncResponse") @@ -434,7 +426,7 @@ impl ConnectorIntegration - for Prophetpay -{ -} +impl ConnectorIntegration for Prophetpay {} // This is Void Implementation for Prophetpay // Since Prophetpay does not have capture this have been commented out but kept if it is required for future usage -impl ConnectorIntegration - for Prophetpay -{ +impl ConnectorIntegration for Prophetpay { /* fn get_headers( &self, @@ -497,9 +484,9 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + _req: &PaymentsCancelRouterData, + _connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("Void flow not implemented".to_string()).into()) } @@ -530,14 +517,12 @@ impl ConnectorIntegration - for Prophetpay -{ +impl ConnectorIntegration for Prophetpay { 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) } @@ -547,8 +532,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + _req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}hp/api/Transactions/ProcessTransaction", @@ -558,8 +543,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_router_data = prophetpay::ProphetpayRouterData::try_from(( &self.get_currency_unit(), @@ -573,11 +558,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( @@ -592,10 +577,10 @@ impl ConnectorIntegration, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: prophetpay::ProphetpayRefundResponse = res .response .parse_struct("prophetpay ProphetpayRefundResponse") @@ -604,7 +589,7 @@ impl ConnectorIntegration - for Prophetpay -{ +impl ConnectorIntegration for Prophetpay { 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) } @@ -637,8 +620,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}hp/api/Transactions/ProcessTransaction", @@ -648,8 +631,8 @@ impl ConnectorIntegration CustomResult { let connector_req = prophetpay::ProphetpayRefundSyncRequest::try_from(req)?; @@ -658,12 +641,12 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) + RequestBuilder::new() + .method(Method::Post) .url(&types::RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::RefundSyncType::get_headers(self, req, connectors)?) @@ -676,10 +659,10 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: prophetpay::ProphetpayRefundSyncResponse = res .response .parse_struct("prophetpay ProphetpayRefundResponse") @@ -688,7 +671,7 @@ impl ConnectorIntegration, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + _request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } 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/prophetpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs similarity index 83% rename from crates/router/src/connector/prophetpay/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs index 24bd4642c019..53f902ff4956 100644 --- a/crates/router/src/connector/prophetpay/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs @@ -1,17 +1,30 @@ use std::collections::HashMap; -use common_utils::{consts, errors::CustomResult}; +use common_enums::enums; +use common_utils::{ + consts::{PROPHETPAY_REDIRECT_URL, PROPHETPAY_TOKEN}, + errors::CustomResult, + request::Method, +}; use error_stack::ResultExt; +use hyperswitch_domain_models::{ + payment_method_data::{CardRedirectData, PaymentMethodData}, + router_data::{ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::refunds::Execute, + router_request_types::{ + CompleteAuthorizeData, CompleteAuthorizeRedirectResponse, PaymentsAuthorizeData, ResponseId, + }, + router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::{api, consts::NO_ERROR_CODE, errors}; use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; use url::Url; use crate::{ - connector::utils::{self, to_connector_meta}, - consts as const_val, - core::errors, - services, - types::{self, api, domain, storage::enums}, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{self, to_connector_meta}, }; pub struct ProphetpayRouterData { @@ -38,11 +51,11 @@ pub struct ProphetpayAuthType { pub(super) profile_id: Secret, } -impl TryFrom<&types::ConnectorAuthType> for ProphetpayAuthType { +impl TryFrom<&ConnectorAuthType> for ProphetpayAuthType { 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::SignatureKey { + ConnectorAuthType::SignatureKey { api_key, key1, api_secret, @@ -124,9 +137,7 @@ impl TryFrom<&ProphetpayRouterData<&types::PaymentsAuthorizeRouterData>> ) -> Result { if item.router_data.request.currency == api_models::enums::Currency::USD { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::CardRedirect( - domain::payments::CardRedirectData::CardRedirect {}, - ) => { + PaymentMethodData::CardRedirect(CardRedirectData::CardRedirect {}) => { let auth_data = ProphetpayAuthType::try_from(&item.router_data.connector_auth_type)?; Ok(Self { @@ -165,26 +176,21 @@ pub struct ProphetpayTokenResponse { impl TryFrom< - types::ResponseRouterData< - F, - ProphetpayTokenResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, - >, - > for types::RouterData + ResponseRouterData, + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, ProphetpayTokenResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, ) -> Result { let url_data = format!( "{}{}", - consts::PROPHETPAY_REDIRECT_URL, + PROPHETPAY_REDIRECT_URL, item.response.hosted_tokenize_id.expose() ); @@ -199,8 +205,8 @@ impl 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: Box::new(redirection_data), mandate_reference: Box::new(None), connector_metadata: None, @@ -217,7 +223,7 @@ impl fn get_redirect_url_form( mut redirect_url: Url, complete_auth_url: Option, -) -> CustomResult { +) -> CustomResult { let mut form_fields = HashMap::::new(); form_fields.insert( @@ -230,9 +236,9 @@ fn get_redirect_url_form( // Do not include query params in the endpoint redirect_url.set_query(None); - Ok(services::RedirectForm::Form { + Ok(RedirectForm::Form { endpoint: redirect_url.to_string(), - method: services::Method::Get, + method: Method::Get, form_fields, }) } @@ -271,7 +277,7 @@ impl TryFrom<&ProphetpayRouterData<&types::PaymentsCompleteAuthorizeRouterData>> } fn get_card_token( - response: Option, + response: Option, ) -> CustomResult { let res = response.ok_or(errors::ConnectorError::MissingRequiredField { field_name: "redirect_response", @@ -298,7 +304,7 @@ fn get_card_token( .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?; for (key, val) in queries_params { - if key.as_str() == consts::PROPHETPAY_TOKEN { + if key.as_str() == PROPHETPAY_TOKEN { return Ok(val); } } @@ -372,21 +378,21 @@ pub struct ProphetpayCardTokenData { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, ProphetpayCompleteAuthResponse, - types::CompleteAuthorizeData, - types::PaymentsResponseData, + CompleteAuthorizeData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, ProphetpayCompleteAuthResponse, - types::CompleteAuthorizeData, - types::PaymentsResponseData, + CompleteAuthorizeData, + PaymentsResponseData, >, ) -> Result { if item.response.success { @@ -397,10 +403,8 @@ impl let connector_metadata = serde_json::to_value(card_token_data).ok(); Ok(Self { status: enums::AttemptStatus::Charged, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.transaction_id, - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata, @@ -414,7 +418,7 @@ impl } else { Ok(Self { status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { + response: Err(ErrorResponse { code: item.response.response_code, message: item.response.response_text.clone(), reason: Some(item.response.response_text), @@ -437,21 +441,18 @@ pub struct ProphetpaySyncResponse { pub transaction_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 { if item.response.success { Ok(Self { status: enums::AttemptStatus::Charged, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.transaction_id, - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, @@ -465,8 +466,8 @@ impl } else { Ok(Self { status: enums::AttemptStatus::Failure, - response: Err(types::ErrorResponse { - code: const_val::NO_ERROR_CODE.to_string(), + response: Err(ErrorResponse { + code: NO_ERROR_CODE.to_string(), message: item.response.response_text.clone(), reason: Some(item.response.response_text), status_code: item.http_code, @@ -488,21 +489,18 @@ pub struct ProphetpayVoidResponse { pub transaction_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 { if item.response.success { Ok(Self { status: enums::AttemptStatus::Voided, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.transaction_id, - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.transaction_id), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, @@ -516,8 +514,8 @@ impl } else { Ok(Self { status: enums::AttemptStatus::VoidFailed, - response: Err(types::ErrorResponse { - code: const_val::NO_ERROR_CODE.to_string(), + response: Err(ErrorResponse { + code: NO_ERROR_CODE.to_string(), message: item.response.response_text.clone(), reason: Some(item.response.response_text), status_code: item.http_code, @@ -601,16 +599,16 @@ pub struct ProphetpayRefundResponse { pub tran_seq_number: 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 { if item.response.success { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { // no refund id is generated, tranSeqNumber is kept for future usage connector_refund_id: item.response.tran_seq_number.ok_or( errors::ConnectorError::MissingRequiredField { @@ -624,8 +622,8 @@ impl TryFrom TryFrom> +impl TryFrom> for types::RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { if item.response.success { Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { // no refund id is generated, rather transaction id is used for referring to status in refund also connector_refund_id: item.data.request.connector_transaction_id.clone(), refund_status: enums::RefundStatus::Success, @@ -664,8 +662,8 @@ impl TryFrom(&self, connectors: &'a settings::Connectors) -> &'a str { + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.rapyd.base_url.as_ref() } fn get_auth_header( &self, - _auth_type: &types::ConnectorAuthType, - ) -> CustomResult)>, errors::ConnectorError> { + _auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![]) } fn build_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { let response: Result< @@ -139,7 +155,7 @@ impl ConnectorValidation for Rapyd { 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()), ), } } @@ -149,39 +165,22 @@ impl api::ConnectorAccessToken for Rapyd {} impl api::PaymentToken for Rapyd {} -impl - services::ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Rapyd +impl ConnectorIntegration + for Rapyd { // Not Implemented (R) } -impl - services::ConnectorIntegration< - api::AccessTokenAuth, - types::AccessTokenRequestData, - types::AccessToken, - > for Rapyd -{ -} +impl ConnectorIntegration for Rapyd {} impl api::PaymentAuthorize for Rapyd {} -impl - services::ConnectorIntegration< - api::Authorize, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, - > for Rapyd -{ +impl ConnectorIntegration for Rapyd { fn get_headers( &self, - _req: &types::PaymentsAuthorizeRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + _req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![( headers::CONTENT_TYPE.to_string(), types::PaymentsAuthorizeType::get_content_type(self) @@ -196,16 +195,16 @@ impl fn get_url( &self, - _req: &types::PaymentsAuthorizeRouterData, - connectors: &settings::Connectors, + _req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}/v1/payments", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::PaymentsAuthorizeRouterData, - _connectors: &settings::Connectors, + req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, ) -> CustomResult { let amount = convert_amount( self.amount_converter, @@ -219,13 +218,9 @@ impl fn build_request( &self, - req: &types::RouterData< - api::Authorize, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, - >, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &RouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { let timestamp = date_time::now_unix_timestamp(); let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12); @@ -240,8 +235,8 @@ impl ("timestamp".to_string(), timestamp.to_string().into()), ("signature".to_string(), signature.into_masked()), ]; - let request = services::RequestBuilder::new() - .method(services::Method::Post) + let request = RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsAuthorizeType::get_url( self, req, connectors, )?) @@ -259,17 +254,17 @@ impl fn handle_response( &self, - data: &types::PaymentsAuthorizeRouterData, + data: &PaymentsAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: rapyd::RapydPaymentsResponse = res .response .parse_struct("Rapyd PaymentResponse") .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, @@ -279,7 +274,7 @@ impl fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -289,22 +284,12 @@ impl impl api::Payment for Rapyd {} impl api::MandateSetup for Rapyd {} -impl - services::ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Rapyd -{ +impl ConnectorIntegration for Rapyd { 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 Rapyd".to_string()) .into(), @@ -314,18 +299,12 @@ impl impl api::PaymentVoid for Rapyd {} -impl - services::ConnectorIntegration< - api::Void, - types::PaymentsCancelData, - types::PaymentsResponseData, - > for Rapyd -{ +impl ConnectorIntegration for Rapyd { fn get_headers( &self, - _req: &types::PaymentsCancelRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + _req: &PaymentsCancelRouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![( headers::CONTENT_TYPE.to_string(), types::PaymentsVoidType::get_content_type(self) @@ -340,8 +319,8 @@ impl fn get_url( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, + req: &PaymentsCancelRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}/v1/payments/{}", @@ -352,9 +331,9 @@ impl fn build_request( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { let timestamp = date_time::now_unix_timestamp(); let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12); @@ -369,8 +348,8 @@ impl ("timestamp".to_string(), timestamp.to_string().into()), ("signature".to_string(), signature.into_masked()), ]; - let request = services::RequestBuilder::new() - .method(services::Method::Delete) + let request = RequestBuilder::new() + .method(Method::Delete) .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) @@ -381,17 +360,17 @@ impl fn handle_response( &self, - data: &types::PaymentsCancelRouterData, + data: &PaymentsCancelRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: rapyd::RapydPaymentsResponse = res .response .parse_struct("Rapyd PaymentResponse") .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, @@ -401,7 +380,7 @@ impl fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -409,15 +388,12 @@ impl } impl api::PaymentSync for Rapyd {} -impl - services::ConnectorIntegration - for Rapyd -{ +impl ConnectorIntegration for Rapyd { fn get_headers( &self, - _req: &types::PaymentsSyncRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + _req: &PaymentsSyncRouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![( headers::CONTENT_TYPE.to_string(), types::PaymentsSyncType::get_content_type(self) @@ -432,8 +408,8 @@ impl fn get_url( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, + req: &PaymentsSyncRouterData, + connectors: &Connectors, ) -> CustomResult { let id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -446,9 +422,9 @@ impl fn build_request( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { let timestamp = date_time::now_unix_timestamp(); let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12); @@ -468,8 +444,8 @@ impl ("timestamp".to_string(), timestamp.to_string().into()), ("signature".to_string(), signature.into_masked()), ]; - let request = services::RequestBuilder::new() - .method(services::Method::Get) + let request = RequestBuilder::new() + .method(Method::Get) .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) @@ -480,7 +456,7 @@ impl fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -488,17 +464,17 @@ impl fn handle_response( &self, - data: &types::PaymentsSyncRouterData, + data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: rapyd::RapydPaymentsResponse = res .response .parse_struct("Rapyd PaymentResponse") .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, @@ -508,18 +484,12 @@ impl } impl api::PaymentCapture for Rapyd {} -impl - services::ConnectorIntegration< - api::Capture, - types::PaymentsCaptureData, - types::PaymentsResponseData, - > for Rapyd -{ +impl ConnectorIntegration for Rapyd { fn get_headers( &self, - _req: &types::PaymentsCaptureRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + _req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![( headers::CONTENT_TYPE.to_string(), types::PaymentsCaptureType::get_content_type(self) @@ -534,8 +504,8 @@ impl fn get_request_body( &self, - req: &types::PaymentsCaptureRouterData, - _connectors: &settings::Connectors, + req: &PaymentsCaptureRouterData, + _connectors: &Connectors, ) -> CustomResult { let amount = convert_amount( self.amount_converter, @@ -549,9 +519,9 @@ impl fn build_request( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { let timestamp = date_time::now_unix_timestamp(); let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12); @@ -570,8 +540,8 @@ impl ("timestamp".to_string(), timestamp.to_string().into()), ("signature".to_string(), signature.into_masked()), ]; - let request = services::RequestBuilder::new() - .method(services::Method::Post) + let request = RequestBuilder::new() + .method(Method::Post) .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsCaptureType::get_headers( @@ -587,10 +557,10 @@ impl fn handle_response( &self, - data: &types::PaymentsCaptureRouterData, + data: &PaymentsCaptureRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: rapyd::RapydPaymentsResponse = res .response .parse_struct("RapydPaymentResponse") @@ -599,7 +569,7 @@ impl 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, @@ -609,8 +579,8 @@ impl fn get_url( &self, - req: &types::PaymentsCaptureRouterData, - connectors: &settings::Connectors, + req: &PaymentsCaptureRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}/v1/payments/{}/capture", @@ -621,7 +591,7 @@ impl fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult { self.build_error_response(res, event_builder) @@ -630,13 +600,7 @@ impl impl api::PaymentSession for Rapyd {} -impl - services::ConnectorIntegration< - api::Session, - types::PaymentsSessionData, - types::PaymentsResponseData, - > for Rapyd -{ +impl ConnectorIntegration for Rapyd { //TODO: implement sessions flow } @@ -644,14 +608,12 @@ impl api::Refund for Rapyd {} impl api::RefundExecute for Rapyd {} impl api::RefundSync for Rapyd {} -impl services::ConnectorIntegration - for Rapyd -{ +impl ConnectorIntegration for Rapyd { fn get_headers( &self, - _req: &types::RefundsRouterData, - _connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + _req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { Ok(vec![( headers::CONTENT_TYPE.to_string(), types::RefundExecuteType::get_content_type(self) @@ -666,16 +628,16 @@ impl services::ConnectorIntegration, - connectors: &settings::Connectors, + _req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}/v1/refunds", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::RefundsRouterData, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let amount = convert_amount( self.amount_converter, @@ -690,9 +652,9 @@ impl services::ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { let timestamp = date_time::now_unix_timestamp(); let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12); @@ -707,8 +669,8 @@ impl services::ConnectorIntegration, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult, errors::ConnectorError> { + res: Response, + ) -> CustomResult, errors::ConnectorError> { let response: rapyd::RefundResponse = res .response .parse_struct("rapyd 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, @@ -741,30 +703,28 @@ impl services::ConnectorIntegration, ) -> CustomResult { self.build_error_response(res, event_builder) } } -impl services::ConnectorIntegration - for Rapyd -{ +impl ConnectorIntegration for Rapyd { // default implementation of build_request method will be executed fn handle_response( &self, - data: &types::RefundSyncRouterData, + data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: rapyd::RefundResponse = res .response .parse_struct("rapyd 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, @@ -774,21 +734,21 @@ impl services::ConnectorIntegration, + _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Ok(Box::new(crypto::HmacSha256)) } fn get_webhook_source_verification_signature( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult, errors::ConnectorError> { - let base64_signature = connector_utils::get_header_key_value("signature", request.headers)?; - let signature = consts::BASE64_ENGINE_URL_SAFE + let base64_signature = get_header_key_value("signature", request.headers)?; + let signature = BASE64_ENGINE_URL_SAFE .decode(base64_signature.as_bytes()) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; Ok(signature) @@ -796,18 +756,18 @@ impl api::IncomingWebhook for Rapyd { 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> { - let host = connector_utils::get_header_key_value("host", request.headers)?; + let host = get_header_key_value("host", request.headers)?; let connector = self.id(); let url_path = format!( "https://{host}/webhooks/{}/{connector}", merchant_id.get_string_repr() ); - let salt = connector_utils::get_header_key_value("salt", request.headers)?; - let timestamp = connector_utils::get_header_key_value("timestamp", request.headers)?; + let salt = get_header_key_value("salt", request.headers)?; + let timestamp = get_header_key_value("timestamp", request.headers)?; let stringify_auth = String::from_utf8(connector_webhook_secrets.secret.to_vec()) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Could not convert secret to UTF-8")?; @@ -830,7 +790,7 @@ impl api::IncomingWebhook for Rapyd { 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>, @@ -870,7 +830,7 @@ impl api::IncomingWebhook for Rapyd { fn get_webhook_object_reference_id( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult { let webhook: transformers::RapydIncomingWebhook = request .body @@ -900,8 +860,8 @@ impl api::IncomingWebhook for Rapyd { fn get_webhook_event_type( &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { let webhook: transformers::RapydIncomingWebhook = request .body .parse_struct("RapydIncomingWebhook") @@ -909,34 +869,32 @@ impl api::IncomingWebhook for Rapyd { Ok(match webhook.webhook_type { rapyd::RapydWebhookObjectEventType::PaymentCompleted | rapyd::RapydWebhookObjectEventType::PaymentCaptured => { - api::IncomingWebhookEvent::PaymentIntentSuccess + IncomingWebhookEvent::PaymentIntentSuccess } rapyd::RapydWebhookObjectEventType::PaymentFailed => { - api::IncomingWebhookEvent::PaymentIntentFailure + IncomingWebhookEvent::PaymentIntentFailure } rapyd::RapydWebhookObjectEventType::PaymentRefundFailed | rapyd::RapydWebhookObjectEventType::PaymentRefundRejected => { - api::IncomingWebhookEvent::RefundFailure + IncomingWebhookEvent::RefundFailure } rapyd::RapydWebhookObjectEventType::RefundCompleted => { - api::IncomingWebhookEvent::RefundSuccess + IncomingWebhookEvent::RefundSuccess } rapyd::RapydWebhookObjectEventType::PaymentDisputeCreated => { - api::IncomingWebhookEvent::DisputeOpened - } - rapyd::RapydWebhookObjectEventType::Unknown => { - api::IncomingWebhookEvent::EventNotSupported + IncomingWebhookEvent::DisputeOpened } + rapyd::RapydWebhookObjectEventType::Unknown => IncomingWebhookEvent::EventNotSupported, rapyd::RapydWebhookObjectEventType::PaymentDisputeUpdated => match webhook.data { - rapyd::WebhookData::Dispute(data) => api::IncomingWebhookEvent::from(data.status), - _ => api::IncomingWebhookEvent::EventNotSupported, + rapyd::WebhookData::Dispute(data) => IncomingWebhookEvent::from(data.status), + _ => IncomingWebhookEvent::EventNotSupported, }, }) } fn get_webhook_resource_object( &self, - request: &api::IncomingWebhookRequestDetails<'_>, + request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { let webhook: transformers::RapydIncomingWebhook = request .body @@ -962,8 +920,8 @@ impl api::IncomingWebhook for Rapyd { fn get_dispute_details( &self, - request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { + request: &IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { let webhook: transformers::RapydIncomingWebhook = request .body .parse_struct("RapydIncomingWebhook") @@ -972,7 +930,7 @@ impl api::IncomingWebhook for Rapyd { transformers::WebhookData::Dispute(dispute_data) => Ok(dispute_data), _ => Err(errors::ConnectorError::WebhookBodyDecodingFailed), }?; - Ok(api::disputes::DisputePayload { + Ok(DisputePayload { amount: webhook_dispute_data.amount.to_string(), currency: webhook_dispute_data.currency, dispute_stage: api_models::enums::DisputeStage::Dispute, diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs similarity index 82% rename from crates/router/src/connector/rapyd/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs index b83ffcec4124..4f9f276c1913 100644 --- a/crates/router/src/connector/rapyd/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs @@ -1,17 +1,23 @@ -use common_utils::types::MinorUnit; +use common_enums::enums; +use common_utils::{ext_traits::OptionExt, request::Method, types::MinorUnit}; use error_stack::ResultExt; +use hyperswitch_domain_models::{ + payment_method_data::{PaymentMethodData, WalletData}, + router_data::{ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::ResponseId, + router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, + types, +}; +use hyperswitch_interfaces::{consts::NO_ERROR_CODE, errors}; +use masking::Secret; use serde::{Deserialize, Serialize}; use time::PrimitiveDateTime; use url::Url; use crate::{ - connector::utils::{PaymentsAuthorizeRequestData, RouterData}, - consts, - core::errors, - pii::Secret, - services, - types::{self, api, domain, storage::enums, transformers::ForeignFrom}, - utils::OptionExt, + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::{PaymentsAuthorizeRequestData, RouterData as _}, }; #[derive(Debug, Serialize)] @@ -92,7 +98,7 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay item: &RapydRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result { let (capture, payment_method_options) = match item.router_data.payment_method { - diesel_models::enums::PaymentMethod::Card => { + enums::PaymentMethod::Card => { let three_ds_enabled = matches!( item.router_data.auth_type, enums::AuthenticationType::ThreeDs @@ -111,7 +117,7 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay _ => (None, None), }; let payment_method = match item.router_data.request.payment_method_data { - domain::PaymentMethodData::Card(ref ccard) => { + PaymentMethodData::Card(ref ccard) => { Some(PaymentMethod { pm_type: "in_amex_card".to_owned(), //[#369] Map payment method type based on country fields: Some(PaymentFields { @@ -129,13 +135,13 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay digital_wallet: None, }) } - domain::PaymentMethodData::Wallet(ref wallet_data) => { + PaymentMethodData::Wallet(ref wallet_data) => { let digital_wallet = match wallet_data { - domain::WalletData::GooglePay(data) => Some(RapydWallet { + WalletData::GooglePay(data) => Some(RapydWallet { payment_type: "google_pay".to_string(), token: Some(Secret::new(data.tokenization_data.token.to_owned())), }), - domain::WalletData::ApplePay(data) => Some(RapydWallet { + WalletData::ApplePay(data) => Some(RapydWallet { payment_type: "apple_pay".to_string(), token: Some(Secret::new(data.payment_data.to_string())), }), @@ -175,10 +181,10 @@ pub struct RapydAuthType { pub secret_key: Secret, } -impl TryFrom<&types::ConnectorAuthType> for RapydAuthType { +impl TryFrom<&ConnectorAuthType> for RapydAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - if let types::ConnectorAuthType::BodyKey { api_key, key1 } = auth_type { + fn try_from(auth_type: &ConnectorAuthType) -> Result { + if let ConnectorAuthType::BodyKey { api_key, key1 } = auth_type { Ok(Self { access_key: api_key.to_owned(), secret_key: key1.to_owned(), @@ -209,28 +215,24 @@ pub enum RapydPaymentStatus { New, } -impl ForeignFrom<(RapydPaymentStatus, NextAction)> for enums::AttemptStatus { - fn foreign_from(item: (RapydPaymentStatus, NextAction)) -> Self { - let (status, next_action) = item; - match (status, next_action) { - (RapydPaymentStatus::Closed, _) => Self::Charged, - ( - RapydPaymentStatus::Active, - NextAction::ThreedsVerification | NextAction::PendingConfirmation, - ) => Self::AuthenticationPending, - ( - RapydPaymentStatus::Active, - NextAction::PendingCapture | NextAction::NotApplicable, - ) => Self::Authorized, - ( - RapydPaymentStatus::CanceledByClientOrBank - | RapydPaymentStatus::Expired - | RapydPaymentStatus::ReversedByRapyd, - _, - ) => Self::Voided, - (RapydPaymentStatus::Error, _) => Self::Failure, - (RapydPaymentStatus::New, _) => Self::Authorizing, +fn get_status(status: RapydPaymentStatus, next_action: NextAction) -> enums::AttemptStatus { + match (status, next_action) { + (RapydPaymentStatus::Closed, _) => enums::AttemptStatus::Charged, + ( + RapydPaymentStatus::Active, + NextAction::ThreedsVerification | NextAction::PendingConfirmation, + ) => enums::AttemptStatus::AuthenticationPending, + (RapydPaymentStatus::Active, NextAction::PendingCapture | NextAction::NotApplicable) => { + enums::AttemptStatus::Authorized } + ( + RapydPaymentStatus::CanceledByClientOrBank + | RapydPaymentStatus::Expired + | RapydPaymentStatus::ReversedByRapyd, + _, + ) => enums::AttemptStatus::Voided, + (RapydPaymentStatus::Error, _) => enums::AttemptStatus::Failure, + (RapydPaymentStatus::New, _) => enums::AttemptStatus::Authorizing, } } @@ -357,12 +359,12 @@ pub struct RefundResponseData { pub failure_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 (connector_refund_id, refund_status) = match item.response.data { Some(data) => (data.id, enums::RefundStatus::from(data.status)), @@ -372,7 +374,7 @@ impl TryFrom> ), }; Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id, refund_status, }), @@ -381,12 +383,10 @@ impl TryFrom> } } -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 (connector_refund_id, refund_status) = match item.response.data { Some(data) => (data.id, enums::RefundStatus::from(data.status)), @@ -396,7 +396,7 @@ impl TryFrom> ), }; Ok(Self { - response: Ok(types::RefundsResponseData { + response: Ok(RefundsResponseData { connector_refund_id, refund_status, }), @@ -425,24 +425,21 @@ impl TryFrom<&RapydRouterData<&types::PaymentsCaptureRouterData>> for CaptureReq } } -impl - TryFrom> - for types::RouterData +impl TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData, + item: ResponseRouterData, ) -> Result { let (status, response) = match &item.response.data { Some(data) => { - let attempt_status = enums::AttemptStatus::foreign_from(( - data.status.to_owned(), - data.next_action.to_owned(), - )); + let attempt_status = + get_status(data.status.to_owned(), data.next_action.to_owned()); match attempt_status { - diesel_models::enums::AttemptStatus::Failure => ( + enums::AttemptStatus::Failure => ( enums::AttemptStatus::Failure, - Err(types::ErrorResponse { + Err(ErrorResponse { code: data .failure_code .to_owned() @@ -466,15 +463,13 @@ impl }) .transpose()?; - let redirection_data = redirection_url - .map(|url| services::RedirectForm::from((url, services::Method::Get))); + let redirection_data = + redirection_url.map(|url| RedirectForm::from((url, Method::Get))); ( attempt_status, - Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - data.id.to_owned(), - ), //transaction_id is also the field but this id is used to initiate a refund + Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(data.id.to_owned()), //transaction_id is also the field but this id is used to initiate a refund redirection_data: Box::new(redirection_data), mandate_reference: Box::new(None), connector_metadata: None, @@ -491,7 +486,7 @@ impl } None => ( enums::AttemptStatus::Failure, - Err(types::ErrorResponse { + Err(ErrorResponse { code: item.response.status.error_code, status_code: item.http_code, message: item.response.status.status.unwrap_or_default(), @@ -574,7 +569,7 @@ impl From for RapydPaymentsResponse { fn from(value: ResponseData) -> Self { Self { status: Status { - error_code: consts::NO_ERROR_CODE.to_owned(), + error_code: NO_ERROR_CODE.to_owned(), status: None, message: None, response_code: None, @@ -589,7 +584,7 @@ impl From for RefundResponse { fn from(value: RefundResponseData) -> Self { Self { status: Status { - error_code: consts::NO_ERROR_CODE.to_owned(), + error_code: NO_ERROR_CODE.to_owned(), status: None, message: None, response_code: None, diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs index 25306458e8f7..b39f50bfe18f 100644 --- a/crates/hyperswitch_connectors/src/default_implementations.rs +++ b/crates/hyperswitch_connectors/src/default_implementations.rs @@ -92,8 +92,10 @@ default_imp_for_authorize_session_token!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -106,6 +108,7 @@ default_imp_for_authorize_session_token!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -116,8 +119,10 @@ default_imp_for_authorize_session_token!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -151,8 +156,10 @@ default_imp_for_calculate_tax!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -165,6 +172,7 @@ default_imp_for_calculate_tax!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -177,6 +185,8 @@ default_imp_for_calculate_tax!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -210,8 +220,10 @@ default_imp_for_session_update!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -224,6 +236,7 @@ default_imp_for_session_update!( connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -240,12 +253,14 @@ default_imp_for_session_update!( connectors::Payu, connectors::Fiuu, connectors::Globepay, + connectors::Gocardless, connectors::Worldline, connectors::Worldpay, connectors::Xendit, connectors::Zen, connectors::Zsl, connectors::Powertranz, + connectors::Prophetpay, connectors::Thunes, connectors::Tsys, connectors::Deutschebank, @@ -270,7 +285,9 @@ default_imp_for_post_session_tokens!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Bitpay, + connectors::Boku, connectors::Billwerk, connectors::Cashtocode, connectors::Coinbase, @@ -285,6 +302,7 @@ default_imp_for_post_session_tokens!( connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -300,10 +318,12 @@ default_imp_for_post_session_tokens!( connectors::Payu, connectors::Fiuu, connectors::Globepay, + connectors::Gocardless, connectors::Worldline, connectors::Worldpay, connectors::Xendit, connectors::Powertranz, + connectors::Prophetpay, connectors::Thunes, connectors::Tsys, connectors::Deutschebank, @@ -330,8 +350,10 @@ macro_rules! default_imp_for_complete_authorize { default_imp_for_complete_authorize!( connectors::Amazonpay, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -342,6 +364,7 @@ default_imp_for_complete_authorize!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -351,6 +374,7 @@ default_imp_for_complete_authorize!( connectors::Nexinets, connectors::Payeezy, connectors::Payu, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Stax, @@ -384,8 +408,10 @@ default_imp_for_incremental_authorization!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -398,6 +424,7 @@ default_imp_for_incremental_authorization!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -408,8 +435,10 @@ default_imp_for_incremental_authorization!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -445,8 +474,10 @@ default_imp_for_create_customer!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -471,6 +502,8 @@ default_imp_for_create_customer!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -507,6 +540,8 @@ default_imp_for_connector_redirect_response!( connectors::Amazonpay, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, + connectors::Bamboraapac, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -518,6 +553,7 @@ default_imp_for_connector_redirect_response!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -528,6 +564,8 @@ default_imp_for_connector_redirect_response!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -560,8 +598,10 @@ macro_rules! default_imp_for_pre_processing_steps{ default_imp_for_pre_processing_steps!( connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -583,8 +623,10 @@ default_imp_for_pre_processing_steps!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Stax, @@ -619,8 +661,10 @@ default_imp_for_post_processing_steps!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -633,6 +677,7 @@ default_imp_for_post_processing_steps!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -643,8 +688,10 @@ default_imp_for_post_processing_steps!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -680,8 +727,10 @@ default_imp_for_approve!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -694,6 +743,7 @@ default_imp_for_approve!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -704,8 +754,10 @@ default_imp_for_approve!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -741,8 +793,10 @@ default_imp_for_reject!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -755,6 +809,7 @@ default_imp_for_reject!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -765,8 +820,10 @@ default_imp_for_reject!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -802,8 +859,10 @@ default_imp_for_webhook_source_verification!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -816,6 +875,7 @@ default_imp_for_webhook_source_verification!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -826,8 +886,10 @@ default_imp_for_webhook_source_verification!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -864,8 +926,10 @@ default_imp_for_accept_dispute!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -878,6 +942,7 @@ default_imp_for_accept_dispute!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -888,8 +953,10 @@ default_imp_for_accept_dispute!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -925,8 +992,10 @@ default_imp_for_submit_evidence!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -939,6 +1008,7 @@ default_imp_for_submit_evidence!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -949,8 +1019,10 @@ default_imp_for_submit_evidence!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -986,8 +1058,10 @@ default_imp_for_defend_dispute!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1000,6 +1074,7 @@ default_imp_for_defend_dispute!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Inespay, connectors::Jpmorgan, connectors::Helcim, @@ -1010,8 +1085,10 @@ default_imp_for_defend_dispute!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1056,8 +1133,10 @@ default_imp_for_file_upload!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1070,6 +1149,7 @@ default_imp_for_file_upload!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1080,8 +1160,10 @@ default_imp_for_file_upload!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1110,8 +1192,10 @@ default_imp_for_payouts!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Cryptopay, connectors::Coinbase, @@ -1124,6 +1208,7 @@ default_imp_for_payouts!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1136,6 +1221,8 @@ default_imp_for_payouts!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1172,8 +1259,10 @@ default_imp_for_payouts_create!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1186,6 +1275,7 @@ default_imp_for_payouts_create!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1196,8 +1286,10 @@ default_imp_for_payouts_create!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1235,8 +1327,10 @@ default_imp_for_payouts_retrieve!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1249,6 +1343,7 @@ default_imp_for_payouts_retrieve!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1259,8 +1354,10 @@ default_imp_for_payouts_retrieve!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1298,8 +1395,10 @@ default_imp_for_payouts_eligibility!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1312,6 +1411,7 @@ default_imp_for_payouts_eligibility!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1322,8 +1422,10 @@ default_imp_for_payouts_eligibility!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1361,8 +1463,10 @@ default_imp_for_payouts_fulfill!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1375,6 +1479,7 @@ default_imp_for_payouts_fulfill!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1385,8 +1490,10 @@ default_imp_for_payouts_fulfill!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1424,8 +1531,10 @@ default_imp_for_payouts_cancel!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1438,6 +1547,7 @@ default_imp_for_payouts_cancel!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1448,8 +1558,10 @@ default_imp_for_payouts_cancel!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1487,8 +1599,10 @@ default_imp_for_payouts_quote!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1501,6 +1615,7 @@ default_imp_for_payouts_quote!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1511,8 +1626,10 @@ default_imp_for_payouts_quote!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1550,8 +1667,10 @@ default_imp_for_payouts_recipient!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1564,6 +1683,7 @@ default_imp_for_payouts_recipient!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1574,8 +1694,10 @@ default_imp_for_payouts_recipient!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1613,8 +1735,10 @@ default_imp_for_payouts_recipient_account!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1627,6 +1751,7 @@ default_imp_for_payouts_recipient_account!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1637,8 +1762,10 @@ default_imp_for_payouts_recipient_account!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1676,8 +1803,10 @@ default_imp_for_frm_sale!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1690,6 +1819,7 @@ default_imp_for_frm_sale!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1700,8 +1830,10 @@ default_imp_for_frm_sale!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1739,8 +1871,10 @@ default_imp_for_frm_checkout!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1753,6 +1887,7 @@ default_imp_for_frm_checkout!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1763,8 +1898,10 @@ default_imp_for_frm_checkout!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1802,8 +1939,10 @@ default_imp_for_frm_transaction!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1816,6 +1955,7 @@ default_imp_for_frm_transaction!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1826,8 +1966,10 @@ default_imp_for_frm_transaction!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1865,8 +2007,10 @@ default_imp_for_frm_fulfillment!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1879,6 +2023,7 @@ default_imp_for_frm_fulfillment!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1889,8 +2034,10 @@ default_imp_for_frm_fulfillment!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1928,8 +2075,10 @@ default_imp_for_frm_record_return!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1942,6 +2091,7 @@ default_imp_for_frm_record_return!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1952,8 +2102,10 @@ default_imp_for_frm_record_return!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1988,8 +2140,10 @@ default_imp_for_revoking_mandates!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -2002,6 +2156,7 @@ default_imp_for_revoking_mandates!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -2012,8 +2167,10 @@ default_imp_for_revoking_mandates!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs index 6a30a180fe7b..60e14ca35957 100644 --- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs +++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs @@ -208,8 +208,10 @@ default_imp_for_new_connector_integration_payment!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -222,6 +224,7 @@ default_imp_for_new_connector_integration_payment!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -232,8 +235,10 @@ default_imp_for_new_connector_integration_payment!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -270,8 +275,10 @@ default_imp_for_new_connector_integration_refund!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -284,6 +291,7 @@ default_imp_for_new_connector_integration_refund!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -294,8 +302,10 @@ default_imp_for_new_connector_integration_refund!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -327,8 +337,10 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -341,6 +353,7 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -351,8 +364,10 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -390,8 +405,10 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -404,6 +421,7 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -414,8 +432,10 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -452,8 +472,10 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -466,6 +488,7 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -476,8 +499,10 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -514,8 +539,10 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -528,6 +555,7 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -538,8 +566,10 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -586,8 +616,10 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -600,6 +632,7 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -610,8 +643,10 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -650,8 +685,10 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -664,6 +701,7 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -674,8 +712,10 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -714,8 +754,10 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -728,6 +770,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -738,8 +781,10 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -778,8 +823,10 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -792,6 +839,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -802,8 +850,10 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -842,8 +892,10 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -856,6 +908,7 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -866,8 +919,10 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -906,8 +961,10 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -920,6 +977,7 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -930,8 +988,10 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -970,8 +1030,10 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -984,6 +1046,7 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -994,8 +1057,10 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1034,8 +1099,10 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1048,6 +1115,7 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1058,8 +1126,10 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1098,8 +1168,10 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1112,6 +1184,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1122,8 +1195,10 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1160,8 +1235,10 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1174,6 +1251,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1184,8 +1262,10 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1224,8 +1304,10 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1238,6 +1320,7 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1248,8 +1331,10 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1288,8 +1373,10 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1302,6 +1389,7 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1312,8 +1400,10 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1352,8 +1442,10 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1366,6 +1458,7 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1376,8 +1469,10 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1416,8 +1511,10 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1430,6 +1527,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1440,8 +1538,10 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1480,8 +1580,10 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1494,6 +1596,7 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1504,8 +1607,10 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, @@ -1541,8 +1646,10 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Airwallex, connectors::Amazonpay, connectors::Bambora, + connectors::Bamboraapac, connectors::Billwerk, connectors::Bitpay, + connectors::Boku, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -1555,6 +1662,7 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Fiuu, connectors::Forte, connectors::Globepay, + connectors::Gocardless, connectors::Helcim, connectors::Inespay, connectors::Jpmorgan, @@ -1565,8 +1673,10 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Payeezy, connectors::Payu, connectors::Powertranz, + connectors::Prophetpay, connectors::Mollie, connectors::Multisafepay, + connectors::Rapyd, connectors::Razorpay, connectors::Redsys, connectors::Shift4, diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index cef71610cb4b..0fbc60e88dc2 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -22,7 +22,7 @@ use hyperswitch_domain_models::{ ApplePayPredecryptData, ErrorResponse, PaymentMethodToken, RecurringMandatePaymentData, }, router_request_types::{ - AuthenticationData, BrowserInformation, CompleteAuthorizeData, + AuthenticationData, BrowserInformation, CompleteAuthorizeData, ConnectorCustomerData, PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsPreProcessingData, PaymentsSyncData, RefundsData, ResponseId, SetupMandateRequestData, @@ -1139,6 +1139,15 @@ impl PhoneDetailsData for PhoneDetails { } } +pub trait CustomerData { + fn get_email(&self) -> Result; +} + +impl CustomerData for ConnectorCustomerData { + fn get_email(&self) -> Result { + self.email.clone().ok_or_else(missing_field_err("email")) + } +} pub trait PaymentsAuthorizeRequestData { fn get_optional_language_from_browser_info(&self) -> Option; fn is_auto_capture(&self) -> Result; diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index f6e1f0efc69f..dde06fe832fc 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -91,7 +91,6 @@ rdkafka = "0.36.2" regex = "1.10.4" reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "multipart"] } ring = "0.17.8" -roxmltree = "0.19.0" rust_decimal = { version = "1.35.0", features = ["serde-with-float", "serde-with-str"] } rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" } rustc-hash = "1.1.0" diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs index 5874f4ba463b..1f67c1f75d76 100644 --- a/crates/router/src/connector.rs +++ b/crates/router/src/connector.rs @@ -2,10 +2,8 @@ pub mod aci; pub mod adyen; pub mod adyenplatform; pub mod authorizedotnet; -pub mod bamboraapac; pub mod bankofamerica; pub mod bluesnap; -pub mod boku; pub mod braintree; pub mod checkout; pub mod cybersource; @@ -14,7 +12,6 @@ pub mod datatrans; pub mod dummyconnector; pub mod ebanx; pub mod globalpay; -pub mod gocardless; pub mod gpayments; pub mod iatapay; pub mod itaubank; @@ -32,8 +29,6 @@ pub mod payone; pub mod paypal; pub mod placetopay; pub mod plaid; -pub mod prophetpay; -pub mod rapyd; pub mod riskified; pub mod signifyd; pub mod stripe; @@ -46,32 +41,32 @@ pub mod wise; pub use hyperswitch_connectors::connectors::{ airwallex, airwallex::Airwallex, amazonpay, amazonpay::Amazonpay, bambora, bambora::Bambora, - billwerk, billwerk::Billwerk, bitpay, bitpay::Bitpay, cashtocode, cashtocode::Cashtocode, - coinbase, coinbase::Coinbase, cryptopay, cryptopay::Cryptopay, deutschebank, - deutschebank::Deutschebank, digitalvirgo, digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, - elavon, elavon::Elavon, fiserv, fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, - fiuu::Fiuu, forte, forte::Forte, globepay, globepay::Globepay, helcim, helcim::Helcim, inespay, - inespay::Inespay, jpmorgan, jpmorgan::Jpmorgan, mollie, mollie::Mollie, multisafepay, + bamboraapac, bamboraapac::Bamboraapac, billwerk, billwerk::Billwerk, bitpay, bitpay::Bitpay, + boku, boku::Boku, cashtocode, cashtocode::Cashtocode, coinbase, coinbase::Coinbase, cryptopay, + cryptopay::Cryptopay, deutschebank, deutschebank::Deutschebank, digitalvirgo, + digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, elavon, elavon::Elavon, fiserv, + fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, forte, forte::Forte, + globepay, globepay::Globepay, gocardless, gocardless::Gocardless, helcim, helcim::Helcim, + inespay, inespay::Inespay, jpmorgan, jpmorgan::Jpmorgan, mollie, mollie::Mollie, multisafepay, multisafepay::Multisafepay, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, nomupay, nomupay::Nomupay, novalnet, novalnet::Novalnet, payeezy, payeezy::Payeezy, payu, - payu::Payu, powertranz, powertranz::Powertranz, razorpay, razorpay::Razorpay, redsys, - redsys::Redsys, shift4, shift4::Shift4, square, square::Square, stax, stax::Stax, taxjar, - taxjar::Taxjar, thunes, thunes::Thunes, tsys, tsys::Tsys, volt, volt::Volt, worldline, - worldline::Worldline, worldpay, worldpay::Worldpay, xendit, xendit::Xendit, zen, zen::Zen, zsl, - zsl::Zsl, + payu::Payu, powertranz, powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, + rapyd::Rapyd, razorpay, razorpay::Razorpay, redsys, redsys::Redsys, shift4, shift4::Shift4, + square, square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, thunes, thunes::Thunes, tsys, + tsys::Tsys, volt, volt::Volt, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, + xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl, }; #[cfg(feature = "dummy_connector")] pub use self::dummyconnector::DummyConnector; pub use self::{ aci::Aci, adyen::Adyen, adyenplatform::Adyenplatform, authorizedotnet::Authorizedotnet, - bamboraapac::Bamboraapac, bankofamerica::Bankofamerica, bluesnap::Bluesnap, boku::Boku, - braintree::Braintree, checkout::Checkout, cybersource::Cybersource, datatrans::Datatrans, - ebanx::Ebanx, globalpay::Globalpay, gocardless::Gocardless, gpayments::Gpayments, - iatapay::Iatapay, itaubank::Itaubank, klarna::Klarna, mifinity::Mifinity, 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, riskified::Riskified, signifyd::Signifyd, stripe::Stripe, + bankofamerica::Bankofamerica, bluesnap::Bluesnap, braintree::Braintree, checkout::Checkout, + cybersource::Cybersource, datatrans::Datatrans, ebanx::Ebanx, globalpay::Globalpay, + gpayments::Gpayments, iatapay::Iatapay, itaubank::Itaubank, klarna::Klarna, mifinity::Mifinity, + netcetera::Netcetera, nmi::Nmi, noon::Noon, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, + paybox::Paybox, payme::Payme, payone::Payone, paypal::Paypal, placetopay::Placetopay, + plaid::Plaid, riskified::Riskified, signifyd::Signifyd, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay, wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, }; diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs index 9b02c67ce6a7..2c02b8b14836 100644 --- a/crates/router/src/consts.rs +++ b/crates/router/src/consts.rs @@ -52,9 +52,6 @@ pub(crate) const DEFAULT_NOTIFICATION_SCRIPT_LANGUAGE: &str = "en-US"; pub(crate) const BASE64_ENGINE: base64::engine::GeneralPurpose = consts::BASE64_ENGINE; -pub(crate) const BASE64_ENGINE_URL_SAFE: base64::engine::GeneralPurpose = - base64::engine::general_purpose::URL_SAFE; - pub(crate) const API_KEY_LENGTH: usize = 64; // Apple Pay validation url 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 8afd019d0801..7aeca55592a1 100644 --- a/crates/router/src/core/payments/connector_integration_v2_impls.rs +++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs @@ -694,17 +694,14 @@ default_imp_for_new_connector_integration_payment!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -721,8 +718,6 @@ default_imp_for_new_connector_integration_payment!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -755,17 +750,14 @@ default_imp_for_new_connector_integration_refund!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -782,8 +774,6 @@ default_imp_for_new_connector_integration_refund!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -810,17 +800,14 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -837,8 +824,6 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -887,17 +872,14 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -914,8 +896,6 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -946,17 +926,14 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -973,8 +950,6 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -989,17 +964,14 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1016,8 +988,6 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1059,17 +1029,14 @@ default_imp_for_new_connector_integration_file_upload!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1086,8 +1053,6 @@ default_imp_for_new_connector_integration_file_upload!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1138,7 +1103,6 @@ default_imp_for_new_connector_integration_payouts!( connector::Forte, connector::Globalpay, connector::Globepay, - connector::Gocardless, connector::Gpayments, connector::Helcim, connector::Iatapay, @@ -1167,7 +1131,6 @@ default_imp_for_new_connector_integration_payouts!( connector::Payu, connector::Placetopay, connector::Powertranz, - connector::Prophetpay, connector::Rapyd, connector::Razorpay, connector::Redsys, @@ -1214,17 +1177,14 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1241,8 +1201,6 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1276,17 +1234,14 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1303,8 +1258,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1338,17 +1291,14 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1365,8 +1315,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1400,17 +1348,14 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1427,8 +1372,6 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1462,17 +1405,14 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1489,8 +1429,6 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1524,17 +1462,14 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1551,8 +1486,6 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1586,17 +1519,14 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1613,8 +1543,6 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1648,17 +1576,14 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1675,8 +1600,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1708,17 +1631,14 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1735,8 +1655,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1787,7 +1705,6 @@ default_imp_for_new_connector_integration_frm!( connector::Fiuu, connector::Globalpay, connector::Globepay, - connector::Gocardless, connector::Gpayments, connector::Helcim, connector::Iatapay, @@ -1816,7 +1733,6 @@ default_imp_for_new_connector_integration_frm!( connector::Payu, connector::Placetopay, connector::Powertranz, - connector::Prophetpay, connector::Rapyd, connector::Razorpay, connector::Redsys, @@ -1863,17 +1779,14 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1890,8 +1803,6 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1925,17 +1836,14 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1952,8 +1860,6 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1987,17 +1893,14 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2014,8 +1917,6 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2049,17 +1950,14 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2076,8 +1974,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2111,17 +2007,14 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2138,8 +2031,6 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2170,17 +2061,14 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2197,8 +2085,6 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Payone, connector::Paypal, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs index df319724bc40..45fe296e8edb 100644 --- a/crates/router/src/core/payments/flows.rs +++ b/crates/router/src/core/payments/flows.rs @@ -207,13 +207,10 @@ default_imp_for_complete_authorize!( connector::Adyenplatform, connector::Aci, connector::Adyen, - connector::Bamboraapac, connector::Bankofamerica, - connector::Boku, connector::Checkout, connector::Datatrans, connector::Ebanx, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -226,7 +223,6 @@ default_imp_for_complete_authorize!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -267,17 +263,14 @@ default_imp_for_webhook_source_verification!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, connector::Braintree, - connector::Boku, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -294,8 +287,6 @@ default_imp_for_webhook_source_verification!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -338,10 +329,8 @@ default_imp_for_create_customer!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, @@ -365,8 +354,6 @@ default_imp_for_create_customer!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -409,13 +396,10 @@ default_imp_for_connector_redirect_response!( connector::Adyenplatform, connector::Aci, connector::Adyen, - connector::Bamboraapac, connector::Bankofamerica, - connector::Boku, connector::Cybersource, connector::Datatrans, connector::Ebanx, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -427,8 +411,6 @@ default_imp_for_connector_redirect_response!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -566,16 +548,13 @@ default_imp_for_accept_dispute!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -593,8 +572,6 @@ default_imp_for_accept_dispute!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -658,16 +635,13 @@ default_imp_for_file_upload!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -684,8 +658,6 @@ default_imp_for_file_upload!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -727,16 +699,13 @@ default_imp_for_submit_evidence!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -753,8 +722,6 @@ default_imp_for_submit_evidence!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -796,16 +763,13 @@ default_imp_for_defend_dispute!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -822,8 +786,6 @@ default_imp_for_defend_dispute!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -881,10 +843,8 @@ default_imp_for_pre_processing_steps!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Datatrans, @@ -903,8 +863,6 @@ default_imp_for_pre_processing_steps!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -930,7 +888,6 @@ default_imp_for_post_processing_steps!( connector::Adyen, connector::Bankofamerica, connector::Cybersource, - connector::Gocardless, connector::Nmi, connector::Nuvei, connector::Payme, @@ -939,9 +896,7 @@ default_imp_for_post_processing_steps!( connector::Trustpay, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Datatrans, @@ -959,8 +914,6 @@ default_imp_for_post_processing_steps!( connector::Paybox, connector::Payone, connector::Placetopay, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -983,15 +936,12 @@ impl Payouts for connector::DummyConnector {} default_imp_for_payouts!( connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1007,8 +957,6 @@ default_imp_for_payouts!( connector::Payme, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -1049,16 +997,13 @@ default_imp_for_payouts_create!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1075,8 +1020,6 @@ default_imp_for_payouts_create!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -1118,17 +1061,14 @@ default_imp_for_payouts_retrieve!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1145,8 +1085,6 @@ default_imp_for_payouts_retrieve!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1192,16 +1130,13 @@ default_imp_for_payouts_eligibility!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1219,8 +1154,6 @@ default_imp_for_payouts_eligibility!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1261,15 +1194,12 @@ impl default_imp_for_payouts_fulfill!( connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1285,8 +1215,6 @@ default_imp_for_payouts_fulfill!( connector::Payme, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -1327,16 +1255,13 @@ default_imp_for_payouts_cancel!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1354,8 +1279,6 @@ default_imp_for_payouts_cancel!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -1397,16 +1320,13 @@ default_imp_for_payouts_quote!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1424,8 +1344,6 @@ default_imp_for_payouts_quote!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1468,16 +1386,13 @@ default_imp_for_payouts_recipient!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1495,8 +1410,6 @@ default_imp_for_payouts_recipient!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -1541,17 +1454,14 @@ default_imp_for_payouts_recipient_account!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1569,8 +1479,6 @@ default_imp_for_payouts_recipient_account!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Threedsecureio, @@ -1612,17 +1520,14 @@ default_imp_for_approve!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1640,8 +1545,6 @@ default_imp_for_approve!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1684,17 +1587,14 @@ default_imp_for_reject!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1712,8 +1612,6 @@ default_imp_for_reject!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -1853,17 +1751,14 @@ default_imp_for_frm_sale!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1881,8 +1776,6 @@ default_imp_for_frm_sale!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Stripe, connector::Threedsecureio, connector::Trustpay, @@ -1925,17 +1818,14 @@ default_imp_for_frm_checkout!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -1953,8 +1843,6 @@ default_imp_for_frm_checkout!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Stripe, connector::Threedsecureio, connector::Trustpay, @@ -1997,17 +1885,14 @@ default_imp_for_frm_transaction!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2025,8 +1910,6 @@ default_imp_for_frm_transaction!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Stripe, connector::Threedsecureio, connector::Trustpay, @@ -2069,17 +1952,14 @@ default_imp_for_frm_fulfillment!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2097,8 +1977,6 @@ default_imp_for_frm_fulfillment!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Stripe, connector::Threedsecureio, connector::Trustpay, @@ -2141,17 +2019,14 @@ default_imp_for_frm_record_return!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2169,8 +2044,6 @@ default_imp_for_frm_record_return!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Stripe, connector::Threedsecureio, connector::Trustpay, @@ -2211,16 +2084,13 @@ default_imp_for_incremental_authorization!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2238,8 +2108,6 @@ default_imp_for_incremental_authorization!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2279,16 +2147,13 @@ default_imp_for_revoking_mandates!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2305,8 +2170,6 @@ default_imp_for_revoking_mandates!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2513,17 +2376,14 @@ default_imp_for_authorize_session_token!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2540,8 +2400,6 @@ default_imp_for_authorize_session_token!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2582,17 +2440,14 @@ default_imp_for_calculate_tax!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2610,8 +2465,6 @@ default_imp_for_calculate_tax!( connector::Paypal, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2652,17 +2505,14 @@ default_imp_for_session_update!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2679,8 +2529,6 @@ default_imp_for_session_update!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe, @@ -2721,17 +2569,14 @@ default_imp_for_post_session_tokens!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bamboraapac, connector::Bankofamerica, connector::Bluesnap, - connector::Boku, connector::Braintree, connector::Checkout, connector::Cybersource, connector::Datatrans, connector::Ebanx, connector::Globalpay, - connector::Gocardless, connector::Gpayments, connector::Iatapay, connector::Itaubank, @@ -2748,8 +2593,6 @@ default_imp_for_post_session_tokens!( connector::Payone, connector::Placetopay, connector::Plaid, - connector::Prophetpay, - connector::Rapyd, connector::Riskified, connector::Signifyd, connector::Stripe,