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(router): use `Connector` enum for `connector_name` field in `MerchantConnectorCreate` (#1637)

DEEPANSHU BANSALe750a7332376
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index e7164a2493..895b137679 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -391,8 +391,8 @@ pub struct MerchantConnectorCreate {
#[schema(value_type = ConnectorType, example = "payment_processor")]
pub connector_type: api_enums::ConnectorType,
/// Name of the Connector
- #[schema(example = "stripe")]
- pub connector_name: String,
+ #[schema(value_type = Connector, example = "stripe")]
+ pub connector_name: api_enums::Connector,
// /// Connector label for specific country and Business
#[serde(skip_deserializing)]
#[schema(example = "stripe_US_travel")]
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index d80744c83f..9bb0d449a9 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -462,7 +462,7 @@ pub async fn create_payment_connector(
business_country,
&business_label,
req.business_sub_label.as_ref(),
- &req.connector_name,
+ &req.connector_name.to_string(),
);
let mut vec = Vec::new();
@@ -504,7 +504,7 @@ pub async fn create_payment_connector(
let merchant_connector_account = domain::MerchantConnectorAccount {
merchant_id: merchant_id.to_string(),
connector_type: req.connector_type.foreign_into(),
- connector_name: req.connector_name.clone(),
+ connector_name: req.connector_name.to_string(),
merchant_connector_id: utils::generate_id(consts::ID_LENGTH, "mca"),
connector_account_details: domain_types::encrypt(
req.connector_account_details.ok_or(
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 9b332e14dd..abc252e2c9 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -4986,9 +4986,7 @@
"$ref": "#/components/schemas/ConnectorType"
},
"connector_name": {
- "type": "string",
- "description": "Name of the Connector",
- "example": "stripe"
+ "$ref": "#/components/schemas/Connector"
},
"connector_label": {
"type": "string",