mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(connector): generate connector template code for gpayments authenticaition connector (#4584)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -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",
|
||||
|
||||
@ -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/"
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
};
|
||||
|
||||
231
crates/router/src/connector/gpayments.rs
Normal file
231
crates/router/src/connector/gpayments.rs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
62
crates/router/src/connector/gpayments/transformers.rs
Normal file
62
crates/router/src/connector/gpayments/transformers.rs
Normal file
@ -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>,
|
||||
}
|
||||
@ -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(())
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
33
crates/router/tests/connectors/gpayments.rs
Normal file
33
crates/router/tests/connectors/gpayments.rs
Normal file
@ -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()
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,7 @@ mod forte;
|
||||
mod globalpay;
|
||||
mod globepay;
|
||||
mod gocardless;
|
||||
mod gpayments;
|
||||
mod helcim;
|
||||
mod iatapay;
|
||||
mod mifinity;
|
||||
|
||||
@ -226,3 +226,7 @@ api_key="API Key"
|
||||
|
||||
[mifinity]
|
||||
api_key="API Key"
|
||||
|
||||
|
||||
[gpayments]
|
||||
api_key="API Key"
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -5163,7 +5163,8 @@
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"threedsecureio",
|
||||
"netcetera"
|
||||
"netcetera",
|
||||
"gpayments"
|
||||
]
|
||||
},
|
||||
"AuthenticationStatus": {
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user