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): generate connector template code for gpayments authenticaition connector (#4584)

Hrithikesh2a302eb5973c
diff --git a/config/config.example.toml b/config/config.example.toml
index 52fefc4988..6835cfdb4a 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -191,6 +191,7 @@ forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
+gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
@@ -275,6 +276,7 @@ cards = [
"globalpay",
"globepay",
"gocardless",
+ "gpayments",
"helcim",
"mollie",
"paypal",
diff --git a/config/development.toml b/config/development.toml
index 563565782d..80f4d2b8ea 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -115,6 +115,7 @@ cards = [
"globalpay",
"globepay",
"gocardless",
+ "gpayments",
"helcim",
"iatapay",
"mollie",
@@ -192,6 +193,7 @@ forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
+gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 9c83373c60..b9b25e4666 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -128,6 +128,7 @@ forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
+gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
@@ -204,6 +205,7 @@ cards = [
"globalpay",
"globepay",
"gocardless",
+ "gpayments",
"helcim",
"iatapay",
"mollie",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 35d76e9775..884e0fd82f 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -95,6 +95,7 @@ pub enum Connector {
Globalpay,
Globepay,
Gocardless,
+ // Gpayments, Added as template code for future usage
Helcim,
Iatapay,
Klarna,
@@ -209,6 +210,7 @@ impl Connector {
| Self::Globalpay
| Self::Globepay
| Self::Gocardless
+ // | Self::Gpayments Added as template code for future usage
| Self::Helcim
| Self::Iatapay
| Self::Klarna
@@ -268,6 +270,7 @@ impl Connector {
pub enum AuthenticationConnectors {
Threedsecureio,
Netcetera,
+ Gpayments,
}
#[cfg(feature = "payouts")]
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 691d52b4fb..e1d55e3938 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -145,6 +145,7 @@ pub struct ConnectorConfig {
pub globalpay: Option<ConnectorTomlConfig>,
pub globepay: Option<ConnectorTomlConfig>,
pub gocardless: Option<ConnectorTomlConfig>,
+ pub gpayments: Option<ConnectorTomlConfig>,
pub helcim: Option<ConnectorTomlConfig>,
pub klarna: Option<ConnectorTomlConfig>,
pub mollie: Option<ConnectorTomlConfig>,
@@ -236,6 +237,7 @@ impl ConnectorConfig {
match connector {
AuthenticationConnectors::Threedsecureio => Ok(connector_data.threedsecureio),
AuthenticationConnectors::Netcetera => Ok(connector_data.netcetera),
+ AuthenticationConnectors::Gpayments => Ok(connector_data.gpayments),
}
}
@@ -269,6 +271,7 @@ impl ConnectorConfig {
Connector::Globalpay => Ok(connector_data.globalpay),
Connector::Globepay => Ok(connector_data.globepay),
Connector::Gocardless => Ok(connector_data.gocardless),
+ // Connector::Gpayments => Ok(connector_data.gpayments), Added as template code for future usage
Connector::Helcim => Ok(connector_data.helcim),
Connector::Klarna => Ok(connector_data.klarna),
Connector::Mollie => Ok(connector_data.mollie),
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 9fa126816c..2dfae47bff 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -518,6 +518,7 @@ pub struct Connectors {
pub globalpay: ConnectorParams,
pub globepay: ConnectorParams,
pub gocardless: ConnectorParams,
+ pub gpayments: ConnectorParams,
pub helcim: ConnectorParams,
pub iatapay: ConnectorParams,
pub klarna: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 700ff4556b..c3fb730b12 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -23,6 +23,7 @@ pub mod forte;
pub mod globalpay;
pub mod globepay;
pub mod gocardless;
+pub mod gpayments;
pub mod helcim;
pub mod iatapay;
pub mod klarna;
@@ -70,12 +71,13 @@ pub use self::{
bluesnap::Bluesnap, boku::Boku, braintree::Braintree, cashtocode::Cashtocode,
checkout::Checkout, coinbase::Coinbase, cryptopay::Cryptopay, cybersource::Cybersource,
dlocal::Dlocal, ebanx::Ebanx, fiserv::Fiserv, forte::Forte, globalpay::Globalpay,
- globepay::Globepay, gocardless::Gocardless, helcim::Helcim, iatapay::Iatapay, klarna::Klarna,
- mifinity::Mifinity, mollie::Mollie, multisafepay::Multisafepay, netcetera::Netcetera,
- nexinets::Nexinets, nmi::Nmi, noon::Noon, nuvei::Nuvei, opayo::Opayo, opennode::Opennode,
- payeezy::Payeezy, payme::Payme, payone::Payone, paypal::Paypal, payu::Payu,
- placetopay::Placetopay, powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd,
- riskified::Riskified, shift4::Shift4, signifyd::Signifyd, square::Square, stax::Stax,
- stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay, tsys::Tsys, volt::Volt,
- wise::Wise, worldline::Worldline, worldpay::Worldpay, zen::Zen, zsl::Zsl,
+ globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments, helcim::Helcim,
+ iatapay::Iatapay, klarna::Klarna, mifinity::Mifinity, mollie::Mollie,
+ multisafepay::Multisafepay, netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon,
+ nuvei::Nuvei, opayo::Opayo, opennode::Opennode, payeezy::Payeezy, payme::Payme, payone::Payone,
+ paypal::Paypal, payu::Payu, placetopay::Placetopay, powertranz::Powertranz,
+ prophetpay::Prophetpay, rapyd::Rapyd, riskified::Riskified, shift4::Shift4, signifyd::Signifyd,
+ square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay,
+ tsys::Tsys, volt::Volt, wise::Wise, worldline::Worldline, worldpay::Worldpay, zen::Zen,
+ zsl::Zsl,
};
diff --git a/crates/router/src/connector/gpayments.rs b/crates/router/src/connector/gpayments.rs
new file mode 100644
index 0000000000..9608f44b9d
--- /dev/null
+++ b/crates/router/src/connector/gpayments.rs
@@ -0,0 +1,231 @@
+pub mod transformers;
+
+use std::fmt::Debug;
+
+use error_stack::{report, ResultExt};
+use masking::ExposeInterface;
+use transformers as gpayments;
+
+use crate::{
+ configs::settings,
+ core::errors::{self, CustomResult},
+ events::connector_api_logs::ConnectorEvent,
+ headers,
+ services::{
+ request::{self, Mask},
+ ConnectorIntegration, ConnectorValidation,
+ },
+ types::{
+ self,
+ api::{self, ConnectorCommon, ConnectorCommonExt},
+ ErrorResponse, Response,
+ },
+ utils::BytesExt,
+};
+
+#[derive(Debug, Clone)]
+pub struct Gpayments;
+
+impl api::Payment for Gpayments {}
+impl api::PaymentSession for Gpayments {}
+impl api::ConnectorAccessToken for Gpayments {}
+impl api::MandateSetup for Gpayments {}
+impl api::PaymentAuthorize for Gpayments {}
+impl api::PaymentSync for Gpayments {}
+impl api::PaymentCapture for Gpayments {}
+impl api::PaymentVoid for Gpayments {}
+impl api::Refund for Gpayments {}
+impl api::RefundExecute for Gpayments {}
+impl api::RefundSync for Gpayments {}
+impl api::PaymentToken for Gpayments {}
+
+impl
+ ConnectorIntegration<
+ api::PaymentMethodToken,
+ types::PaymentMethodTokenizationData,
+ types::PaymentsResponseData,
+ > for Gpayments
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Gpayments
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &types::RouterData<Flow, Request, Response>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::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 Gpayments {
+ fn id(&self) -> &'static str {
+ "gpayments"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ // 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 settings::Connectors) -> &'a str {
+ connectors.gpayments.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &types::ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ let auth = gpayments::GpaymentsAuthType::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: gpayments::GpaymentsErrorResponse = res
+ .response
+ .parse_struct("GpaymentsErrorResponse")
+ .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,
+ })
+ }
+}
+
+impl ConnectorValidation for Gpayments {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
+ for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for Gpayments
+{
+}
+
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
+ for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
+ for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
+ for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
+ for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData>
+ for Gpayments
+{
+}
+
+impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData>
+ for Gpayments
+{
+}
+
+#[async_trait::async_trait]
+impl api::IncomingWebhook for Gpayments {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+impl api::ExternalAuthentication for Gpayments {}
+impl api::ConnectorAuthentication for Gpayments {}
+impl api::ConnectorPreAuthentication for Gpayments {}
+impl api::ConnectorPostAuthentication for Gpayments {}
+impl
+ ConnectorIntegration<
+ api::Authentication,
+ types::authentication::ConnectorAuthenticationRequestData,
+ types::authentication::AuthenticationResponseData,
+ > for Gpayments
+{
+}
+impl
+ ConnectorIntegration<
+ api::PreAuthentication,
+ types::authentication::PreAuthNRequestData,
+ types::authentication::AuthenticationResponseData,
+ > for Gpayments
+{
+}
+impl
+ ConnectorIntegration<
+ api::PostAuthentication,
+ types::authentication::ConnectorPostAuthenticationRequestData,
+ types::authentication::AuthenticationResponseData,
+ > for Gpayments
+{
+}
diff --git a/crates/router/src/connector/gpayments/transformers.rs b/crates/router/src/connector/gpayments/transformers.rs
new file mode 100644
index 0000000000..3ace928e23
--- /dev/null
+++ b/crates/router/src/connector/gpayments/transformers.rs
@@ -0,0 +1,62 @@
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{core::errors, types};
+
+//TODO: Fill the struct with respective fields
+pub struct GpaymentsRouterData<T> {
+ pub amount: i64, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T>
+ TryFrom<(
+ &types::api::CurrencyUnit,
+ types::storage::enums::Currency,
+ i64,
+ T,
+ )> for GpaymentsRouterData<T>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (_currency_unit, _currency, amount, item): (
+ &types::api::CurrencyUnit,
+ types::storage::enums::Currency,
+ i64,
+ T,
+ ),
+ ) -> Result<Self, Self::Error> {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Ok(Self {
+ amount,
+ router_data: item,
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct GpaymentsAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&types::ConnectorAuthType> for GpaymentsAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct GpaymentsErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 84aa095e29..422b88ee9e 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1904,6 +1904,10 @@ pub(crate) fn validate_auth_and_metadata_type(
gocardless::transformers::GocardlessAuthType::try_from(val)?;
Ok(())
}
+ // api_enums::Connector::Gpayments => {
+ // gpayments::transformers::GpaymentsAuthType::try_from(val)?;
+ // Ok(())
+ // } Added as template code for future usage
api_enums::Connector::Helcim => {
helcim::transformers::HelcimAuthType::try_from(val)?;
Ok(())
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index de7b6694dd..e1bd785830 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -157,6 +157,7 @@ default_imp_for_complete_authorize!(
connector::Forte,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -237,6 +238,7 @@ default_imp_for_webhook_source_verification!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -325,6 +327,7 @@ default_imp_for_create_customer!(
connector::Forte,
connector::Globalpay,
connector::Globepay,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -408,6 +411,7 @@ default_imp_for_connector_redirect_response!(
connector::Forte,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -474,6 +478,7 @@ default_imp_for_connector_request_id!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Iatapay,
connector::Klarna,
connector::Mifinity,
@@ -563,6 +568,7 @@ default_imp_for_accept_dispute!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -674,6 +680,7 @@ default_imp_for_file_upload!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -762,6 +769,7 @@ default_imp_for_submit_evidence!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -850,6 +858,7 @@ default_imp_for_defend_dispute!(
connector::Forte,
connector::Globalpay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -937,6 +946,7 @@ default_imp_for_pre_processing_steps!(
connector::Forte,
connector::Globalpay,
connector::Globepay,
+ connector::Gpayments,
connector::Helcim,
connector::Klarna,
connector::Mifinity,
@@ -1002,6 +1012,7 @@ default_imp_for_payouts!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1088,6 +1099,7 @@ default_imp_for_payouts_create!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1177,6 +1189,7 @@ default_imp_for_payouts_eligibility!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1264,6 +1277,7 @@ default_imp_for_payouts_fulfill!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1350,6 +1364,7 @@ default_imp_for_payouts_cancel!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1438,6 +1453,7 @@ default_imp_for_payouts_quote!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1527,6 +1543,7 @@ default_imp_for_payouts_recipient!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1619,6 +1636,7 @@ default_imp_for_payouts_recipient_account!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1708,6 +1726,7 @@ default_imp_for_approve!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1798,6 +1817,7 @@ default_imp_for_reject!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1872,6 +1892,7 @@ default_imp_for_fraud_check!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -1962,6 +1983,7 @@ default_imp_for_frm_sale!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -2052,6 +2074,7 @@ default_imp_for_frm_checkout!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -2142,6 +2165,7 @@ default_imp_for_frm_transaction!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -2232,6 +2256,7 @@ default_imp_for_frm_fulfillment!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -2322,6 +2347,7 @@ default_imp_for_frm_record_return!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -2409,6 +2435,7 @@ default_imp_for_incremental_authorization!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
@@ -2496,6 +2523,7 @@ default_imp_for_revoking_mandates!(
connector::Globalpay,
connector::Globepay,
connector::Gocardless,
+ connector::Gpayments,
connector::Helcim,
connector::Iatapay,
connector::Klarna,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index a4ef6ddca3..2013f48275 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -383,7 +383,6 @@ impl ConnectorData {
enums::Connector::Worldline => Ok(Box::new(&connector::Worldline)),
enums::Connector::Worldpay => Ok(Box::new(&connector::Worldpay)),
enums::Connector::Multisafepay => Ok(Box::new(&connector::Multisafepay)),
- enums::Connector::Netcetera => Ok(Box::new(&connector::Netcetera)),
enums::Connector::Nexinets => Ok(Box::new(&connector::Nexinets)),
enums::Connector::Paypal => Ok(Box::new(&connector::Paypal)),
enums::Connector::Trustpay => Ok(Box::new(&connector::Trustpay)),
@@ -394,7 +393,9 @@ impl ConnectorData {
enums::Connector::Signifyd
| enums::Connector::Plaid
| enums::Connector::Riskified
- | enums::Connector::Threedsecureio => {
+ | enums::Connector::Threedsecureio
+ // | enums::Connector::Gpayments Added as template code for future usage
+ | enums::Connector::Netcetera => {
Err(report!(errors::ConnectorError::InvalidConnectorName)
.attach_printable(format!("invalid connector name: {connector_name}")))
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/types/api/authentication.rs b/crates/router/src/types/api/authentication.rs
index 3e4a494f65..5b8e3238fb 100644
--- a/crates/router/src/types/api/authentication.rs
+++ b/crates/router/src/types/api/authentication.rs
@@ -137,6 +137,7 @@ impl AuthenticationConnectorData {
Ok(Box::new(&connector::Threedsecureio))
}
enums::AuthenticationConnectors::Netcetera => Ok(Box::new(&connector::Netcetera)),
+ enums::AuthenticationConnectors::Gpayments => Ok(Box::new(&connector::Gpayments)),
}
}
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 00ec4df677..423a1ee90a 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -228,6 +228,11 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Globalpay => Self::Globalpay,
api_enums::Connector::Globepay => Self::Globepay,
api_enums::Connector::Gocardless => Self::Gocardless,
+ // api_enums::Connector::Gpayments => {
+ // Err(common_utils::errors::ValidationError::InvalidValue {
+ // message: "gpayments is not a routable connector".to_string(),
+ // })?
+ // }Added as template code for future usage
api_enums::Connector::Helcim => Self::Helcim,
api_enums::Connector::Iatapay => Self::Iatapay,
api_enums::Connector::Klarna => Self::Klarna,
diff --git a/crates/router/tests/connectors/gpayments.rs b/crates/router/tests/connectors/gpayments.rs
new file mode 100644
index 0000000000..8e133b3ede
--- /dev/null
+++ b/crates/router/tests/connectors/gpayments.rs
@@ -0,0 +1,33 @@
+use router::types;
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct GpaymentsTest;
+impl ConnectorActions for GpaymentsTest {}
+impl utils::Connector for GpaymentsTest {
+ fn get_data(&self) -> types::api::ConnectorData {
+ use router::connector::Gpayments;
+ types::api::ConnectorData {
+ connector: Box::new(&Gpayments),
+ connector_name: types::Connector::Threedsecureio,
+ // Added as Dummy connector as template code is added for future usage
+ get_token: types::api::GetToken::Connector,
+ merchant_connector_id: None,
+ }
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .gpayments
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "gpayments".to_string()
+ }
+}
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index d0d737d1b9..a84f3f76c7 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -32,6 +32,7 @@ mod forte;
mod globalpay;
mod globepay;
mod gocardless;
+mod gpayments;
mod helcim;
mod iatapay;
mod mifinity;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index dc2c52e37a..fdb4c20863 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -226,3 +226,7 @@ api_key="API Key"
[mifinity]
api_key="API Key"
+
+
+[gpayments]
+api_key="API Key"
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 5e725bd40d..7f536916d3 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -36,6 +36,7 @@ pub struct ConnectorAuthentication {
pub globalpay: Option<BodyKey>,
pub globepay: Option<BodyKey>,
pub gocardless: Option<HeaderKey>,
+ pub gpayments: Option<HeaderKey>,
pub helcim: Option<HeaderKey>,
pub iatapay: Option<SignatureKey>,
pub mifinity: Option<HeaderKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 21fd24e3ea..a104f5760b 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -95,6 +95,7 @@ forte.base_url = "https://sandbox.forte.net/api/v3"
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
globepay.base_url = "https://pay.globepay.co/"
gocardless.base_url = "https://api-sandbox.gocardless.com"
+gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
klarna.base_url = "https://api-na.playground.klarna.com/"
@@ -170,6 +171,7 @@ cards = [
"globalpay",
"globepay",
"gocardless",
+ "gpayments",
"helcim",
"iatapay",
"mollie",
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index baa200be20..259d166952 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -5163,7 +5163,8 @@
"type": "string",
"enum": [
"threedsecureio",
- "netcetera"
+ "netcetera",
+ "gpayments"
]
},
"AuthenticationStatus": {
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 780ef21988..dcd9c29fb6 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 airwallex applepay authorizedotnet bambora bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless helcim iatapay klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode payeezy payme payone paypal payu placetopay powertranz prophetpay rapyd shift4 square stax stripe threedsecureio trustpay tsys volt wise worldline worldpay zsl "$1")
+ connectors=(aci adyen airwallex applepay authorizedotnet bambora bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless gpayments helcim iatapay klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode payeezy payme payone paypal payu placetopay powertranz prophetpay rapyd shift4 square stax stripe threedsecureio trustpay tsys volt wise worldline worldpay zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res=`echo ${sorted[@]}`
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp