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): [nordea] pass valid connector metadata fields and properly throw error unsupported flows (#9041)

Pa1NarK70b426e3cac2
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index fbdb974574..6427611bbf 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -114,6 +114,7 @@ pub struct ConfigMetadata {
pub merchant_config_currency: Option<InputData>,
pub merchant_account_id: Option<InputData>,
pub account_name: Option<InputData>,
+ pub account_type: Option<InputData>,
pub terminal_id: Option<InputData>,
pub google_pay: Option<Vec<InputData>>,
pub apple_pay: Option<Vec<InputData>>,
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index ac14c55982..b496418f62 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -6420,20 +6420,20 @@ type = "Text"
api_key="Client Secret"
key1="Client ID"
api_secret="eIDAS Private Key"
-[nordea.metadata.creditor_account_type]
- name="creditor_account_type"
+[nordea.metadata.account_type]
+ name="account_type"
label="Creditor Account Type"
placeholder="Enter Beneficiary Account Type e.g. IBAN"
required=true
type="Text"
-[nordea.metadata.creditor_account_value]
- name="creditor_account_value"
- label="Creditor Account Type"
+[nordea.metadata.account_value]
+ name="destination_account_number"
+ label="Creditor Account Number"
placeholder="Enter Beneficiary Account Number"
required=true
type="Text"
-[nordea.metadata.creditor_beneficiary_name]
- name="creditor_beneficiary_name"
+[nordea.metadata.merchant_name]
+ name="merchant_name"
label="Creditor Account Beneficiary Name"
placeholder="Enter Beneficiary Name"
required=true
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 5b14d328a6..5eaa0f7fb2 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -5026,26 +5026,25 @@ type = "Text"
api_key="Client Secret"
key1="Client ID"
api_secret="eIDAS Private Key"
-[nordea.metadata.creditor_account_type]
- name="creditor_account_type"
+[nordea.metadata.account_type]
+ name="account_type"
label="Creditor Account Type"
placeholder="Enter Beneficiary Account Type e.g. IBAN"
required=true
type="Text"
-[nordea.metadata.creditor_account_value]
- name="creditor_account_value"
- label="Creditor Account Type"
+[nordea.metadata.account_value]
+ name="destination_account_number"
+ label="Creditor Account Number"
placeholder="Enter Beneficiary Account Number"
required=true
type="Text"
-[nordea.metadata.creditor_beneficiary_name]
- name="creditor_beneficiary_name"
+[nordea.metadata.merchant_name]
+ name="merchant_name"
label="Creditor Account Beneficiary Name"
placeholder="Enter Beneficiary Name"
required=true
type="Text"
-
[worldpayxml]
[[worldpayxml.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 486af69301..f9be6ac7b4 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -6402,26 +6402,25 @@ type = "Text"
api_key="Client Secret"
key1="Client ID"
api_secret="eIDAS Private Key"
-[nordea.metadata.creditor_account_type]
- name="creditor_account_type"
+[nordea.metadata.account_type]
+ name="account_type"
label="Creditor Account Type"
placeholder="Enter Beneficiary Account Type e.g. IBAN"
required=true
type="Text"
-[nordea.metadata.creditor_account_value]
- name="creditor_account_value"
- label="Creditor Account Type"
+[nordea.metadata.account_value]
+ name="destination_account_number"
+ label="Creditor Account Number"
placeholder="Enter Beneficiary Account Number"
required=true
type="Text"
-[nordea.metadata.creditor_beneficiary_name]
- name="creditor_beneficiary_name"
+[nordea.metadata.merchant_name]
+ name="merchant_name"
label="Creditor Account Beneficiary Name"
placeholder="Enter Beneficiary Name"
required=true
type="Text"
-
[worldpayxml]
[[worldpayxml.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rs
index 8eb29c3f0c..f33397ba99 100644
--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs
@@ -1053,9 +1053,9 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
_req: &RouterData<Capture, PaymentsCaptureData, PaymentsResponseData>,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- Err(errors::ConnectorError::FlowNotSupported {
- flow: "Capture".to_string(),
- connector: "Nordea".to_string(),
+ Err(errors::ConnectorError::NotSupported {
+ message: "Capture".to_string(),
+ connector: "Nordea",
}
.into())
}
@@ -1067,9 +1067,9 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for No
_req: &RouterData<Void, PaymentsCancelData, PaymentsResponseData>,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- Err(errors::ConnectorError::FlowNotSupported {
- flow: "Payments Cancel".to_string(),
- connector: "Nordea".to_string(),
+ Err(errors::ConnectorError::NotSupported {
+ message: "Payments Cancel".to_string(),
+ connector: "Nordea",
}
.into())
}
@@ -1081,9 +1081,9 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Nordea
_req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
- Err(errors::ConnectorError::FlowNotSupported {
- flow: "Personal API Refunds".to_string(),
- connector: "Nordea".to_string(),
+ Err(errors::ConnectorError::NotSupported {
+ message: "Personal API Refunds flow".to_string(),
+ connector: "Nordea",
}
.into())
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs
index 5ca8e11045..e7d5cc3f1d 100644
--- a/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nordea/transformers.rs
@@ -75,9 +75,12 @@ impl TryFrom<&ConnectorAuthType> for NordeaAuthType {
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct NordeaConnectorMetadataObject {
- pub creditor_account_value: Secret<String>,
- pub creditor_account_type: String,
- pub creditor_beneficiary_name: Secret<String>,
+ /// Account number of the beneficiary (merchant)
+ pub destination_account_number: Secret<String>,
+ /// Account type (example: IBAN, BBAN_SE, BBAN_DK, BBAN_NO, BGNR, PGNR, GIRO_DK, BBAN_OTHER)
+ pub account_type: String,
+ /// Name of the beneficiary (merchant)
+ pub merchant_name: Secret<String>,
}
impl TryFrom<&Option<pii::SecretSerdeValue>> for NordeaConnectorMetadataObject {
@@ -222,14 +225,14 @@ fn get_creditor_account_from_metadata(
})?;
let creditor_account = CreditorAccount {
account: AccountNumber {
- account_type: AccountType::try_from(metadata.creditor_account_type.as_str())
+ account_type: AccountType::try_from(metadata.account_type.as_str())
.unwrap_or(AccountType::Iban),
currency: router_data.request.currency,
- value: metadata.creditor_account_value,
+ value: metadata.destination_account_number,
},
country: router_data.get_optional_billing_country(),
// Merchant is the beneficiary in this case
- name: Some(metadata.creditor_beneficiary_name),
+ name: Some(metadata.merchant_name),
message: router_data
.description
.as_ref()