Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(connector): [Gigadat] Connector Template code (#9450)
Swangi Kumari1ae6c20933f9
diff --git a/config/config.example.toml b/config/config.example.tomlindex bae0da78fb..ea27effe83 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -233,6 +233,7 @@ fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"fiuu.third_base_url="https://api.merchant.razer.com/"forte.base_url = "https://sandbox.forte.net/api/v3"getnet.base_url = "https://api-test.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api-sandbox.gocardless.com"diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.tomlindex f1addc2b58..c381bc0596 100644--- a/config/deployments/integration_test.toml+++ b/config/deployments/integration_test.toml@@ -72,6 +72,7 @@ fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"fiuu.third_base_url="https://api.merchant.razer.com/"forte.base_url = "https://sandbox.forte.net/api/v3"getnet.base_url = "https://api-test.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api-sandbox.gocardless.com"diff --git a/config/deployments/production.toml b/config/deployments/production.tomlindex 3fd609dd9b..34bfffa8f3 100644--- a/config/deployments/production.toml+++ b/config/deployments/production.toml@@ -76,6 +76,7 @@ fiuu.secondary_base_url="https://api.merchant.razer.com/"fiuu.third_base_url="https://api.merchant.razer.com/"forte.base_url = "https://api.forte.net/v3"getnet.base_url = "https://api.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api.gocardless.com"diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.tomlindex 44238899b5..a13157b860 100644--- a/config/deployments/sandbox.toml+++ b/config/deployments/sandbox.toml@@ -76,6 +76,7 @@ fiuu.secondary_base_url="https://sandbox.merchant.razer.com/"fiuu.third_base_url="https://api.merchant.razer.com/"forte.base_url = "https://sandbox.forte.net/api/v3"getnet.base_url = "https://api-test.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api-sandbox.gocardless.com"diff --git a/config/development.toml b/config/development.tomlindex e145d1eb08..b05755409e 100644--- a/config/development.toml+++ b/config/development.toml@@ -271,6 +271,7 @@ fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/"fiuu.third_base_url = "https://api.merchant.razer.com/"forte.base_url = "https://sandbox.forte.net/api/v3"getnet.base_url = "https://api-test.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api-sandbox.gocardless.com"diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex c36904d5fe..896f3eeba6 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -159,6 +159,7 @@ fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/"fiuu.third_base_url = "https://api.merchant.razer.com/"forte.base_url = "https://sandbox.forte.net/api/v3"getnet.base_url = "https://api-test.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api-sandbox.gocardless.com"diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rsindex 186e08989e..9dc646f36d 100644--- a/crates/connector_configs/src/connector.rs+++ b/crates/connector_configs/src/connector.rs@@ -273,6 +273,7 @@ pub struct ConnectorConfig {pub flexiti: Option<ConnectorTomlConfig>,pub forte: Option<ConnectorTomlConfig>,pub getnet: Option<ConnectorTomlConfig>,+ pub gigadat: Option<ConnectorTomlConfig>,pub globalpay: Option<ConnectorTomlConfig>,pub globepay: Option<ConnectorTomlConfig>,pub gocardless: Option<ConnectorTomlConfig>,diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.tomlindex 7d68c4de4f..e27c801faf 100644--- a/crates/connector_configs/toml/development.toml+++ b/crates/connector_configs/toml/development.toml@@ -7089,3 +7089,7 @@ type="Text"[tokenex][tokenex.connector_auth.HeaderKey]api_key = "API Key"++[gigadat]+[gigadat.connector_auth.HeaderKey]+api_key = "API Key"diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.tomlindex eff6373097..6d026312b5 100644--- a/crates/connector_configs/toml/production.toml+++ b/crates/connector_configs/toml/production.toml@@ -5807,3 +5807,7 @@ type="Text"[tokenex][tokenex.connector_auth.HeaderKey]api_key = "API Key"++[gigadat]+[gigadat.connector_auth.HeaderKey]+api_key = "API Key"diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.tomlindex 379ea955c9..96b9586f3c 100644--- a/crates/connector_configs/toml/sandbox.toml+++ b/crates/connector_configs/toml/sandbox.toml@@ -7070,3 +7070,7 @@ type="Text"[tokenex][tokenex.connector_auth.HeaderKey]api_key = "API Key"++[gigadat]+[gigadat.connector_auth.HeaderKey]+api_key = "API Key"diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rsindex 806c21859f..d0b8ed74eb 100644--- a/crates/hyperswitch_connectors/src/connectors.rs+++ b/crates/hyperswitch_connectors/src/connectors.rs@@ -46,6 +46,7 @@ pub mod fiuu;pub mod flexiti;pub mod forte;pub mod getnet;+pub mod gigadat;pub mod globalpay;pub mod globepay;pub mod gocardless;@@ -142,10 +143,10 @@ pub use self::{custombilling::Custombilling, cybersource::Cybersource, datatrans::Datatrans,deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, dwolla::Dwolla,ebanx::Ebanx, elavon::Elavon, facilitapay::Facilitapay, fiserv::Fiserv, fiservemea::Fiservemea,- fiuu::Fiuu, flexiti::Flexiti, forte::Forte, getnet::Getnet, globalpay::Globalpay,- globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments, helcim::Helcim, hipay::Hipay,- hyperswitch_vault::HyperswitchVault, hyperwallet::Hyperwallet, iatapay::Iatapay,- inespay::Inespay, itaubank::Itaubank, jpmorgan::Jpmorgan,+ fiuu::Fiuu, flexiti::Flexiti, forte::Forte, getnet::Getnet, gigadat::Gigadat,+ globalpay::Globalpay, globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments,+ helcim::Helcim, hipay::Hipay, hyperswitch_vault::HyperswitchVault, hyperwallet::Hyperwallet,+ iatapay::Iatapay, inespay::Inespay, itaubank::Itaubank, jpmorgan::Jpmorgan,juspaythreedsserver::Juspaythreedsserver, katapult::Katapult, klarna::Klarna,mifinity::Mifinity, mollie::Mollie, moneris::Moneris, mpgs::Mpgs, multisafepay::Multisafepay,netcetera::Netcetera, nexinets::Nexinets, nexixpay::Nexixpay, nmi::Nmi, nomupay::Nomupay,diff --git a/crates/hyperswitch_connectors/src/connectors/gigadat.rs b/crates/hyperswitch_connectors/src/connectors/gigadat.rsnew file mode 100644index 0000000000..bebad38b04--- /dev/null+++ b/crates/hyperswitch_connectors/src/connectors/gigadat.rs@@ -0,0 +1,621 @@+pub mod transformers;++use std::sync::LazyLock;++use common_enums::enums;+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::{+ payment_method_data::PaymentMethodData,+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},+ router_flow_types::{+ access_token_auth::AccessTokenAuth,+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},+ refunds::{Execute, RSync},+ },+ router_request_types::{+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,+ RefundsData, SetupMandateRequestData,+ },+ router_response_types::{+ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods,+ },+ 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 gigadat;++use crate::{constants::headers, types::ResponseRouterData, utils};++#[derive(Clone)]+pub struct Gigadat {+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),+}++impl Gigadat {+ pub fn new() -> &'static Self {+ &Self {+ amount_converter: &StringMinorUnitForConnector,+ }+ }+}++impl api::Payment for Gigadat {}+impl api::PaymentSession for Gigadat {}+impl api::ConnectorAccessToken for Gigadat {}+impl api::MandateSetup for Gigadat {}+impl api::PaymentAuthorize for Gigadat {}+impl api::PaymentSync for Gigadat {}+impl api::PaymentCapture for Gigadat {}+impl api::PaymentVoid for Gigadat {}+impl api::Refund for Gigadat {}+impl api::RefundExecute for Gigadat {}+impl api::RefundSync for Gigadat {}+impl api::PaymentToken for Gigadat {}++impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>+ for Gigadat+{+ // Not Implemented (R)+}++impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Gigadat+where+ Self: ConnectorIntegration<Flow, Request, Response>,+{+ fn build_headers(+ &self,+ req: &RouterData<Flow, Request, Response>,+ _connectors: &Connectors,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, 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 Gigadat {+ fn id(&self) -> &'static str {+ "gigadat"+ }++ fn get_currency_unit(&self) -> api::CurrencyUnit {+ api::CurrencyUnit::Base+ }++ fn common_get_content_type(&self) -> &'static str {+ "application/json"+ }++ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {+ connectors.gigadat.base_url.as_ref()+ }++ fn get_auth_header(+ &self,+ auth_type: &ConnectorAuthType,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {+ let auth = gigadat::GigadatAuthType::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<ErrorResponse, errors::ConnectorError> {+ let response: gigadat::GigadatErrorResponse = res+ .response+ .parse_struct("GigadatErrorResponse")+ .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_advice_code: None,+ network_decline_code: None,+ network_error_message: None,+ connector_metadata: None,+ })+ }+}++impl ConnectorValidation for Gigadat {+ fn validate_mandate_payment(+ &self,+ _pm_type: Option<enums::PaymentMethodType>,+ pm_data: PaymentMethodData,+ ) -> CustomResult<(), errors::ConnectorError> {+ match pm_data {+ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(+ "validate_mandate_payment does not support cards".to_string(),+ )+ .into()),+ _ => Ok(()),+ }+ }++ fn validate_psync_reference_id(+ &self,+ _data: &PaymentsSyncData,+ _is_three_ds: bool,+ _status: enums::AttemptStatus,+ _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,+ ) -> CustomResult<(), errors::ConnectorError> {+ Ok(())+ }+}++impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Gigadat {+ //TODO: implement sessions flow+}++impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Gigadat {}++impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Gigadat {}++impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Gigadat {+ fn get_headers(+ &self,+ req: &PaymentsAuthorizeRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, 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<String, errors::ConnectorError> {+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())+ }++ fn get_request_body(+ &self,+ req: &PaymentsAuthorizeRouterData,+ _connectors: &Connectors,+ ) -> CustomResult<RequestContent, errors::ConnectorError> {+ let amount = utils::convert_amount(+ self.amount_converter,+ req.request.minor_amount,+ req.request.currency,+ )?;++ let connector_router_data = gigadat::GigadatRouterData::from((amount, req));+ let connector_req = gigadat::GigadatPaymentsRequest::try_from(&connector_router_data)?;+ Ok(RequestContent::Json(Box::new(connector_req)))+ }++ fn build_request(+ &self,+ req: &PaymentsAuthorizeRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, 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<PaymentsAuthorizeRouterData, errors::ConnectorError> {+ let response: gigadat::GigadatPaymentsResponse = res+ .response+ .parse_struct("Gigadat 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<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}++impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Gigadat {+ fn get_headers(+ &self,+ req: &PaymentsSyncRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, 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<String, errors::ConnectorError> {+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())+ }++ fn build_request(+ &self,+ req: &PaymentsSyncRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, 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<PaymentsSyncRouterData, errors::ConnectorError> {+ let response: gigadat::GigadatPaymentsResponse = res+ .response+ .parse_struct("gigadat 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<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}++impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Gigadat {+ fn get_headers(+ &self,+ req: &PaymentsCaptureRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, 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<String, errors::ConnectorError> {+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())+ }++ fn get_request_body(+ &self,+ _req: &PaymentsCaptureRouterData,+ _connectors: &Connectors,+ ) -> CustomResult<RequestContent, errors::ConnectorError> {+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())+ }++ fn build_request(+ &self,+ req: &PaymentsCaptureRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, 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<PaymentsCaptureRouterData, errors::ConnectorError> {+ let response: gigadat::GigadatPaymentsResponse = res+ .response+ .parse_struct("Gigadat 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<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}++impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Gigadat {}++impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Gigadat {+ fn get_headers(+ &self,+ req: &RefundsRouterData<Execute>,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, 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<Execute>,+ _connectors: &Connectors,+ ) -> CustomResult<String, errors::ConnectorError> {+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())+ }++ fn get_request_body(+ &self,+ req: &RefundsRouterData<Execute>,+ _connectors: &Connectors,+ ) -> CustomResult<RequestContent, errors::ConnectorError> {+ let refund_amount = utils::convert_amount(+ self.amount_converter,+ req.request.minor_refund_amount,+ req.request.currency,+ )?;++ let connector_router_data = gigadat::GigadatRouterData::from((refund_amount, req));+ let connector_req = gigadat::GigadatRefundRequest::try_from(&connector_router_data)?;+ Ok(RequestContent::Json(Box::new(connector_req)))+ }++ fn build_request(+ &self,+ req: &RefundsRouterData<Execute>,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, 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<Execute>,+ event_builder: Option<&mut ConnectorEvent>,+ res: Response,+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {+ let response: gigadat::RefundResponse = res+ .response+ .parse_struct("gigadat 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<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}++impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Gigadat {+ fn get_headers(+ &self,+ req: &RefundSyncRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, 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<String, errors::ConnectorError> {+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())+ }++ fn build_request(+ &self,+ req: &RefundSyncRouterData,+ connectors: &Connectors,+ ) -> CustomResult<Option<Request>, 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<RefundSyncRouterData, errors::ConnectorError> {+ let response: gigadat::RefundResponse = res+ .response+ .parse_struct("gigadat 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<ErrorResponse, errors::ConnectorError> {+ self.build_error_response(res, event_builder)+ }+}++#[async_trait::async_trait]+impl webhooks::IncomingWebhook for Gigadat {+ fn get_webhook_object_reference_id(+ &self,+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))+ }++ fn get_webhook_event_type(+ &self,+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))+ }++ fn get_webhook_resource_object(+ &self,+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))+ }+}++static GIGADAT_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =+ LazyLock::new(SupportedPaymentMethods::new);++static GIGADAT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+ display_name: "Gigadat",+ description: "Gigadat connector",+ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,+ integration_status: enums::ConnectorIntegrationStatus::Sandbox,+};++static GIGADAT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];++impl ConnectorSpecifications for Gigadat {+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {+ Some(&GIGADAT_CONNECTOR_INFO)+ }++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {+ Some(&*GIGADAT_SUPPORTED_PAYMENT_METHODS)+ }++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {+ Some(&GIGADAT_SUPPORTED_WEBHOOK_FLOWS)+ }+}diff --git a/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs b/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rsnew file mode 100644index 0000000000..db58300ed3--- /dev/null+++ b/crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs@@ -0,0 +1,219 @@+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};++//TODO: Fill the struct with respective fields+pub struct GigadatRouterData<T> {+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.+ pub router_data: T,+}++impl<T> From<(StringMinorUnit, T)> for GigadatRouterData<T> {+ 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 GigadatPaymentsRequest {+ amount: StringMinorUnit,+ card: GigadatCard,+}++#[derive(Default, Debug, Serialize, Eq, PartialEq)]+pub struct GigadatCard {+ number: cards::CardNumber,+ expiry_month: Secret<String>,+ expiry_year: Secret<String>,+ cvc: Secret<String>,+ complete: bool,+}++impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatPaymentsRequest {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ item: &GigadatRouterData<&PaymentsAuthorizeRouterData>,+ ) -> Result<Self, Self::Error> {+ match item.router_data.request.payment_method_data.clone() {+ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(+ "Card payment method not implemented".to_string(),+ )+ .into()),+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),+ }+ }+}++//TODO: Fill the struct with respective fields+// Auth Struct+pub struct GigadatAuthType {+ pub(super) api_key: Secret<String>,+}++impl TryFrom<&ConnectorAuthType> for GigadatAuthType {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {+ 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, Copy, Default, Serialize, Deserialize, PartialEq)]+#[serde(rename_all = "lowercase")]+pub enum GigadatPaymentStatus {+ Succeeded,+ Failed,+ #[default]+ Processing,+}++impl From<GigadatPaymentStatus> for common_enums::AttemptStatus {+ fn from(item: GigadatPaymentStatus) -> Self {+ match item {+ GigadatPaymentStatus::Succeeded => Self::Charged,+ GigadatPaymentStatus::Failed => Self::Failure,+ GigadatPaymentStatus::Processing => Self::Authorizing,+ }+ }+}++//TODO: Fill the struct with respective fields+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]+pub struct GigadatPaymentsResponse {+ status: GigadatPaymentStatus,+ id: String,+}++impl<F, T> TryFrom<ResponseRouterData<F, GigadatPaymentsResponse, T, PaymentsResponseData>>+ for RouterData<F, T, PaymentsResponseData>+{+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ item: ResponseRouterData<F, GigadatPaymentsResponse, T, PaymentsResponseData>,+ ) -> Result<Self, Self::Error> {+ 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 GigadatRefundRequest {+ pub amount: StringMinorUnit,+}++impl<F> TryFrom<&GigadatRouterData<&RefundsRouterData<F>>> for GigadatRefundRequest {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(item: &GigadatRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {+ Ok(Self {+ amount: item.amount.to_owned(),+ })+ }+}++// Type definition for Refund Response++#[allow(dead_code)]+#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]+pub enum RefundStatus {+ Succeeded,+ Failed,+ #[default]+ Processing,+}++impl From<RefundStatus> 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<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ item: RefundsResponseRouterData<Execute, RefundResponse>,+ ) -> Result<Self, Self::Error> {+ 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<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {+ type Error = error_stack::Report<errors::ConnectorError>;+ fn try_from(+ item: RefundsResponseRouterData<RSync, RefundResponse>,+ ) -> Result<Self, Self::Error> {+ 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 GigadatErrorResponse {+ pub status_code: u16,+ pub code: String,+ pub message: String,+ pub reason: Option<String>,+ pub network_advice_code: Option<String>,+ pub network_decline_code: Option<String>,+ pub network_error_message: Option<String>,+}diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rsindex 3a5c3e77bc..057aca866f 100644--- a/crates/hyperswitch_connectors/src/default_implementations.rs+++ b/crates/hyperswitch_connectors/src/default_implementations.rs@@ -214,6 +214,7 @@ default_imp_for_authorize_session_token!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -357,6 +358,7 @@ default_imp_for_calculate_tax!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -499,6 +501,7 @@ default_imp_for_session_update!(connectors::Fiservemea,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Helcim,connectors::HyperswitchVault,connectors::Hyperwallet,@@ -643,6 +646,7 @@ default_imp_for_post_session_tokens!(connectors::Fiservemea,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Helcim,connectors::HyperswitchVault,connectors::Hyperwallet,@@ -785,6 +789,7 @@ default_imp_for_create_order!(connectors::Fiservemea,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Helcim,connectors::HyperswitchVault,connectors::Hyperwallet,@@ -929,6 +934,7 @@ default_imp_for_update_metadata!(connectors::Fiservemea,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Helcim,connectors::HyperswitchVault,connectors::Hyperwallet,@@ -1073,6 +1079,7 @@ default_imp_for_cancel_post_capture!(connectors::Fiservemea,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Helcim,connectors::HyperswitchVault,connectors::Hyperwallet,@@ -1212,6 +1219,7 @@ default_imp_for_complete_authorize!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globepay,connectors::Gocardless,connectors::Gpayments,@@ -1342,6 +1350,7 @@ default_imp_for_incremental_authorization!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1480,6 +1489,7 @@ default_imp_for_create_customer!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gpayments,@@ -1618,6 +1628,7 @@ default_imp_for_connector_redirect_response!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globepay,connectors::Gocardless,connectors::Gpayments,@@ -1746,6 +1757,7 @@ default_imp_for_pre_authenticate_steps!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1889,6 +1901,7 @@ default_imp_for_authenticate_steps!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2032,6 +2045,7 @@ default_imp_for_post_authenticate_steps!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2173,6 +2187,7 @@ default_imp_for_pre_processing_steps!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gpayments,@@ -2305,6 +2320,7 @@ default_imp_for_post_processing_steps!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2450,6 +2466,7 @@ default_imp_for_approve!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2596,6 +2613,7 @@ default_imp_for_reject!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2743,6 +2761,7 @@ default_imp_for_webhook_source_verification!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2886,6 +2905,7 @@ default_imp_for_accept_dispute!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3029,6 +3049,7 @@ default_imp_for_submit_evidence!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3171,6 +3192,7 @@ default_imp_for_defend_dispute!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3317,6 +3339,7 @@ default_imp_for_fetch_disputes!(connectors::Forte,connectors::Flexiti,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3462,6 +3485,7 @@ default_imp_for_dispute_sync!(connectors::Forte,connectors::Flexiti,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3614,6 +3638,7 @@ default_imp_for_file_upload!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3748,6 +3773,7 @@ default_imp_for_payouts!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3888,6 +3914,7 @@ default_imp_for_payouts_create!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4032,6 +4059,7 @@ default_imp_for_payouts_retrieve!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4174,6 +4202,7 @@ default_imp_for_payouts_eligibility!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4317,6 +4346,7 @@ default_imp_for_payouts_fulfill!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4457,6 +4487,7 @@ default_imp_for_payouts_cancel!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4601,6 +4632,7 @@ default_imp_for_payouts_quote!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4746,6 +4778,7 @@ default_imp_for_payouts_recipient!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4891,6 +4924,7 @@ default_imp_for_payouts_recipient_account!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5037,6 +5071,7 @@ default_imp_for_frm_sale!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5183,6 +5218,7 @@ default_imp_for_frm_checkout!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5329,6 +5365,7 @@ default_imp_for_frm_transaction!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5475,6 +5512,7 @@ default_imp_for_frm_fulfillment!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5621,6 +5659,7 @@ default_imp_for_frm_record_return!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5762,6 +5801,7 @@ default_imp_for_revoking_mandates!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -5906,6 +5946,7 @@ default_imp_for_uas_pre_authentication!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6049,6 +6090,7 @@ default_imp_for_uas_post_authentication!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6193,6 +6235,7 @@ default_imp_for_uas_authentication_confirmation!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6329,6 +6372,7 @@ default_imp_for_connector_request_id!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6467,6 +6511,7 @@ default_imp_for_fraud_check!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6635,6 +6680,7 @@ default_imp_for_connector_authentication!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6776,6 +6822,7 @@ default_imp_for_uas_authentication!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -6912,6 +6959,7 @@ default_imp_for_revenue_recovery!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7072,6 +7120,7 @@ default_imp_for_subscriptions!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7219,6 +7268,7 @@ default_imp_for_billing_connector_payment_sync!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7364,6 +7414,7 @@ default_imp_for_revenue_recovery_record_back!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7509,6 +7560,7 @@ default_imp_for_billing_connector_invoice_sync!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7648,6 +7700,7 @@ default_imp_for_external_vault!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7793,6 +7846,7 @@ default_imp_for_external_vault_insert!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -7936,6 +7990,7 @@ default_imp_for_gift_card_balance_check!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -8082,6 +8137,7 @@ default_imp_for_external_vault_retrieve!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -8227,6 +8283,7 @@ default_imp_for_external_vault_delete!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -8374,6 +8431,7 @@ default_imp_for_external_vault_create!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -8518,6 +8576,7 @@ default_imp_for_connector_authentication_token!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -8661,6 +8720,7 @@ default_imp_for_external_vault_proxy_payments_create!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rsindex 5f67ba53ec..621e41dcb9 100644--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs@@ -314,6 +314,7 @@ default_imp_for_new_connector_integration_payment!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -461,6 +462,7 @@ default_imp_for_new_connector_integration_refund!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -599,6 +601,7 @@ default_imp_for_new_connector_integration_connector_authentication_token!(connectors::Fiuu,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -735,6 +738,7 @@ default_imp_for_new_connector_integration_connector_access_token!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -881,6 +885,7 @@ default_imp_for_new_connector_integration_accept_dispute!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1027,6 +1032,7 @@ default_imp_for_new_connector_integration_fetch_disputes!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1174,6 +1180,7 @@ default_imp_for_new_connector_integration_dispute_sync!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1321,6 +1328,7 @@ default_imp_for_new_connector_integration_defend_dispute!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1466,6 +1474,7 @@ default_imp_for_new_connector_integration_submit_evidence!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1622,6 +1631,7 @@ default_imp_for_new_connector_integration_file_upload!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1770,6 +1780,7 @@ default_imp_for_new_connector_integration_payouts_create!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -1918,6 +1929,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2066,6 +2078,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2214,6 +2227,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2362,6 +2376,7 @@ default_imp_for_new_connector_integration_payouts_quote!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2510,6 +2525,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2658,6 +2674,7 @@ default_imp_for_new_connector_integration_payouts_sync!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2806,6 +2823,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -2952,6 +2970,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3100,6 +3119,7 @@ default_imp_for_new_connector_integration_frm_sale!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3248,6 +3268,7 @@ default_imp_for_new_connector_integration_frm_checkout!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3396,6 +3417,7 @@ default_imp_for_new_connector_integration_frm_transaction!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3544,6 +3566,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3692,6 +3715,7 @@ default_imp_for_new_connector_integration_frm_record_return!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3838,6 +3862,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -3930,6 +3955,7 @@ macro_rules! default_imp_for_new_connector_integration_frm {#[cfg(feature = "frm")]default_imp_for_new_connector_integration_frm!(+ connectors::Gigadat,connectors::Affirm,connectors::Paytm,connectors::Airwallex,@@ -4075,6 +4101,7 @@ macro_rules! default_imp_for_new_connector_integration_connector_authentication}default_imp_for_new_connector_integration_connector_authentication!(+ connectors::Gigadat,connectors::Affirm,connectors::Paytm,connectors::Airwallex,@@ -4209,6 +4236,7 @@ macro_rules! default_imp_for_new_connector_integration_revenue_recovery {}default_imp_for_new_connector_integration_revenue_recovery!(+ connectors::Gigadat,connectors::Affirm,connectors::Paytm,connectors::Airwallex,@@ -4399,6 +4427,7 @@ default_imp_for_new_connector_integration_external_vault!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,@@ -4544,6 +4573,7 @@ default_imp_for_new_connector_integration_external_vault_proxy!(connectors::Flexiti,connectors::Forte,connectors::Getnet,+ connectors::Gigadat,connectors::Globalpay,connectors::Globepay,connectors::Gocardless,diff --git a/crates/hyperswitch_domain_models/src/connector_endpoints.rs b/crates/hyperswitch_domain_models/src/connector_endpoints.rsindex 739f89ce4d..cca0310190 100644--- a/crates/hyperswitch_domain_models/src/connector_endpoints.rs+++ b/crates/hyperswitch_domain_models/src/connector_endpoints.rs@@ -61,6 +61,7 @@ pub struct Connectors {pub flexiti: ConnectorParams,pub forte: ConnectorParams,pub getnet: ConnectorParams,+ pub gigadat: ConnectorParams,pub globalpay: ConnectorParams,pub globepay: ConnectorParams,pub gocardless: ConnectorParams,diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rsindex b378e685f5..895d9ae1a2 100644--- a/crates/router/src/connector.rs+++ b/crates/router/src/connector.rs@@ -19,30 +19,31 @@ pub use hyperswitch_connectors::connectors::{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, flexiti, flexiti::Flexiti, 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, hyperwallet, hyperwallet::Hyperwallet,- iatapay, iatapay::Iatapay, inespay, inespay::Inespay, itaubank, itaubank::Itaubank, jpmorgan,- jpmorgan::Jpmorgan, juspaythreedsserver, juspaythreedsserver::Juspaythreedsserver, katapult,- katapult::Katapult, klarna, klarna::Klarna, mifinity, mifinity::Mifinity, mollie,- mollie::Mollie, moneris, moneris::Moneris, mpgs, mpgs::Mpgs, 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, paysafe,- paysafe::Paysafe, paystack, paystack::Paystack, paytm, paytm::Paytm, payu, payu::Payu,- peachpayments, peachpayments::Peachpayments, phonepe, phonepe::Phonepe, 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, sift, sift::Sift, signifyd, signifyd::Signifyd,- silverflow, silverflow::Silverflow, square, square::Square, stax, stax::Stax, stripe,- stripe::Stripe, stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar,- threedsecureio, threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenex,- tokenex::Tokenex, tokenio, tokenio::Tokenio, trustpay, trustpay::Trustpay, trustpayments,- trustpayments::Trustpayments, tsys, tsys::Tsys, unified_authentication_service,+ fiuu::Fiuu, flexiti, flexiti::Flexiti, forte, forte::Forte, getnet, getnet::Getnet, gigadat,+ gigadat::Gigadat, globalpay, globalpay::Globalpay, globepay, globepay::Globepay, gocardless,+ gocardless::Gocardless, gpayments, gpayments::Gpayments, helcim, helcim::Helcim, hipay,+ hipay::Hipay, hyperswitch_vault, hyperswitch_vault::HyperswitchVault, hyperwallet,+ hyperwallet::Hyperwallet, iatapay, iatapay::Iatapay, inespay, inespay::Inespay, itaubank,+ itaubank::Itaubank, jpmorgan, jpmorgan::Jpmorgan, juspaythreedsserver,+ juspaythreedsserver::Juspaythreedsserver, katapult, katapult::Katapult, klarna, klarna::Klarna,+ mifinity, mifinity::Mifinity, mollie, mollie::Mollie, moneris, moneris::Moneris, mpgs,+ mpgs::Mpgs, 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, paysafe, paysafe::Paysafe, paystack,+ paystack::Paystack, paytm, paytm::Paytm, payu, payu::Payu, peachpayments,+ peachpayments::Peachpayments, phonepe, phonepe::Phonepe, 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, sift, sift::Sift, signifyd, signifyd::Signifyd, silverflow,+ silverflow::Silverflow, square, square::Square, stax, stax::Stax, stripe, stripe::Stripe,+ stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, threedsecureio,+ threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenex, tokenex::Tokenex, tokenio,+ tokenio::Tokenio, trustpay, trustpay::Trustpay, trustpayments, trustpayments::Trustpayments,+ tsys, tsys::Tsys, unified_authentication_service,unified_authentication_service::UnifiedAuthenticationService, vgs, vgs::Vgs, volt, volt::Volt,wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, wellsfargopayout::Wellsfargopayout, wise,wise::Wise, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, worldpayvantiv,diff --git a/crates/router/tests/connectors/gigadat.rs b/crates/router/tests/connectors/gigadat.rsnew file mode 100644index 0000000000..f77277ad24--- /dev/null+++ b/crates/router/tests/connectors/gigadat.rs@@ -0,0 +1,421 @@+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};+use masking::Secret;+use router::types::{self, api, storage::enums};+use test_utils::connector_auth;++use crate::utils::{self, ConnectorActions};++#[derive(Clone, Copy)]+struct GigadatTest;+impl ConnectorActions for GigadatTest {}+impl utils::Connector for GigadatTest {+ fn get_data(&self) -> api::ConnectorData {+ use router::connector::Gigadat;+ utils::construct_connector_data_old(+ Box::new(Gigadat::new()),+ types::Connector::Plaid,+ api::GetToken::Connector,+ None,+ )+ }++ fn get_auth_token(&self) -> types::ConnectorAuthType {+ utils::to_connector_auth_type(+ connector_auth::ConnectorAuthentication::new()+ .gigadat+ .expect("Missing connector authentication configuration")+ .into(),+ )+ }++ fn get_name(&self) -> String {+ "gigadat".to_string()+ }+}++static CONNECTOR: GigadatTest = GigadatTest {};++fn get_default_payment_info() -> Option<utils::PaymentInfo> {+ None+}++fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {+ 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: PaymentMethodData::Card(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: PaymentMethodData::Card(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: PaymentMethodData::Card(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 testsdiff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rsindex 4f405f56ee..fbabe1155f 100644--- a/crates/router/tests/connectors/main.rs+++ b/crates/router/tests/connectors/main.rs@@ -49,6 +49,7 @@ mod fiuu;mod flexiti;mod forte;mod getnet;+mod gigadat;mod globalpay;mod globepay;mod gocardless;diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rsindex 64fa913d51..d58a1d8388 100644--- a/crates/test_utils/src/connector_auth.rs+++ b/crates/test_utils/src/connector_auth.rs@@ -59,6 +59,7 @@ pub struct ConnectorAuthentication {pub flexiti: Option<HeaderKey>,pub forte: Option<MultiAuthKey>,pub getnet: Option<HeaderKey>,+ pub gigadat: Option<HeaderKey>,pub globalpay: Option<BodyKey>,pub globepay: Option<BodyKey>,pub gocardless: Option<HeaderKey>,diff --git a/loadtest/config/development.toml b/loadtest/config/development.tomlindex cd4fe3fc8c..e072a370b9 100644--- a/loadtest/config/development.toml+++ b/loadtest/config/development.toml@@ -126,6 +126,7 @@ fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/"fiuu.third_base_url = "https://api.merchant.razer.com/"forte.base_url = "https://sandbox.forte.net/api/v3"getnet.base_url = "https://api-test.getneteurope.com/engine/rest"+gigadat.base_url = "https://interac.express-connect.com/"globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"globepay.base_url = "https://pay.globepay.co/"gocardless.base_url = "https://api-sandbox.gocardless.com"diff --git a/scripts/add_connector.sh b/scripts/add_connector.shindex 9f6a3062c4..22573052f1 100755--- a/scripts/add_connector.sh+++ b/scripts/add_connector.sh@@ -6,7 +6,7 @@ function find_prev_connector() {git checkout $selfcp $self $self.tmp# Add new connector to existing list and sort it- connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluecode bluesnap boku braintree breadpay cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu flexiti forte getnet globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paysafe paystack paytm payu peachpayments phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar threedsecureio thunes tokenex tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1")+ connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluecode bluesnap boku braintree breadpay cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payload payme payone paypal paysafe paystack paytm payu peachpayments phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar threedsecureio thunes tokenex tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zsl "$1")IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS