From dfed2be2900a53f62a4903376004a264f9da25a8 Mon Sep 17 00:00:00 2001 From: Nithin N <57832822+Nithin1506200@users.noreply.github.com> Date: Mon, 7 Jul 2025 16:52:50 +0530 Subject: [PATCH] feat(connector): [Celero] add Connector Template Code (#8489) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- api-reference/v1/openapi_spec_v1.json | 2 + api-reference/v2/openapi_spec_v2.json | 2 + config/config.example.toml | 2 + config/deployments/integration_test.toml | 1 + config/deployments/production.toml | 1 + config/deployments/sandbox.toml | 1 + config/development.toml | 2 + config/docker_compose.toml | 2 + crates/common_enums/src/connector_enums.rs | 5 + crates/connector_configs/src/connector.rs | 2 + .../hyperswitch_connectors/src/connectors.rs | 45 +- .../src/connectors/celero.rs | 571 ++++++++++++++++++ .../src/connectors/celero/transformers.rs | 228 +++++++ .../src/default_implementations.rs | 50 ++ .../src/default_implementations_v2.rs | 26 + .../hyperswitch_domain_models/src/configs.rs | 1 + crates/router/src/connector.rs | 51 +- .../router/src/core/connector_validation.rs | 5 +- crates/router/src/types/api.rs | 3 + crates/router/src/types/transformers.rs | 1 + crates/router/tests/connectors/celero.rs | 420 +++++++++++++ crates/router/tests/connectors/main.rs | 1 + crates/test_utils/src/connector_auth.rs | 1 + loadtest/config/development.toml | 84 +-- scripts/add_connector.sh | 2 +- 25 files changed, 1419 insertions(+), 90 deletions(-) create mode 100644 crates/hyperswitch_connectors/src/connectors/celero.rs create mode 100644 crates/hyperswitch_connectors/src/connectors/celero/transformers.rs create mode 100644 crates/router/tests/connectors/celero.rs diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json index 84cfe8e619..940922743c 100644 --- a/api-reference/v1/openapi_spec_v1.json +++ b/api-reference/v1/openapi_spec_v1.json @@ -10940,6 +10940,7 @@ "boku", "braintree", "cashtocode", + "celero", "chargebee", "checkout", "coinbase", @@ -27949,6 +27950,7 @@ "boku", "braintree", "cashtocode", + "celero", "chargebee", "checkout", "coinbase", diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json index 63a25bf4fc..12340ea5dc 100644 --- a/api-reference/v2/openapi_spec_v2.json +++ b/api-reference/v2/openapi_spec_v2.json @@ -8147,6 +8147,7 @@ "boku", "braintree", "cashtocode", + "celero", "chargebee", "checkout", "coinbase", @@ -22666,6 +22667,7 @@ "boku", "braintree", "cashtocode", + "celero", "chargebee", "checkout", "coinbase", diff --git a/config/config.example.toml b/config/config.example.toml index 3c6da56b24..0bb5cb1300 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -202,6 +202,7 @@ bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" boku.base_url = "https://$-api4-stage.boku.com" braintree.base_url = "https://payments.sandbox.braintree-api.com/graphql" cashtocode.base_url = "https://cluster05.api-test.cashtocode.com" +celero.base_url = "https://sandbox.gotnpgateway.com" chargebee.base_url = "https://$.chargebee.com/api/" checkbook.base_url = "https://api.sandbox.checkbook.io" checkout.base_url = "https://api.sandbox.checkout.com/" @@ -342,6 +343,7 @@ cards = [ "adyenplatform", "archipel", "authorizedotnet", + "celero", "coinbase", "coingate", "cryptopay", diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml index 495847bd89..c92570aaee 100644 --- a/config/deployments/integration_test.toml +++ b/config/deployments/integration_test.toml @@ -41,6 +41,7 @@ bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" boku.base_url = "https://$-api4-stage.boku.com" braintree.base_url = "https://payments.sandbox.braintree-api.com/graphql" cashtocode.base_url = "https://cluster05.api-test.cashtocode.com" +celero.base_url = "https://sandbox.gotnpgateway.com" chargebee.base_url = "https://$.chargebee.com/api/" checkbook.base_url = "https://api.sandbox.checkbook.io" checkout.base_url = "https://api.sandbox.checkout.com/" diff --git a/config/deployments/production.toml b/config/deployments/production.toml index 335d7f5ace..8e7fd10702 100644 --- a/config/deployments/production.toml +++ b/config/deployments/production.toml @@ -45,6 +45,7 @@ bluesnap.secondary_base_url = "https://pay.bluesnap.com/" boku.base_url = "https://country-api4-stage.boku.com" braintree.base_url = "https://payments.braintree-api.com/graphql" cashtocode.base_url = "https://cluster14.api.cashtocode.com" +celero.base_url = "https://app.gotnpgateway.com" chargebee.base_url = "https://{{merchant_endpoint_prefix}}.chargebee.com/api/" checkbook.base_url = "https://api.checkbook.io" checkout.base_url = "https://api.checkout.com/" diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml index 721e32b9b8..2011b50b75 100644 --- a/config/deployments/sandbox.toml +++ b/config/deployments/sandbox.toml @@ -45,6 +45,7 @@ bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" boku.base_url = "https://$-api4-stage.boku.com" braintree.base_url = "https://payments.sandbox.braintree-api.com/graphql" cashtocode.base_url = "https://cluster05.api-test.cashtocode.com" +celero.base_url = "https://sandbox.gotnpgateway.com" checkbook.base_url = "https://api.sandbox.checkbook.io" checkout.base_url = "https://api.sandbox.checkout.com/" chargebee.base_url = "https://$.chargebee.com/api/" diff --git a/config/development.toml b/config/development.toml index ab885503c8..49e5bb8a52 100644 --- a/config/development.toml +++ b/config/development.toml @@ -109,6 +109,7 @@ cards = [ "bluesnap", "boku", "braintree", + "celero", "checkbook", "checkout", "coinbase", @@ -238,6 +239,7 @@ bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" boku.base_url = "https://$-api4-stage.boku.com" braintree.base_url = "https://payments.sandbox.braintree-api.com/graphql" cashtocode.base_url = "https://cluster05.api-test.cashtocode.com" +celero.base_url = "https://sandbox.gotnpgateway.com" chargebee.base_url = "https://$.chargebee.com/api/" checkbook.base_url = "https://api.sandbox.checkbook.io" checkout.base_url = "https://api.sandbox.checkout.com/" diff --git a/config/docker_compose.toml b/config/docker_compose.toml index dbfeccf7cd..329c3743d3 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -128,6 +128,7 @@ bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" boku.base_url = "https://$-api4-stage.boku.com" braintree.base_url = "https://payments.sandbox.braintree-api.com/graphql" cashtocode.base_url = "https://cluster05.api-test.cashtocode.com" +celero.base_url = "https://sandbox.gotnpgateway.com" chargebee.base_url = "https://$.chargebee.com/api/" checkbook.base_url = "https://api.sandbox.checkbook.io" checkout.base_url = "https://api.sandbox.checkout.com/" @@ -259,6 +260,7 @@ cards = [ "bluesnap", "boku", "braintree", + "celero", "checkout", "checkbook", "coinbase", diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs index e975dc8bcb..5251b9b317 100644 --- a/crates/common_enums/src/connector_enums.rs +++ b/crates/common_enums/src/connector_enums.rs @@ -74,6 +74,7 @@ pub enum RoutableConnectors { Boku, Braintree, Cashtocode, + Celero, Chargebee, // Checkbook, Checkout, @@ -232,6 +233,7 @@ pub enum Connector { Boku, Braintree, Cashtocode, + Celero, Chargebee, // Checkbook, Checkout, @@ -417,6 +419,7 @@ impl Connector { | Self::Boku | Self::Braintree | Self::Cashtocode + | Self::Celero | Self::Chargebee // | Self::Checkbook | Self::Coinbase @@ -580,6 +583,7 @@ impl From for Connector { RoutableConnectors::Boku => Self::Boku, RoutableConnectors::Braintree => Self::Braintree, RoutableConnectors::Cashtocode => Self::Cashtocode, + RoutableConnectors::Celero => Self::Celero, RoutableConnectors::Chargebee => Self::Chargebee, // RoutableConnectors::Checkbook => Self::Checkbook, RoutableConnectors::Checkout => Self::Checkout, @@ -701,6 +705,7 @@ impl TryFrom for RoutableConnectors { Connector::Boku => Ok(Self::Boku), Connector::Braintree => Ok(Self::Braintree), Connector::Cashtocode => Ok(Self::Cashtocode), + Connector::Celero => Ok(Self::Celero), Connector::Chargebee => Ok(Self::Chargebee), // Connector::Checkbook => Ok(Self::Checkbook), Connector::Checkout => Ok(Self::Checkout), diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index 6ec11e8ca7..3e36dc023b 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -190,6 +190,7 @@ pub struct ConnectorConfig { pub boku: Option, pub braintree: Option, pub cashtocode: Option, + pub celero: Option, pub chargebee: Option, pub checkbook: Option, pub checkout: Option, @@ -381,6 +382,7 @@ impl ConnectorConfig { Connector::Boku => Ok(connector_data.boku), Connector::Braintree => Ok(connector_data.braintree), Connector::Cashtocode => Ok(connector_data.cashtocode), + Connector::Celero => Ok(connector_data.celero), Connector::Chargebee => Ok(connector_data.chargebee), Connector::Checkout => Ok(connector_data.checkout), Connector::Coinbase => Ok(connector_data.coinbase), diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs index 16b56bed6f..0861bbb461 100644 --- a/crates/hyperswitch_connectors/src/connectors.rs +++ b/crates/hyperswitch_connectors/src/connectors.rs @@ -15,6 +15,7 @@ pub mod bluesnap; pub mod boku; pub mod braintree; pub mod cashtocode; +pub mod celero; pub mod chargebee; pub mod checkbook; pub mod checkout; @@ -116,26 +117,26 @@ pub use self::{ amazonpay::Amazonpay, archipel::Archipel, authorizedotnet::Authorizedotnet, bambora::Bambora, bamboraapac::Bamboraapac, bankofamerica::Bankofamerica, barclaycard::Barclaycard, billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap, boku::Boku, braintree::Braintree, - cashtocode::Cashtocode, chargebee::Chargebee, checkbook::Checkbook, checkout::Checkout, - coinbase::Coinbase, coingate::Coingate, cryptopay::Cryptopay, ctp_mastercard::CtpMastercard, - cybersource::Cybersource, datatrans::Datatrans, deutschebank::Deutschebank, - digitalvirgo::Digitalvirgo, dlocal::Dlocal, dwolla::Dwolla, ebanx::Ebanx, elavon::Elavon, - facilitapay::Facilitapay, fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, - getnet::Getnet, globalpay::Globalpay, globepay::Globepay, gocardless::Gocardless, - gpayments::Gpayments, helcim::Helcim, hipay::Hipay, hyperswitch_vault::HyperswitchVault, - iatapay::Iatapay, inespay::Inespay, itaubank::Itaubank, jpmorgan::Jpmorgan, - juspaythreedsserver::Juspaythreedsserver, klarna::Klarna, mifinity::Mifinity, mollie::Mollie, - moneris::Moneris, multisafepay::Multisafepay, netcetera::Netcetera, nexinets::Nexinets, - nexixpay::Nexixpay, nmi::Nmi, nomupay::Nomupay, noon::Noon, nordea::Nordea, novalnet::Novalnet, - nuvei::Nuvei, opayo::Opayo, opennode::Opennode, paybox::Paybox, payeezy::Payeezy, - payload::Payload, payme::Payme, payone::Payone, paypal::Paypal, paystack::Paystack, payu::Payu, - placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz, prophetpay::Prophetpay, - rapyd::Rapyd, razorpay::Razorpay, recurly::Recurly, redsys::Redsys, riskified::Riskified, - santander::Santander, shift4::Shift4, signifyd::Signifyd, square::Square, stax::Stax, - stripe::Stripe, stripebilling::Stripebilling, taxjar::Taxjar, threedsecureio::Threedsecureio, - thunes::Thunes, tokenio::Tokenio, trustpay::Trustpay, tsys::Tsys, - unified_authentication_service::UnifiedAuthenticationService, vgs::Vgs, volt::Volt, - wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, worldline::Worldline, - worldpay::Worldpay, worldpayvantiv::Worldpayvantiv, worldpayxml::Worldpayxml, xendit::Xendit, - zen::Zen, zsl::Zsl, + cashtocode::Cashtocode, celero::Celero, chargebee::Chargebee, checkbook::Checkbook, + checkout::Checkout, coinbase::Coinbase, coingate::Coingate, cryptopay::Cryptopay, + ctp_mastercard::CtpMastercard, cybersource::Cybersource, datatrans::Datatrans, + deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, dwolla::Dwolla, + ebanx::Ebanx, elavon::Elavon, facilitapay::Facilitapay, fiserv::Fiserv, fiservemea::Fiservemea, + fiuu::Fiuu, forte::Forte, getnet::Getnet, globalpay::Globalpay, globepay::Globepay, + gocardless::Gocardless, gpayments::Gpayments, helcim::Helcim, hipay::Hipay, + hyperswitch_vault::HyperswitchVault, iatapay::Iatapay, inespay::Inespay, itaubank::Itaubank, + jpmorgan::Jpmorgan, juspaythreedsserver::Juspaythreedsserver, klarna::Klarna, + mifinity::Mifinity, mollie::Mollie, moneris::Moneris, multisafepay::Multisafepay, + netcetera::Netcetera, nexinets::Nexinets, nexixpay::Nexixpay, nmi::Nmi, nomupay::Nomupay, + noon::Noon, nordea::Nordea, novalnet::Novalnet, nuvei::Nuvei, opayo::Opayo, opennode::Opennode, + paybox::Paybox, payeezy::Payeezy, payload::Payload, payme::Payme, payone::Payone, + paypal::Paypal, paystack::Paystack, payu::Payu, placetopay::Placetopay, plaid::Plaid, + powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, + recurly::Recurly, redsys::Redsys, riskified::Riskified, santander::Santander, shift4::Shift4, + signifyd::Signifyd, square::Square, stax::Stax, stripe::Stripe, stripebilling::Stripebilling, + taxjar::Taxjar, threedsecureio::Threedsecureio, thunes::Thunes, tokenio::Tokenio, + trustpay::Trustpay, tsys::Tsys, unified_authentication_service::UnifiedAuthenticationService, + vgs::Vgs, volt::Volt, wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, + worldline::Worldline, worldpay::Worldpay, worldpayvantiv::Worldpayvantiv, + worldpayxml::Worldpayxml, xendit::Xendit, zen::Zen, zsl::Zsl, }; diff --git a/crates/hyperswitch_connectors/src/connectors/celero.rs b/crates/hyperswitch_connectors/src/connectors/celero.rs new file mode 100644 index 0000000000..5d37d73735 --- /dev/null +++ b/crates/hyperswitch_connectors/src/connectors/celero.rs @@ -0,0 +1,571 @@ +pub mod transformers; + +use common_utils::{ + errors::CustomResult, + ext_traits::BytesExt, + request::{Method, Request, RequestBuilder, RequestContent}, + types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector}, +}; +use error_stack::{report, ResultExt}; +use hyperswitch_domain_models::{ + router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, + router_flow_types::{ + access_token_auth::AccessTokenAuth, + payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, + refunds::{Execute, RSync}, + }, + router_request_types::{ + AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, + PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, + RefundsData, SetupMandateRequestData, + }, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{ + PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, + RefundSyncRouterData, RefundsRouterData, + }, +}; +use hyperswitch_interfaces::{ + api::{ + self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications, + ConnectorValidation, + }, + configs::Connectors, + errors, + events::connector_api_logs::ConnectorEvent, + types::{self, Response}, + webhooks, +}; +use masking::{ExposeInterface, Mask}; +use transformers as celero; + +use crate::{constants::headers, types::ResponseRouterData, utils}; + +#[derive(Clone)] +pub struct Celero { + amount_converter: &'static (dyn AmountConvertor + Sync), +} + +impl Celero { + pub fn new() -> &'static Self { + &Self { + amount_converter: &StringMinorUnitForConnector, + } + } +} + +impl api::Payment for Celero {} +impl api::PaymentSession for Celero {} +impl api::ConnectorAccessToken for Celero {} +impl api::MandateSetup for Celero {} +impl api::PaymentAuthorize for Celero {} +impl api::PaymentSync for Celero {} +impl api::PaymentCapture for Celero {} +impl api::PaymentVoid for Celero {} +impl api::Refund for Celero {} +impl api::RefundExecute for Celero {} +impl api::RefundSync for Celero {} +impl api::PaymentToken for Celero {} + +impl ConnectorIntegration + for Celero +{ + // Not Implemented (R) +} + +impl ConnectorCommonExt for Celero +where + Self: ConnectorIntegration, +{ + fn build_headers( + &self, + req: &RouterData, + _connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + let mut header = vec![( + headers::CONTENT_TYPE.to_string(), + self.get_content_type().to_string().into(), + )]; + let mut api_key = self.get_auth_header(&req.connector_auth_type)?; + header.append(&mut api_key); + Ok(header) + } +} + +impl ConnectorCommon for Celero { + fn id(&self) -> &'static str { + "celero" + } + + fn get_currency_unit(&self) -> api::CurrencyUnit { + api::CurrencyUnit::Base + // TODO! Check connector documentation, on which unit they are processing the currency. + // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor, + // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base + } + + fn common_get_content_type(&self) -> &'static str { + "application/json" + } + + fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { + connectors.celero.base_url.as_ref() + } + + fn get_auth_header( + &self, + auth_type: &ConnectorAuthType, + ) -> CustomResult)>, errors::ConnectorError> { + let auth = celero::CeleroAuthType::try_from(auth_type) + .change_context(errors::ConnectorError::FailedToObtainAuthType)?; + Ok(vec![( + headers::AUTHORIZATION.to_string(), + auth.api_key.expose().into_masked(), + )]) + } + + fn build_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + let response: celero::CeleroErrorResponse = res + .response + .parse_struct("CeleroErrorResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + + Ok(ErrorResponse { + status_code: res.status_code, + code: response.code, + message: response.message, + reason: response.reason, + attempt_status: None, + connector_transaction_id: None, + network_decline_code: None, + network_advice_code: None, + network_error_message: None, + }) + } +} + +impl ConnectorValidation for Celero { + //TODO: implement functions when support enabled +} + +impl ConnectorIntegration for Celero { + //TODO: implement sessions flow +} + +impl ConnectorIntegration for Celero {} + +impl ConnectorIntegration for Celero {} + +impl ConnectorIntegration for Celero { + fn get_headers( + &self, + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + _req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, + ) -> CustomResult { + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + } + + fn get_request_body( + &self, + req: &PaymentsAuthorizeRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let amount = utils::convert_amount( + self.amount_converter, + req.request.minor_amount, + req.request.currency, + )?; + + let connector_router_data = celero::CeleroRouterData::from((amount, req)); + let connector_req = celero::CeleroPaymentsRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, + req: &PaymentsAuthorizeRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(&types::PaymentsAuthorizeType::get_url( + self, req, connectors, + )?) + .attach_default_headers() + .headers(types::PaymentsAuthorizeType::get_headers( + self, req, connectors, + )?) + .set_body(types::PaymentsAuthorizeType::get_request_body( + self, req, connectors, + )?) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsAuthorizeRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: celero::CeleroPaymentsResponse = res + .response + .parse_struct("Celero PaymentsAuthorizeResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Celero { + fn get_headers( + &self, + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + _req: &PaymentsSyncRouterData, + _connectors: &Connectors, + ) -> CustomResult { + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + } + + fn build_request( + &self, + req: &PaymentsSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Get) + .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsSyncRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: celero::CeleroPaymentsResponse = res + .response + .parse_struct("celero PaymentsSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Celero { + fn get_headers( + &self, + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + _req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + } + + fn get_request_body( + &self, + _req: &PaymentsCaptureRouterData, + _connectors: &Connectors, + ) -> CustomResult { + Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) + } + + fn build_request( + &self, + req: &PaymentsCaptureRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Post) + .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::PaymentsCaptureType::get_headers( + self, req, connectors, + )?) + .set_body(types::PaymentsCaptureType::get_request_body( + self, req, connectors, + )?) + .build(), + )) + } + + fn handle_response( + &self, + data: &PaymentsCaptureRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: celero::CeleroPaymentsResponse = res + .response + .parse_struct("Celero PaymentsCaptureResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Celero {} + +impl ConnectorIntegration for Celero { + fn get_headers( + &self, + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult)>, errors::ConnectorError> { + self.build_headers(req, connectors) + } + + fn get_content_type(&self) -> &'static str { + self.common_get_content_type() + } + + fn get_url( + &self, + _req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + } + + fn get_request_body( + &self, + req: &RefundsRouterData, + _connectors: &Connectors, + ) -> CustomResult { + let refund_amount = utils::convert_amount( + self.amount_converter, + req.request.minor_refund_amount, + req.request.currency, + )?; + + let connector_router_data = celero::CeleroRouterData::from((refund_amount, req)); + let connector_req = celero::CeleroRefundRequest::try_from(&connector_router_data)?; + Ok(RequestContent::Json(Box::new(connector_req))) + } + + fn build_request( + &self, + req: &RefundsRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + let request = RequestBuilder::new() + .method(Method::Post) + .url(&types::RefundExecuteType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::RefundExecuteType::get_headers( + self, req, connectors, + )?) + .set_body(types::RefundExecuteType::get_request_body( + self, req, connectors, + )?) + .build(); + Ok(Some(request)) + } + + fn handle_response( + &self, + data: &RefundsRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult, errors::ConnectorError> { + let response: celero::RefundResponse = + res.response + .parse_struct("celero RefundResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +impl ConnectorIntegration for Celero { + fn get_headers( + &self, + 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_url( + &self, + _req: &RefundSyncRouterData, + _connectors: &Connectors, + ) -> CustomResult { + Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) + } + + fn build_request( + &self, + req: &RefundSyncRouterData, + connectors: &Connectors, + ) -> CustomResult, errors::ConnectorError> { + Ok(Some( + RequestBuilder::new() + .method(Method::Get) + .url(&types::RefundSyncType::get_url(self, req, connectors)?) + .attach_default_headers() + .headers(types::RefundSyncType::get_headers(self, req, connectors)?) + .set_body(types::RefundSyncType::get_request_body( + self, req, connectors, + )?) + .build(), + )) + } + + fn handle_response( + &self, + data: &RefundSyncRouterData, + event_builder: Option<&mut ConnectorEvent>, + res: Response, + ) -> CustomResult { + let response: celero::RefundResponse = res + .response + .parse_struct("celero RefundSyncResponse") + .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; + event_builder.map(|i| i.set_response_body(&response)); + router_env::logger::info!(connector_response=?response); + RouterData::try_from(ResponseRouterData { + response, + data: data.clone(), + http_code: res.status_code, + }) + } + + fn get_error_response( + &self, + res: Response, + event_builder: Option<&mut ConnectorEvent>, + ) -> CustomResult { + self.build_error_response(res, event_builder) + } +} + +#[async_trait::async_trait] +impl webhooks::IncomingWebhook for Celero { + fn get_webhook_object_reference_id( + &self, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + } + + fn get_webhook_event_type( + &self, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult { + Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + } + + fn get_webhook_resource_object( + &self, + _request: &webhooks::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult, errors::ConnectorError> { + Err(report!(errors::ConnectorError::WebhooksNotImplemented)) + } +} + +impl ConnectorSpecifications for Celero {} diff --git a/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs new file mode 100644 index 0000000000..2579c81ae6 --- /dev/null +++ b/crates/hyperswitch_connectors/src/connectors/celero/transformers.rs @@ -0,0 +1,228 @@ +use common_enums::enums; +use common_utils::types::StringMinorUnit; +use hyperswitch_domain_models::{ + payment_method_data::PaymentMethodData, + router_data::{ConnectorAuthType, RouterData}, + router_flow_types::refunds::{Execute, RSync}, + router_request_types::ResponseId, + router_response_types::{PaymentsResponseData, RefundsResponseData}, + types::{PaymentsAuthorizeRouterData, RefundsRouterData}, +}; +use hyperswitch_interfaces::errors; +use masking::Secret; +use serde::{Deserialize, Serialize}; + +use crate::{ + types::{RefundsResponseRouterData, ResponseRouterData}, + utils::PaymentsAuthorizeRequestData, +}; + +//TODO: Fill the struct with respective fields +pub struct CeleroRouterData { + pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. + pub router_data: T, +} + +impl From<(StringMinorUnit, T)> for CeleroRouterData { + fn from((amount, item): (StringMinorUnit, T)) -> Self { + //Todo : use utils to convert the amount to the type of amount that a connector accepts + Self { + amount, + router_data: item, + } + } +} + +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Serialize, PartialEq)] +pub struct CeleroPaymentsRequest { + amount: StringMinorUnit, + card: CeleroCard, +} + +#[derive(Default, Debug, Serialize, Eq, PartialEq)] +pub struct CeleroCard { + number: cards::CardNumber, + expiry_month: Secret, + expiry_year: Secret, + cvc: Secret, + complete: bool, +} + +impl TryFrom<&CeleroRouterData<&PaymentsAuthorizeRouterData>> for CeleroPaymentsRequest { + type Error = error_stack::Report; + fn try_from( + item: &CeleroRouterData<&PaymentsAuthorizeRouterData>, + ) -> Result { + match item.router_data.request.payment_method_data.clone() { + PaymentMethodData::Card(req_card) => { + let card = CeleroCard { + number: req_card.card_number, + expiry_month: req_card.card_exp_month, + expiry_year: req_card.card_exp_year, + cvc: req_card.card_cvc, + complete: item.router_data.request.is_auto_capture()?, + }; + Ok(Self { + amount: item.amount.clone(), + card, + }) + } + _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), + } + } +} + +//TODO: Fill the struct with respective fields +// Auth Struct +pub struct CeleroAuthType { + pub(super) api_key: Secret, +} + +impl TryFrom<&ConnectorAuthType> for CeleroAuthType { + type Error = error_stack::Report; + fn try_from(auth_type: &ConnectorAuthType) -> Result { + match auth_type { + ConnectorAuthType::HeaderKey { api_key } => Ok(Self { + api_key: api_key.to_owned(), + }), + _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), + } + } +} +// PaymentsResponse +//TODO: Append the remaining status flags +#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] +#[serde(rename_all = "lowercase")] +pub enum CeleroPaymentStatus { + Succeeded, + Failed, + #[default] + Processing, +} + +impl From for common_enums::AttemptStatus { + fn from(item: CeleroPaymentStatus) -> Self { + match item { + CeleroPaymentStatus::Succeeded => Self::Charged, + CeleroPaymentStatus::Failed => Self::Failure, + CeleroPaymentStatus::Processing => Self::Authorizing, + } + } +} + +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct CeleroPaymentsResponse { + status: CeleroPaymentStatus, + id: String, +} + +impl TryFrom> + for RouterData +{ + type Error = error_stack::Report; + fn try_from( + item: ResponseRouterData, + ) -> Result { + Ok(Self { + status: common_enums::AttemptStatus::from(item.response.status), + response: Ok(PaymentsResponseData::TransactionResponse { + resource_id: ResponseId::ConnectorTransactionId(item.response.id), + redirection_data: Box::new(None), + mandate_reference: Box::new(None), + connector_metadata: None, + network_txn_id: None, + connector_response_reference_id: None, + incremental_authorization_allowed: None, + charges: None, + }), + ..item.data + }) + } +} + +//TODO: Fill the struct with respective fields +// REFUND : +// Type definition for RefundRequest +#[derive(Default, Debug, Serialize)] +pub struct CeleroRefundRequest { + pub amount: StringMinorUnit, +} + +impl TryFrom<&CeleroRouterData<&RefundsRouterData>> for CeleroRefundRequest { + type Error = error_stack::Report; + fn try_from(item: &CeleroRouterData<&RefundsRouterData>) -> Result { + Ok(Self { + amount: item.amount.to_owned(), + }) + } +} + +// Type definition for Refund Response + +#[allow(dead_code)] +#[derive(Debug, Serialize, Default, Deserialize, Clone)] +pub enum RefundStatus { + Succeeded, + Failed, + #[default] + Processing, +} + +impl From for enums::RefundStatus { + fn from(item: RefundStatus) -> Self { + match item { + RefundStatus::Succeeded => Self::Success, + RefundStatus::Failed => Self::Failure, + RefundStatus::Processing => Self::Pending, + //TODO: Review mapping + } + } +} + +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Clone, Serialize, Deserialize)] +pub struct RefundResponse { + id: String, + status: RefundStatus, +} + +impl TryFrom> for RefundsRouterData { + type Error = error_stack::Report; + fn try_from( + item: RefundsResponseRouterData, + ) -> Result { + Ok(Self { + response: Ok(RefundsResponseData { + connector_refund_id: item.response.id.to_string(), + refund_status: enums::RefundStatus::from(item.response.status), + }), + ..item.data + }) + } +} + +impl TryFrom> for RefundsRouterData { + type Error = error_stack::Report; + fn try_from( + item: RefundsResponseRouterData, + ) -> Result { + Ok(Self { + response: Ok(RefundsResponseData { + connector_refund_id: item.response.id.to_string(), + refund_status: enums::RefundStatus::from(item.response.status), + }), + ..item.data + }) + } +} + +//TODO: Fill the struct with respective fields +#[derive(Default, Debug, Serialize, Deserialize, PartialEq)] +pub struct CeleroErrorResponse { + pub status_code: u16, + pub code: String, + pub message: String, + pub reason: Option, +} diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs index a338b96bc5..a2a5c16386 100644 --- a/crates/hyperswitch_connectors/src/default_implementations.rs +++ b/crates/hyperswitch_connectors/src/default_implementations.rs @@ -159,6 +159,7 @@ default_imp_for_authorize_session_token!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -283,6 +284,7 @@ default_imp_for_calculate_tax!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -408,6 +410,7 @@ default_imp_for_session_update!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -533,6 +536,7 @@ default_imp_for_post_session_tokens!( connectors::Boku, connectors::Billwerk, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -657,6 +661,7 @@ default_imp_for_create_order!( connectors::Boku, connectors::Billwerk, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -782,6 +787,7 @@ default_imp_for_update_metadata!( connectors::Boku, connectors::Billwerk, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -905,6 +911,7 @@ default_imp_for_complete_authorize!( connectors::Bitpay, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1015,6 +1022,7 @@ default_imp_for_incremental_authorization!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1140,6 +1148,7 @@ default_imp_for_create_customer!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1259,6 +1268,7 @@ default_imp_for_connector_redirect_response!( connectors::Barclaycard, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Coinbase, @@ -1367,6 +1377,7 @@ default_imp_for_pre_processing_steps!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1483,6 +1494,7 @@ default_imp_for_post_processing_steps!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1609,6 +1621,7 @@ default_imp_for_approve!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1736,6 +1749,7 @@ default_imp_for_reject!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1863,6 +1877,7 @@ default_imp_for_webhook_source_verification!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1989,6 +2004,7 @@ default_imp_for_accept_dispute!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Coinbase, @@ -2114,6 +2130,7 @@ default_imp_for_submit_evidence!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Coinbase, @@ -2238,6 +2255,7 @@ default_imp_for_defend_dispute!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Coinbase, @@ -2372,6 +2390,7 @@ default_imp_for_file_upload!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Coinbase, @@ -2488,6 +2507,7 @@ default_imp_for_payouts!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2608,6 +2628,7 @@ default_imp_for_payouts_create!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2732,6 +2753,7 @@ default_imp_for_payouts_retrieve!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2858,6 +2880,7 @@ default_imp_for_payouts_eligibility!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2982,6 +3005,7 @@ default_imp_for_payouts_fulfill!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3103,6 +3127,7 @@ default_imp_for_payouts_cancel!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3228,6 +3253,7 @@ default_imp_for_payouts_quote!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3354,6 +3380,7 @@ default_imp_for_payouts_recipient!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3479,6 +3506,7 @@ default_imp_for_payouts_recipient_account!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3606,6 +3634,7 @@ default_imp_for_frm_sale!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3733,6 +3762,7 @@ default_imp_for_frm_checkout!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3860,6 +3890,7 @@ default_imp_for_frm_transaction!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3987,6 +4018,7 @@ default_imp_for_frm_fulfillment!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4114,6 +4146,7 @@ default_imp_for_frm_record_return!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4237,6 +4270,7 @@ default_imp_for_revoking_mandates!( connectors::Bluesnap, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4360,6 +4394,7 @@ default_imp_for_uas_pre_authentication!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4484,6 +4519,7 @@ default_imp_for_uas_post_authentication!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4609,6 +4645,7 @@ default_imp_for_uas_authentication_confirmation!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4726,6 +4763,7 @@ default_imp_for_connector_request_id!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4845,6 +4883,7 @@ default_imp_for_fraud_check!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -4994,6 +5033,7 @@ default_imp_for_connector_authentication!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5116,6 +5156,7 @@ default_imp_for_uas_authentication!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5233,6 +5274,7 @@ default_imp_for_revenue_recovery!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5361,6 +5403,7 @@ default_imp_for_billing_connector_payment_sync!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5488,6 +5531,7 @@ default_imp_for_revenue_recovery_record_back!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Checkbook, connectors::Checkout, connectors::Coinbase, @@ -5613,6 +5657,7 @@ default_imp_for_billing_connector_invoice_sync!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5733,6 +5778,7 @@ default_imp_for_external_vault!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5859,6 +5905,7 @@ default_imp_for_external_vault_insert!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -5985,6 +6032,7 @@ default_imp_for_external_vault_retrieve!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -6111,6 +6159,7 @@ default_imp_for_external_vault_delete!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -6237,6 +6286,7 @@ default_imp_for_external_vault_create!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs index 99685607c4..2c3e849d4c 100644 --- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs +++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs @@ -264,6 +264,7 @@ default_imp_for_new_connector_integration_payment!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -391,6 +392,7 @@ default_imp_for_new_connector_integration_refund!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -513,6 +515,7 @@ default_imp_for_new_connector_integration_connector_access_token!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -641,6 +644,7 @@ default_imp_for_new_connector_integration_accept_dispute!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -767,6 +771,7 @@ default_imp_for_new_connector_integration_submit_evidence!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -893,6 +898,7 @@ default_imp_for_new_connector_integration_defend_dispute!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1030,6 +1036,7 @@ default_imp_for_new_connector_integration_file_upload!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1159,6 +1166,7 @@ default_imp_for_new_connector_integration_payouts_create!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1288,6 +1296,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1417,6 +1426,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1546,6 +1556,7 @@ default_imp_for_new_connector_integration_payouts_cancel!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1675,6 +1686,7 @@ default_imp_for_new_connector_integration_payouts_quote!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1804,6 +1816,7 @@ default_imp_for_new_connector_integration_payouts_recipient!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -1933,6 +1946,7 @@ default_imp_for_new_connector_integration_payouts_sync!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2062,6 +2076,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2189,6 +2204,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2318,6 +2334,7 @@ default_imp_for_new_connector_integration_frm_sale!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2447,6 +2464,7 @@ default_imp_for_new_connector_integration_frm_checkout!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2576,6 +2594,7 @@ default_imp_for_new_connector_integration_frm_transaction!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2705,6 +2724,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2834,6 +2854,7 @@ default_imp_for_new_connector_integration_frm_record_return!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -2960,6 +2981,7 @@ default_imp_for_new_connector_integration_revoking_mandates!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, @@ -3074,6 +3096,7 @@ default_imp_for_new_connector_integration_frm!( connectors::Bluesnap, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Checkbook, connectors::Coinbase, connectors::Cryptopay, @@ -3200,6 +3223,7 @@ default_imp_for_new_connector_integration_connector_authentication!( connectors::Bluesnap, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Checkbook, connectors::Coinbase, connectors::Cryptopay, @@ -3315,6 +3339,7 @@ default_imp_for_new_connector_integration_revenue_recovery!( connectors::Bluesnap, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Checkbook, connectors::Coinbase, connectors::Cryptopay, @@ -3446,6 +3471,7 @@ default_imp_for_new_connector_integration_external_vault!( connectors::Braintree, connectors::Boku, connectors::Cashtocode, + connectors::Celero, connectors::Chargebee, connectors::Checkbook, connectors::Checkout, diff --git a/crates/hyperswitch_domain_models/src/configs.rs b/crates/hyperswitch_domain_models/src/configs.rs index 16fbd3e1d3..89f8ddf673 100644 --- a/crates/hyperswitch_domain_models/src/configs.rs +++ b/crates/hyperswitch_domain_models/src/configs.rs @@ -29,6 +29,7 @@ pub struct Connectors { pub boku: ConnectorParams, pub braintree: ConnectorParams, pub cashtocode: ConnectorParams, + pub celero: ConnectorParams, pub chargebee: ConnectorParams, pub checkbook: ConnectorParams, pub checkout: ConnectorParams, diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs index 4b12c47118..49aa7c61cd 100644 --- a/crates/router/src/connector.rs +++ b/crates/router/src/connector.rs @@ -9,31 +9,32 @@ pub use hyperswitch_connectors::connectors::{ bamboraapac::Bamboraapac, bankofamerica, bankofamerica::Bankofamerica, barclaycard, barclaycard::Barclaycard, billwerk, billwerk::Billwerk, bitpay, bitpay::Bitpay, bluesnap, bluesnap::Bluesnap, boku, boku::Boku, braintree, braintree::Braintree, cashtocode, - cashtocode::Cashtocode, chargebee, chargebee::Chargebee, checkbook, checkbook::Checkbook, - checkout, checkout::Checkout, coinbase, coinbase::Coinbase, coingate, coingate::Coingate, - cryptopay, cryptopay::Cryptopay, ctp_mastercard, ctp_mastercard::CtpMastercard, cybersource, - cybersource::Cybersource, datatrans, datatrans::Datatrans, deutschebank, - deutschebank::Deutschebank, digitalvirgo, digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, - dwolla, dwolla::Dwolla, ebanx, ebanx::Ebanx, elavon, elavon::Elavon, facilitapay, - facilitapay::Facilitapay, fiserv, fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, - fiuu::Fiuu, forte, forte::Forte, getnet, getnet::Getnet, globalpay, globalpay::Globalpay, - globepay, globepay::Globepay, gocardless, gocardless::Gocardless, gpayments, - gpayments::Gpayments, helcim, helcim::Helcim, hipay, hipay::Hipay, hyperswitch_vault, - hyperswitch_vault::HyperswitchVault, iatapay, iatapay::Iatapay, inespay, inespay::Inespay, - itaubank, itaubank::Itaubank, jpmorgan, jpmorgan::Jpmorgan, juspaythreedsserver, - juspaythreedsserver::Juspaythreedsserver, klarna, klarna::Klarna, mifinity, mifinity::Mifinity, - mollie, mollie::Mollie, moneris, moneris::Moneris, multisafepay, multisafepay::Multisafepay, - netcetera, netcetera::Netcetera, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, - nmi, nmi::Nmi, nomupay, nomupay::Nomupay, noon, noon::Noon, nordea, nordea::Nordea, novalnet, - novalnet::Novalnet, nuvei, nuvei::Nuvei, opayo, opayo::Opayo, opennode, opennode::Opennode, - paybox, paybox::Paybox, payeezy, payeezy::Payeezy, payload, payload::Payload, payme, - payme::Payme, payone, payone::Payone, paypal, paypal::Paypal, paystack, paystack::Paystack, - payu, payu::Payu, placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz, - powertranz::Powertranz, prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, - razorpay::Razorpay, recurly, recurly::Recurly, redsys, redsys::Redsys, riskified, - riskified::Riskified, santander, santander::Santander, shift4, shift4::Shift4, signifyd, - signifyd::Signifyd, square, square::Square, stax, stax::Stax, stripe, stripe::Stripe, - stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, threedsecureio, + cashtocode::Cashtocode, celero, celero::Celero, chargebee, chargebee::Chargebee, checkbook, + checkbook::Checkbook, checkout, checkout::Checkout, coinbase, coinbase::Coinbase, coingate, + coingate::Coingate, cryptopay, cryptopay::Cryptopay, ctp_mastercard, + ctp_mastercard::CtpMastercard, cybersource, cybersource::Cybersource, datatrans, + datatrans::Datatrans, deutschebank, deutschebank::Deutschebank, digitalvirgo, + digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal, dwolla, dwolla::Dwolla, ebanx, + ebanx::Ebanx, elavon, elavon::Elavon, facilitapay, facilitapay::Facilitapay, fiserv, + fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu, fiuu::Fiuu, forte, forte::Forte, + getnet, getnet::Getnet, globalpay, globalpay::Globalpay, globepay, globepay::Globepay, + gocardless, gocardless::Gocardless, gpayments, gpayments::Gpayments, helcim, helcim::Helcim, + hipay, hipay::Hipay, hyperswitch_vault, hyperswitch_vault::HyperswitchVault, iatapay, + iatapay::Iatapay, inespay, inespay::Inespay, itaubank, itaubank::Itaubank, jpmorgan, + jpmorgan::Jpmorgan, juspaythreedsserver, juspaythreedsserver::Juspaythreedsserver, klarna, + klarna::Klarna, mifinity, mifinity::Mifinity, mollie, mollie::Mollie, moneris, + moneris::Moneris, multisafepay, multisafepay::Multisafepay, netcetera, netcetera::Netcetera, + nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, nmi, nmi::Nmi, nomupay, + nomupay::Nomupay, noon, noon::Noon, nordea, nordea::Nordea, novalnet, novalnet::Novalnet, + nuvei, nuvei::Nuvei, opayo, opayo::Opayo, opennode, opennode::Opennode, paybox, paybox::Paybox, + payeezy, payeezy::Payeezy, payload, payload::Payload, payme, payme::Payme, payone, + payone::Payone, paypal, paypal::Paypal, paystack, paystack::Paystack, payu, payu::Payu, + placetopay, placetopay::Placetopay, plaid, plaid::Plaid, powertranz, powertranz::Powertranz, + prophetpay, prophetpay::Prophetpay, rapyd, rapyd::Rapyd, razorpay, razorpay::Razorpay, recurly, + recurly::Recurly, redsys, redsys::Redsys, riskified, riskified::Riskified, santander, + santander::Santander, shift4, shift4::Shift4, signifyd, signifyd::Signifyd, square, + square::Square, stax, stax::Stax, stripe, stripe::Stripe, stripebilling, + stripebilling::Stripebilling, taxjar, taxjar::Taxjar, threedsecureio, threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenio, tokenio::Tokenio, trustpay, trustpay::Trustpay, tsys, tsys::Tsys, unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService, vgs, vgs::Vgs, volt, volt::Volt, diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs index d23a3a175f..655636197d 100644 --- a/crates/router/src/core/connector_validation.rs +++ b/crates/router/src/core/connector_validation.rs @@ -136,7 +136,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> { } api_enums::Connector::Chargebee => { chargebee::transformers::ChargebeeAuthType::try_from(self.auth_type)?; - chargebee::transformers::ChargebeeMetadata::try_from(self.connector_meta_data)?; + Ok(()) + } + api_enums::Connector::Celero => { + celero::transformers::CeleroAuthType::try_from(self.auth_type)?; Ok(()) } // api_enums::Connector::Checkbook => { diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index 3fa8aebf2c..45d6dd0d75 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -372,6 +372,9 @@ impl ConnectorData { enums::Connector::Cashtocode => { Ok(ConnectorEnum::Old(Box::new(connector::Cashtocode::new()))) } + enums::Connector::Celero => { + Ok(ConnectorEnum::Old(Box::new(connector::Celero::new()))) + } enums::Connector::Chargebee => { Ok(ConnectorEnum::Old(Box::new(connector::Chargebee::new()))) } diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 284a5243d0..713293568b 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -223,6 +223,7 @@ impl ForeignTryFrom for common_enums::RoutableConnectors { api_enums::Connector::Boku => Self::Boku, api_enums::Connector::Braintree => Self::Braintree, api_enums::Connector::Cashtocode => Self::Cashtocode, + api_enums::Connector::Celero => Self::Celero, api_enums::Connector::Chargebee => Self::Chargebee, // api_enums::Connector::Checkbook => Self::Checkbook, api_enums::Connector::Checkout => Self::Checkout, diff --git a/crates/router/tests/connectors/celero.rs b/crates/router/tests/connectors/celero.rs new file mode 100644 index 0000000000..7d4e942471 --- /dev/null +++ b/crates/router/tests/connectors/celero.rs @@ -0,0 +1,420 @@ +use masking::Secret; +use router::types::{self, api, domain, storage::enums}; +use test_utils::connector_auth; + +use crate::utils::{self, ConnectorActions}; + +#[derive(Clone, Copy)] +struct CeleroTest; +impl ConnectorActions for CeleroTest {} +impl utils::Connector for CeleroTest { + fn get_data(&self) -> api::ConnectorData { + use router::connector::Celero; + utils::construct_connector_data_old( + Box::new(Celero::new()), + types::Connector::Celero, + api::GetToken::Connector, + None, + ) + } + + fn get_auth_token(&self) -> types::ConnectorAuthType { + utils::to_connector_auth_type( + connector_auth::ConnectorAuthentication::new() + .celero + .expect("Missing connector authentication configuration") + .into(), + ) + } + + fn get_name(&self) -> String { + "celero".to_string() + } +} + +static CONNECTOR: CeleroTest = CeleroTest {}; + +fn get_default_payment_info() -> Option { + None +} + +fn payment_method_details() -> Option { + None +} + +// Cards Positive Tests +// Creates a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_only_authorize_payment() { + let response = CONNECTOR + .authorize_payment(payment_method_details(), get_default_payment_info()) + .await + .expect("Authorize payment response"); + assert_eq!(response.status, enums::AttemptStatus::Authorized); +} + +// Captures a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_capture_authorized_payment() { + let response = CONNECTOR + .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) + .await + .expect("Capture payment response"); + assert_eq!(response.status, enums::AttemptStatus::Charged); +} + +// Partially captures a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_partially_capture_authorized_payment() { + let response = CONNECTOR + .authorize_and_capture_payment( + payment_method_details(), + Some(types::PaymentsCaptureData { + amount_to_capture: 50, + ..utils::PaymentCaptureType::default().0 + }), + get_default_payment_info(), + ) + .await + .expect("Capture payment response"); + assert_eq!(response.status, enums::AttemptStatus::Charged); +} + +// Synchronizes a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_sync_authorized_payment() { + let authorize_response = CONNECTOR + .authorize_payment(payment_method_details(), get_default_payment_info()) + .await + .expect("Authorize payment response"); + let txn_id = utils::get_connector_transaction_id(authorize_response.response); + let response = CONNECTOR + .psync_retry_till_status_matches( + enums::AttemptStatus::Authorized, + Some(types::PaymentsSyncData { + connector_transaction_id: types::ResponseId::ConnectorTransactionId( + txn_id.unwrap(), + ), + ..Default::default() + }), + get_default_payment_info(), + ) + .await + .expect("PSync response"); + assert_eq!(response.status, enums::AttemptStatus::Authorized,); +} + +// Voids a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_void_authorized_payment() { + let response = CONNECTOR + .authorize_and_void_payment( + payment_method_details(), + Some(types::PaymentsCancelData { + connector_transaction_id: String::from(""), + cancellation_reason: Some("requested_by_customer".to_string()), + ..Default::default() + }), + get_default_payment_info(), + ) + .await + .expect("Void payment response"); + assert_eq!(response.status, enums::AttemptStatus::Voided); +} + +// Refunds a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_refund_manually_captured_payment() { + let response = CONNECTOR + .capture_payment_and_refund( + payment_method_details(), + None, + None, + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap().refund_status, + enums::RefundStatus::Success, + ); +} + +// Partially refunds a payment using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_partially_refund_manually_captured_payment() { + let response = CONNECTOR + .capture_payment_and_refund( + payment_method_details(), + None, + Some(types::RefundsData { + refund_amount: 50, + ..utils::PaymentRefundType::default().0 + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap().refund_status, + enums::RefundStatus::Success, + ); +} + +// Synchronizes a refund using the manual capture flow (Non 3DS). +#[actix_web::test] +async fn should_sync_manually_captured_refund() { + let refund_response = CONNECTOR + .capture_payment_and_refund( + payment_method_details(), + None, + None, + get_default_payment_info(), + ) + .await + .unwrap(); + let response = CONNECTOR + .rsync_retry_till_status_matches( + enums::RefundStatus::Success, + refund_response.response.unwrap().connector_refund_id, + None, + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap().refund_status, + enums::RefundStatus::Success, + ); +} + +// Creates a payment using the automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_make_payment() { + let authorize_response = CONNECTOR + .make_payment(payment_method_details(), get_default_payment_info()) + .await + .unwrap(); + assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); +} + +// Synchronizes a payment using the automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_sync_auto_captured_payment() { + let authorize_response = CONNECTOR + .make_payment(payment_method_details(), get_default_payment_info()) + .await + .unwrap(); + assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); + let txn_id = utils::get_connector_transaction_id(authorize_response.response); + assert_ne!(txn_id, None, "Empty connector transaction id"); + let response = CONNECTOR + .psync_retry_till_status_matches( + enums::AttemptStatus::Charged, + Some(types::PaymentsSyncData { + connector_transaction_id: types::ResponseId::ConnectorTransactionId( + txn_id.unwrap(), + ), + capture_method: Some(enums::CaptureMethod::Automatic), + ..Default::default() + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!(response.status, enums::AttemptStatus::Charged,); +} + +// Refunds a payment using the automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_refund_auto_captured_payment() { + let response = CONNECTOR + .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) + .await + .unwrap(); + assert_eq!( + response.response.unwrap().refund_status, + enums::RefundStatus::Success, + ); +} + +// Partially refunds a payment using the automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_partially_refund_succeeded_payment() { + let refund_response = CONNECTOR + .make_payment_and_refund( + payment_method_details(), + Some(types::RefundsData { + refund_amount: 50, + ..utils::PaymentRefundType::default().0 + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + refund_response.response.unwrap().refund_status, + enums::RefundStatus::Success, + ); +} + +// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_refund_succeeded_payment_multiple_times() { + CONNECTOR + .make_payment_and_multiple_refund( + payment_method_details(), + Some(types::RefundsData { + refund_amount: 50, + ..utils::PaymentRefundType::default().0 + }), + get_default_payment_info(), + ) + .await; +} + +// Synchronizes a refund using the automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_sync_refund() { + let refund_response = CONNECTOR + .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) + .await + .unwrap(); + let response = CONNECTOR + .rsync_retry_till_status_matches( + enums::RefundStatus::Success, + refund_response.response.unwrap().connector_refund_id, + None, + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap().refund_status, + enums::RefundStatus::Success, + ); +} + +// Cards Negative scenarios +// Creates a payment with incorrect CVC. +#[actix_web::test] +async fn should_fail_payment_for_incorrect_cvc() { + let response = CONNECTOR + .make_payment( + Some(types::PaymentsAuthorizeData { + payment_method_data: domain::PaymentMethodData::Card(domain::Card { + card_cvc: Secret::new("12345".to_string()), + ..utils::CCardType::default().0 + }), + ..utils::PaymentAuthorizeType::default().0 + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap_err().message, + "Your card's security code is invalid.".to_string(), + ); +} + +// Creates a payment with incorrect expiry month. +#[actix_web::test] +async fn should_fail_payment_for_invalid_exp_month() { + let response = CONNECTOR + .make_payment( + Some(types::PaymentsAuthorizeData { + payment_method_data: domain::PaymentMethodData::Card(domain::Card { + card_exp_month: Secret::new("20".to_string()), + ..utils::CCardType::default().0 + }), + ..utils::PaymentAuthorizeType::default().0 + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap_err().message, + "Your card's expiration month is invalid.".to_string(), + ); +} + +// Creates a payment with incorrect expiry year. +#[actix_web::test] +async fn should_fail_payment_for_incorrect_expiry_year() { + let response = CONNECTOR + .make_payment( + Some(types::PaymentsAuthorizeData { + payment_method_data: domain::PaymentMethodData::Card(domain::Card { + card_exp_year: Secret::new("2000".to_string()), + ..utils::CCardType::default().0 + }), + ..utils::PaymentAuthorizeType::default().0 + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap_err().message, + "Your card's expiration year is invalid.".to_string(), + ); +} + +// Voids a payment using automatic capture flow (Non 3DS). +#[actix_web::test] +async fn should_fail_void_payment_for_auto_capture() { + let authorize_response = CONNECTOR + .make_payment(payment_method_details(), get_default_payment_info()) + .await + .unwrap(); + assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); + let txn_id = utils::get_connector_transaction_id(authorize_response.response); + assert_ne!(txn_id, None, "Empty connector transaction id"); + let void_response = CONNECTOR + .void_payment(txn_id.unwrap(), None, get_default_payment_info()) + .await + .unwrap(); + assert_eq!( + void_response.response.unwrap_err().message, + "You cannot cancel this PaymentIntent because it has a status of succeeded." + ); +} + +// Captures a payment using invalid connector payment id. +#[actix_web::test] +async fn should_fail_capture_for_invalid_payment() { + let capture_response = CONNECTOR + .capture_payment("123456789".to_string(), None, get_default_payment_info()) + .await + .unwrap(); + assert_eq!( + capture_response.response.unwrap_err().message, + String::from("No such payment_intent: '123456789'") + ); +} + +// Refunds a payment with refund amount higher than payment amount. +#[actix_web::test] +async fn should_fail_for_refund_amount_higher_than_payment_amount() { + let response = CONNECTOR + .make_payment_and_refund( + payment_method_details(), + Some(types::RefundsData { + refund_amount: 150, + ..utils::PaymentRefundType::default().0 + }), + get_default_payment_info(), + ) + .await + .unwrap(); + assert_eq!( + response.response.unwrap_err().message, + "Refund amount (₹1.50) is greater than charge amount (₹1.00)", + ); +} + +// Connector dependent test cases goes here + +// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs index 90af2bd8d8..10707ba2f4 100644 --- a/crates/router/tests/connectors/main.rs +++ b/crates/router/tests/connectors/main.rs @@ -23,6 +23,7 @@ mod bitpay; mod bluesnap; mod boku; mod cashtocode; +mod celero; mod chargebee; mod checkbook; mod checkout; diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs index fd0f918091..3114120552 100644 --- a/crates/test_utils/src/connector_auth.rs +++ b/crates/test_utils/src/connector_auth.rs @@ -29,6 +29,7 @@ pub struct ConnectorAuthentication { pub bluesnap: Option, pub boku: Option, pub cashtocode: Option, + pub celero: Option, pub chargebee: Option, pub checkbook: Option, pub checkout: Option, diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml index 28e3e724c3..d2c62a5779 100644 --- a/loadtest/config/development.toml +++ b/loadtest/config/development.toml @@ -95,6 +95,7 @@ bluesnap.secondary_base_url = "https://sandpay.bluesnap.com/" boku.base_url = "https://country-api4-stage.boku.com" braintree.base_url = "https://payments.sandbox.braintree-api.com/graphql" cashtocode.base_url = "https://cluster05.api-test.cashtocode.com" +celero.base_url = "https://sandbox.gotnpgateway.com" chargebee.base_url = "https://$.chargebee.com/api/" checkbook.base_url = "https://api.sandbox.checkbook.io" checkout.base_url = "https://api.sandbox.checkout.com/" @@ -225,6 +226,7 @@ cards = [ "bluesnap", "boku", "braintree", + "celero", "checkbook", "checkout", "coinbase", @@ -332,36 +334,36 @@ przelewy24 = { country = "PL", currency = "PLN,EUR" } mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" } [pm_filters.globepay] -ali_pay = { country = "GB",currency = "GBP,CNY" } -we_chat_pay = { country = "GB",currency = "GBP,CNY" } +ali_pay = { country = "GB", currency = "GBP,CNY" } +we_chat_pay = { country = "GB", currency = "GBP,CNY" } [pm_filters.itaubank] pix = { country = "BR", currency = "BRL" } [pm_filters.nexinets] -credit = { country = "DE",currency = "EUR" } -debit = { country = "DE",currency = "EUR" } -ideal = { country = "DE",currency = "EUR" } -giropay = { country = "DE",currency = "EUR" } -sofort = { country = "DE",currency = "EUR" } -eps = { country = "DE",currency = "EUR" } -apple_pay = { country = "DE",currency = "EUR" } -paypal = { country = "DE",currency = "EUR" } +credit = { country = "DE", currency = "EUR" } +debit = { country = "DE", currency = "EUR" } +ideal = { country = "DE", currency = "EUR" } +giropay = { country = "DE", currency = "EUR" } +sofort = { country = "DE", currency = "EUR" } +eps = { country = "DE", currency = "EUR" } +apple_pay = { country = "DE", currency = "EUR" } +paypal = { country = "DE", currency = "EUR" } [pm_filters.nuvei] -credit = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US",currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } -debit = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US",currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } -klarna = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US",currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } -afterpay_clearpay = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US",currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } -ideal = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US",currency = "AED,AMD,ARS,AU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MR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } +ideal = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US", currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } +giropay = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US", currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } +sofort = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US", currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR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google_pay = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US", currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } +paypal = { country = "AU,CA,GB,IN,JP,NZ,PH,SG,TH,US", currency = "AED,AMD,ARS,AUD,AZN,BAM,BDT,BGN,BHD,BMD,BND,BRL,BYN,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,GBP,GEL,GHS,GTQ,HKD,HUF,IDR,INR,IQD,ISK,JOD,JPY,KES,KGS,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MMK,MNT,MUR,MWK,MXN,MYR,MZN,NAD,NGN,NOK,NZD,OMR,PEN,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,SAR,SEK,SGD,SOS,THB,TND,TOP,TRY,TTD,TWD,UAH,UGX,USD,UYU,UZS,VND,XAF,YER,ZAR" } [pm_filters.prophetpay] card_redirect = { country = "US", currency = "USD" } @@ -495,16 +497,16 @@ crypto_currency = { country = "US, CA, GB, AU, BR, MX, SG, PH, NZ, ZA, JP, AT, B klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" } [pm_filters.bluesnap] -credit = { country = "AD,AE,AG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,MW,MX,MY,MZ,NA,NE,NG,NI,NL,NO,NP,NR,NZ,OM,PA,PE,PG,PH,PK,PL,PS,PT,PW,PY,QA,RO,RS,RW,SA,SB,SC,SE,SG,SI,SK,SL,SM,SN,SO,SR,SS,ST,SV,SZ,TD,TG,TH,TJ,TL,TM,TN,TO,TR,TT,TV,TZ,UA,UG,US,UY,UZ,VA,VC,VE,VN,VU,WS,ZA,ZM,ZW", currency = "AED,AFN,ALL,AMD,ANG,ARS,AUD,AWG,BAM,BBD,BGN,BHD,BMD,BND,BOB,BRL,BSD,BWP,CAD,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,DZD,EGP,EUR,FJD,GBP,GEL,GIP,GTQ,HKD,HUF,IDR,ILS,INR,ISK,JMD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,MAD,MDL,MKD,MUR,MWK,MXN,MYR,NAD,NGN,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PLN,PKR,QAR,RON,RSD,RUB,SAR,SCR,SDG,SEK,SGD,THB,TND,TRY,TTD,TWD,TZS,UAH,USD,UYU,UZS,VND,XAF,XCD,XOF,ZAR" } [pm_filters.inespay] -sepa = { country = "ES", currency = "EUR"} +sepa = { country = "ES", currency = "EUR" } [pm_filters.fiserv] -credit = {country = "AU,NZ,CN,HK,IN,LK,KR,MY,SG,GB,BE,FR,DE,IT,ME,NL,PL,ES,ZA,AR,BR,CO,MX,PA,UY,US,CA", currency = "AFN,ALL,DZD,AOA,ARS,AMD,AWG,AUD,AZN,BSD,BHD,BDT,BBD,BYN,BZD,BMD,BTN,BOB,VES,BAM,BWP,BRL,BND,BGN,BIF,KHR,CAD,CVE,KYD,XAF,CLP,CNY,COP,KMF,CDF,CRC,HRK,CUP,CZK,DKK,DJF,DOP,XCD,EGP,ERN,ETB,EUR,FKP,FJD,XPF,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,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PF,GMD,GEL,GHS,GIP,GTQ,GNF,GYD,HTG,HNL,HKD,HUF,ISK,INR,IDR,IRR,IQD,ILS,JMD,JPY,JOD,KZT,KES,KGS,KWD,LAK,LBP,LSL,LRD,LYD,MOP,MKD,MGA,MWK,MYR,MVR,MRU,MUR,MXN,MDL,MNT,MAD,MZN,MMK,NAD,NPR,ANG,NZD,NIO,NGN,VUV,KPW,NOK,OMR,PKR,PAB,PGK,PYG,PEN,PHP,PLN,GBP,QAR,RON,RUB,RWF,SHP,SVC,WST,STN,SAR,RSD,SCR,SLL,SGD,SBD,SOS,ZAR,KRW,SSP,LKR,SDG,SRD,SZL,SEK,CHF,SYP,TWD,TJS,TZS,THB,TOP,TTD,TND,TRY,TMT,UGX,UAH,AED,USD,UYU,UZS,VND,XOF,YER,ZMW,ZWL" } [pm_filters.stax] credit = { country = "US", currency = "USD" } @@ -512,8 +514,8 @@ debit = { country = "US", currency = "USD" } ach = { country = "US", currency = "USD" } [pm_filters.braintree] -credit = { country = "AD,AT,AU,BE,BG,CA,CH,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GG,GI,GR,HK,HR,HU,IE,IM,IT,JE,LI,LT,LU,LV,MT,MC,MY,NL,NO,NZ,PL,PT,RO,SE,SG,SI,SK,SM,US", currency = "AED,AMD,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,INR,ISK,JMD,JPY,KES,KGS,KHR,KMF,KRW,KYD,KZT,LAK,LBP,LKR,LRD,LSL,MAD,MDL,MKD,MNT,MOP,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR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SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STD,SVC,SYP,SZL,THB,TJS,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL" } [pm_filters.aci] credit = { country = "AD,AE,AT,BE,BG,CH,CN,CO,CR,CY,CZ,DE,DK,DO,EE,EG,ES,ET,FI,FR,GB,GH,GI,GR,GT,HN,HK,HR,HU,ID,IE,IS,IT,JP,KH,LA,LI,LT,LU,LY,MK,MM,MX,MY,MZ,NG,NZ,OM,PA,PE,PK,PL,PT,QA,RO,SA,SN,SE,SI,SK,SV,TH,UA,US,UY,VN,ZM", currency = "AED,ALL,ARS,BGN,CHF,CLP,CNY,COP,CRC,CZK,DKK,DOP,EGP,EUR,GBP,GHS,HKD,HNL,HRK,HUF,IDR,ILS,ISK,JPY,KHR,KPW,LAK,LKR,MAD,MKD,MMK,MXN,MYR,MZN,NGN,NOK,NZD,OMR,PAB,PEN,PHP,PKR,PLN,QAR,RON,RSD,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,UYU,VND,ZAR,ZMW" } @@ -523,22 +525,22 @@ ali_pay = { country = "CN", currency = "CNY" } eps = { country = "AT", currency = "EUR" } ideal = { country = "NL", currency = "EUR" } giropay = { country = "DE", currency = "EUR" } -sofort = { country = "AT,BE,CH,DE,ES,GB,IT,NL,PL", currency = "CHF,EUR,GBP,HUF,PLN"} -interac = { country = "CA", currency = "CAD,USD"} +sofort = { country = "AT,BE,CH,DE,ES,GB,IT,NL,PL", currency = "CHF,EUR,GBP,HUF,PLN" } +interac = { country = "CA", currency = "CAD,USD" } przelewy24 = { country = "PL", currency = "CZK,EUR,GBP,PLN" } trustly = { country = "ES,GB,SE,NO,AT,NL,DE,DK,FI,EE,LT,LV", currency = "CZK,DKK,EUR,GBP,NOK,SEK" } klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" } [pm_filters.authorizedotnet] -credit = {currency = "CAD,USD"} -debit = {currency = "CAD,USD"} -google_pay = {currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"} -apple_pay = {currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR"} -paypal = {currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD"} +credit = { currency = "CAD,USD" } +debit = { currency = "CAD,USD" } +google_pay = { currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" } +apple_pay = { currency = "EUR,GBP,ISK,USD,AUD,CAD,BRL,CLP,COP,CRC,CZK,DKK,EGP,GEL,GHS,GTQ,HNL,HKD,HUF,ILS,INR,JPY,KZT,KRW,KWD,MAD,MXN,MYR,NOK,NZD,PEN,PLN,PYG,QAR,RON,SAR,SEK,SGD,THB,TWD,UAH,AED,VND,ZAR" } +paypal = { currency = "AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HKD,HUF,ILS,JPY,MXN,MYR,NOK,NZD,PHP,PLN,SEK,SGD,THB,TWD,USD" } [pm_filters.forte] -credit = { country = "US, CA", currency = "CAD,USD"} -debit = { country = "US, CA", currency = "CAD,USD"} +credit = { country = "US, CA", currency = "CAD,USD" } +debit = { country = "US, CA", currency = "CAD,USD" } [pm_filters.fiuu] duit_now = { country = "MY", currency = "MYR" } @@ -549,8 +551,8 @@ credit = { country = "CN,HK,ID,MY,PH,SG,TH,TW,VN", currency = "CNY,HKD,IDR,MYR,P debit = { country = "CN,HK,ID,MY,PH,SG,TH,TW,VN", currency = "CNY,HKD,IDR,MYR,PHP,SGD,THB,TWD,VND" } [pm_filters.placetopay] -credit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD"} -debit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD"} +credit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD" } +debit = { country = "BE,CH,CO,CR,EC,HN,MX,PA,PR,UY", currency = "CLP,COP,USD" } [pm_filters.coingate] crypto_currency = { country = "AL, AD, AT, BE, BA, BG, HR, CZ, DK, EE, FI, FR, DE, GR, HU, IS, IE, IT, LV, LT, LU, MT, MD, NL, NO, PL, PT, RO, RS, SK, SI, ES, SE, CH, UA, GB, AR, BR, CL, CO, CR, DO, SV, GD, MX, PE, LC, AU, NZ, CY, HK, IN, IL, JP, KR, QA, SA, SG, EG", currency = "EUR, USD, GBP" } @@ -704,4 +706,4 @@ redsys = { payment_method = "card" } [billing_connectors_payment_sync] billing_connectors_which_require_payment_sync = "stripebilling, recurly" [billing_connectors_invoice_sync] -billing_connectors_which_requires_invoice_sync_call = "recurly" \ No newline at end of file +billing_connectors_which_requires_invoice_sync_call = "recurly" diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh index 534c1614a5..648d2e6899 100755 --- a/scripts/add_connector.sh +++ b/scripts/add_connector.sh @@ -6,7 +6,7 @@ function find_prev_connector() { git checkout $self cp $self $self.tmp # Add new connector to existing list and sort it - connectors=(aci adyen adyenplatform airwallex amazonpay applepay archipel authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay bluesnap boku braintree cashtocode chargebee checkbook checkout coinbase cryptopay ctp_visa cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault iatapay inespay itaubank jpmorgan juspaythreedsserver klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 square stax stripe stripebilling taxjar threedsecureio thunes tokenio trustpay tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1") + connectors=(aci adyen adyenplatform airwallex amazonpay applepay archipel authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay bluesnap boku braintree cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault iatapay inespay itaubank jpmorgan juspaythreedsserver klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 square stax stripe stripebilling taxjar threedsecureio thunes tokenio trustpay tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1") IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS res="$(echo ${sorted[@]})" sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp