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

fix(connector): (payload) currency auth key wasm changes (#8825)

Pa1NarK4d4a81e9c7d1
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 54224a0fdd..92313a44ef 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -6,32 +6,45 @@ use api_models::{
enums::{AuthenticationConnectors, Connector, PmAuthConnectors, TaxConnectors},
payments,
};
-use serde::Deserialize;
+use serde::{Deserialize, Serialize};
use toml;
use crate::common_config::{CardProvider, InputData, Provider, ZenApplePay};
-#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct PayloadCurrencyAuthKeyType {
+ pub api_key: String,
+ pub processing_account_id: String,
+}
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct Classic {
pub password_classic: String,
pub username_classic: String,
pub merchant_id_classic: String,
}
-#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct Evoucher {
pub password_evoucher: String,
pub username_evoucher: String,
pub merchant_id_evoucher: String,
}
-#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)]
-pub struct CurrencyAuthKeyType {
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct CashtoCodeCurrencyAuthKeyType {
pub classic: Classic,
pub evoucher: Evoucher,
}
-#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum CurrencyAuthValue {
+ CashtoCode(CashtoCodeCurrencyAuthKeyType),
+ Payload(PayloadCurrencyAuthKeyType),
+}
+
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub enum ConnectorAuthType {
HeaderKey {
api_key: String,
@@ -52,7 +65,7 @@ pub enum ConnectorAuthType {
key2: String,
},
CurrencyAuthKey {
- auth_key_map: HashMap<String, CurrencyAuthKeyType>,
+ auth_key_map: HashMap<String, CurrencyAuthValue>,
},
CertificateAuth {
certificate: String,
@@ -63,7 +76,7 @@ pub enum ConnectorAuthType {
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, Deserialize, Serialize, Clone)]
#[serde(untagged)]
pub enum ApplePayTomlConfig {
Standard(Box<payments::ApplePayMetadata>),
@@ -71,7 +84,7 @@ pub enum ApplePayTomlConfig {
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Clone, serde::Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum KlarnaEndpoint {
Europe,
NorthAmerica,
@@ -79,7 +92,7 @@ pub enum KlarnaEndpoint {
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ConfigMerchantAdditionalDetails {
pub open_banking_recipient_data: Option<InputData>,
pub account_data: Option<InputData>,
@@ -96,7 +109,7 @@ pub struct ConfigMerchantAdditionalDetails {
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ConfigMetadata {
pub merchant_config_currency: Option<InputData>,
pub merchant_account_id: Option<InputData>,
@@ -137,7 +150,7 @@ pub struct ConfigMetadata {
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ConnectorWalletDetailsConfig {
pub samsung_pay: Option<Vec<InputData>>,
pub paze: Option<Vec<InputData>>,
@@ -145,7 +158,7 @@ pub struct ConnectorWalletDetailsConfig {
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ConnectorTomlConfig {
pub connector_auth: Option<ConnectorAuthType>,
pub connector_webhook_details: Option<api_models::admin::MerchantConnectorWebhookDetails>,
@@ -170,7 +183,7 @@ pub struct ConnectorTomlConfig {
pub real_time_payment: Option<Vec<Provider>>,
}
#[serde_with::skip_serializing_none]
-#[derive(Debug, Deserialize, serde::Serialize, Clone)]
+#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ConnectorConfig {
pub authipay: Option<ConnectorTomlConfig>,
pub juspaythreedsserver: Option<ConnectorTomlConfig>,
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index ab2ebb4725..2b5130aaea 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -6416,9 +6416,13 @@ type="Text"
[[payload.debit]]
payment_method_type = "Visa"
-[payload.connector_auth.HeaderKey]
-api_key="API Key"
-
+[payload.connector_auth.CurrencyAuthKey.auth_key_map.USD]
+processing_account_id = "processing_account_id"
+api_key = "API Key"
+[payload.connector_auth.CurrencyAuthKey.auth_key_map.CAD]
+processing_account_id = "processing_account_id"
+api_key = "API Key"
+
[silverflow]
[[silverflow.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 0b378a0571..2f5281162f 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -5029,9 +5029,13 @@ payment_method_type = "Mastercard"
[[payload.debit]]
payment_method_type = "Visa"
-[payload.connector_auth.HeaderKey]
-api_key="API Key"
-
+[payload.connector_auth.CurrencyAuthKey.auth_key_map.USD]
+processing_account_id = "processing_account_id"
+api_key = "API Key"
+[payload.connector_auth.CurrencyAuthKey.auth_key_map.CAD]
+processing_account_id = "processing_account_id"
+api_key = "API Key"
+
[silverflow]
[[silverflow.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 957e966e1f..cc3c8afc66 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -6397,9 +6397,13 @@ payment_method_type = "Mastercard"
[[payload.debit]]
payment_method_type = "Visa"
-[payload.connector_auth.HeaderKey]
-api_key="API Key"
-
+[payload.connector_auth.CurrencyAuthKey.auth_key_map.USD]
+processing_account_id = "processing_account_id"
+api_key = "API Key"
+[payload.connector_auth.CurrencyAuthKey.auth_key_map.CAD]
+processing_account_id = "processing_account_id"
+api_key = "API Key"
+
[silverflow]
[[silverflow.credit]]
payment_method_type = "Mastercard"