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(core): Add visa click to pay support (#7562)

Sahkal Poddar9e5e6be73076
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index beb1ee1dad..cec287a52c 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -4562,7 +4562,8 @@
"gpayments",
"ctp_mastercard",
"unified_authentication_service",
- "juspaythreedsserver"
+ "juspaythreedsserver",
+ "ctp_visa"
]
},
"AuthenticationDetails": {
@@ -7755,6 +7756,7 @@
"coingate",
"cryptopay",
"ctp_mastercard",
+ "ctp_visa",
"cybersource",
"datatrans",
"deutschebank",
@@ -8448,6 +8450,9 @@
},
"CtpServiceDetails": {
"type": "object",
+ "required": [
+ "provider"
+ ],
"properties": {
"merchant_transaction_id": {
"type": "string",
@@ -8465,12 +8470,22 @@
"nullable": true
},
"provider": {
+ "$ref": "#/components/schemas/CtpServiceProvider"
+ },
+ "encypted_payload": {
"type": "string",
- "description": "provider Eg: Visa, Mastercard",
+ "description": "Encrypted payload",
"nullable": true
}
}
},
+ "CtpServiceProvider": {
+ "type": "string",
+ "enum": [
+ "visa",
+ "mastercard"
+ ]
+ },
"Currency": {
"type": "string",
"description": "The three letter ISO currency code in uppercase. Eg: 'USD' for the United States Dollar.",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index da14c85cf6..ab04cfc490 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -6694,7 +6694,8 @@
"gpayments",
"ctp_mastercard",
"unified_authentication_service",
- "juspaythreedsserver"
+ "juspaythreedsserver",
+ "ctp_visa"
]
},
"AuthenticationStatus": {
@@ -9827,6 +9828,7 @@
"coingate",
"cryptopay",
"ctp_mastercard",
+ "ctp_visa",
"cybersource",
"datatrans",
"deutschebank",
@@ -10549,6 +10551,9 @@
},
"CtpServiceDetails": {
"type": "object",
+ "required": [
+ "provider"
+ ],
"properties": {
"merchant_transaction_id": {
"type": "string",
@@ -10566,12 +10571,22 @@
"nullable": true
},
"provider": {
+ "$ref": "#/components/schemas/CtpServiceProvider"
+ },
+ "encypted_payload": {
"type": "string",
- "description": "provider Eg: Visa, Mastercard",
+ "description": "Encrypted payload",
"nullable": true
}
}
},
+ "CtpServiceProvider": {
+ "type": "string",
+ "enum": [
+ "visa",
+ "mastercard"
+ ]
+ },
"Currency": {
"type": "string",
"description": "The three letter ISO currency code in uppercase. Eg: 'USD' for the United States Dollar.",
diff --git a/config/development.toml b/config/development.toml
index b53d763b34..cae8a54940 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -356,7 +356,7 @@ worldpay.base_url = "https://try.access.worldpay.com/"
xendit.base_url = "https://api.xendit.co"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
-unified_authentication_service.base_url = "http://localhost:8000"
+unified_authentication_service.base_url = "http://localhost:8080/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 0969ac8709..f7e180e253 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -248,6 +248,7 @@ cards = [
"coinbase",
"coingate",
"cryptopay",
+ "ctp_visa",
"cybersource",
"datatrans",
"deutschebank",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 1d2ccafffb..dd3c2aa124 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1162,7 +1162,17 @@ pub struct CtpServiceDetails {
/// session transaction flow id
pub x_src_flow_id: Option<String>,
/// provider Eg: Visa, Mastercard
- pub provider: Option<String>,
+ #[schema(value_type = CtpServiceProvider)]
+ pub provider: api_enums::CtpServiceProvider,
+ /// Encrypted payload
+ #[schema(value_type = Option<String>)]
+ pub encypted_payload: Option<Secret<String>>,
+}
+
+impl CtpServiceDetails {
+ pub fn is_network_confirmation_call_required(&self) -> bool {
+ self.provider == api_enums::CtpServiceProvider::Mastercard
+ }
}
#[cfg(feature = "v1")]
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index f53f6d1c49..a99bf83bc4 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -217,6 +217,7 @@ pub enum Connector {
Coingate,
Cryptopay,
CtpMastercard,
+ CtpVisa,
Cybersource,
Datatrans,
Deutschebank,
@@ -451,6 +452,7 @@ impl Connector {
| Self::Threedsecureio
| Self::Netcetera
| Self::CtpMastercard
+ | Self::CtpVisa
| Self::Noon
| Self::Stripe
| Self::Datatrans => false,
@@ -707,7 +709,8 @@ impl TryFrom<Connector> for RoutableConnectors {
| Connector::Juspaythreedsserver
| Connector::Netcetera
| Connector::Taxjar
- | Connector::Threedsecureio => Err("Invalid conversion. Not a routable connector"),
+ | Connector::Threedsecureio
+ | Connector::CtpVisa => Err("Invalid conversion. Not a routable connector"),
}
}
}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 2860e06d59..1b29d0e00c 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1933,6 +1933,26 @@ pub enum ScaExemptionType {
TransactionRiskAnalysis,
}
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum CtpServiceProvider {
+ Visa,
+ Mastercard,
+}
+
#[derive(
Clone,
Copy,
@@ -6685,6 +6705,7 @@ pub enum AuthenticationConnectors {
CtpMastercard,
UnifiedAuthenticationService,
Juspaythreedsserver,
+ CtpVisa,
}
impl AuthenticationConnectors {
@@ -6694,7 +6715,8 @@ impl AuthenticationConnectors {
| Self::Netcetera
| Self::CtpMastercard
| Self::UnifiedAuthenticationService
- | Self::Juspaythreedsserver => false,
+ | Self::Juspaythreedsserver
+ | Self::CtpVisa => false,
Self::Gpayments => true,
}
}
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 2e6e6bf91f..0745758aaf 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -178,6 +178,7 @@ pub struct ConnectorConfig {
pub coinbase: Option<ConnectorTomlConfig>,
pub coingate: Option<ConnectorTomlConfig>,
pub cryptopay: Option<ConnectorTomlConfig>,
+ pub ctp_visa: Option<ConnectorTomlConfig>,
pub cybersource: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub cybersource_payout: Option<ConnectorTomlConfig>,
@@ -307,6 +308,7 @@ impl ConnectorConfig {
AuthenticationConnectors::Netcetera => Ok(connector_data.netcetera),
AuthenticationConnectors::Gpayments => Ok(connector_data.gpayments),
AuthenticationConnectors::CtpMastercard => Ok(connector_data.ctp_mastercard),
+ AuthenticationConnectors::CtpVisa => Ok(connector_data.ctp_visa),
AuthenticationConnectors::UnifiedAuthenticationService => {
Ok(connector_data.unified_authentication_service)
}
@@ -355,6 +357,7 @@ impl ConnectorConfig {
Connector::Coinbase => Ok(connector_data.coinbase),
Connector::Coingate => Ok(connector_data.coingate),
Connector::Cryptopay => Ok(connector_data.cryptopay),
+ Connector::CtpVisa => Ok(connector_data.ctp_visa),
Connector::Cybersource => Ok(connector_data.cybersource),
Connector::Iatapay => Ok(connector_data.iatapay),
Connector::Itaubank => Ok(connector_data.itaubank),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index cf066ea244..435b72d269 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -4896,6 +4896,9 @@ api_key="API Key"
api_key="API Login ID"
key1="API password"
+[ctp_visa]
+[ctp_visa.connector_auth.NoKey]
+
[redsys]
[[redsys.credit]]
payment_method_type = "Mastercard"
@@ -4924,4 +4927,4 @@ key1="API password"
[redsys.connector_auth.SignatureKey]
api_key="Merchant ID"
key1="Terminal ID"
-api_secret="Secret Key"
\ No newline at end of file
+api_secret="Secret Key"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 056b14fc82..e7d23c169a 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -3805,6 +3805,9 @@ type="Text"
api_key="API Login ID"
key1="API password"
+[ctp_visa]
+[ctp_visa.connector_auth.NoKey]
+
[redsys]
[[redsys.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 316d13f877..d47e4dd8cf 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -4836,6 +4836,9 @@ api_key="API Key"
api_key="API Login ID"
key1="API password"
+[ctp_visa]
+[ctp_visa.connector_auth.NoKey]
+
[redsys]
[[redsys.credit]]
payment_method_type = "Mastercard"
@@ -4864,4 +4867,4 @@ payment_method_type = "UnionPay"
[redsys.connector_auth.SignatureKey]
api_key = "Merchant ID"
key1 = "Terminal ID"
-api_secret = "Secret Key"
\ No newline at end of file
+api_secret = "Secret Key"
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
index 61e2920397..620b88b8c0 100644
--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
@@ -332,10 +332,11 @@ impl
unified_authentication_service::UnifiedAuthenticationServiceRouterData::from((
amount, req,
));
- let connector_req =
- unified_authentication_service::UnifiedAuthenticationServicePreAuthenticateRequest::try_from(
- &connector_router_data,
- )?;
+
+ let connector_req = unified_authentication_service::UnifiedAuthenticationServicePreAuthenticateRequest::try_from(
+ &connector_router_data,
+ )?;
+
Ok(RequestContent::Json(Box::new(connector_req)))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
index c5d0968fd5..0b50559a4e 100644
--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
@@ -3,8 +3,8 @@ use common_utils::types::FloatMajorUnit;
use hyperswitch_domain_models::{
router_data::{ConnectorAuthType, RouterData},
router_request_types::unified_authentication_service::{
- DynamicData, PostAuthenticationDetails, PreAuthenticationDetails, TokenDetails,
- UasAuthenticationResponseData,
+ AuthenticationInfo, DynamicData, PostAuthenticationDetails, PreAuthenticationDetails,
+ TokenDetails, UasAuthenticationResponseData,
},
types::{
UasAuthenticationConfirmationRouterData, UasPostAuthenticationRouterData,
@@ -17,9 +17,6 @@ use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use crate::types::ResponseRouterData;
-
-const CTP_MASTERCARD: &str = "ctp_mastercard";
-
//TODO: Fill the struct with respective fields
pub struct UnifiedAuthenticationServiceRouterData<T> {
pub amount: FloatMajorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
@@ -36,7 +33,7 @@ impl<T> From<(FloatMajorUnit, T)> for UnifiedAuthenticationServiceRouterData<T>
}
}
-#[derive(Debug, Serialize, PartialEq)]
+#[derive(Debug, Serialize)]
pub struct UnifiedAuthenticationServicePreAuthenticateRequest {
pub authenticate_by: String,
pub session_id: String,
@@ -45,15 +42,15 @@ pub struct UnifiedAuthenticationServicePreAuthenticateRequest {
pub service_details: Option<CtpServiceDetails>,
pub customer_details: Option<CustomerDetails>,
pub pmt_details: Option<PaymentDetails>,
- pub auth_creds: AuthType,
+ pub auth_creds: ConnectorAuthType,
pub transaction_details: Option<TransactionDetails>,
}
-#[derive(Debug, Serialize, PartialEq)]
+#[derive(Debug, Serialize)]
pub struct UnifiedAuthenticationServiceAuthenticateConfirmationRequest {
pub authenticate_by: String,
pub source_authentication_id: String,
- pub auth_creds: AuthType,
+ pub auth_creds: ConnectorAuthType,
pub x_src_flow_id: Option<String>,
pub transaction_amount: Option<FloatMajorUnit>,
pub transaction_currency: Option<enums::Currency>,
@@ -99,12 +96,6 @@ impl<F, T>
}
}
-#[derive(Debug, Serialize, PartialEq)]
-#[serde(tag = "auth_type")]
-pub enum AuthType {
- HeaderKey { api_key: Secret<String> },
-}
-
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct PaymentDetails {
pub pan: cards::CardNumber,
@@ -158,16 +149,6 @@ pub struct BrowserInfo {
pub challenge_window_size: String,
}
-#[derive(Default, Debug, Serialize, PartialEq)]
-pub struct AuthenticationInfo {
- pub authentication_type: Option<String>,
- pub authentication_reasons: Option<Vec<String>>,
- pub consent_received: bool,
- pub is_authenticated: bool,
- pub locale: Option<String>,
- pub supported_card_brands: Option<String>,
-}
-
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct CtpServiceDetails {
pub service_session_ids: Option<ServiceSessionIds>,
@@ -241,18 +222,17 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasPreAuthenticationRouter
fn try_from(
item: &UnifiedAuthenticationServiceRouterData<&UasPreAuthenticationRouterData>,
) -> Result<Self, Self::Error> {
- let auth_type =
- UnifiedAuthenticationServiceAuthType::try_from(&item.router_data.connector_auth_type)?;
let authentication_id = item.router_data.authentication_id.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "authentication_id",
},
)?;
+ let authentication_info = item.router_data.request.authentication_info.clone();
Ok(Self {
authenticate_by: item.router_data.connector.clone(),
session_id: authentication_id.clone(),
source_authentication_id: authentication_id,
- authentication_info: None,
+ authentication_info,
service_details: Some(CtpServiceDetails {
service_session_ids: item.router_data.request.service_details.clone().map(
|service_details| ServiceSessionIds {
@@ -279,9 +259,7 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasPreAuthenticationRouter
}),
customer_details: None,
pmt_details: None,
- auth_creds: AuthType::HeaderKey {
- api_key: auth_type.api_key,
- },
+ auth_creds: item.router_data.connector_auth_type.clone(),
transaction_details: Some(TransactionDetails {
amount: item.amount,
currency: item
@@ -308,24 +286,6 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasPreAuthenticationRouter
}
}
-//TODO: Fill the struct with respective fields
-// Auth Struct
-pub struct UnifiedAuthenticationServiceAuthType {
- pub(super) api_key: Secret<String>,
-}
-
-impl TryFrom<&ConnectorAuthType> for UnifiedAuthenticationServiceAuthType {
- 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()),
- }
- }
-}
-
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum UnifiedAuthenticationServicePreAuthenticateStatus {
@@ -375,11 +335,11 @@ impl<F, T>
}
}
-#[derive(Debug, Serialize, PartialEq)]
+#[derive(Debug, Serialize)]
pub struct UnifiedAuthenticationServicePostAuthenticateRequest {
pub authenticate_by: String,
pub source_authentication_id: String,
- pub auth_creds: AuthType,
+ pub auth_creds: ConnectorAuthType,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -414,17 +374,14 @@ impl TryFrom<&UasPostAuthenticationRouterData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &UasPostAuthenticationRouterData) -> Result<Self, Self::Error> {
- let auth_type = UnifiedAuthenticationServiceAuthType::try_from(&item.connector_auth_type)?;
Ok(Self {
- authenticate_by: CTP_MASTERCARD.to_owned(),
+ authenticate_by: item.connector.clone(),
source_authentication_id: item.authentication_id.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "authentication_id",
},
)?,
- auth_creds: AuthType::HeaderKey {
- api_key: auth_type.api_key,
- },
+ auth_creds: item.connector_auth_type.clone(),
})
}
}
@@ -504,8 +461,6 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasAuthenticationConfirmat
fn try_from(
item: &UnifiedAuthenticationServiceRouterData<&UasAuthenticationConfirmationRouterData>,
) -> Result<Self, Self::Error> {
- let auth_type =
- UnifiedAuthenticationServiceAuthType::try_from(&item.router_data.connector_auth_type)?;
let authentication_id = item.router_data.authentication_id.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "authentication_id",
@@ -513,9 +468,7 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasAuthenticationConfirmat
)?;
Ok(Self {
authenticate_by: item.router_data.connector.clone(),
- auth_creds: AuthType::HeaderKey {
- api_key: auth_type.api_key,
- },
+ auth_creds: item.router_data.connector_auth_type.clone(),
source_authentication_id: authentication_id,
x_src_flow_id: item.router_data.request.x_src_flow_id.clone(),
transaction_amount: Some(item.amount),
diff --git a/crates/hyperswitch_domain_models/src/configs.rs b/crates/hyperswitch_domain_models/src/configs.rs
index 5256e1a824..813a6ecbb4 100644
--- a/crates/hyperswitch_domain_models/src/configs.rs
+++ b/crates/hyperswitch_domain_models/src/configs.rs
@@ -30,6 +30,7 @@ pub struct Connectors {
pub coingate: ConnectorParams,
pub cryptopay: ConnectorParams,
pub ctp_mastercard: NoParams,
+ pub ctp_visa: NoParams,
pub cybersource: ConnectorParams,
pub datatrans: ConnectorParamsWithSecondaryBaseUrl,
pub deutschebank: ConnectorParams,
diff --git a/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs b/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
index 248fec6f05..76251fa6dd 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types/unified_authentication_service.rs
@@ -10,8 +10,19 @@ pub struct UasPreAuthenticationRequestData {
pub service_details: Option<CtpServiceDetails>,
pub transaction_details: Option<TransactionDetails>,
pub payment_details: Option<PaymentDetails>,
+ pub authentication_info: Option<AuthenticationInfo>,
}
+#[derive(Clone, Debug, PartialEq, serde::Serialize)]
+pub struct AuthenticationInfo {
+ pub authentication_type: Option<String>,
+ pub authentication_reasons: Option<Vec<String>>,
+ pub consent_received: bool,
+ pub is_authenticated: bool,
+ pub locale: Option<String>,
+ pub supported_card_brands: Option<String>,
+ pub encypted_payload: Option<Secret<String>>,
+}
#[derive(Clone, Debug)]
pub struct UasAuthenticationRequestData {
pub payment_method_data: PaymentMethodData,
@@ -28,13 +39,13 @@ pub struct UasAuthenticationRequestData {
pub webhook_url: String,
}
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, serde::Serialize)]
pub struct CtpServiceDetails {
pub service_session_ids: Option<ServiceSessionIds>,
pub payment_details: Option<PaymentDetails>,
}
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, serde::Serialize)]
pub struct PaymentDetails {
pub pan: cards::CardNumber,
pub digital_card_id: Option<String>,
@@ -80,7 +91,7 @@ pub enum UasAuthenticationResponseData {
Confirmation {},
}
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, serde::Serialize)]
pub struct PreAuthenticationDetails {
pub threeds_server_transaction_id: Option<String>,
pub maximum_supported_3ds_version: Option<common_utils::types::SemanticVersion>,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 9d326780ac..ff3be87846 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -326,6 +326,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::PaymentConnectorCategory,
api_models::enums::CardDiscovery,
api_models::enums::FeatureStatus,
+ api_models::enums::CtpServiceProvider,
api_models::admin::MerchantConnectorCreate,
api_models::admin::AdditionalMerchantData,
api_models::admin::ConnectorWalletDetails,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index b127421bce..ee9ae3cec0 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -292,6 +292,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::FeatureStatus,
api_models::enums::OrderFulfillmentTimeOrigin,
api_models::enums::UIWidgetFormLayout,
+ api_models::enums::CtpServiceProvider,
api_models::admin::MerchantConnectorCreate,
api_models::admin::AdditionalMerchantData,
api_models::admin::CardTestingGuardConfig,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 6be1be4b7d..9357962237 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1338,6 +1338,7 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
Ok(())
}
api_enums::Connector::CtpMastercard => Ok(()),
+ api_enums::Connector::CtpVisa => Ok(()),
api_enums::Connector::Cybersource => {
cybersource::transformers::CybersourceAuthType::try_from(self.auth_type)?;
cybersource::transformers::CybersourceConnectorMetadataObject::try_from(
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 88e5cc7481..c6fc064463 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -7690,6 +7690,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
authentication_details.three_ds_requestor_url.clone(),
&merchant_connector_account,
&authentication_connector,
+ payment_intent.payment_id,
)
.await?;
let authentication = external_authentication_update_trackers(
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index 63824a40c9..787257b57d 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -10,9 +10,9 @@ use hyperswitch_domain_models::{
router_request_types::{
authentication::{MessageCategory, PreAuthenticationData},
unified_authentication_service::{
- PaymentDetails, ServiceSessionIds, TransactionDetails, UasAuthenticationRequestData,
- UasConfirmationRequestData, UasPostAuthenticationRequestData,
- UasPreAuthenticationRequestData,
+ AuthenticationInfo, PaymentDetails, ServiceSessionIds, TransactionDetails,
+ UasAuthenticationRequestData, UasConfirmationRequestData,
+ UasPostAuthenticationRequestData, UasPreAuthenticationRequestData,
},
BrowserInformation,
},
@@ -60,24 +60,32 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
}),
payment_details: None,
};
- let currency = payment_data.payment_attempt.currency.ok_or(
- ApiErrorResponse::MissingRequiredField {
- field_name: "currency",
- },
- )?;
let amount = payment_data.payment_attempt.net_amount.get_order_amount();
let transaction_details = TransactionDetails {
amount: Some(amount),
- currency: Some(currency),
+ currency: payment_data.payment_attempt.currency,
device_channel: None,
message_category: None,
};
+ let authentication_info = Some(AuthenticationInfo {
+ authentication_type: None,
+ authentication_reasons: None,
+ consent_received: false, // This is not relevant in this flow so keeping it as false
+ is_authenticated: false, // This is not relevant in this flow so keeping it as false
+ locale: None,
+ supported_card_brands: None,
+ encypted_payload: payment_data
+ .service_details
+ .as_ref()
+ .and_then(|details| details.encypted_payload.clone()),
+ });
Ok(UasPreAuthenticationRequestData {
service_details: Some(service_details),
transaction_details: Some(transaction_details),
payment_details: None,
+ authentication_info,
})
}
@@ -103,6 +111,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
pre_authentication_data,
merchant_connector_account,
Some(authentication_id.to_owned()),
+ payment_data.payment_intent.payment_id.clone(),
)?;
utils::do_auth_connector_call(
@@ -144,6 +153,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
post_authentication_data,
merchant_connector_account,
Some(authentication_id.clone()),
+ payment_data.payment_intent.payment_id.clone(),
)?;
utils::do_auth_connector_call(
@@ -215,6 +225,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
authentication_confirmation_data,
merchant_connector_account,
Some(authentication_id.clone()),
+ payment_data.payment_intent.payment_id.clone()
)?;
utils::do_auth_connector_call(
@@ -258,6 +269,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ExternalAuthentication
service_details: None,
transaction_details: None,
payment_details,
+ authentication_info: None,
})
}
@@ -284,6 +296,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ExternalAuthentication
pre_authentication_data,
merchant_connector_account,
Some(authentication_id.to_owned()),
+ payment_data.payment_intent.payment_id.clone(),
)?;
utils::do_auth_connector_call(
@@ -369,6 +382,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ExternalAuthentication
three_ds_requestor_url: String,
merchant_connector_account: &MerchantConnectorAccountType,
connector_name: &str,
+ payment_id: common_utils::id_type::PaymentId,
) -> RouterResult<UasAuthenticationRouterData> {
let authentication_data =
<Self as UnifiedAuthenticationService<F>>::get_authentication_request_data(
@@ -397,6 +411,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ExternalAuthentication
authentication_data,
merchant_connector_account,
Some(authentication.authentication_id.to_owned()),
+ payment_id,
)?;
Box::pin(utils::do_auth_connector_call(
@@ -426,7 +441,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ExternalAuthentication
state: &SessionState,
_key_store: &domain::MerchantKeyStore,
business_profile: &domain::Profile,
- _payment_data: &PaymentData<F>,
+ payment_data: &PaymentData<F>,
merchant_connector_account: &MerchantConnectorAccountType,
connector_name: &str,
payment_method: common_enums::PaymentMethod,
@@ -445,6 +460,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ExternalAuthentication
authentication_data,
merchant_connector_account,
authentication.map(|auth| auth.authentication_id),
+ payment_data.payment_intent.payment_id.clone(),
)?;
utils::do_auth_connector_call(
diff --git a/crates/router/src/core/unified_authentication_service/types.rs b/crates/router/src/core/unified_authentication_service/types.rs
index 7a1caf2d0e..06c3bd1178 100644
--- a/crates/router/src/core/unified_authentication_service/types.rs
+++ b/crates/router/src/core/unified_authentication_service/types.rs
@@ -112,6 +112,7 @@ pub trait UnifiedAuthenticationService<F: Clone + Sync> {
_three_ds_requestor_url: String,
_merchant_connector_account: &MerchantConnectorAccountType,
_connector_name: &str,
+ _payment_id: common_utils::id_type::PaymentId,
) -> RouterResult<hyperswitch_domain_models::types::UasAuthenticationRouterData> {
Err(errors::ApiErrorResponse::NotImplemented {
message: NotImplementedMessage::Reason("authentication".to_string()),
diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs
index b74cd4d0c8..efffd2f4a2 100644
--- a/crates/router/src/core/unified_authentication_service/utils.rs
+++ b/crates/router/src/core/unified_authentication_service/utils.rs
@@ -63,6 +63,7 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(
request_data: Req,
merchant_connector_account: &payments::helpers::MerchantConnectorAccountType,
authentication_id: Option<String>,
+ payment_id: common_utils::id_type::PaymentId,
) -> RouterResult<RouterData<F, Req, Res>> {
let auth_type: ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
@@ -75,9 +76,7 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(
customer_id: None,
connector_customer: None,
connector: authentication_connector_name,
- payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("authentication")
- .get_string_repr()
- .to_owned(),
+ payment_id: payment_id.get_string_repr().to_owned(),
tenant_id: state.tenant.tenant_id.clone(),
attempt_id: IRRELEVANT_ATTEMPT_ID_IN_AUTHENTICATION_FLOW.to_owned(),
status: common_enums::AttemptStatus::default(),
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index 2b0625319c..577c306c36 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -344,6 +344,9 @@ impl ConnectorData {
enums::Connector::CtpMastercard => {
Ok(ConnectorEnum::Old(Box::new(&connector::CtpMastercard)))
}
+ enums::Connector::CtpVisa => Ok(ConnectorEnum::Old(Box::new(
+ connector::UnifiedAuthenticationService::new(),
+ ))),
enums::Connector::Cybersource => {
Ok(ConnectorEnum::Old(Box::new(connector::Cybersource::new())))
}
diff --git a/crates/router/src/types/api/authentication.rs b/crates/router/src/types/api/authentication.rs
index 5234013f64..a50f4fce8c 100644
--- a/crates/router/src/types/api/authentication.rs
+++ b/crates/router/src/types/api/authentication.rs
@@ -96,6 +96,9 @@ impl AuthenticationConnectorData {
enums::AuthenticationConnectors::CtpMastercard => {
Ok(ConnectorEnum::Old(Box::new(&connector::CtpMastercard)))
}
+ enums::AuthenticationConnectors::CtpVisa => Ok(ConnectorEnum::Old(Box::new(
+ connector::UnifiedAuthenticationService::new(),
+ ))),
enums::AuthenticationConnectors::UnifiedAuthenticationService => Ok(
ConnectorEnum::Old(Box::new(connector::UnifiedAuthenticationService::new())),
),
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 847298db98..44c179bc2b 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -230,6 +230,11 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Coinbase => Self::Coinbase,
api_enums::Connector::Coingate => Self::Coingate,
api_enums::Connector::Cryptopay => Self::Cryptopay,
+ api_enums::Connector::CtpVisa => {
+ Err(common_utils::errors::ValidationError::InvalidValue {
+ message: "ctp visa is not a routable connector".to_string(),
+ })?
+ }
api_enums::Connector::CtpMastercard => {
Err(common_utils::errors::ValidationError::InvalidValue {
message: "ctp mastercard is not a routable connector".to_string(),
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index f7a68ca3d0..08a7e59357 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -213,6 +213,7 @@ cards = [
"coinbase",
"coingate",
"cryptopay",
+ "ctp_visa",
"cybersource",
"datatrans",
"deutschebank",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 75de021f04..8aab99447a 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon facilitapay fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim hipay iatapay inespay itaubank jpmorgan juspaythreedsserver klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode chargebee checkout coinbase cryptopay ctp_visa cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon facilitapay fiserv fiservemea fiuu forte getnet globalpay globepay gocardless gpayments helcim hipay iatapay inespay itaubank jpmorgan juspaythreedsserver klarna mifinity mollie moneris multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal paystack payu placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys shift4 square stax stripe stripebilling taxjar threedsecureio thunes trustpay tsys unified_authentication_service volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp