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(wasm): [Adyen] update connector account configs and integration bugs (#3910)

SamraatBansal34f7705c44f5
diff --git a/crates/connector_configs/src/common_config.rs b/crates/connector_configs/src/common_config.rs
index c3cbaab4ab..2af5b88b33 100644
--- a/crates/connector_configs/src/common_config.rs
+++ b/crates/connector_configs/src/common_config.rs
@@ -81,6 +81,7 @@ pub struct ApiModelMetaData {
pub google_pay: Option<GoogleApiModelData>,
pub apple_pay: Option<ApplePayData>,
pub apple_pay_combined: Option<ApplePayData>,
+ pub endpoint_prefix: Option<String>,
}
#[serde_with::skip_serializing_none]
@@ -173,4 +174,5 @@ pub struct DashboardMetaData {
pub google_pay: Option<GooglePayData>,
pub apple_pay: Option<ApplePayData>,
pub apple_pay_combined: Option<ApplePayData>,
+ pub endpoint_prefix: Option<String>,
}
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index f0997d5310..357ee0cb73 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -74,6 +74,7 @@ pub struct ConfigMetadata {
pub google_pay: Option<GooglePayData>,
pub apple_pay: Option<ApplePayTomlConfig>,
pub merchant_id: Option<String>,
+ pub endpoint_prefix: Option<String>,
}
#[serde_with::skip_serializing_none]
diff --git a/crates/connector_configs/src/response_modifier.rs b/crates/connector_configs/src/response_modifier.rs
index 80332612c1..5942a9e01a 100644
--- a/crates/connector_configs/src/response_modifier.rs
+++ b/crates/connector_configs/src/response_modifier.rs
@@ -293,6 +293,10 @@ impl ConnectorApiIntegrationPayload {
Some(meta_data) => meta_data.terminal_id,
_ => None,
};
+ let endpoint_prefix = match response.metadata.clone() {
+ Some(meta_data) => meta_data.endpoint_prefix,
+ _ => None,
+ };
let apple_pay = match response.metadata.clone() {
Some(meta_data) => meta_data.apple_pay,
_ => None,
@@ -315,6 +319,7 @@ impl ConnectorApiIntegrationPayload {
account_name,
terminal_id,
merchant_id,
+ endpoint_prefix,
};
DashboardRequestPayload {
diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs
index be68a0c5f9..735178cd67 100644
--- a/crates/connector_configs/src/transformer.rs
+++ b/crates/connector_configs/src/transformer.rs
@@ -186,6 +186,7 @@ impl DashboardRequestPayload {
merchant_account_id: None,
merchant_id: None,
merchant_config_currency: None,
+ endpoint_prefix: None,
};
let meta_data = match request.metadata {
Some(data) => data,
@@ -196,6 +197,7 @@ impl DashboardRequestPayload {
let merchant_account_id = meta_data.merchant_account_id.clone();
let merchant_id = meta_data.merchant_id.clone();
let terminal_id = meta_data.terminal_id.clone();
+ let endpoint_prefix = meta_data.endpoint_prefix.clone();
let apple_pay = meta_data.apple_pay;
let apple_pay_combined = meta_data.apple_pay_combined;
let merchant_config_currency = meta_data.merchant_config_currency;
@@ -208,6 +210,7 @@ impl DashboardRequestPayload {
merchant_id,
merchant_config_currency,
apple_pay_combined,
+ endpoint_prefix,
})
}
diff --git a/crates/diesel_models/src/enums.rs b/crates/diesel_models/src/enums.rs
index a616f302cf..0310944de7 100644
--- a/crates/diesel_models/src/enums.rs
+++ b/crates/diesel_models/src/enums.rs
@@ -372,6 +372,9 @@ pub enum BankNames {
TsbBank,
TescoBank,
UlsterBank,
+ Yoursafe,
+ N26,
+ NationaleNederlanden,
}
#[derive(
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 261495e2bf..93301364e6 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -280,10 +280,12 @@ fn build_env_specific_endpoint(
} else {
let adyen_connector_metadata_object =
transformers::AdyenConnectorMetadataObject::try_from(connector_metadata)?;
- Ok(base_url.replace(
- "{{merchant_endpoint_prefix}}",
- &adyen_connector_metadata_object.endpoint_prefix,
- ))
+ let endpoint_prefix = adyen_connector_metadata_object.endpoint_prefix.ok_or(
+ errors::ConnectorError::InvalidConnectorConfig {
+ config: "metadata.endpoint_prefix",
+ },
+ )?;
+ Ok(base_url.replace("{{merchant_endpoint_prefix}}", &endpoint_prefix))
}
}
@@ -1556,17 +1558,6 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData>
for Adyen
{
- fn build_request(
- &self,
- _req: &types::RefundsRouterData<api::RSync>,
- _connectors: &settings::Connectors,
- ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
- Err(errors::ConnectorError::FlowNotSupported {
- flow: "Rsync".to_owned(),
- connector: "Adyen".to_owned(),
- }
- .into())
- }
}
fn get_webhook_object_from_body(
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 7f20041e1f..9fbf7d9981 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -63,7 +63,7 @@ impl<T>
}
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct AdyenConnectorMetadataObject {
- pub endpoint_prefix: String,
+ pub endpoint_prefix: Option<String>,
}
impl TryFrom<&Option<pii::SecretSerdeValue>> for AdyenConnectorMetadataObject {
@@ -106,7 +106,8 @@ pub enum AuthType {
#[serde(rename_all = "camelCase")]
pub struct AdditionalData {
authorisation_type: Option<AuthType>,
- manual_capture: Option<bool>,
+ manual_capture: Option<String>,
+ execute_three_d: Option<String>,
pub recurring_processing_model: Option<AdyenRecurringModel>,
/// Enable recurring details in dashboard to receive this ID, https://docs.adyen.com/online-payments/tokenization/create-and-use-tokens#test-and-go-live
#[serde(rename = "recurring.recurringDetailReference")]
@@ -1641,19 +1642,28 @@ fn get_browser_info(
}
fn get_additional_data(item: &types::PaymentsAuthorizeRouterData) -> Option<AdditionalData> {
- match item.request.capture_method {
+ let (authorisation_type, manual_capture) = match item.request.capture_method {
Some(diesel_models::enums::CaptureMethod::Manual)
- | Some(diesel_models::enums::CaptureMethod::ManualMultiple) => Some(AdditionalData {
- authorisation_type: Some(AuthType::PreAuth),
- manual_capture: Some(true),
- network_tx_reference: None,
- recurring_detail_reference: None,
- recurring_shopper_reference: None,
- recurring_processing_model: Some(AdyenRecurringModel::UnscheduledCardOnFile),
- ..AdditionalData::default()
- }),
- _ => None,
- }
+ | Some(diesel_models::enums::CaptureMethod::ManualMultiple) => {
+ (Some(AuthType::PreAuth), Some("true".to_string()))
+ }
+ _ => (None, None),
+ };
+ let execute_three_d = if matches!(item.auth_type, enums::AuthenticationType::ThreeDs) {
+ Some("true".to_string())
+ } else {
+ None
+ };
+ Some(AdditionalData {
+ authorisation_type,
+ manual_capture,
+ execute_three_d,
+ network_tx_reference: None,
+ recurring_detail_reference: None,
+ recurring_shopper_reference: None,
+ recurring_processing_model: None,
+ ..AdditionalData::default()
+ })
}
fn get_channel_type(pm_type: &Option<storage_enums::PaymentMethodType>) -> Option<Channel> {
@@ -3809,7 +3819,7 @@ impl<F> TryFrom<types::RefundsResponseRouterData<F, AdyenRefundResponse>>
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(types::RefundsResponseData {
- connector_refund_id: item.response.reference,
+ connector_refund_id: item.response.psp_reference,
// From the docs, the only value returned is "received", outcome of refund is available
// through refund notification webhook
// For more info: https://docs.adyen.com/online-payments/refund
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js
index dcf3f19164..cfbd9695bd 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Cancel/event.test.js
@@ -22,7 +22,7 @@ pm.test("[POST]::/payments/:id/cancel - Response has JSON Body", function () {
let jsonData = {};
try {
jsonData = pm.response.json();
-} catch (e) {}
+} catch (e) { }
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
if (jsonData?.payment_id) {
@@ -53,9 +53,9 @@ if (jsonData?.client_secret) {
// Response body should have value "cancelled" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'",
+ "[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("cancelled");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js
index 5e52e13a59..ec02aad862 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Retrieve/event.test.js
@@ -19,7 +19,7 @@ pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
let jsonData = {};
try {
jsonData = pm.response.json();
-} catch (e) {}
+} catch (e) { }
// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
if (jsonData?.payment_id) {
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "cancelled" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'",
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'processing'",
function () {
- pm.expect(jsonData.status).to.eql("cancelled");
+ pm.expect(jsonData.status).to.eql("processing");
},
);
}
diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payment Connector - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payment Connector - Create/request.json
index b5002aeca8..401201dff6 100644
--- a/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payment Connector - Create/request.json
+++ b/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payment Connector - Create/request.json
@@ -46,7 +46,7 @@
"key1": "{{connector_key1}}",
"api_secret": "{{connector_api_secret}}"
},
- "test_mode": false,
+ "test_mode": true,
"disabled": false,
"business_country": "US",
"business_label": "default",
@@ -56,12 +56,17 @@
"payment_method_types": [
{
"payment_method_type": "credit",
- "card_networks": ["AmericanExpress",
- "Discover",
- "Interac",
- "JCB",
- "Mastercard",
- "Visa", "DinersClub","UnionPay","RuPay"],
+ "card_networks": [
+ "AmericanExpress",
+ "Discover",
+ "Interac",
+ "JCB",
+ "Mastercard",
+ "Visa",
+ "DinersClub",
+ "UnionPay",
+ "RuPay"
+ ],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
@@ -69,12 +74,17 @@
},
{
"payment_method_type": "debit",
- "card_networks": ["AmericanExpress",
- "Discover",
- "Interac",
- "JCB",
- "Mastercard",
- "Visa", "DinersClub","UnionPay","RuPay"],
+ "card_networks": [
+ "AmericanExpress",
+ "Discover",
+ "Interac",
+ "JCB",
+ "Mastercard",
+ "Visa",
+ "DinersClub",
+ "UnionPay",
+ "RuPay"
+ ],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
@@ -203,15 +213,15 @@
{
"payment_method": "gift_card",
"payment_method_types": [
- {
- "payment_method_type": "givex",
- "minimum_amount": 1,
- "maximum_amount": 68607706,
- "recurring_enabled": true,
- "installment_payment_enabled": true
- }
+ {
+ "payment_method_type": "givex",
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
]
- },
+ },
{
"payment_method": "bank_redirect",
"payment_method_types": [
@@ -303,7 +313,10 @@
{
"type": "CARD",
"parameters": {
- "allowed_auth_methods": ["PAN_ONLY", "CRYPTOGRAM_3DS"],
+ "allowed_auth_methods": [
+ "PAN_ONLY",
+ "CRYPTOGRAM_3DS"
+ ],
"allowed_card_networks": [
"AMEX",
"DISCOVER",
@@ -327,8 +340,14 @@
},
"url": {
"raw": "{{baseUrl}}/account/:account_id/connectors",
- "host": ["{{baseUrl}}"],
- "path": ["account", ":account_id", "connectors"],
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "account",
+ ":account_id",
+ "connectors"
+ ],
"variable": [
{
"key": "account_id",
@@ -338,4 +357,4 @@
]
},
"description": "Create a new Payment Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialised services like Fraud / Accounting etc."
-}
+}
\ No newline at end of file