fix(router): use Connector enum for connector_name field in MerchantConnectorCreate (#1637)

This commit is contained in:
DEEPANSHU BANSAL
2023-07-07 18:31:21 +05:30
committed by GitHub
parent 36a9f0e8b1
commit e750a73323
3 changed files with 5 additions and 7 deletions

View File

@ -391,8 +391,8 @@ pub struct MerchantConnectorCreate {
#[schema(value_type = ConnectorType, example = "payment_processor")] #[schema(value_type = ConnectorType, example = "payment_processor")]
pub connector_type: api_enums::ConnectorType, pub connector_type: api_enums::ConnectorType,
/// Name of the Connector /// Name of the Connector
#[schema(example = "stripe")] #[schema(value_type = Connector, example = "stripe")]
pub connector_name: String, pub connector_name: api_enums::Connector,
// /// Connector label for specific country and Business // /// Connector label for specific country and Business
#[serde(skip_deserializing)] #[serde(skip_deserializing)]
#[schema(example = "stripe_US_travel")] #[schema(example = "stripe_US_travel")]

View File

@ -462,7 +462,7 @@ pub async fn create_payment_connector(
business_country, business_country,
&business_label, &business_label,
req.business_sub_label.as_ref(), req.business_sub_label.as_ref(),
&req.connector_name, &req.connector_name.to_string(),
); );
let mut vec = Vec::new(); let mut vec = Vec::new();
@ -504,7 +504,7 @@ pub async fn create_payment_connector(
let merchant_connector_account = domain::MerchantConnectorAccount { let merchant_connector_account = domain::MerchantConnectorAccount {
merchant_id: merchant_id.to_string(), merchant_id: merchant_id.to_string(),
connector_type: req.connector_type.foreign_into(), 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"), merchant_connector_id: utils::generate_id(consts::ID_LENGTH, "mca"),
connector_account_details: domain_types::encrypt( connector_account_details: domain_types::encrypt(
req.connector_account_details.ok_or( req.connector_account_details.ok_or(

View File

@ -4986,9 +4986,7 @@
"$ref": "#/components/schemas/ConnectorType" "$ref": "#/components/schemas/ConnectorType"
}, },
"connector_name": { "connector_name": {
"type": "string", "$ref": "#/components/schemas/Connector"
"description": "Name of the Connector",
"example": "stripe"
}, },
"connector_label": { "connector_label": {
"type": "string", "type": "string",