Skip to content

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

feat(connector): [Zift] Add Template Code (#10104)

awasthi21172d14ee6b32
diff --git a/config/config.example.toml b/config/config.example.toml
index 49906bc333..d727114c9a 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -330,6 +330,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
zsl.base_url = "https://api.sitoffalb.net/"
zen.base_url = "https://api.zen-test.com/"
zen.secondary_base_url = "https://secure.zen-test.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 3c08ccb1bd..eeb9a88620 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -165,6 +165,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
zen.base_url = "https://api.zen-test.com/"
zen.secondary_base_url = "https://secure.zen-test.com/"
zsl.base_url = "https://api.sitoffalb.net/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 41554d450a..57f7eff7a6 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -168,6 +168,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivcnp.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com" # pre-live environment
worldpayxml.base_url = "https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
zen.base_url = "https://api.zen.com/"
zen.secondary_base_url = "https://secure.zen.com/"
zsl.base_url = "https://apirh.prodoffalb.net/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index aa15321211..65f83a0559 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -168,6 +168,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
zen.base_url = "https://api.zen-test.com/"
zen.secondary_base_url = "https://secure.zen-test.com/"
zsl.base_url = "https://api.sitoffalb.net/"
diff --git a/config/development.toml b/config/development.toml
index 01ffdc380c..51ea4b2614 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -359,6 +359,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
tsys.base_url = "https://stagegw.transnox.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 57fa72da27..2a66fdef4e 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -256,6 +256,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
zen.base_url = "https://api.zen-test.com/"
zen.secondary_base_url = "https://secure.zen-test.com/"
zsl.base_url = "https://api.sitoffalb.net/"
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index e27d73101d..02ef0d388c 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -370,6 +370,7 @@ pub struct ConnectorConfig {
pub worldpayvantiv: Option<ConnectorTomlConfig>,
pub worldpayxml: Option<ConnectorTomlConfig>,
pub xendit: Option<ConnectorTomlConfig>,
+ pub zift: Option<ConnectorTomlConfig>,
pub square: Option<ConnectorTomlConfig>,
pub stax: Option<ConnectorTomlConfig>,
pub dummy_connector: Option<ConnectorTomlConfig>,
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 259c517ce2..cb10b6f278 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -7660,6 +7660,10 @@ required=true
type="MultiSelect"
options=["CRYPTOGRAM_3DS"]
+[zift]
+[zift.connector_auth.HeaderKey]
+api_key = "API Key"
+
[payjustnow]
[payjustnow.connector_auth.BodyKey]
api_key = "Signing Key"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 6be4b7b937..e59684032e 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -6396,6 +6396,10 @@ required=true
type="MultiSelect"
options=["CRYPTOGRAM_3DS"]
+[zift]
+[zift.connector_auth.HeaderKey]
+api_key = "API Key"
+
[payjustnow]
[payjustnow.connector_auth.BodyKey]
api_key = "Signing Key"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 7e00d2fd2b..15c3753aac 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -7633,6 +7633,10 @@ required=true
type="MultiSelect"
options=["CRYPTOGRAM_3DS"]
+[zift]
+[zift.connector_auth.HeaderKey]
+
+api_key = "API Key"
[payjustnow]
[payjustnow.connector_auth.BodyKey]
api_key = "Signing Key"
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index e4f03db86d..d22675ff5e 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -132,6 +132,7 @@ pub mod worldpayvantiv;
pub mod worldpayxml;
pub mod xendit;
pub mod zen;
+pub mod zift;
pub mod zsl;
#[cfg(feature = "dummy_connector")]
pub use self::dummyconnector::DummyConnector;
@@ -168,5 +169,5 @@ pub use self::{
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,
+ zen::Zen, zift::Zift, zsl::Zsl,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/zift.rs b/crates/hyperswitch_connectors/src/connectors/zift.rs
new file mode 100644
index 0000000000..020403e605
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/zift.rs
@@ -0,0 +1,624 @@
+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 zift;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Zift {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Zift {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Zift {}
+impl api::PaymentSession for Zift {}
+impl api::ConnectorAccessToken for Zift {}
+impl api::MandateSetup for Zift {}
+impl api::PaymentAuthorize for Zift {}
+impl api::PaymentSync for Zift {}
+impl api::PaymentCapture for Zift {}
+impl api::PaymentVoid for Zift {}
+impl api::Refund for Zift {}
+impl api::RefundExecute for Zift {}
+impl api::RefundSync for Zift {}
+impl api::PaymentToken for Zift {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Zift
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Zift
+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 Zift {
+ fn id(&self) -> &'static str {
+ "zift"
+ }
+
+ 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.zift.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = zift::ZiftAuthType::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: zift::ZiftErrorResponse = res
+ .response
+ .parse_struct("ZiftErrorResponse")
+ .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 Zift {
+ 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 Zift {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Zift {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Zift {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Zift {
+ 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 = zift::ZiftRouterData::from((amount, req));
+ let connector_req = zift::ZiftPaymentsRequest::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: zift::ZiftPaymentsResponse = res
+ .response
+ .parse_struct("Zift 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 Zift {
+ 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: zift::ZiftPaymentsResponse = res
+ .response
+ .parse_struct("zift 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 Zift {
+ 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: zift::ZiftPaymentsResponse = res
+ .response
+ .parse_struct("Zift 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 Zift {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Zift {
+ 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 = zift::ZiftRouterData::from((refund_amount, req));
+ let connector_req = zift::ZiftRefundRequest::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: zift::RefundResponse = res
+ .response
+ .parse_struct("zift 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 Zift {
+ 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: zift::RefundResponse =
+ res.response
+ .parse_struct("zift 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 Zift {
+ 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 ZIFT_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(SupportedPaymentMethods::new);
+
+static ZIFT_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Zift",
+ description: "Zift connector",
+ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
+ integration_status: enums::ConnectorIntegrationStatus::Alpha,
+};
+
+static ZIFT_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Zift {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&ZIFT_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*ZIFT_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&ZIFT_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/zift/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zift/transformers.rs
new file mode 100644
index 0000000000..e9dfcccc00
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/zift/transformers.rs
@@ -0,0 +1,217 @@
+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 ZiftRouterData<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 ZiftRouterData<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 ZiftPaymentsRequest {
+ amount: StringMinorUnit,
+ card: ZiftCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct ZiftCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&ZiftRouterData<&PaymentsAuthorizeRouterData>> for ZiftPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &ZiftRouterData<&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 ZiftAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for ZiftAuthType {
+ 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 ZiftPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<ZiftPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: ZiftPaymentStatus) -> Self {
+ match item {
+ ZiftPaymentStatus::Succeeded => Self::Charged,
+ ZiftPaymentStatus::Failed => Self::Failure,
+ ZiftPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct ZiftPaymentsResponse {
+ status: ZiftPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, ZiftPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, ZiftPaymentsResponse, 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 ZiftRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&ZiftRouterData<&RefundsRouterData<F>>> for ZiftRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &ZiftRouterData<&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 ZiftErrorResponse {
+ 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.rs
index 721cec368e..15dc43f756 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -303,6 +303,7 @@ default_imp_for_authorize_session_token!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -452,6 +453,7 @@ default_imp_for_calculate_tax!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -590,6 +592,7 @@ default_imp_for_session_update!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::Powertranz,
@@ -738,6 +741,7 @@ default_imp_for_post_session_tokens!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Threedsecureio,
@@ -885,6 +889,7 @@ default_imp_for_create_order!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Threedsecureio,
@@ -1033,6 +1038,7 @@ default_imp_for_update_metadata!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Riskified,
@@ -1181,6 +1187,7 @@ default_imp_for_cancel_post_capture!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Riskified,
@@ -1322,6 +1329,7 @@ default_imp_for_complete_authorize!(
connectors::Worldpayxml,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -1468,6 +1476,7 @@ default_imp_for_incremental_authorization!(
connectors::Worldpayxml,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -1602,6 +1611,7 @@ default_imp_for_extend_authorization!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Riskified,
@@ -1757,6 +1767,7 @@ default_imp_for_create_customer!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -1780,6 +1791,7 @@ macro_rules! default_imp_for_connector_redirect_response {
}
default_imp_for_connector_redirect_response!(
+ connectors::Zift,
connectors::Paysafe,
connectors::Trustpayments,
connectors::Vgs,
@@ -2038,6 +2050,7 @@ default_imp_for_pre_authenticate_steps!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2188,6 +2201,7 @@ default_imp_for_authenticate_steps!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2338,6 +2352,7 @@ default_imp_for_post_authenticate_steps!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2358,6 +2373,7 @@ macro_rules! default_imp_for_pre_processing_steps{
}
default_imp_for_pre_processing_steps!(
+ connectors::Zift,
connectors::Trustpayments,
connectors::Silverflow,
connectors::Vgs,
@@ -2622,6 +2638,7 @@ default_imp_for_post_processing_steps!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -2773,6 +2790,7 @@ default_imp_for_approve!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -2924,6 +2942,7 @@ default_imp_for_reject!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3074,6 +3093,7 @@ default_imp_for_webhook_source_verification!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3223,6 +3243,7 @@ default_imp_for_accept_dispute!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3370,6 +3391,7 @@ default_imp_for_submit_evidence!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3519,6 +3541,7 @@ default_imp_for_defend_dispute!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3669,6 +3692,7 @@ default_imp_for_fetch_disputes!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3819,6 +3843,7 @@ default_imp_for_dispute_sync!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -3975,6 +4000,7 @@ default_imp_for_file_upload!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4105,6 +4131,7 @@ default_imp_for_payouts!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4251,6 +4278,7 @@ default_imp_for_payouts_create!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4399,6 +4427,7 @@ default_imp_for_payouts_retrieve!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4548,6 +4577,7 @@ default_imp_for_payouts_eligibility!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4688,6 +4718,7 @@ default_imp_for_payouts_fulfill!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4836,6 +4867,7 @@ default_imp_for_payouts_cancel!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -4985,6 +5017,7 @@ default_imp_for_payouts_quote!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -5134,6 +5167,7 @@ default_imp_for_payouts_recipient!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -5285,6 +5319,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -5436,6 +5471,7 @@ default_imp_for_frm_sale!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -5587,6 +5623,7 @@ default_imp_for_frm_checkout!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -5738,6 +5775,7 @@ default_imp_for_frm_transaction!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -5889,6 +5927,7 @@ default_imp_for_frm_fulfillment!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -6040,6 +6079,7 @@ default_imp_for_frm_record_return!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -6185,6 +6225,7 @@ default_imp_for_revoking_mandates!(
connectors::Worldpayxml,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
@@ -6335,6 +6376,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -6483,6 +6525,7 @@ default_imp_for_uas_post_authentication!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -6632,6 +6675,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -6773,6 +6817,7 @@ default_imp_for_connector_request_id!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -6916,6 +6961,7 @@ default_imp_for_fraud_check!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -7088,6 +7134,7 @@ default_imp_for_connector_authentication!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -7235,6 +7282,7 @@ default_imp_for_uas_authentication!(
connectors::Worldpayxml,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -7378,6 +7426,7 @@ default_imp_for_revenue_recovery!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -7578,6 +7627,7 @@ default_imp_for_subscriptions!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -7729,6 +7779,7 @@ default_imp_for_billing_connector_payment_sync!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -7872,6 +7923,7 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8024,6 +8076,7 @@ default_imp_for_billing_connector_invoice_sync!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8166,6 +8219,7 @@ default_imp_for_external_vault!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8315,6 +8369,7 @@ default_imp_for_external_vault_insert!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8464,6 +8519,7 @@ default_imp_for_gift_card_balance_check!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8613,6 +8669,7 @@ default_imp_for_external_vault_retrieve!(
connectors::Wellsfargopayout,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8764,6 +8821,7 @@ default_imp_for_external_vault_delete!(
connectors::Vgs,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -8914,6 +8972,7 @@ default_imp_for_external_vault_create!(
connectors::Vgs,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -9063,6 +9122,7 @@ default_imp_for_connector_authentication_token!(
connectors::Vgs,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -9213,6 +9273,7 @@ default_imp_for_external_vault_proxy_payments_create!(
connectors::Vgs,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index ec97b1433f..90930c47d1 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -433,6 +433,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -584,6 +585,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -723,6 +725,7 @@ default_imp_for_new_connector_integration_connector_authentication_token!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -869,6 +872,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1020,6 +1024,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1172,6 +1177,7 @@ default_imp_for_new_connector_integration_fetch_disputes!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1324,6 +1330,7 @@ default_imp_for_new_connector_integration_dispute_sync!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1475,6 +1482,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1625,6 +1633,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1786,6 +1795,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -1939,6 +1949,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2092,6 +2103,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2245,6 +2257,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2398,6 +2411,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2551,6 +2565,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2704,6 +2719,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -2857,6 +2873,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3010,6 +3027,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3161,6 +3179,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3314,6 +3333,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3467,6 +3487,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3620,6 +3641,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3773,6 +3795,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -3926,6 +3949,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -4075,6 +4099,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -4192,6 +4217,7 @@ default_imp_for_new_connector_integration_frm!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -4340,6 +4366,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -4480,6 +4507,7 @@ default_imp_for_new_connector_integration_revenue_recovery!(
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -4659,6 +4687,7 @@ default_imp_for_new_connector_integration_external_vault!(
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl
);
@@ -4809,6 +4838,7 @@ default_imp_for_new_connector_integration_external_vault_proxy!(
connectors::Vgs,
connectors::Volt,
connectors::Xendit,
+ connectors::Zift,
connectors::Zen,
connectors::Zsl,
connectors::CtpMastercard
diff --git a/crates/hyperswitch_domain_models/src/connector_endpoints.rs b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
index cc49053cb6..a9e7bebe12 100644
--- a/crates/hyperswitch_domain_models/src/connector_endpoints.rs
+++ b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
@@ -147,6 +147,7 @@ pub struct Connectors {
pub worldpayvantiv: ConnectorParamsWithThreeUrls,
pub worldpayxml: ConnectorParams,
pub xendit: ConnectorParams,
+ pub zift: ConnectorParams,
pub zen: ConnectorParams,
pub zsl: ConnectorParams,
}
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index e80e7b5904..2efecb19de 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -49,5 +49,5 @@ pub use hyperswitch_connectors::connectors::{
wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, wellsfargopayout::Wellsfargopayout, wise,
wise::Wise, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, worldpayvantiv,
worldpayvantiv::Worldpayvantiv, worldpayxml, worldpayxml::Worldpayxml, xendit, xendit::Xendit,
- zen, zen::Zen, zsl, zsl::Zsl,
+ zen, zen::Zen, zift, zift::Zift, zsl, zsl::Zsl,
};
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 14c0a7e24a..6d37707e26 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -126,6 +126,7 @@ mod vgs;
mod volt;
mod wellsfargo;
mod worldpayvantiv;
+mod zift;
// mod wellsfargopayout;
#[cfg(feature = "payouts")]
mod wise;
diff --git a/crates/router/tests/connectors/zift.rs b/crates/router/tests/connectors/zift.rs
new file mode 100644
index 0000000000..c169aa9ad5
--- /dev/null
+++ b/crates/router/tests/connectors/zift.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 ZiftTest;
+impl ConnectorActions for ZiftTest {}
+impl utils::Connector for ZiftTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Zift;
+ utils::construct_connector_data_old(
+ Box::new(Zift::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .zift
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "zift".to_string()
+ }
+}
+
+static CONNECTOR: ZiftTest = ZiftTest {};
+
+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 tests
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 3ecedad33a..05ecaca882 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -142,6 +142,7 @@ pub struct ConnectorAuthentication {
pub worldpayvantiv: Option<HeaderKey>,
pub worldpayxml: Option<HeaderKey>,
pub xendit: Option<HeaderKey>,
+ pub zift: Option<HeaderKey>,
pub worldline: Option<SignatureKey>,
pub zen: Option<HeaderKey>,
pub zsl: Option<BodyKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index e8bfbdda15..5cc8b45242 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -222,6 +222,7 @@ worldpayvantiv.secondary_base_url = "https://onlinessr.vantivprelive.com"
worldpayvantiv.third_base_url = "https://services.vantivprelive.com"
worldpayxml.base_url = "https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"
xendit.base_url = "https://api.xendit.co"
+zift.base_url = "https://sandbox-secure.zift.io/gates/xurl?"
wise.base_url = "https://api.sandbox.transferwise.tech/"
zen.base_url = "https://api.zen-test.com/"
zen.secondary_base_url = "https://secure.zen-test.com/"
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 00b60bb054..557c9e8fc7 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 affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluesnap boku braintree breadpay calida cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay finix fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna loonio mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payjustnow 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 tesouro 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 bluesnap boku braintree breadpay calida cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon facilitapay finix fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna loonio mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payjustnow 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 tesouro threedsecureio thunes tokenex tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpayvantiv worldpayxml xendit zift zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS