diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs index 821bf845a5d4..bd646c95eb90 100644 --- a/crates/hyperswitch_connectors/src/connectors.rs +++ b/crates/hyperswitch_connectors/src/connectors.rs @@ -2,6 +2,7 @@ pub mod airwallex; pub mod amazonpay; pub mod bambora; pub mod bamboraapac; +pub mod bankofamerica; pub mod billwerk; pub mod bitpay; pub mod bluesnap; @@ -48,6 +49,7 @@ pub mod thunes; pub mod tsys; pub mod unified_authentication_service; pub mod volt; +pub mod wellsfargo; pub mod worldline; pub mod worldpay; pub mod xendit; @@ -56,16 +58,17 @@ pub mod zsl; pub use self::{ airwallex::Airwallex, amazonpay::Amazonpay, bambora::Bambora, bamboraapac::Bamboraapac, - billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap, boku::Boku, cashtocode::Cashtocode, - coinbase::Coinbase, cryptopay::Cryptopay, ctp_mastercard::CtpMastercard, - cybersource::Cybersource, datatrans::Datatrans, 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, + bankofamerica::Bankofamerica, billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap, + boku::Boku, cashtocode::Cashtocode, coinbase::Coinbase, cryptopay::Cryptopay, + ctp_mastercard::CtpMastercard, cybersource::Cybersource, datatrans::Datatrans, + 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, paybox::Paybox, payeezy::Payeezy, payu::Payu, placetopay::Placetopay, powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, redsys::Redsys, shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys, unified_authentication_service::UnifiedAuthenticationService, volt::Volt, - worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen, zsl::Zsl, + wellsfargo::Wellsfargo, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen, + zsl::Zsl, }; diff --git a/crates/router/src/connector/bankofamerica.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs similarity index 70% rename from crates/router/src/connector/bankofamerica.rs rename to crates/hyperswitch_connectors/src/connectors/bankofamerica.rs index fc6594442c94..40c45219b327 100644 --- a/crates/router/src/connector/bankofamerica.rs +++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs @@ -1,39 +1,56 @@ pub mod transformers; -use std::fmt::Debug; - +use crate::{ + constants::headers, + types::ResponseRouterData, + utils::{self, PaymentMethodDataType, RefundsRequestData}, +}; use base64::Engine; -use common_utils::request::RequestContent; -use diesel_models::enums; +use common_enums::enums; +use common_utils::{ + consts, + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, +}; use error_stack::{report, ResultExt}; -use masking::{ExposeInterface, PeekInterface}; -use ring::{digest, hmac}; -use time::OffsetDateTime; -use transformers as bankofamerica; -use url::Url; - -use crate::{ - configs::settings, - connector::{ - utils as connector_utils, - utils::{PaymentMethodDataType, RefundsRequestData}, +use hyperswitch_domain_models::types::RefundsRouterData; +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}, }, - consts, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - ErrorResponse, Response, + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsSyncRouterData, RefundSyncRouterData, SetupMandateRouterData, }, - utils::BytesExt, }; +use hyperswitch_interfaces::{ + api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation}, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, + types::{ + PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType, + RefundExecuteType, RefundSyncType, Response, SetupMandateType, + }, + webhooks, +}; +use masking::{ExposeInterface, Mask, Maskable, PeekInterface}; +use ring::{digest, hmac}; +use std::fmt::Debug; +use time::OffsetDateTime; +use transformers as bankofamerica; +use url::Url; pub const V_C_MERCHANT_ID: &str = "v-c-merchant-id"; @@ -66,14 +83,14 @@ impl Bankofamerica { resource: &str, payload: &String, date: OffsetDateTime, - http_method: services::Method, + http_method: Method, ) -> CustomResult { let bankofamerica::BankOfAmericaAuthType { api_key, merchant_account, api_secret, } = auth; - let is_post_method = matches!(http_method, services::Method::Post); + let is_post_method = matches!(http_method, Method::Post); let digest_str = if is_post_method { "digest " } else { "" }; let headers = format!("host date (request-target) {digest_str}{V_C_MERCHANT_ID}"); let request_target = if is_post_method { @@ -102,12 +119,8 @@ impl Bankofamerica { } } -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Bankofamerica +impl ConnectorIntegration + for Bankofamerica { // Not Implemented (R) } @@ -118,9 +131,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let date = OffsetDateTime::now_utc(); let boa_req = self.get_request_body(req, connectors)?; let http_method = self.get_http_method(); @@ -161,7 +174,7 @@ where ("Host".to_string(), host.to_string().into()), ("Signature".to_string(), signature.into_masked()), ]; - if matches!(http_method, services::Method::Post | services::Method::Put) { + if matches!(http_method, Method::Post | Method::Put) { headers.push(( "Digest".to_string(), format!("SHA-256={sha256}").into_masked(), @@ -184,7 +197,7 @@ impl ConnectorCommon for Bankofamerica { "application/json;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.bankofamerica.base_url.as_ref() } @@ -204,7 +217,7 @@ impl ConnectorCommon for Bankofamerica { let error_message = if res.status_code == 401 { consts::CONNECTOR_UNAUTHORIZED_ERROR } else { - consts::NO_ERROR_MESSAGE + hyperswitch_interfaces::consts::NO_ERROR_MESSAGE }; match response { transformers::BankOfAmericaErrorResponse::StandardError(response) => { @@ -236,12 +249,10 @@ impl ConnectorCommon for Bankofamerica { .join(", ") }); ( - response - .reason - .clone() - .map_or(consts::NO_ERROR_CODE.to_string(), |reason| { - reason.to_string() - }), + response.reason.clone().map_or( + hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), + |reason| reason.to_string(), + ), response .reason .map_or(error_message.to_string(), |reason| reason.to_string()), @@ -266,7 +277,7 @@ impl ConnectorCommon for Bankofamerica { transformers::BankOfAmericaErrorResponse::AuthenticationError(response) => { Ok(ErrorResponse { status_code: res.status_code, - code: consts::NO_ERROR_CODE.to_string(), + code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: response.response.rmsg.clone(), reason: Some(response.response.rmsg), attempt_status: None, @@ -289,48 +300,39 @@ impl ConnectorValidation for Bankofamerica { | enums::CaptureMethod::Manual | enums::CaptureMethod::SequentialAutomatic => Ok(()), enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_implemented_error_report(capture_method, self.id()), + utils::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::Card, PaymentMethodDataType::ApplePay, PaymentMethodDataType::GooglePay, ]); - connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) + utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) } } -impl ConnectorIntegration - for Bankofamerica -{ +impl ConnectorIntegration for Bankofamerica { //TODO: implement sessions flow } -impl ConnectorIntegration - for Bankofamerica -{ -} +impl ConnectorIntegration for Bankofamerica {} -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Bankofamerica +impl ConnectorIntegration + for Bankofamerica { 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_content_type(&self) -> &'static str { @@ -338,15 +340,15 @@ impl } fn get_url( &self, - _req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, + _req: &SetupMandateRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}pts/v2/payments/", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::SetupMandateRouterData, - _connectors: &settings::Connectors, + req: &SetupMandateRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = bankofamerica::BankOfAmericaPaymentsRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -354,31 +356,25 @@ impl 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> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::SetupMandateType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&SetupMandateType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::SetupMandateType::get_headers(self, req, connectors)?) - .set_body(types::SetupMandateType::get_request_body( - self, req, connectors, - )?) + .headers(SetupMandateType::get_headers(self, req, connectors)?) + .set_body(SetupMandateType::get_request_body(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::SetupMandateRouterData, + data: &SetupMandateRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: bankofamerica::BankOfAmericaSetupMandatesResponse = res .response .parse_struct("BankOfAmericaSetupMandatesResponse") @@ -387,7 +383,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, @@ -425,24 +421,26 @@ impl Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), - code: response.status.unwrap_or(consts::NO_ERROR_CODE.to_string()), + code: response + .status + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, }) } } -impl ConnectorIntegration +impl ConnectorIntegration for Bankofamerica { 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) } @@ -452,8 +450,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}pts/v2/payments/", @@ -463,8 +461,8 @@ impl ConnectorIntegration CustomResult { let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( &self.get_currency_unit(), @@ -479,20 +477,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsAuthorizeType::get_request_body( + .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) + .set_body(PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), @@ -501,17 +495,17 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: bankofamerica::BankOfAmericaPaymentsResponse = res .response .parse_struct("Bankofamerica 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, @@ -549,24 +543,24 @@ impl ConnectorIntegration - for Bankofamerica -{ +impl ConnectorIntegration for Bankofamerica { 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) } @@ -574,14 +568,14 @@ impl ConnectorIntegration services::Method { - services::Method::Get + fn get_http_method(&self) -> Method { + Method::Get } fn get_url( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, + req: &PaymentsSyncRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req .request @@ -596,32 +590,32 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) + .headers(PaymentsSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsSyncRouterData, + data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: bankofamerica::BankOfAmericaTransactionResponse = res .response .parse_struct("BankOfAmerica PaymentSyncResponse") .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, @@ -637,14 +631,12 @@ impl ConnectorIntegration - for Bankofamerica -{ +impl ConnectorIntegration for Bankofamerica { 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) } @@ -654,8 +646,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -666,8 +658,8 @@ impl ConnectorIntegration CustomResult { let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( &self.get_currency_unit(), @@ -682,18 +674,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsCaptureType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsCaptureType::get_request_body( + .headers(PaymentsCaptureType::get_headers(self, req, connectors)?) + .set_body(PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), @@ -702,17 +692,17 @@ impl ConnectorIntegration, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: bankofamerica::BankOfAmericaPaymentsResponse = res .response .parse_struct("BankOfAmerica 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, @@ -743,31 +733,31 @@ impl ConnectorIntegration - for Bankofamerica -{ +impl ConnectorIntegration for Bankofamerica { fn get_headers( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_url( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, + req: &PaymentsCancelRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -782,8 +772,8 @@ impl ConnectorIntegration CustomResult { let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( &self.get_currency_unit(), @@ -807,35 +797,33 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsVoidType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) - .set_body(types::PaymentsVoidType::get_request_body( - self, req, connectors, - )?) + .headers(PaymentsVoidType::get_headers(self, req, connectors)?) + .set_body(PaymentsVoidType::get_request_body(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsCancelRouterData, + data: &PaymentsCancelRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: bankofamerica::BankOfAmericaPaymentsResponse = res .response .parse_struct("BankOfAmerica 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, @@ -866,24 +854,24 @@ impl ConnectorIntegration - for Bankofamerica -{ +impl ConnectorIntegration for Bankofamerica { 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) } @@ -893,8 +881,8 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, + req: &RefundsRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -905,8 +893,8 @@ impl ConnectorIntegration, - _connectors: &settings::Connectors, + req: &RefundsRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_router_data = bankofamerica::BankOfAmericaRouterData::try_from(( &self.get_currency_unit(), @@ -921,29 +909,25 @@ impl ConnectorIntegration, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) - .set_body(types::RefundExecuteType::get_request_body( - self, req, connectors, - )?) + .headers(RefundExecuteType::get_headers(self, req, connectors)?) + .set_body(RefundExecuteType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, - data: &types::RefundsRouterData, + data: &RefundsRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult, errors::ConnectorError> { + ) -> CustomResult, errors::ConnectorError> { let response: bankofamerica::BankOfAmericaRefundResponse = res .response .parse_struct("bankofamerica RefundResponse") @@ -952,7 +936,7 @@ impl ConnectorIntegration - for Bankofamerica -{ +impl ConnectorIntegration for Bankofamerica { 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) } @@ -983,14 +965,14 @@ impl ConnectorIntegration services::Method { - services::Method::Get + fn get_http_method(&self) -> Method { + Method::Get } fn get_url( &self, - req: &types::RefundSyncRouterData, - connectors: &settings::Connectors, + req: &RefundSyncRouterData, + connectors: &Connectors, ) -> CustomResult { let refund_id = req.request.get_connector_refund_id()?; Ok(format!( @@ -1001,32 +983,32 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::RefundSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundSyncType::get_headers(self, req, connectors)?) + .headers(RefundSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::RefundSyncRouterData, + data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, - ) -> CustomResult { + ) -> CustomResult { let response: bankofamerica::BankOfAmericaRsyncResponse = res .response .parse_struct("bankofamerica RefundSyncResponse") .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, @@ -1043,24 +1025,24 @@ impl ConnectorIntegration, - ) -> CustomResult { + _request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + _request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs similarity index 82% rename from crates/router/src/connector/bankofamerica/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs index 71cc006700e4..0178fa0634c0 100644 --- a/crates/router/src/connector/bankofamerica/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs @@ -1,38 +1,49 @@ +use crate::{ + types::{RefundsResponseRouterData, ResponseRouterData}, + unimplemented_payment_method, + utils::{ + self, AddressDetailsData, ApplePayDecrypt, CardData, PaymentsAuthorizeRequestData, + PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RecurringMandateData, + RouterData as OtherRouterData, + }, +}; use base64::Engine; +use common_enums::{enums, FutureUsage}; +use common_utils::consts; use common_utils::pii; use masking::{ExposeInterface, PeekInterface, Secret}; use serde::{Deserialize, Serialize}; use serde_json::Value; -use crate::{ - connector::utils::{ - self, AddressDetailsData, ApplePayDecrypt, CardData, CardIssuer, - PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData, PaymentsSyncRequestData, - RecurringMandateData, RouterData, +use hyperswitch_domain_models::{ + payment_method_data::{ApplePayWalletData, GooglePayWalletData, PaymentMethodData, WalletData}, + router_data::{ + AdditionalPaymentMethodConnectorResponse, ApplePayPredecryptData, ConnectorAuthType, + ConnectorResponseData, ErrorResponse, PaymentMethodToken, RouterData, + }, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::{ + PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, + ResponseId, }, - consts, - core::errors, + router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, enums as api_enums}, - domain, - storage::enums, - transformers::ForeignFrom, - ApplePayPredecryptData, + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + RefundsRouterData, SetupMandateRouterData, }, - unimplemented_payment_method, }; - +use hyperswitch_interfaces::{api, errors}; +use utils::ForeignFrom; pub struct BankOfAmericaAuthType { pub(super) api_key: Secret, pub(super) merchant_account: Secret, pub(super) api_secret: Secret, } -impl TryFrom<&types::ConnectorAuthType> for BankOfAmericaAuthType { +impl TryFrom<&ConnectorAuthType> for BankOfAmericaAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - if let types::ConnectorAuthType::SignatureKey { + fn try_from(auth_type: &ConnectorAuthType) -> Result { + if let ConnectorAuthType::SignatureKey { api_key, key1, api_secret, @@ -54,10 +65,17 @@ pub struct BankOfAmericaRouterData { pub router_data: T, } -impl TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for BankOfAmericaRouterData { +impl TryFrom<(&api::CurrencyUnit, api_models::enums::Currency, i64, T)> + for BankOfAmericaRouterData +{ 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, + api_models::enums::Currency, + i64, + T, + ), ) -> Result { let amount = utils::get_amount_as_string(currency_unit, amount, currency)?; Ok(Self { @@ -264,68 +282,64 @@ pub struct BillTo { administrative_area: Option>, #[serde(skip_serializing_if = "Option::is_none")] postal_code: Option>, - country: Option, + country: Option, email: pii::Email, } -impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest { +impl TryFrom<&SetupMandateRouterData> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; - fn try_from(item: &types::SetupMandateRouterData) -> Result { + fn try_from(item: &SetupMandateRouterData) -> Result { match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(card_data) => Self::try_from((item, card_data)), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { - Self::try_from((item, apple_pay_data)) - } - domain::WalletData::GooglePay(google_pay_data) => { - Self::try_from((item, google_pay_data)) - } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::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( + PaymentMethodData::Card(card_data) => Self::try_from((item, card_data)), + PaymentMethodData::Wallet(wallet_data) => match wallet_data { + WalletData::ApplePay(apple_pay_data) => Self::try_from((item, apple_pay_data)), + WalletData::GooglePay(google_pay_data) => Self::try_from((item, google_pay_data)), + WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | 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("BankOfAmerica"), ))?, }, - 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::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("BankOfAmerica"), ))? @@ -335,36 +349,27 @@ impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest { } impl - TryFrom< - types::ResponseRouterData< - F, - BankOfAmericaSetupMandatesResponse, - T, - types::PaymentsResponseData, - >, - > for types::RouterData + TryFrom> + for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - F, - BankOfAmericaSetupMandatesResponse, - T, - types::PaymentsResponseData, - >, + item: ResponseRouterData, ) -> Result { match item.response { BankOfAmericaSetupMandatesResponse::ClientReferenceInformation(info_response) => { - let mandate_reference = info_response.token_information.clone().map(|token_info| { - types::MandateReference { - connector_mandate_id: token_info - .payment_instrument - .map(|payment_instrument| payment_instrument.id.expose()), - payment_method_id: None, - mandate_metadata: None, - connector_mandate_request_reference_id: None, - } - }); + let mandate_reference = + info_response + .token_information + .clone() + .map(|token_info| MandateReference { + connector_mandate_id: token_info + .payment_instrument + .map(|payment_instrument| payment_instrument.id.expose()), + payment_method_id: None, + mandate_metadata: None, + connector_mandate_request_reference_id: None, + }); let mut mandate_status = enums::AttemptStatus::foreign_from((info_response.status.clone(), false)); if matches!(mandate_status, enums::AttemptStatus::Authorized) { @@ -383,13 +388,13 @@ impl .consumer_authentication_information .as_ref() .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::foreign_from(( + AdditionalPaymentMethodConnectorResponse::foreign_from(( processor_information, consumer_auth_information, )) }) }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), + .map(ConnectorResponseData::with_additional_payment_method_data), common_enums::PaymentMethod::CardRedirect | common_enums::PaymentMethod::PayLater | common_enums::PaymentMethod::Wallet @@ -410,8 +415,8 @@ impl status: mandate_status, response: match error_response { Some(error) => Err(error), - None => Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + None => Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( info_response.id.clone(), ), redirection_data: Box::new(None), @@ -434,7 +439,7 @@ impl }) } BankOfAmericaSetupMandatesResponse::ErrorInformation(error_response) => { - let response = Err(types::ErrorResponse::foreign_from(( + let response = Err(ErrorResponse::foreign_from(( &*error_response, item.http_code, ))); @@ -522,23 +527,6 @@ fn build_bill_to( .unwrap_or(default_address)) } -impl From for String { - fn from(card_issuer: CardIssuer) -> Self { - let card_type = match card_issuer { - CardIssuer::AmericanExpress => "003", - CardIssuer::Master => "002", - //"042" is the type code for Masetro Cards(International). For Maestro Cards(UK-Domestic) the mapping should be "024" - CardIssuer::Maestro => "042", - CardIssuer::Visa => "001", - CardIssuer::Discover => "004", - CardIssuer::DinersClub => "005", - CardIssuer::CarteBlanche => "006", - CardIssuer::JCB => "007", - }; - card_type.to_string() - } -} - fn get_boa_card_type(card_network: common_enums::CardNetwork) -> Option<&'static str> { match card_network { common_enums::CardNetwork::Visa => Some("001"), @@ -579,13 +567,13 @@ pub enum TransactionType { impl From<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, Option, )> for OrderInformationWithBill { fn from( (item, bill_to): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, Option, ), ) -> Self { @@ -601,7 +589,7 @@ impl impl TryFrom<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, Option, Option, )> for ProcessingInformation @@ -610,7 +598,7 @@ impl fn try_from( (item, solution, network): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, Option, Option, ), @@ -620,7 +608,7 @@ impl .request .setup_future_usage .map_or(false, |future_usage| { - matches!(future_usage, common_enums::FutureUsage::OffSession) + matches!(future_usage, FutureUsage::OffSession) }) && (item.router_data.request.customer_acceptance.is_some() || item @@ -677,18 +665,16 @@ impl } } -impl From<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> - for ClientReferenceInformation -{ - fn from(item: &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>) -> Self { +impl From<&BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>> for ClientReferenceInformation { + fn from(item: &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>) -> Self { Self { code: Some(item.router_data.connector_request_reference_id.clone()), } } } -impl From<&types::SetupMandateRouterData> for ClientReferenceInformation { - fn from(item: &types::SetupMandateRouterData) -> Self { +impl From<&SetupMandateRouterData> for ClientReferenceInformation { + fn from(item: &SetupMandateRouterData) -> Self { Self { code: Some(item.connector_request_reference_id.clone()), } @@ -824,15 +810,15 @@ pub struct Avs { impl TryFrom<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, + hyperswitch_domain_models::payment_method_data::Card, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, ccard): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, + hyperswitch_domain_models::payment_method_data::Card, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -861,17 +847,17 @@ impl impl TryFrom<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + ApplePayWalletData, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, apple_pay_data, apple_pay_wallet_data): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + ApplePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -919,15 +905,15 @@ impl impl TryFrom<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, + GooglePayWalletData, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, google_pay_data): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, + GooglePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -955,33 +941,33 @@ impl } } -impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> +impl TryFrom<&BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( - item: &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + item: &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.connector_mandate_id() { Some(connector_mandate_id) => Self::try_from((item, connector_mandate_id)), None => { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { + PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), + PaymentMethodData::Wallet(wallet_data) => match wallet_data { + WalletData::ApplePay(apple_pay_data) => { match item.router_data.payment_method_token.clone() { Some(payment_method_token) => match payment_method_token { - types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { + PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { Self::try_from((item, decrypt_data, apple_pay_data)) } - types::PaymentMethodToken::Token(_) => { + PaymentMethodToken::Token(_) => { Err(unimplemented_payment_method!( "Apple Pay", "Manual", "Bank Of America" ))? } - types::PaymentMethodToken::PazeDecrypt(_) => Err( + PaymentMethodToken::PazeDecrypt(_) => Err( unimplemented_payment_method!("Paze", "Bank Of America"), )?, }, @@ -1038,47 +1024,45 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> } } } - domain::WalletData::GooglePay(google_pay_data) => { + WalletData::GooglePay(google_pay_data) => { Self::try_from((item, google_pay_data)) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::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( - utils::get_unimplemented_payment_method_error_message( - "Bank of America", - ), - ) - .into()) - } + WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | 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( + "Bank of America", + ), + ) + .into()), }, // If connector_mandate_id is present MandatePayment will be the PMD, the case will be handled in the first `if` clause. // This is a fallback implementation in the event of catastrophe. - domain::PaymentMethodData::MandatePayment => { + PaymentMethodData::MandatePayment => { let connector_mandate_id = item.router_data.request.connector_mandate_id().ok_or( errors::ConnectorError::MissingRequiredField { @@ -1087,22 +1071,22 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> )?; Self::try_from((item, connector_mandate_id)) } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankDebit(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | 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::CardRedirect(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankDebit(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | 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( "Bank of America", @@ -1118,14 +1102,14 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>> impl TryFrom<( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, String, )> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, connector_mandate_id): ( - &BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>, + &BankOfAmericaRouterData<&PaymentsAuthorizeRouterData>, String, ), ) -> Result { @@ -1303,7 +1287,7 @@ pub struct PaymentInformationResponse { bin: Option, account_type: Option, issuer: Option, - bin_country: Option, + bin_country: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] @@ -1374,7 +1358,7 @@ pub struct BankOfAmericaTokenInformation { #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IssuerInformation { - country: Option, + country: Option, discretionary_data: Option, country_specific_discretionary_data: Option, response_code: Option, @@ -1409,19 +1393,14 @@ pub struct BankOfAmericaErrorInformation { impl ForeignFrom<( &BankOfAmericaErrorInformationResponse, - types::ResponseRouterData, + ResponseRouterData, Option, - )> for types::RouterData + )> for RouterData { fn foreign_from( (error_response, item, transaction_status): ( &BankOfAmericaErrorInformationResponse, - types::ResponseRouterData< - F, - BankOfAmericaPaymentsResponse, - T, - types::PaymentsResponseData, - >, + ResponseRouterData, Option, ), ) -> Self { @@ -1443,17 +1422,17 @@ impl detailed_error_info, None, ); - let response = Err(types::ErrorResponse { + let response = Err(ErrorResponse { code: error_response .error_information .reason .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_response .error_information .reason .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code: item.http_code, attempt_status: None, @@ -1480,9 +1459,9 @@ fn get_error_response_if_failure( enums::AttemptStatus, u16, ), -) -> Option { +) -> Option { if utils::is_payment_failure(status) { - Some(types::ErrorResponse::foreign_from(( + Some(ErrorResponse::foreign_from(( &info_response.error_information, &info_response.risk_information, Some(status), @@ -1500,7 +1479,7 @@ fn get_payment_response( enums::AttemptStatus, u16, ), -) -> Result { +) -> Result { let error_response = get_error_response_if_failure((info_response, status, http_code)); match error_response { Some(error) => Err(error), @@ -1509,7 +1488,7 @@ fn get_payment_response( info_response .token_information .clone() - .map(|token_info| types::MandateReference { + .map(|token_info| MandateReference { connector_mandate_id: token_info .payment_instrument .map(|payment_instrument| payment_instrument.id.expose()), @@ -1518,8 +1497,8 @@ fn get_payment_response( connector_mandate_request_reference_id: None, }); - Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()), + Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(info_response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(mandate_reference), connector_metadata: None, @@ -1540,21 +1519,21 @@ fn get_payment_response( impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BankOfAmericaPaymentsResponse, - 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, BankOfAmericaPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, ) -> Result { match item.response { @@ -1573,13 +1552,13 @@ impl .consumer_authentication_information .as_ref() .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::foreign_from(( + AdditionalPaymentMethodConnectorResponse::foreign_from(( processor_information, consumer_auth_information, )) }) }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), + .map(ConnectorResponseData::with_additional_payment_method_data), common_enums::PaymentMethod::CardRedirect | common_enums::PaymentMethod::PayLater | common_enums::PaymentMethod::Wallet @@ -1618,7 +1597,7 @@ impl ForeignFrom<( &ClientProcessorInformation, &ConsumerAuthenticationInformation, - )> for types::AdditionalPaymentMethodConnectorResponse + )> for AdditionalPaymentMethodConnectorResponse { fn foreign_from( item: ( @@ -1653,21 +1632,21 @@ impl impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BankOfAmericaPaymentsResponse, - 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, BankOfAmericaPaymentsResponse, - types::PaymentsCaptureData, - types::PaymentsResponseData, + PaymentsCaptureData, + PaymentsResponseData, >, ) -> Result { match item.response { @@ -1690,21 +1669,21 @@ impl impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BankOfAmericaPaymentsResponse, - types::PaymentsCancelData, - types::PaymentsResponseData, + PaymentsCancelData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, BankOfAmericaPaymentsResponse, - types::PaymentsCancelData, - types::PaymentsResponseData, + PaymentsCancelData, + PaymentsResponseData, >, ) -> Result { match item.response { @@ -1757,21 +1736,21 @@ pub struct ApplicationInformation { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, BankOfAmericaTransactionResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, + PaymentsSyncData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, BankOfAmericaTransactionResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, + PaymentsSyncData, + PaymentsResponseData, >, ) -> Result { match item.response.application_information.status { @@ -1791,13 +1770,13 @@ impl .consumer_authentication_information .as_ref() .map(|consumer_auth_information| { - types::AdditionalPaymentMethodConnectorResponse::foreign_from(( + AdditionalPaymentMethodConnectorResponse::foreign_from(( processor_information, consumer_auth_information, )) }) }) - .map(types::ConnectorResponseData::with_additional_payment_method_data), + .map(ConnectorResponseData::with_additional_payment_method_data), common_enums::PaymentMethod::CardRedirect | common_enums::PaymentMethod::PayLater | common_enums::PaymentMethod::Wallet @@ -1817,7 +1796,7 @@ impl let risk_info: Option = None; if utils::is_payment_failure(status) { Ok(Self { - response: Err(types::ErrorResponse::foreign_from(( + response: Err(ErrorResponse::foreign_from(( &item.response.error_information, &risk_info, Some(status), @@ -1831,8 +1810,8 @@ impl } else { Ok(Self { status, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( item.response.id.clone(), ), redirection_data: Box::new(None), @@ -1854,10 +1833,8 @@ impl } None => Ok(Self { status: item.data.status, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.id.clone(), - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, @@ -1887,12 +1864,10 @@ pub struct BankOfAmericaCaptureRequest { merchant_defined_information: Option>, } -impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsCaptureRouterData>> - for BankOfAmericaCaptureRequest -{ +impl TryFrom<&BankOfAmericaRouterData<&PaymentsCaptureRouterData>> for BankOfAmericaCaptureRequest { type Error = error_stack::Report; fn try_from( - value: &BankOfAmericaRouterData<&types::PaymentsCaptureRouterData>, + value: &BankOfAmericaRouterData<&PaymentsCaptureRouterData>, ) -> Result { let merchant_defined_information = value .router_data @@ -1932,12 +1907,10 @@ pub struct ReversalInformation { reason: String, } -impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsCancelRouterData>> - for BankOfAmericaVoidRequest -{ +impl TryFrom<&BankOfAmericaRouterData<&PaymentsCancelRouterData>> for BankOfAmericaVoidRequest { type Error = error_stack::Report; fn try_from( - value: &BankOfAmericaRouterData<&types::PaymentsCancelRouterData>, + value: &BankOfAmericaRouterData<&PaymentsCancelRouterData>, ) -> Result { let merchant_defined_information = value .router_data @@ -1979,12 +1952,10 @@ pub struct BankOfAmericaRefundRequest { client_reference_information: ClientReferenceInformation, } -impl TryFrom<&BankOfAmericaRouterData<&types::RefundsRouterData>> - for BankOfAmericaRefundRequest -{ +impl TryFrom<&BankOfAmericaRouterData<&RefundsRouterData>> for BankOfAmericaRefundRequest { type Error = error_stack::Report; fn try_from( - item: &BankOfAmericaRouterData<&types::RefundsRouterData>, + item: &BankOfAmericaRouterData<&RefundsRouterData>, ) -> Result { Ok(Self { order_information: OrderInformation { @@ -2032,16 +2003,16 @@ pub struct BankOfAmericaRefundResponse { error_information: Option, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let refund_status = enums::RefundStatus::from(item.response.clone()); let response = if utils::is_refund_failure(refund_status) { - Err(types::ErrorResponse::foreign_from(( + Err(ErrorResponse::foreign_from(( &item.response.error_information, &None, None, @@ -2049,7 +2020,7 @@ impl TryFrom, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let response = match item .response @@ -2124,7 +2095,7 @@ impl TryFrom Ok(types::RefundsResponseData { + None => Ok(RefundsResponseData { connector_refund_id: item.response.id.clone(), refund_status: match item.data.response { Ok(response) => response.refund_status, @@ -2232,7 +2203,7 @@ impl Option, u16, String, - )> for types::ErrorResponse + )> for ErrorResponse { fn foreign_from( (error_data, risk_information, attempt_status, status_code, transaction_id): ( @@ -2284,10 +2255,10 @@ impl Self { code: error_message .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_message .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status, @@ -2296,10 +2267,18 @@ impl } } -impl TryFrom<(&types::SetupMandateRouterData, domain::Card)> for BankOfAmericaPaymentsRequest { +impl + TryFrom<( + &SetupMandateRouterData, + hyperswitch_domain_models::payment_method_data::Card, + )> for BankOfAmericaPaymentsRequest +{ type Error = error_stack::Report; fn try_from( - (item, ccard): (&types::SetupMandateRouterData, domain::Card), + (item, ccard): ( + &SetupMandateRouterData, + hyperswitch_domain_models::payment_method_data::Card, + ), ) -> Result { let order_information = OrderInformationWithBill::try_from(item)?; let client_reference_information = ClientReferenceInformation::from(item); @@ -2319,12 +2298,10 @@ impl TryFrom<(&types::SetupMandateRouterData, domain::Card)> for BankOfAmericaPa } } -impl TryFrom<(&types::SetupMandateRouterData, domain::ApplePayWalletData)> - for BankOfAmericaPaymentsRequest -{ +impl TryFrom<(&SetupMandateRouterData, ApplePayWalletData)> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( - (item, apple_pay_data): (&types::SetupMandateRouterData, domain::ApplePayWalletData), + (item, apple_pay_data): (&SetupMandateRouterData, ApplePayWalletData), ) -> Result { let order_information = OrderInformationWithBill::try_from(item)?; let client_reference_information = ClientReferenceInformation::from(item); @@ -2333,15 +2310,15 @@ impl TryFrom<(&types::SetupMandateRouterData, domain::ApplePayWalletData)> }); let payment_information = match item.payment_method_token.clone() { Some(payment_method_token) => match payment_method_token { - types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { + PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { PaymentInformation::try_from(&decrypt_data)? } - types::PaymentMethodToken::Token(_) => Err(unimplemented_payment_method!( + PaymentMethodToken::Token(_) => Err(unimplemented_payment_method!( "Apple Pay", "Manual", "Bank Of America" ))?, - types::PaymentMethodToken::PazeDecrypt(_) => { + PaymentMethodToken::PazeDecrypt(_) => { Err(unimplemented_payment_method!("Paze", "Bank Of America"))? } }, @@ -2380,12 +2357,10 @@ impl TryFrom<(&types::SetupMandateRouterData, domain::ApplePayWalletData)> } } -impl TryFrom<(&types::SetupMandateRouterData, domain::GooglePayWalletData)> - for BankOfAmericaPaymentsRequest -{ +impl TryFrom<(&SetupMandateRouterData, GooglePayWalletData)> for BankOfAmericaPaymentsRequest { type Error = error_stack::Report; fn try_from( - (item, google_pay_data): (&types::SetupMandateRouterData, domain::GooglePayWalletData), + (item, google_pay_data): (&SetupMandateRouterData, GooglePayWalletData), ) -> Result { let order_information = OrderInformationWithBill::try_from(item)?; let client_reference_information = ClientReferenceInformation::from(item); @@ -2429,10 +2404,10 @@ impl TryFrom<(Option, Option)> for ProcessingInformatio } } -impl TryFrom<&types::SetupMandateRouterData> for OrderInformationWithBill { +impl TryFrom<&SetupMandateRouterData> for OrderInformationWithBill { type Error = error_stack::Report; - fn try_from(item: &types::SetupMandateRouterData) -> Result { + fn try_from(item: &SetupMandateRouterData) -> Result { let email = item.request.get_email()?; let bill_to = build_bill_to(item.get_optional_billing(), email)?; @@ -2446,10 +2421,12 @@ impl TryFrom<&types::SetupMandateRouterData> for OrderInformationWithBill { } } -impl TryFrom<&domain::Card> for PaymentInformation { +impl TryFrom<&hyperswitch_domain_models::payment_method_data::Card> for PaymentInformation { type Error = error_stack::Report; - fn try_from(ccard: &domain::Card) -> Result { + fn try_from( + ccard: &hyperswitch_domain_models::payment_method_data::Card, + ) -> Result { let card_type = match ccard.card_network.clone().and_then(get_boa_card_type) { Some(card_network) => Some(card_network.to_string()), None => ccard.get_card_issuer().ok().map(String::from), @@ -2488,8 +2465,8 @@ impl TryFrom<&Box> for PaymentInformation { } } -impl From<&domain::ApplePayWalletData> for PaymentInformation { - fn from(apple_pay_data: &domain::ApplePayWalletData) -> Self { +impl From<&ApplePayWalletData> for PaymentInformation { + fn from(apple_pay_data: &ApplePayWalletData) -> Self { Self::ApplePayToken(Box::new(ApplePayTokenPaymentInformation { fluid_data: FluidData { value: Secret::from(apple_pay_data.payment_data.clone()), @@ -2501,8 +2478,8 @@ impl From<&domain::ApplePayWalletData> for PaymentInformation { } } -impl From<&domain::GooglePayWalletData> for PaymentInformation { - fn from(google_pay_data: &domain::GooglePayWalletData) -> Self { +impl From<&GooglePayWalletData> for PaymentInformation { + fn from(google_pay_data: &GooglePayWalletData) -> Self { Self::GooglePay(Box::new(GooglePayPaymentInformation { fluid_data: FluidData { value: Secret::from( @@ -2513,7 +2490,7 @@ impl From<&domain::GooglePayWalletData> for PaymentInformation { } } -impl ForeignFrom<(&BankOfAmericaErrorInformationResponse, u16)> for types::ErrorResponse { +impl ForeignFrom<(&BankOfAmericaErrorInformationResponse, u16)> for ErrorResponse { fn foreign_from( (error_response, status_code): (&BankOfAmericaErrorInformationResponse, u16), ) -> Self { @@ -2540,12 +2517,12 @@ impl ForeignFrom<(&BankOfAmericaErrorInformationResponse, u16)> for types::Error .error_information .reason .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_response .error_information .reason .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status: None, diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs index 78d8c96d3062..4b418840637c 100644 --- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs @@ -11,7 +11,6 @@ use common_utils::{ types::{SemanticVersion, StringMajorUnit}, }; use error_stack::ResultExt; -#[cfg(feature = "payouts")] use hyperswitch_domain_models::{ address::{AddressDetails, PhoneDetails}, payment_method_data::{ diff --git a/crates/router/src/connector/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs similarity index 66% rename from crates/router/src/connector/wellsfargo.rs rename to crates/hyperswitch_connectors/src/connectors/wellsfargo.rs index df0de2c0c5ed..a95aad31345c 100644 --- a/crates/router/src/connector/wellsfargo.rs +++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs @@ -1,42 +1,70 @@ pub mod transformers; use base64::Engine; +use common_enums::enums; +use common_utils::types::{ + AmountConvertor, MinorUnit, StringMajorUnit, StringMajorUnitForConnector, +}; use common_utils::{ - request::RequestContent, - types::{AmountConvertor, MinorUnit, StringMajorUnit, StringMajorUnitForConnector}, + consts, + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, }; -use diesel_models::enums; use error_stack::{report, Report, ResultExt}; -use masking::{ExposeInterface, PeekInterface}; -use ring::{digest, hmac}; -use time::OffsetDateTime; -use transformers as wellsfargo; -use url::Url; - -use super::utils::convert_amount; -use crate::{ - configs::settings, - connector::{ - utils as connector_utils, - utils::{PaymentMethodDataType, RefundsRequestData}, +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{AccessToken, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + mandate_revoke::MandateRevoke, + payments::{ + Authorize, Capture, IncrementalAuthorization, PSync, PaymentMethodToken, Session, + SetupMandate, Void, + }, + refunds::{Execute, RSync}, }, - consts, - core::errors::{self, CustomResult}, - events::connector_api_logs::ConnectorEvent, - headers, - services::{ - self, - request::{self, Mask}, - ConnectorIntegration, ConnectorValidation, + router_request_types::{ + AccessTokenRequestData, MandateRevokeRequestData, PaymentMethodTokenizationData, + PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, + PaymentsIncrementalAuthorizationData, PaymentsSessionData, PaymentsSyncData, RefundsData, + SetupMandateRequestData, }, + router_response_types::{MandateRevokeResponseData, PaymentsResponseData, RefundsResponseData}, types::{ + MandateRevokeRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData, + PaymentsCaptureRouterData, PaymentsIncrementalAuthorizationRouterData, + PaymentsSyncRouterData, RefundExecuteRouterData, RefundSyncRouterData, + SetupMandateRouterData, + }, +}; +use hyperswitch_interfaces::{ + api::{ self, - api::{self, ConnectorCommon, ConnectorCommonExt}, - transformers::ForeignTryFrom, + refunds::{Refund, RefundExecute, RefundSync}, + ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation, + }, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, + types::{ + IncrementalAuthorizationType, MandateRevokeType, PaymentsAuthorizeType, + PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType, RefundExecuteType, RefundSyncType, + Response, SetupMandateType, }, - utils::BytesExt, + webhooks, }; +use masking::{ExposeInterface, Mask, Maskable, PeekInterface}; +use ring::{digest, hmac}; +use time::OffsetDateTime; +use transformers as wellsfargo; +use url::Url; +use crate::{ + constants::headers, + types::ResponseRouterData, + utils::{self, convert_amount, ForeignTryFrom, PaymentMethodDataType, RefundsRequestData}, +}; #[derive(Clone)] pub struct Wellsfargo { amount_converter: &'static (dyn AmountConvertor + Sync), @@ -61,16 +89,16 @@ impl Wellsfargo { resource: &str, payload: &String, date: OffsetDateTime, - http_method: services::Method, + http_method: Method, ) -> CustomResult { let wellsfargo::WellsfargoAuthType { api_key, merchant_account, api_secret, } = auth; - let is_post_method = matches!(http_method, services::Method::Post); - let is_patch_method = matches!(http_method, services::Method::Patch); - let is_delete_method = matches!(http_method, services::Method::Delete); + let is_post_method = matches!(http_method, Method::Post); + let is_patch_method = matches!(http_method, Method::Patch); + let is_delete_method = matches!(http_method, Method::Delete); let digest_str = if is_post_method || is_patch_method { "digest " } else { @@ -116,7 +144,7 @@ impl ConnectorCommon for Wellsfargo { "application/json;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.wellsfargo.base_url.as_ref() } @@ -126,9 +154,9 @@ impl ConnectorCommon for Wellsfargo { fn build_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { let response: Result< wellsfargo::WellsfargoErrorResponse, Report, @@ -137,7 +165,7 @@ impl ConnectorCommon for Wellsfargo { let error_message = if res.status_code == 401 { consts::CONNECTOR_UNAUTHORIZED_ERROR } else { - consts::NO_ERROR_MESSAGE + hyperswitch_interfaces::consts::NO_ERROR_MESSAGE }; match response { Ok(transformers::WellsfargoErrorResponse::StandardError(response)) => { @@ -172,12 +200,10 @@ impl ConnectorCommon for Wellsfargo { .join(", ") }); ( - response - .reason - .clone() - .map_or(consts::NO_ERROR_CODE.to_string(), |reason| { - reason.to_string() - }), + response.reason.clone().map_or( + hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), + |reason| reason.to_string(), + ), response .reason .map_or(error_message.to_string(), |reason| reason.to_string()), @@ -190,7 +216,7 @@ impl ConnectorCommon for Wellsfargo { } }; - Ok(types::ErrorResponse { + Ok(ErrorResponse { status_code: res.status_code, code, message, @@ -202,9 +228,9 @@ impl ConnectorCommon for Wellsfargo { Ok(transformers::WellsfargoErrorResponse::AuthenticationError(response)) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); - Ok(types::ErrorResponse { + Ok(ErrorResponse { status_code: res.status_code, - code: consts::NO_ERROR_CODE.to_string(), + code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: response.response.rmsg.clone(), reason: Some(response.response.rmsg), attempt_status: None, @@ -226,9 +252,9 @@ impl ConnectorCommon for Wellsfargo { }) .collect::>() .join(" & "); - Ok(types::ErrorResponse { + Ok(ErrorResponse { status_code: res.status_code, - code: consts::NO_ERROR_CODE.to_string(), + code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: error_response.clone(), reason: Some(error_response), attempt_status: None, @@ -238,7 +264,7 @@ impl ConnectorCommon for Wellsfargo { Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); - crate::utils::handle_json_response_deserialization_failure(res, "wellsfargo") + utils::handle_json_response_deserialization_failure(res, "wellsfargo") } } } @@ -256,21 +282,21 @@ impl ConnectorValidation for Wellsfargo { | enums::CaptureMethod::Manual | enums::CaptureMethod::SequentialAutomatic => Ok(()), enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err( - connector_utils::construct_not_implemented_error_report(capture_method, self.id()), + utils::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::Card, PaymentMethodDataType::ApplePay, PaymentMethodDataType::GooglePay, ]); - connector_utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) + utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id()) } } @@ -280,9 +306,9 @@ where { fn build_headers( &self, - req: &types::RouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &RouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { let date = OffsetDateTime::now_utc(); let wellsfargo_req = self.get_request_body(req, connectors)?; let auth = wellsfargo::WellsfargoAuthType::try_from(&req.connector_auth_type)?; @@ -326,10 +352,7 @@ where ("Host".to_string(), host.to_string().into()), ("Signature".to_string(), signature.into_masked()), ]; - if matches!( - http_method, - services::Method::Post | services::Method::Put | services::Method::Patch - ) { + if matches!(http_method, Method::Post | Method::Put | Method::Patch) { headers.push(( "Digest".to_string(), format!("SHA-256={sha256}").into_masked(), @@ -350,28 +373,20 @@ impl api::ConnectorAccessToken for Wellsfargo {} impl api::PaymentToken for Wellsfargo {} impl api::ConnectorMandateRevoke for Wellsfargo {} -impl - ConnectorIntegration< - api::PaymentMethodToken, - types::PaymentMethodTokenizationData, - types::PaymentsResponseData, - > for Wellsfargo +impl ConnectorIntegration + for Wellsfargo { // Not Implemented (R) } -impl - ConnectorIntegration< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > for Wellsfargo +impl ConnectorIntegration + for Wellsfargo { 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_content_type(&self) -> &'static str { @@ -379,15 +394,15 @@ impl } fn get_url( &self, - _req: &types::SetupMandateRouterData, - connectors: &settings::Connectors, + _req: &SetupMandateRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!("{}pts/v2/payments/", self.base_url(connectors))) } fn get_request_body( &self, - req: &types::SetupMandateRouterData, - _connectors: &settings::Connectors, + req: &SetupMandateRouterData, + _connectors: &Connectors, ) -> CustomResult { let connector_req = wellsfargo::WellsfargoZeroMandateRequest::try_from(req)?; Ok(RequestContent::Json(Box::new(connector_req))) @@ -395,35 +410,33 @@ 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) - .url(&types::SetupMandateType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&SetupMandateType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::SetupMandateType::get_headers(self, req, connectors)?) - .set_body(types::SetupMandateType::get_request_body( - self, req, connectors, - )?) + .headers(SetupMandateType::get_headers(self, req, connectors)?) + .set_body(SetupMandateType::get_request_body(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::SetupMandateRouterData, + data: &SetupMandateRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: wellsfargo::WellsfargoPaymentsResponse = res .response .parse_struct("WellsfargoSetupMandatesResponse") .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, @@ -432,17 +445,17 @@ impl fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { let response: wellsfargo::WellsfargoServerErrorResponse = res .response .parse_struct("WellsfargoServerErrorResponse") @@ -458,76 +471,72 @@ impl }, None => None, }; - Ok(types::ErrorResponse { + Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), - code: response.status.unwrap_or(consts::NO_ERROR_CODE.to_string()), + code: response + .status + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, }) } } -impl - ConnectorIntegration< - api::MandateRevoke, - types::MandateRevokeRequestData, - types::MandateRevokeResponseData, - > for Wellsfargo +impl ConnectorIntegration + for Wellsfargo { fn get_headers( &self, - req: &types::MandateRevokeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &MandateRevokeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } - fn get_http_method(&self) -> services::Method { - services::Method::Delete + fn get_http_method(&self) -> Method { + Method::Delete } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, - req: &types::MandateRevokeRouterData, - connectors: &settings::Connectors, + req: &MandateRevokeRouterData, + connectors: &Connectors, ) -> CustomResult { Ok(format!( "{}tms/v1/paymentinstruments/{}", self.base_url(connectors), - connector_utils::RevokeMandateRequestData::get_connector_mandate_id(&req.request)? + utils::RevokeMandateRequestData::get_connector_mandate_id(&req.request)? )) } fn build_request( &self, - req: &types::MandateRevokeRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &MandateRevokeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Delete) - .url(&types::MandateRevokeType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Delete) + .url(&MandateRevokeType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::MandateRevokeType::get_headers( - self, req, connectors, - )?) + .headers(MandateRevokeType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::MandateRevokeRouterData, + data: &MandateRevokeRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { if matches!(res.status_code, 204) { event_builder.map(|i| i.set_response_body(&serde_json::json!({"mandate_status": common_enums::MandateStatus::Revoked.to_string()}))); - Ok(types::MandateRevokeRouterData { - response: Ok(types::MandateRevokeResponseData { + Ok(MandateRevokeRouterData { + response: Ok(MandateRevokeResponseData { mandate_status: common_enums::MandateStatus::Revoked, }), ..data.clone() @@ -545,9 +554,9 @@ impl }); router_env::logger::info!(connector_response=?response_string); - Ok(types::MandateRevokeRouterData { - response: Err(types::ErrorResponse { - code: consts::NO_ERROR_CODE.to_string(), + Ok(MandateRevokeRouterData { + response: Err(ErrorResponse { + code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: response_string.clone(), reason: Some(response_string), status_code: res.status_code, @@ -560,33 +569,26 @@ impl } fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } } -impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { // Not Implemented (R) } impl api::PaymentSession for Wellsfargo {} -impl ConnectorIntegration - for Wellsfargo -{ -} +impl ConnectorIntegration for Wellsfargo {} -impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { 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) } @@ -596,8 +598,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -609,8 +611,8 @@ impl ConnectorIntegration CustomResult { let amount = convert_amount( self.amount_converter, @@ -626,18 +628,16 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsCaptureType::get_headers( - self, req, connectors, - )?) - .set_body(types::PaymentsCaptureType::get_request_body( + .headers(PaymentsCaptureType::get_headers(self, req, connectors)?) + .set_body(PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), @@ -645,11 +645,11 @@ impl ConnectorIntegration, - res: types::Response, + res: Response, ) -> CustomResult< - types::RouterData, + RouterData, errors::ConnectorError, > { let response: wellsfargo::WellsfargoPaymentsResponse = res @@ -658,7 +658,7 @@ impl ConnectorIntegration, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { let response: wellsfargo::WellsfargoServerErrorResponse = res .response .parse_struct("WellsfargoServerErrorResponse") @@ -685,38 +685,38 @@ impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { 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) } - fn get_http_method(&self) -> services::Method { - services::Method::Get + fn get_http_method(&self) -> Method { + Method::Get } fn get_url( &self, - req: &types::PaymentsSyncRouterData, - connectors: &settings::Connectors, + req: &PaymentsSyncRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req .request @@ -736,31 +736,31 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) + .headers(PaymentsSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::PaymentsSyncRouterData, + data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: wellsfargo::WellsfargoTransactionResponse = res .response .parse_struct("Wellsfargo PaymentSyncResponse") .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, @@ -768,21 +768,19 @@ impl ConnectorIntegration, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } } -impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { 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) } @@ -792,8 +790,8 @@ impl ConnectorIntegration CustomResult { Ok(format!( "{}pts/v2/payments/", @@ -803,8 +801,8 @@ impl ConnectorIntegration CustomResult { let amount = convert_amount( self.amount_converter, @@ -820,18 +818,14 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { - let request = services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsAuthorizeType::get_url( - self, req, connectors, - )?) + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsAuthorizeType::get_headers( - self, req, connectors, - )?) + .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(); @@ -840,17 +834,17 @@ impl ConnectorIntegration, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: wellsfargo::WellsfargoPaymentsResponse = res .response .parse_struct("Wellsfargo 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, @@ -859,17 +853,17 @@ impl ConnectorIntegration, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { let response: wellsfargo::WellsfargoServerErrorResponse = res .response .parse_struct("WellsfargoServerErrorResponse") @@ -885,34 +879,34 @@ impl ConnectorIntegration None, }; - Ok(types::ErrorResponse { + Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), - code: response.status.unwrap_or(consts::NO_ERROR_CODE.to_string()), + code: response + .status + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, }) } } -impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { fn get_headers( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_url( &self, - req: &types::PaymentsCancelRouterData, - connectors: &settings::Connectors, + req: &PaymentsCancelRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -927,8 +921,8 @@ impl ConnectorIntegration CustomResult { let amount = convert_amount( self.amount_converter, @@ -952,15 +946,15 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &PaymentsCancelRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::PaymentsVoidType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&PaymentsVoidType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?) + .headers(PaymentsVoidType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(), )) @@ -968,17 +962,17 @@ impl ConnectorIntegration, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: wellsfargo::WellsfargoPaymentsResponse = res .response .parse_struct("Wellsfargo 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, @@ -987,17 +981,17 @@ impl ConnectorIntegration, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { let response: wellsfargo::WellsfargoServerErrorResponse = res .response .parse_struct("WellsfargoServerErrorResponse") @@ -1006,31 +1000,31 @@ impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { 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) } @@ -1040,8 +1034,8 @@ impl ConnectorIntegration CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -1053,8 +1047,8 @@ impl ConnectorIntegration CustomResult { let amount = convert_amount( self.amount_converter, @@ -1068,17 +1062,15 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundExecuteRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Post) - .url(&types::RefundExecuteType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Post) + .url(&RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundExecuteType::get_headers( - self, req, connectors, - )?) + .headers(RefundExecuteType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(), )) @@ -1086,17 +1078,17 @@ impl ConnectorIntegration, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: wellsfargo::WellsfargoRefundResponse = res .response .parse_struct("Wellsfargo 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, @@ -1104,33 +1096,31 @@ impl ConnectorIntegration, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } } -impl ConnectorIntegration - for Wellsfargo -{ +impl ConnectorIntegration for Wellsfargo { 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) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } - fn get_http_method(&self) -> services::Method { - services::Method::Get + fn get_http_method(&self) -> Method { + Method::Get } fn get_url( &self, - req: &types::RefundSyncRouterData, - connectors: &settings::Connectors, + req: &RefundSyncRouterData, + connectors: &Connectors, ) -> CustomResult { let refund_id = req.request.get_connector_refund_id()?; Ok(format!( @@ -1141,31 +1131,31 @@ impl ConnectorIntegration CustomResult, errors::ConnectorError> { + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Get) - .url(&types::RefundSyncType::get_url(self, req, connectors)?) + RequestBuilder::new() + .method(Method::Get) + .url(&RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() - .headers(types::RefundSyncType::get_headers(self, req, connectors)?) + .headers(RefundSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, - data: &types::RefundSyncRouterData, + data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, - ) -> CustomResult { + res: Response, + ) -> CustomResult { let response: wellsfargo::WellsfargoRsyncResponse = res .response .parse_struct("Wellsfargo RefundSyncResponse") .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, @@ -1173,30 +1163,30 @@ impl ConnectorIntegration, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } } impl ConnectorIntegration< - api::IncrementalAuthorization, - types::PaymentsIncrementalAuthorizationData, - types::PaymentsResponseData, + IncrementalAuthorization, + PaymentsIncrementalAuthorizationData, + PaymentsResponseData, > for Wellsfargo { fn get_headers( &self, - req: &types::PaymentsIncrementalAuthorizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult)>, errors::ConnectorError> { + req: &PaymentsIncrementalAuthorizationRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { self.build_headers(req, connectors) } - fn get_http_method(&self) -> services::Method { - services::Method::Patch + fn get_http_method(&self) -> Method { + Method::Patch } fn get_content_type(&self) -> &'static str { @@ -1205,8 +1195,8 @@ impl fn get_url( &self, - req: &types::PaymentsIncrementalAuthorizationRouterData, - connectors: &settings::Connectors, + req: &PaymentsIncrementalAuthorizationRouterData, + connectors: &Connectors, ) -> CustomResult { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( @@ -1218,8 +1208,8 @@ impl fn get_request_body( &self, - req: &types::PaymentsIncrementalAuthorizationRouterData, - _connectors: &settings::Connectors, + req: &PaymentsIncrementalAuthorizationRouterData, + _connectors: &Connectors, ) -> CustomResult { let amount = convert_amount( self.amount_converter, @@ -1236,20 +1226,20 @@ impl } fn build_request( &self, - req: &types::PaymentsIncrementalAuthorizationRouterData, - connectors: &settings::Connectors, - ) -> CustomResult, errors::ConnectorError> { + req: &PaymentsIncrementalAuthorizationRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { Ok(Some( - services::RequestBuilder::new() - .method(services::Method::Patch) - .url(&types::IncrementalAuthorizationType::get_url( + RequestBuilder::new() + .method(Method::Patch) + .url(&IncrementalAuthorizationType::get_url( self, req, connectors, )?) .attach_default_headers() - .headers(types::IncrementalAuthorizationType::get_headers( + .headers(IncrementalAuthorizationType::get_headers( self, req, connectors, )?) - .set_body(types::IncrementalAuthorizationType::get_request_body( + .set_body(IncrementalAuthorizationType::get_request_body( self, req, connectors, )?) .build(), @@ -1257,14 +1247,14 @@ impl } fn handle_response( &self, - data: &types::PaymentsIncrementalAuthorizationRouterData, + data: &PaymentsIncrementalAuthorizationRouterData, event_builder: Option<&mut ConnectorEvent>, - res: types::Response, + res: Response, ) -> CustomResult< - types::RouterData< - api::IncrementalAuthorization, - types::PaymentsIncrementalAuthorizationData, - types::PaymentsResponseData, + RouterData< + IncrementalAuthorization, + PaymentsIncrementalAuthorizationData, + PaymentsResponseData, >, errors::ConnectorError, > { @@ -1274,8 +1264,8 @@ impl .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); - types::RouterData::foreign_try_from(( - types::ResponseRouterData { + RouterData::foreign_try_from(( + ResponseRouterData { response, data: data.clone(), http_code: res.status_code, @@ -1286,32 +1276,32 @@ impl } fn get_error_response( &self, - res: types::Response, + res: Response, event_builder: Option<&mut ConnectorEvent>, - ) -> CustomResult { + ) -> CustomResult { self.build_error_response(res, event_builder) } } #[async_trait::async_trait] -impl api::IncomingWebhook for Wellsfargo { +impl webhooks::IncomingWebhook for Wellsfargo { fn get_webhook_object_reference_id( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, - ) -> CustomResult { - Ok(api::IncomingWebhookEvent::EventNotSupported) + _request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, - _request: &api::IncomingWebhookRequestDetails<'_>, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } diff --git a/crates/router/src/connector/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs similarity index 80% rename from crates/router/src/connector/wellsfargo/transformers.rs rename to crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs index 937af33bd798..62790f8cdbad 100644 --- a/crates/router/src/connector/wellsfargo/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs @@ -1,31 +1,48 @@ use api_models::payments; use base64::Engine; -use common_enums::FutureUsage; -use common_utils::{ - pii, - types::{SemanticVersion, StringMajorUnit}, -}; use masking::{ExposeInterface, PeekInterface, Secret}; -use serde::{Deserialize, Serialize}; use serde_json::Value; use crate::{ - connector::utils::{ + types::{RefundsResponseRouterData, ResponseRouterData}, + unimplemented_payment_method, + utils::{ self, AddressDetailsData, ApplePayDecrypt, CardData, PaymentsAuthorizeRequestData, - PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RecurringMandateData, RouterData, + PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RecurringMandateData, + RouterData as OtherRouterData, }, - consts, - core::errors, +}; +use common_enums::{enums, FutureUsage}; +use common_utils::{ + consts, pii, + types::{SemanticVersion, StringMajorUnit}, +}; +use hyperswitch_domain_models::{ + payment_method_data::{ + ApplePayWalletData, BankDebitData, GooglePayWalletData, PaymentMethodData, WalletData, + }, + router_data::{ + AdditionalPaymentMethodConnectorResponse, ApplePayPredecryptData, ConnectorAuthType, + ConnectorResponseData, ErrorResponse, PaymentMethodToken, RouterData, + }, + router_flow_types::{ + payments::Authorize, + refunds::{Execute, RSync}, + SetupMandate, + }, + router_request_types::{ + PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, + ResponseId, SetupMandateRequestData, + }, + router_response_types::{MandateReference, PaymentsResponseData, RefundsResponseData}, types::{ - self, - api::{self, enums as api_enums}, - domain, - storage::enums, - transformers::{ForeignFrom, ForeignTryFrom}, - ApplePayPredecryptData, + PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData, + PaymentsIncrementalAuthorizationRouterData, RefundsRouterData, SetupMandateRouterData, }, - unimplemented_payment_method, }; +use hyperswitch_interfaces::{api, errors}; +use serde::{Deserialize, Serialize}; +use utils::{ForeignFrom, ForeignTryFrom}; #[derive(Debug, Serialize)] pub struct WellsfargoRouterData { @@ -51,9 +68,9 @@ pub struct WellsfargoZeroMandateRequest { client_reference_information: ClientReferenceInformation, } -impl TryFrom<&types::SetupMandateRouterData> for WellsfargoZeroMandateRequest { +impl TryFrom<&SetupMandateRouterData> for WellsfargoZeroMandateRequest { type Error = error_stack::Report; - fn try_from(item: &types::SetupMandateRouterData) -> Result { + fn try_from(item: &SetupMandateRouterData) -> Result { let email = item.request.get_email()?; let bill_to = build_bill_to(item.get_optional_billing(), email)?; @@ -85,7 +102,7 @@ impl TryFrom<&types::SetupMandateRouterData> for WellsfargoZeroMandateRequest { }; let (payment_information, solution) = match item.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => { + PaymentMethodData::Card(ccard) => { let card_issuer = ccard.get_card_issuer(); let card_type = match card_issuer { Ok(issuer) => Some(String::from(issuer)), @@ -105,55 +122,54 @@ impl TryFrom<&types::SetupMandateRouterData> for WellsfargoZeroMandateRequest { ) } - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { - match item.payment_method_token.clone() { - Some(payment_method_token) => match payment_method_token { - types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { - let expiration_month = decrypt_data.get_expiry_month()?; - let expiration_year = decrypt_data.get_four_digit_expiry_year()?; - ( - PaymentInformation::ApplePay(Box::new( - ApplePayPaymentInformation { - tokenized_card: TokenizedCard { - number: decrypt_data - .application_primary_account_number, - cryptogram: decrypt_data - .payment_data - .online_payment_cryptogram, - transaction_type: TransactionType::ApplePay, - expiration_year, - expiration_month, - }, + PaymentMethodData::Wallet(wallet_data) => match wallet_data { + WalletData::ApplePay(apple_pay_data) => match item.payment_method_token.clone() { + Some(payment_method_token) => match payment_method_token { + PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { + let expiration_month = decrypt_data.get_expiry_month()?; + let expiration_year = decrypt_data.get_four_digit_expiry_year()?; + ( + PaymentInformation::ApplePay(Box::new( + ApplePayPaymentInformation { + tokenized_card: TokenizedCard { + number: decrypt_data.application_primary_account_number, + cryptogram: decrypt_data + .payment_data + .online_payment_cryptogram, + transaction_type: TransactionType::ApplePay, + expiration_year, + expiration_month, }, - )), - Some(PaymentSolution::ApplePay), - ) - } - types::PaymentMethodToken::Token(_) => Err( - unimplemented_payment_method!("Apple Pay", "Manual", "Wellsfargo"), - )?, - types::PaymentMethodToken::PazeDecrypt(_) => { - Err(unimplemented_payment_method!("Paze", "Wellsfargo"))? - } - }, - None => ( - PaymentInformation::ApplePayToken(Box::new( - ApplePayTokenPaymentInformation { - fluid_data: FluidData { - value: Secret::from(apple_pay_data.payment_data), - descriptor: Some(FLUID_DATA_DESCRIPTOR.to_string()), - }, - tokenized_card: ApplePayTokenizedCard { - transaction_type: TransactionType::ApplePay, }, + )), + Some(PaymentSolution::ApplePay), + ) + } + PaymentMethodToken::Token(_) => Err(unimplemented_payment_method!( + "Apple Pay", + "Manual", + "Wellsfargo" + ))?, + PaymentMethodToken::PazeDecrypt(_) => { + Err(unimplemented_payment_method!("Paze", "Wellsfargo"))? + } + }, + None => ( + PaymentInformation::ApplePayToken(Box::new( + ApplePayTokenPaymentInformation { + fluid_data: FluidData { + value: Secret::from(apple_pay_data.payment_data), + descriptor: Some(FLUID_DATA_DESCRIPTOR.to_string()), }, - )), - Some(PaymentSolution::ApplePay), - ), - } - } - domain::WalletData::GooglePay(google_pay_data) => ( + tokenized_card: ApplePayTokenizedCard { + transaction_type: TransactionType::ApplePay, + }, + }, + )), + Some(PaymentSolution::ApplePay), + ), + }, + WalletData::GooglePay(google_pay_data) => ( PaymentInformation::GooglePay(Box::new(GooglePayPaymentInformation { fluid_data: FluidData { value: Secret::from( @@ -165,52 +181,52 @@ impl TryFrom<&types::SetupMandateRouterData> for WellsfargoZeroMandateRequest { })), Some(PaymentSolution::GooglePay), ), - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::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::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | 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("Wellsfargo"), ))?, }, - 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::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("Wellsfargo"), ))? @@ -515,15 +531,13 @@ pub struct BillTo { administrative_area: Option>, #[serde(skip_serializing_if = "Option::is_none")] postal_code: Option>, - country: Option, + country: Option, email: pii::Email, phone_number: Option>, } -impl From<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> - for ClientReferenceInformation -{ - fn from(item: &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>) -> Self { +impl From<&WellsfargoRouterData<&PaymentsAuthorizeRouterData>> for ClientReferenceInformation { + fn from(item: &WellsfargoRouterData<&PaymentsAuthorizeRouterData>) -> Self { Self { code: Some(item.router_data.connector_request_reference_id.clone()), } @@ -532,7 +546,7 @@ impl From<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> impl TryFrom<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, Option, Option, )> for ProcessingInformation @@ -540,7 +554,7 @@ impl type Error = error_stack::Report; fn try_from( (item, solution, network): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, Option, Option, ), @@ -784,13 +798,13 @@ fn get_commerce_indicator_for_external_authentication( impl From<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, Option, )> for OrderInformationWithBill { fn from( (item, bill_to): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, Option, ), ) -> Self { @@ -873,15 +887,15 @@ impl ForeignFrom for Vec { impl TryFrom<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, + hyperswitch_domain_models::payment_method_data::Card, )> for WellsfargoPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, ccard): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - domain::Card, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, + hyperswitch_domain_models::payment_method_data::Card, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -953,17 +967,17 @@ impl impl TryFrom<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + ApplePayWalletData, )> for WellsfargoPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, apple_pay_data, apple_pay_wallet_data): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, Box, - domain::ApplePayWalletData, + ApplePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -1024,15 +1038,15 @@ impl impl TryFrom<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, + GooglePayWalletData, )> for WellsfargoPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, google_pay_data): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - domain::GooglePayWalletData, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, + GooglePayWalletData, ), ) -> Result { let email = item.router_data.request.get_email()?; @@ -1087,22 +1101,22 @@ impl TryFrom> for AccountType { impl TryFrom<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - domain::BankDebitData, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, + BankDebitData, )> for WellsfargoPaymentsRequest { type Error = error_stack::Report; fn try_from( (item, bank_debit_data): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - domain::BankDebitData, + &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, + BankDebitData, ), ) -> Result { let email = item.router_data.request.get_email()?; let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?; let order_information = OrderInformationWithBill::from((item, Some(bill_to))); let payment_information = match bank_debit_data { - domain::BankDebitData::AchBankDebit { + BankDebitData::AchBankDebit { account_number, routing_number, bank_type, @@ -1118,13 +1132,11 @@ impl }, }, ))), - domain::BankDebitData::SepaBankDebit { .. } - | domain::BankDebitData::BacsBankDebit { .. } - | domain::BankDebitData::BecsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Wellsfargo"), - )) - } + BankDebitData::SepaBankDebit { .. } + | BankDebitData::BacsBankDebit { .. } + | BankDebitData::BecsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Wellsfargo"), + )), }?; let processing_information = ProcessingInformation::try_from((item, Some(PaymentSolution::GooglePay), None))?; @@ -1140,33 +1152,31 @@ impl } } -impl TryFrom<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> - for WellsfargoPaymentsRequest -{ +impl TryFrom<&WellsfargoRouterData<&PaymentsAuthorizeRouterData>> for WellsfargoPaymentsRequest { type Error = error_stack::Report; fn try_from( - item: &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, + item: &WellsfargoRouterData<&PaymentsAuthorizeRouterData>, ) -> Result { match item.router_data.request.connector_mandate_id() { Some(connector_mandate_id) => Self::try_from((item, connector_mandate_id)), None => { match item.router_data.request.payment_method_data.clone() { - domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), - domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data { - domain::WalletData::ApplePay(apple_pay_data) => { + PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)), + PaymentMethodData::Wallet(wallet_data) => match wallet_data { + WalletData::ApplePay(apple_pay_data) => { match item.router_data.payment_method_token.clone() { Some(payment_method_token) => match payment_method_token { - types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { + PaymentMethodToken::ApplePayDecrypt(decrypt_data) => { Self::try_from((item, decrypt_data, apple_pay_data)) } - types::PaymentMethodToken::Token(_) => { + PaymentMethodToken::Token(_) => { Err(unimplemented_payment_method!( "Apple Pay", "Manual", "Wellsfargo" ))? } - types::PaymentMethodToken::PazeDecrypt(_) => { + PaymentMethodToken::PazeDecrypt(_) => { Err(unimplemented_payment_method!("Paze", "Wellsfargo"))? } }, @@ -1234,44 +1244,42 @@ impl TryFrom<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> } } } - domain::WalletData::GooglePay(google_pay_data) => { + WalletData::GooglePay(google_pay_data) => { Self::try_from((item, google_pay_data)) } - domain::WalletData::AliPayQr(_) - | domain::WalletData::AliPayRedirect(_) - | domain::WalletData::AliPayHkRedirect(_) - | domain::WalletData::MomoRedirect(_) - | domain::WalletData::KakaoPayRedirect(_) - | domain::WalletData::GoPayRedirect(_) - | domain::WalletData::GcashRedirect(_) - | domain::WalletData::ApplePayRedirect(_) - | domain::WalletData::ApplePayThirdPartySdk(_) - | domain::WalletData::DanaRedirect {} - | domain::WalletData::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( - utils::get_unimplemented_payment_method_error_message("Wellsfargo"), - ) - .into()) - } + WalletData::AliPayQr(_) + | WalletData::AliPayRedirect(_) + | WalletData::AliPayHkRedirect(_) + | WalletData::MomoRedirect(_) + | WalletData::KakaoPayRedirect(_) + | WalletData::GoPayRedirect(_) + | WalletData::GcashRedirect(_) + | WalletData::ApplePayRedirect(_) + | WalletData::ApplePayThirdPartySdk(_) + | WalletData::DanaRedirect {} + | 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("Wellsfargo"), + ) + .into()), }, // If connector_mandate_id is present MandatePayment will be the PMD, the case will be handled in the first `if` clause. // This is a fallback implementation in the event of catastrophe. - domain::PaymentMethodData::MandatePayment => { + PaymentMethodData::MandatePayment => { let connector_mandate_id = item.router_data.request.connector_mandate_id().ok_or( errors::ConnectorError::MissingRequiredField { @@ -1280,24 +1288,22 @@ impl TryFrom<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> )?; Self::try_from((item, connector_mandate_id)) } - domain::PaymentMethodData::BankDebit(bank_debit) => { - Self::try_from((item, bank_debit)) - } - domain::PaymentMethodData::CardRedirect(_) - | domain::PaymentMethodData::PayLater(_) - | domain::PaymentMethodData::BankRedirect(_) - | domain::PaymentMethodData::BankTransfer(_) - | domain::PaymentMethodData::Crypto(_) - | 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::BankDebit(bank_debit) => Self::try_from((item, bank_debit)), + PaymentMethodData::CardRedirect(_) + | PaymentMethodData::PayLater(_) + | PaymentMethodData::BankRedirect(_) + | PaymentMethodData::BankTransfer(_) + | PaymentMethodData::Crypto(_) + | 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("Wellsfargo"), ) @@ -1309,18 +1315,12 @@ impl TryFrom<&WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>> } } -impl - TryFrom<( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - String, - )> for WellsfargoPaymentsRequest +impl TryFrom<(&WellsfargoRouterData<&PaymentsAuthorizeRouterData>, String)> + for WellsfargoPaymentsRequest { type Error = error_stack::Report; fn try_from( - (item, connector_mandate_id): ( - &WellsfargoRouterData<&types::PaymentsAuthorizeRouterData>, - String, - ), + (item, connector_mandate_id): (&WellsfargoRouterData<&PaymentsAuthorizeRouterData>, String), ) -> Result { let processing_information = ProcessingInformation::try_from((item, None, None))?; let payment_instrument = WellsfargoPaymentInstrument { @@ -1370,12 +1370,12 @@ pub struct WellsfargoPaymentsIncrementalAuthorizationRequest { order_information: OrderInformationIncrementalAuthorization, } -impl TryFrom<&WellsfargoRouterData<&types::PaymentsCaptureRouterData>> +impl TryFrom<&WellsfargoRouterData<&PaymentsCaptureRouterData>> for WellsfargoPaymentsCaptureRequest { type Error = error_stack::Report; fn try_from( - item: &WellsfargoRouterData<&types::PaymentsCaptureRouterData>, + item: &WellsfargoRouterData<&PaymentsCaptureRouterData>, ) -> Result { let merchant_defined_information = item .router_data @@ -1411,12 +1411,12 @@ impl TryFrom<&WellsfargoRouterData<&types::PaymentsCaptureRouterData>> } } -impl TryFrom<&WellsfargoRouterData<&types::PaymentsIncrementalAuthorizationRouterData>> +impl TryFrom<&WellsfargoRouterData<&PaymentsIncrementalAuthorizationRouterData>> for WellsfargoPaymentsIncrementalAuthorizationRequest { type Error = error_stack::Report; fn try_from( - item: &WellsfargoRouterData<&types::PaymentsIncrementalAuthorizationRouterData>, + item: &WellsfargoRouterData<&PaymentsIncrementalAuthorizationRouterData>, ) -> Result { Ok(Self { processing_information: ProcessingInformation { @@ -1466,10 +1466,10 @@ pub struct ReversalInformation { reason: String, } -impl TryFrom<&WellsfargoRouterData<&types::PaymentsCancelRouterData>> for WellsfargoVoidRequest { +impl TryFrom<&WellsfargoRouterData<&PaymentsCancelRouterData>> for WellsfargoVoidRequest { type Error = error_stack::Report; fn try_from( - value: &WellsfargoRouterData<&types::PaymentsCancelRouterData>, + value: &WellsfargoRouterData<&PaymentsCancelRouterData>, ) -> Result { let merchant_defined_information = value .router_data @@ -1510,10 +1510,10 @@ pub struct WellsfargoAuthType { pub(super) api_secret: Secret, } -impl TryFrom<&types::ConnectorAuthType> for WellsfargoAuthType { +impl TryFrom<&ConnectorAuthType> for WellsfargoAuthType { type Error = error_stack::Report; - fn try_from(auth_type: &types::ConnectorAuthType) -> Result { - if let types::ConnectorAuthType::SignatureKey { + fn try_from(auth_type: &ConnectorAuthType) -> Result { + if let ConnectorAuthType::SignatureKey { api_key, key1, api_secret, @@ -1694,19 +1694,14 @@ pub struct WellsfargoErrorInformation { impl ForeignFrom<( &WellsfargoErrorInformationResponse, - types::ResponseRouterData, + ResponseRouterData, Option, - )> for types::RouterData + )> for RouterData { fn foreign_from( (error_response, item, transaction_status): ( &WellsfargoErrorInformationResponse, - types::ResponseRouterData< - F, - WellsfargoPaymentsResponse, - T, - types::PaymentsResponseData, - >, + ResponseRouterData, Option, ), ) -> Self { @@ -1728,17 +1723,17 @@ impl detailed_error_info, None, ); - let response = Err(types::ErrorResponse { + let response = Err(ErrorResponse { code: error_response .error_information .reason .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_response .error_information .reason .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code: item.http_code, attempt_status: None, @@ -1760,9 +1755,9 @@ impl fn get_error_response_if_failure( (info_response, status, http_code): (&WellsfargoPaymentsResponse, enums::AttemptStatus, u16), -) -> Option { +) -> Option { if utils::is_payment_failure(status) { - Some(types::ErrorResponse::foreign_from(( + Some(ErrorResponse::foreign_from(( &info_response.error_information, &info_response.risk_information, Some(status), @@ -1776,7 +1771,7 @@ fn get_error_response_if_failure( fn get_payment_response( (info_response, status, http_code): (&WellsfargoPaymentsResponse, enums::AttemptStatus, u16), -) -> Result { +) -> Result { let error_response = get_error_response_if_failure((info_response, status, http_code)); match error_response { Some(error) => Err(error), @@ -1787,7 +1782,7 @@ fn get_payment_response( info_response .token_information .clone() - .map(|token_info| types::MandateReference { + .map(|token_info| MandateReference { connector_mandate_id: token_info .payment_instrument .map(|payment_instrument| payment_instrument.id.expose()), @@ -1796,8 +1791,8 @@ fn get_payment_response( connector_mandate_request_reference_id: None, }); - Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId(info_response.id.clone()), + Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(info_response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(mandate_reference), connector_metadata: None, @@ -1820,22 +1815,21 @@ fn get_payment_response( impl TryFrom< - types::ResponseRouterData< - api::Authorize, + ResponseRouterData< + Authorize, WellsfargoPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, - > - for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - api::Authorize, + item: ResponseRouterData< + Authorize, WellsfargoPaymentsResponse, - types::PaymentsAuthorizeData, - types::PaymentsResponseData, + PaymentsAuthorizeData, + PaymentsResponseData, >, ) -> Result { let status = enums::AttemptStatus::foreign_from(( @@ -1850,8 +1844,8 @@ impl .response .processor_information .as_ref() - .map(types::AdditionalPaymentMethodConnectorResponse::from) - .map(types::ConnectorResponseData::with_additional_payment_method_data); + .map(AdditionalPaymentMethodConnectorResponse::from) + .map(ConnectorResponseData::with_additional_payment_method_data); Ok(Self { status, @@ -1862,7 +1856,7 @@ impl } } -impl From<&ClientProcessorInformation> for types::AdditionalPaymentMethodConnectorResponse { +impl From<&ClientProcessorInformation> for AdditionalPaymentMethodConnectorResponse { fn from(processor_information: &ClientProcessorInformation) -> Self { let payment_checks = Some( serde_json::json!({"avs_response": processor_information.avs, "card_verification": processor_information.card_verification}), @@ -1877,21 +1871,21 @@ impl From<&ClientProcessorInformation> for types::AdditionalPaymentMethodConnect impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, WellsfargoPaymentsResponse, - 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, WellsfargoPaymentsResponse, - types::PaymentsCaptureData, - types::PaymentsResponseData, + PaymentsCaptureData, + PaymentsResponseData, >, ) -> Result { let status = enums::AttemptStatus::foreign_from(( @@ -1912,21 +1906,16 @@ impl impl TryFrom< - types::ResponseRouterData< - F, - WellsfargoPaymentsResponse, - types::PaymentsCancelData, - types::PaymentsResponseData, - >, - > for types::RouterData + ResponseRouterData, + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, WellsfargoPaymentsResponse, - types::PaymentsCancelData, - types::PaymentsResponseData, + PaymentsCancelData, + PaymentsResponseData, >, ) -> Result { let status = enums::AttemptStatus::foreign_from(( @@ -1948,33 +1937,28 @@ impl // zero dollar response impl TryFrom< - types::ResponseRouterData< - api::SetupMandate, + ResponseRouterData< + SetupMandate, WellsfargoPaymentsResponse, - types::SetupMandateRequestData, - types::PaymentsResponseData, + SetupMandateRequestData, + PaymentsResponseData, >, - > - for types::RouterData< - api::SetupMandate, - types::SetupMandateRequestData, - types::PaymentsResponseData, - > + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< - api::SetupMandate, + item: ResponseRouterData< + SetupMandate, WellsfargoPaymentsResponse, - types::SetupMandateRequestData, - types::PaymentsResponseData, + SetupMandateRequestData, + PaymentsResponseData, >, ) -> Result { let mandate_reference = item.response .token_information .clone() - .map(|token_info| types::MandateReference { + .map(|token_info| MandateReference { connector_mandate_id: token_info .payment_instrument .map(|payment_instrument| payment_instrument.id.expose()), @@ -2000,17 +1984,15 @@ impl .response .processor_information .as_ref() - .map(types::AdditionalPaymentMethodConnectorResponse::from) - .map(types::ConnectorResponseData::with_additional_payment_method_data); + .map(AdditionalPaymentMethodConnectorResponse::from) + .map(ConnectorResponseData::with_additional_payment_method_data); Ok(Self { status: mandate_status, response: match error_response { Some(error) => Err(error), - None => Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.id.clone(), - ), + None => Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(mandate_reference), connector_metadata: None, @@ -2041,23 +2023,23 @@ impl impl ForeignTryFrom<( - types::ResponseRouterData< + ResponseRouterData< F, WellsfargoPaymentsIncrementalAuthorizationResponse, T, - types::PaymentsResponseData, + PaymentsResponseData, >, bool, - )> for types::RouterData + )> for RouterData { type Error = error_stack::Report; fn foreign_try_from( data: ( - types::ResponseRouterData< + ResponseRouterData< F, WellsfargoPaymentsIncrementalAuthorizationResponse, T, - types::PaymentsResponseData, + PaymentsResponseData, >, bool, ), @@ -2065,22 +2047,18 @@ impl let item = data.0; Ok(Self { response: match item.response.error_information { - Some(error) => Ok( - types::PaymentsResponseData::IncrementalAuthorizationResponse { - status: common_enums::AuthorizationStatus::Failure, - error_code: error.reason, - error_message: error.message, - connector_authorization_id: None, - }, - ), - _ => Ok( - types::PaymentsResponseData::IncrementalAuthorizationResponse { - status: item.response.status.into(), - error_code: None, - error_message: None, - connector_authorization_id: None, - }, - ), + Some(error) => Ok(PaymentsResponseData::IncrementalAuthorizationResponse { + status: common_enums::AuthorizationStatus::Failure, + error_code: error.reason, + error_message: error.message, + connector_authorization_id: None, + }), + _ => Ok(PaymentsResponseData::IncrementalAuthorizationResponse { + status: item.response.status.into(), + error_code: None, + error_message: None, + connector_authorization_id: None, + }), }, ..item.data }) @@ -2104,21 +2082,21 @@ pub struct ApplicationInformation { impl TryFrom< - types::ResponseRouterData< + ResponseRouterData< F, WellsfargoTransactionResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, + PaymentsSyncData, + PaymentsResponseData, >, - > for types::RouterData + > for RouterData { type Error = error_stack::Report; fn try_from( - item: types::ResponseRouterData< + item: ResponseRouterData< F, WellsfargoTransactionResponse, - types::PaymentsSyncData, - types::PaymentsResponseData, + PaymentsSyncData, + PaymentsResponseData, >, ) -> Result { match item.response.application_information.status { @@ -2132,7 +2110,7 @@ impl let risk_info: Option = None; if utils::is_payment_failure(status) { Ok(Self { - response: Err(types::ErrorResponse::foreign_from(( + response: Err(ErrorResponse::foreign_from(( &item.response.error_information, &risk_info, Some(status), @@ -2145,8 +2123,8 @@ impl } else { Ok(Self { status, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId( item.response.id.clone(), ), redirection_data: Box::new(None), @@ -2167,10 +2145,8 @@ impl } None => Ok(Self { status: item.data.status, - response: Ok(types::PaymentsResponseData::TransactionResponse { - resource_id: types::ResponseId::ConnectorTransactionId( - item.response.id.clone(), - ), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, @@ -2192,11 +2168,9 @@ pub struct WellsfargoRefundRequest { client_reference_information: ClientReferenceInformation, } -impl TryFrom<&WellsfargoRouterData<&types::RefundsRouterData>> for WellsfargoRefundRequest { +impl TryFrom<&WellsfargoRouterData<&RefundsRouterData>> for WellsfargoRefundRequest { type Error = error_stack::Report; - fn try_from( - item: &WellsfargoRouterData<&types::RefundsRouterData>, - ) -> Result { + fn try_from(item: &WellsfargoRouterData<&RefundsRouterData>) -> Result { Ok(Self { order_information: OrderInformation { amount_details: Amount { @@ -2244,16 +2218,16 @@ pub struct WellsfargoRefundResponse { error_information: Option, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let refund_status = enums::RefundStatus::from(item.response.status.clone()); let response = if utils::is_refund_failure(refund_status) { - Err(types::ErrorResponse::foreign_from(( + Err(ErrorResponse::foreign_from(( &item.response.error_information, &None, None, @@ -2261,7 +2235,7 @@ impl TryFrom, } -impl TryFrom> - for types::RefundsRouterData +impl TryFrom> + for RefundsRouterData { type Error = error_stack::Report; fn try_from( - item: types::RefundsResponseRouterData, + item: RefundsResponseRouterData, ) -> Result { let response = match item .response @@ -2304,7 +2278,7 @@ impl TryFrom Ok(types::RefundsResponseData { + None => Ok(RefundsResponseData { connector_refund_id: item.response.id.clone(), refund_status: match item.data.response { Ok(response) => response.refund_status, @@ -2428,7 +2402,7 @@ impl Option, u16, String, - )> for types::ErrorResponse + )> for ErrorResponse { fn foreign_from( (error_data, risk_information, attempt_status, status_code, transaction_id): ( @@ -2476,10 +2450,10 @@ impl Self { code: error_message .clone() - .unwrap_or(consts::NO_ERROR_CODE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_message .clone() - .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), + .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status, diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs index 6ef061a717a9..ebe3fa1e2407 100644 --- a/crates/hyperswitch_connectors/src/default_implementations.rs +++ b/crates/hyperswitch_connectors/src/default_implementations.rs @@ -99,6 +99,7 @@ default_imp_for_authorize_session_token!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -145,6 +146,7 @@ default_imp_for_authorize_session_token!( connectors::Tsys, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl, @@ -170,6 +172,7 @@ default_imp_for_calculate_tax!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -216,6 +219,7 @@ default_imp_for_calculate_tax!( connectors::Volt, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl, @@ -241,6 +245,7 @@ default_imp_for_session_update!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -282,6 +287,7 @@ default_imp_for_session_update!( connectors::Gocardless, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl, @@ -313,6 +319,7 @@ default_imp_for_post_session_tokens!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Bitpay, connectors::Bluesnap, connectors::Boku, @@ -353,6 +360,7 @@ default_imp_for_post_session_tokens!( connectors::Gocardless, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Xendit, connectors::Powertranz, connectors::Prophetpay, @@ -385,6 +393,7 @@ macro_rules! default_imp_for_complete_authorize { default_imp_for_complete_authorize!( connectors::Amazonpay, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Boku, @@ -419,6 +428,7 @@ default_imp_for_complete_authorize!( connectors::Thunes, connectors::Tsys, connectors::UnifiedAuthenticationService, + connectors::Wellsfargo, connectors::Worldline, connectors::Volt, connectors::Xendit, @@ -447,6 +457,7 @@ default_imp_for_incremental_authorization!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -519,6 +530,7 @@ default_imp_for_create_customer!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -563,6 +575,7 @@ default_imp_for_create_customer!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -593,6 +606,7 @@ default_imp_for_connector_redirect_response!( connectors::Bitpay, connectors::Boku, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Cashtocode, connectors::Coinbase, connectors::Cryptopay, @@ -629,6 +643,7 @@ default_imp_for_connector_redirect_response!( connectors::Thunes, connectors::Tsys, connectors::UnifiedAuthenticationService, + connectors::Wellsfargo, connectors::Worldline, connectors::Volt, connectors::Xendit, @@ -655,6 +670,7 @@ default_imp_for_pre_processing_steps!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -697,6 +713,7 @@ default_imp_for_pre_processing_steps!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -724,6 +741,7 @@ default_imp_for_post_processing_steps!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -770,6 +788,7 @@ default_imp_for_post_processing_steps!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -797,6 +816,7 @@ default_imp_for_approve!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -843,6 +863,7 @@ default_imp_for_approve!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -870,6 +891,7 @@ default_imp_for_reject!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -916,6 +938,7 @@ default_imp_for_reject!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -943,6 +966,7 @@ default_imp_for_webhook_source_verification!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -989,6 +1013,7 @@ default_imp_for_webhook_source_verification!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1017,6 +1042,7 @@ default_imp_for_accept_dispute!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1063,6 +1089,7 @@ default_imp_for_accept_dispute!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1090,6 +1117,7 @@ default_imp_for_submit_evidence!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1136,6 +1164,7 @@ default_imp_for_submit_evidence!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1163,6 +1192,7 @@ default_imp_for_defend_dispute!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1209,6 +1239,7 @@ default_imp_for_defend_dispute!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1245,6 +1276,7 @@ default_imp_for_file_upload!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1291,6 +1323,7 @@ default_imp_for_file_upload!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1311,6 +1344,7 @@ default_imp_for_payouts!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1356,6 +1390,7 @@ default_imp_for_payouts!( connectors::Volt, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl, @@ -1384,6 +1419,7 @@ default_imp_for_payouts_create!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1430,6 +1466,7 @@ default_imp_for_payouts_create!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1459,6 +1496,7 @@ default_imp_for_payouts_retrieve!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1505,6 +1543,7 @@ default_imp_for_payouts_retrieve!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1534,6 +1573,7 @@ default_imp_for_payouts_eligibility!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1580,6 +1620,7 @@ default_imp_for_payouts_eligibility!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1609,6 +1650,7 @@ default_imp_for_payouts_fulfill!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1654,6 +1696,7 @@ default_imp_for_payouts_fulfill!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1683,6 +1726,7 @@ default_imp_for_payouts_cancel!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1729,6 +1773,7 @@ default_imp_for_payouts_cancel!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1758,6 +1803,7 @@ default_imp_for_payouts_quote!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1804,6 +1850,7 @@ default_imp_for_payouts_quote!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1833,6 +1880,7 @@ default_imp_for_payouts_recipient!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1879,6 +1927,7 @@ default_imp_for_payouts_recipient!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1908,6 +1957,7 @@ default_imp_for_payouts_recipient_account!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1954,6 +2004,7 @@ default_imp_for_payouts_recipient_account!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -1983,6 +2034,7 @@ default_imp_for_frm_sale!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2029,6 +2081,7 @@ default_imp_for_frm_sale!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -2058,6 +2111,7 @@ default_imp_for_frm_checkout!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2104,6 +2158,7 @@ default_imp_for_frm_checkout!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -2133,6 +2188,7 @@ default_imp_for_frm_transaction!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2179,6 +2235,7 @@ default_imp_for_frm_transaction!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -2208,6 +2265,7 @@ default_imp_for_frm_fulfillment!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2254,6 +2312,7 @@ default_imp_for_frm_fulfillment!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -2283,6 +2342,7 @@ default_imp_for_frm_record_return!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2329,6 +2389,7 @@ default_imp_for_frm_record_return!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -2355,6 +2416,7 @@ default_imp_for_revoking_mandates!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2427,6 +2489,7 @@ default_imp_for_uas_pre_authentication!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bluesnap, connectors::Bitpay, @@ -2473,6 +2536,7 @@ default_imp_for_uas_pre_authentication!( connectors::Tsys, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, @@ -2498,6 +2562,7 @@ default_imp_for_uas_post_authentication!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -2544,6 +2609,7 @@ default_imp_for_uas_post_authentication!( connectors::Tsys, connectors::Worldline, connectors::Worldpay, + connectors::Wellsfargo, connectors::Volt, connectors::Xendit, connectors::Zen, diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs index 739cc62c7b32..ca4ace954cdc 100644 --- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs +++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs @@ -209,6 +209,7 @@ default_imp_for_new_connector_integration_payment!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -256,8 +257,8 @@ default_imp_for_new_connector_integration_payment!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -283,6 +284,7 @@ default_imp_for_new_connector_integration_refund!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -328,6 +330,7 @@ default_imp_for_new_connector_integration_refund!( connectors::Thunes, connectors::Tsys, connectors::UnifiedAuthenticationService, + connectors::Wellsfargo, connectors::Worldline, connectors::Volt, connectors::Worldpay, @@ -352,6 +355,7 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -399,8 +403,8 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -427,6 +431,7 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -473,8 +478,8 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -500,6 +505,7 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -546,8 +552,8 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -573,6 +579,7 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -620,8 +627,8 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -657,6 +664,7 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -704,8 +712,8 @@ default_imp_for_new_connector_integration_file_upload!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -733,6 +741,7 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -780,8 +789,8 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -809,6 +818,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -856,8 +866,8 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -885,6 +895,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -932,8 +943,8 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -961,6 +972,7 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1008,8 +1020,8 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1037,6 +1049,7 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1084,8 +1097,8 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1113,6 +1126,7 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1160,8 +1174,8 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1189,6 +1203,7 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1236,8 +1251,8 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1265,6 +1280,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1312,8 +1328,8 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1339,6 +1355,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1386,8 +1403,8 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1415,6 +1432,7 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1462,8 +1480,8 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1491,6 +1509,7 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1538,8 +1557,8 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1567,6 +1586,7 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1614,8 +1634,8 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1643,6 +1663,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1690,8 +1711,8 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1719,6 +1740,7 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1766,8 +1788,8 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); @@ -1792,6 +1814,7 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Amazonpay, connectors::Bambora, connectors::Bamboraapac, + connectors::Bankofamerica, connectors::Billwerk, connectors::Bitpay, connectors::Bluesnap, @@ -1839,8 +1862,8 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::UnifiedAuthenticationService, connectors::Worldline, connectors::Volt, - connectors::Worldpay, - connectors::Xendit, +connectors::Worldpay, +connectors::Wellsfargo, connectors::Xendit, connectors::Zen, connectors::Zsl ); diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs index 331c711f6608..0bd9190f11cf 100644 --- a/crates/router/src/connector.rs +++ b/crates/router/src/connector.rs @@ -2,7 +2,6 @@ pub mod aci; pub mod adyen; pub mod adyenplatform; pub mod authorizedotnet; -pub mod bankofamerica; pub mod braintree; pub mod checkout; #[cfg(feature = "dummy_connector")] @@ -30,29 +29,29 @@ pub mod stripe; pub mod threedsecureio; pub mod trustpay; pub mod utils; -pub mod wellsfargo; pub mod wellsfargopayout; pub mod wise; pub use hyperswitch_connectors::connectors::{ airwallex, airwallex::Airwallex, amazonpay, amazonpay::Amazonpay, bambora, bambora::Bambora, - bamboraapac, bamboraapac::Bamboraapac, billwerk, billwerk::Billwerk, bitpay, bitpay::Bitpay, - bluesnap, bluesnap::Bluesnap, boku, boku::Boku, cashtocode, cashtocode::Cashtocode, coinbase, - coinbase::Coinbase, cryptopay, cryptopay::Cryptopay, ctp_mastercard, - ctp_mastercard::CtpMastercard, cybersource, cybersource::Cybersource, datatrans, - datatrans::Datatrans, 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, paybox, paybox::Paybox, payeezy, - payeezy::Payeezy, payu, payu::Payu, placetopay, placetopay::Placetopay, 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, - unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService, - volt, volt::Volt, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, xendit, + bamboraapac, bamboraapac::Bamboraapac, bankofamerica, bankofamerica::Bankofamerica, billwerk, + billwerk::Billwerk, bitpay, bitpay::Bitpay, bluesnap, bluesnap::Bluesnap, boku, boku::Boku, + cashtocode, cashtocode::Cashtocode, coinbase, coinbase::Coinbase, cryptopay, + cryptopay::Cryptopay, ctp_mastercard, ctp_mastercard::CtpMastercard, cybersource, + cybersource::Cybersource, datatrans, datatrans::Datatrans, 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, paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payu, payu::Payu, + placetopay, placetopay::Placetopay, 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, unified_authentication_service, + unified_authentication_service::UnifiedAuthenticationService, volt, volt::Volt, wellsfargo, + wellsfargo::Wellsfargo, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl, }; @@ -60,10 +59,10 @@ pub use hyperswitch_connectors::connectors::{ pub use self::dummyconnector::DummyConnector; pub use self::{ aci::Aci, adyen::Adyen, adyenplatform::Adyenplatform, authorizedotnet::Authorizedotnet, - bankofamerica::Bankofamerica, braintree::Braintree, checkout::Checkout, 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, payme::Payme, payone::Payone, paypal::Paypal, plaid::Plaid, - riskified::Riskified, signifyd::Signifyd, stripe::Stripe, threedsecureio::Threedsecureio, - trustpay::Trustpay, wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, + braintree::Braintree, checkout::Checkout, 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, + payme::Payme, payone::Payone, paypal::Paypal, plaid::Plaid, riskified::Riskified, + signifyd::Signifyd, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay, + wellsfargopayout::Wellsfargopayout, wise::Wise, }; diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs index 823f0a4bf04f..305579394f4a 100644 --- a/crates/router/src/consts.rs +++ b/crates/router/src/consts.rs @@ -41,7 +41,6 @@ pub const DEFAULT_LIST_API_LIMIT: u16 = 10; pub(crate) const UNSUPPORTED_ERROR_MESSAGE: &str = "Unsupported response type"; pub(crate) const LOW_BALANCE_ERROR_MESSAGE: &str = "Insufficient balance in the payment method"; pub(crate) const CONNECTOR_UNAUTHORIZED_ERROR: &str = "Authentication Error from the connector"; -pub(crate) const REFUND_VOIDED: &str = "Refund request has been voided."; pub(crate) const CANNOT_CONTINUE_AUTH: &str = "Cannot continue with Authorization due to failed Liability Shift."; 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 78b35bbdafaf..380db66223e8 100644 --- a/crates/router/src/core/payments/connector_integration_v2_impls.rs +++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs @@ -699,7 +699,6 @@ default_imp_for_new_connector_integration_payment!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -723,7 +722,6 @@ default_imp_for_new_connector_integration_payment!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise, connector::Plaid @@ -750,7 +748,6 @@ default_imp_for_new_connector_integration_refund!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -774,7 +771,6 @@ default_imp_for_new_connector_integration_refund!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -795,7 +791,6 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -819,7 +814,6 @@ default_imp_for_new_connector_integration_connector_access_token!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -862,7 +856,6 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -886,7 +879,6 @@ default_imp_for_new_connector_integration_accept_dispute!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -911,7 +903,6 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -935,7 +926,6 @@ default_imp_for_new_connector_integration_defend_dispute!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -944,7 +934,6 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -968,7 +957,6 @@ default_imp_for_new_connector_integration_submit_evidence!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1004,7 +992,6 @@ default_imp_for_new_connector_integration_file_upload!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1028,7 +1015,6 @@ default_imp_for_new_connector_integration_file_upload!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1113,7 +1099,6 @@ default_imp_for_new_connector_integration_payouts!( connector::Tsys, connector::UnifiedAuthenticationService, connector::Volt, - connector::Wellsfargo, connector::Wise, connector::Worldline, connector::Worldpay, @@ -1145,7 +1130,6 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1169,7 +1153,6 @@ default_imp_for_new_connector_integration_payouts_create!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1197,7 +1180,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1221,7 +1203,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1249,7 +1230,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1273,7 +1253,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1301,7 +1280,6 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1325,7 +1303,6 @@ default_imp_for_new_connector_integration_payouts_cancel!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1353,7 +1330,6 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1377,7 +1353,6 @@ default_imp_for_new_connector_integration_payouts_quote!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1405,7 +1380,6 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1429,7 +1403,6 @@ default_imp_for_new_connector_integration_payouts_recipient!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1457,7 +1430,6 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1481,7 +1453,6 @@ default_imp_for_new_connector_integration_payouts_sync!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1509,7 +1480,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1533,7 +1503,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1559,7 +1528,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1583,7 +1551,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1605,7 +1572,6 @@ default_imp_for_new_connector_integration_frm!( connector::Authorizedotnet, connector::Bambora, connector::Bamboraapac, - connector::Bankofamerica, connector::Billwerk, connector::Bitpay, connector::Bluesnap, @@ -1669,7 +1635,6 @@ default_imp_for_new_connector_integration_frm!( connector::Tsys, connector::UnifiedAuthenticationService, connector::Volt, - connector::Wellsfargo, connector::Wise, connector::Worldline, connector::Worldpay, @@ -1701,7 +1666,6 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1725,7 +1689,6 @@ default_imp_for_new_connector_integration_frm_sale!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1753,7 +1716,6 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1777,7 +1739,6 @@ default_imp_for_new_connector_integration_frm_checkout!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1805,7 +1766,6 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1829,7 +1789,6 @@ default_imp_for_new_connector_integration_frm_transaction!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1857,7 +1816,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1881,7 +1839,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1909,7 +1866,6 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1933,7 +1889,6 @@ default_imp_for_new_connector_integration_frm_record_return!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -1958,7 +1913,6 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1982,7 +1936,6 @@ default_imp_for_new_connector_integration_revoking_mandates!( connector::Stripe, connector::Trustpay, connector::Threedsecureio, - connector::Wellsfargo, connector::Wise, connector::Plaid ); @@ -2106,7 +2059,6 @@ default_imp_for_new_connector_integration_connector_authentication!( connector::Tsys, connector::UnifiedAuthenticationService, connector::Volt, - connector::Wellsfargo, connector::Wise, connector::Worldline, connector::Worldpay, @@ -2145,7 +2097,6 @@ default_imp_for_new_connector_integration_uas!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2170,7 +2121,6 @@ default_imp_for_new_connector_integration_uas!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs index f5f944542838..e87141f54e81 100644 --- a/crates/router/src/core/payments/flows.rs +++ b/crates/router/src/core/payments/flows.rs @@ -215,7 +215,6 @@ default_imp_for_complete_authorize!( connector::Adyenplatform, connector::Aci, connector::Adyen, - connector::Bankofamerica, connector::Checkout, connector::Ebanx, connector::Gpayments, @@ -235,7 +234,6 @@ default_imp_for_complete_authorize!( connector::Threedsecureio, connector::Trustpay, connector::Wise, - connector::Wellsfargo, connector::Wellsfargopayout ); macro_rules! default_imp_for_webhook_source_verification { @@ -269,7 +267,6 @@ default_imp_for_webhook_source_verification!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -293,7 +290,6 @@ default_imp_for_webhook_source_verification!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -330,7 +326,6 @@ default_imp_for_create_customer!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -354,7 +349,6 @@ default_imp_for_create_customer!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -392,7 +386,6 @@ default_imp_for_connector_redirect_response!( connector::Adyenplatform, connector::Aci, connector::Adyen, - connector::Bankofamerica, connector::Ebanx, connector::Gpayments, connector::Iatapay, @@ -407,7 +400,6 @@ default_imp_for_connector_redirect_response!( connector::Riskified, connector::Signifyd, connector::Threedsecureio, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -543,7 +535,6 @@ default_imp_for_accept_dispute!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Ebanx, connector::Globalpay, @@ -567,7 +558,6 @@ default_imp_for_accept_dispute!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -625,7 +615,6 @@ default_imp_for_file_upload!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Ebanx, connector::Globalpay, @@ -648,7 +637,6 @@ default_imp_for_file_upload!( connector::Threedsecureio, connector::Trustpay, connector::Opennode, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -684,7 +672,6 @@ default_imp_for_submit_evidence!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Ebanx, connector::Globalpay, @@ -707,7 +694,6 @@ default_imp_for_submit_evidence!( connector::Threedsecureio, connector::Trustpay, connector::Opennode, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -743,7 +729,6 @@ default_imp_for_defend_dispute!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Ebanx, connector::Globalpay, @@ -767,7 +752,6 @@ default_imp_for_defend_dispute!( connector::Threedsecureio, connector::Trustpay, connector::Opennode, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -818,7 +802,6 @@ default_imp_for_pre_processing_steps!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -837,7 +820,6 @@ default_imp_for_pre_processing_steps!( connector::Riskified, connector::Signifyd, connector::Threedsecureio, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -857,7 +839,6 @@ impl default_imp_for_post_processing_steps!( connector::Adyenplatform, connector::Adyen, - connector::Bankofamerica, connector::Nmi, connector::Nuvei, connector::Payme, @@ -883,7 +864,6 @@ default_imp_for_post_processing_steps!( connector::Riskified, connector::Signifyd, connector::Threedsecureio, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -902,7 +882,6 @@ impl Payouts for connector::DummyConnector {} default_imp_for_payouts!( connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -923,7 +902,6 @@ default_imp_for_payouts!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -959,7 +937,6 @@ default_imp_for_payouts_create!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -981,7 +958,6 @@ default_imp_for_payouts_create!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -1018,7 +994,6 @@ default_imp_for_payouts_retrieve!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1042,7 +1017,6 @@ default_imp_for_payouts_retrieve!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1082,7 +1056,6 @@ default_imp_for_payouts_eligibility!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -1106,7 +1079,6 @@ default_imp_for_payouts_eligibility!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -1141,7 +1113,6 @@ impl default_imp_for_payouts_fulfill!( connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -1162,7 +1133,6 @@ default_imp_for_payouts_fulfill!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -1198,7 +1168,6 @@ default_imp_for_payouts_cancel!( connector::Adyenplatform, connector::Aci, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -1221,7 +1190,6 @@ default_imp_for_payouts_cancel!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -1258,7 +1226,6 @@ default_imp_for_payouts_quote!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -1282,7 +1249,6 @@ default_imp_for_payouts_quote!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -1319,7 +1285,6 @@ default_imp_for_payouts_recipient!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Globalpay, @@ -1342,7 +1307,6 @@ default_imp_for_payouts_recipient!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout ); @@ -1382,7 +1346,6 @@ default_imp_for_payouts_recipient_account!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1406,7 +1369,6 @@ default_imp_for_payouts_recipient_account!( connector::Signifyd, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1443,7 +1405,6 @@ default_imp_for_approve!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1468,7 +1429,6 @@ default_imp_for_approve!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1505,7 +1465,6 @@ default_imp_for_reject!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1530,7 +1489,6 @@ default_imp_for_reject!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1666,7 +1624,6 @@ default_imp_for_frm_sale!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1689,7 +1646,6 @@ default_imp_for_frm_sale!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1728,7 +1684,6 @@ default_imp_for_frm_checkout!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1751,7 +1706,6 @@ default_imp_for_frm_checkout!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1790,7 +1744,6 @@ default_imp_for_frm_transaction!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1813,7 +1766,6 @@ default_imp_for_frm_transaction!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1852,7 +1804,6 @@ default_imp_for_frm_fulfillment!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1875,7 +1826,6 @@ default_imp_for_frm_fulfillment!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1914,7 +1864,6 @@ default_imp_for_frm_record_return!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -1937,7 +1886,6 @@ default_imp_for_frm_record_return!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -1974,7 +1922,6 @@ default_imp_for_incremental_authorization!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2033,7 +1980,6 @@ default_imp_for_revoking_mandates!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2260,7 +2206,6 @@ default_imp_for_authorize_session_token!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2284,7 +2229,6 @@ default_imp_for_authorize_session_token!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -2319,7 +2263,6 @@ default_imp_for_calculate_tax!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2344,7 +2287,6 @@ default_imp_for_calculate_tax!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -2379,7 +2321,6 @@ default_imp_for_session_update!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2403,7 +2344,6 @@ default_imp_for_session_update!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -2438,7 +2378,6 @@ default_imp_for_post_session_tokens!( connector::Adyen, connector::Adyenplatform, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2462,7 +2401,6 @@ default_imp_for_post_session_tokens!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -2500,7 +2438,6 @@ default_imp_for_uas_pre_authentication!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2525,7 +2462,6 @@ default_imp_for_uas_pre_authentication!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise ); @@ -2560,7 +2496,6 @@ default_imp_for_uas_post_authentication!( connector::Aci, connector::Adyen, connector::Authorizedotnet, - connector::Bankofamerica, connector::Braintree, connector::Checkout, connector::Ebanx, @@ -2585,7 +2520,6 @@ default_imp_for_uas_post_authentication!( connector::Stripe, connector::Threedsecureio, connector::Trustpay, - connector::Wellsfargo, connector::Wellsfargopayout, connector::Wise );