From 5611769964e372eb4690ef95ce950a2842f074d3 Mon Sep 17 00:00:00 2001 From: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:14:36 +0530 Subject: [PATCH] refactor(router): remove metadata, additional_merchant_data and connector_wallets_details from connector list api (#6583) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- api-reference-v2/openapi_spec.json | 21 --------- api-reference/openapi_spec.json | 21 --------- crates/api_models/src/admin.rs | 22 ---------- crates/router/src/types/transformers.rs | 52 ----------------------- cypress-tests/cypress/support/commands.js | 5 +++ 5 files changed, 5 insertions(+), 116 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index c6a1fad0d352..661e51f6c189 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -10020,11 +10020,6 @@ ], "nullable": true }, - "metadata": { - "type": "object", - "description": "Metadata is useful for storing additional, unstructured information on an object.", - "nullable": true - }, "disabled": { "type": "boolean", "description": "A boolean value to indicate if the connector is disabled. By default, its value is false.", @@ -10055,22 +10050,6 @@ }, "status": { "$ref": "#/components/schemas/ConnectorStatus" - }, - "additional_merchant_data": { - "allOf": [ - { - "$ref": "#/components/schemas/AdditionalMerchantData" - } - ], - "nullable": true - }, - "connector_wallets_details": { - "allOf": [ - { - "$ref": "#/components/schemas/ConnectorWalletDetails" - } - ], - "nullable": true } }, "additionalProperties": false diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index 353e9d5d49b3..801b32b490dc 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -13159,11 +13159,6 @@ ], "nullable": true }, - "metadata": { - "type": "object", - "description": "Metadata is useful for storing additional, unstructured information on an object.", - "nullable": true - }, "test_mode": { "type": "boolean", "description": "A boolean value to indicate if the connector is in Test mode. By default, its value is false.", @@ -13221,22 +13216,6 @@ }, "status": { "$ref": "#/components/schemas/ConnectorStatus" - }, - "additional_merchant_data": { - "allOf": [ - { - "$ref": "#/components/schemas/AdditionalMerchantData" - } - ], - "nullable": true - }, - "connector_wallets_details": { - "allOf": [ - { - "$ref": "#/components/schemas/ConnectorWalletDetails" - } - ], - "nullable": true } }, "additionalProperties": false diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index d80a4ea11b4c..8ba50649236b 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -1313,10 +1313,6 @@ pub struct MerchantConnectorListResponse { ]))] pub payment_methods_enabled: Option>, - /// Metadata is useful for storing additional, unstructured information on an object. - #[schema(value_type = Option,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))] - pub metadata: Option, - /// A boolean value to indicate if the connector is in Test mode. By default, its value is false. #[schema(default = false, example = false)] pub test_mode: Option, @@ -1349,13 +1345,6 @@ pub struct MerchantConnectorListResponse { #[schema(value_type = ConnectorStatus, example = "inactive")] pub status: api_enums::ConnectorStatus, - - #[schema(value_type = Option)] - pub additional_merchant_data: Option, - - /// The connector_wallets_details is used to store wallet details such as certificates and wallet credentials - #[schema(value_type = Option)] - pub connector_wallets_details: Option, } #[cfg(feature = "v1")] @@ -1423,10 +1412,6 @@ pub struct MerchantConnectorListResponse { ]))] pub payment_methods_enabled: Option>, - /// Metadata is useful for storing additional, unstructured information on an object. - #[schema(value_type = Option,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))] - pub metadata: Option, - /// A boolean value to indicate if the connector is disabled. By default, its value is false. #[schema(default = false, example = false)] pub disabled: Option, @@ -1443,13 +1428,6 @@ pub struct MerchantConnectorListResponse { #[schema(value_type = ConnectorStatus, example = "inactive")] pub status: api_enums::ConnectorStatus, - - #[schema(value_type = Option)] - pub additional_merchant_data: Option, - - /// The connector_wallets_details is used to store wallet details such as certificates and wallet credentials - #[schema(value_type = Option)] - pub connector_wallets_details: Option, } #[cfg(feature = "v2")] diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 8fe910cd7b46..c47c0ca342c2 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -1028,7 +1028,6 @@ impl ForeignTryFrom test_mode: item.test_mode, disabled: item.disabled, payment_methods_enabled, - metadata: item.metadata, business_country: item.business_country, business_label: item.business_label, business_sub_label: item.business_sub_label, @@ -1037,31 +1036,6 @@ impl ForeignTryFrom applepay_verified_domains: item.applepay_verified_domains, pm_auth_config: item.pm_auth_config, status: item.status, - additional_merchant_data: item - .additional_merchant_data - .map(|data| { - let data = data.into_inner(); - serde_json::Value::parse_value::( - data.expose(), - "AdditionalMerchantData", - ) - .attach_printable("Unable to deserialize additional_merchant_data") - .change_context(errors::ApiErrorResponse::InternalServerError) - }) - .transpose()? - .map(api_models::admin::AdditionalMerchantData::foreign_from), - connector_wallets_details: item - .connector_wallets_details - .map(|data| { - data.into_inner() - .expose() - .parse_value::( - "ConnectorWalletDetails", - ) - .attach_printable("Unable to deserialize connector_wallets_details") - .change_context(errors::ApiErrorResponse::InternalServerError) - }) - .transpose()?, }; #[cfg(feature = "v2")] let response = Self { @@ -1071,37 +1045,11 @@ impl ForeignTryFrom connector_label: item.connector_label, disabled: item.disabled, payment_methods_enabled, - metadata: item.metadata, frm_configs, profile_id: item.profile_id, applepay_verified_domains: item.applepay_verified_domains, pm_auth_config: item.pm_auth_config, status: item.status, - additional_merchant_data: item - .additional_merchant_data - .map(|data| { - let data = data.into_inner(); - serde_json::Value::parse_value::( - data.expose(), - "AdditionalMerchantData", - ) - .attach_printable("Unable to deserialize additional_merchant_data") - .change_context(errors::ApiErrorResponse::InternalServerError) - }) - .transpose()? - .map(api_models::admin::AdditionalMerchantData::foreign_from), - connector_wallets_details: item - .connector_wallets_details - .map(|data| { - data.into_inner() - .expose() - .parse_value::( - "ConnectorWalletDetails", - ) - .attach_printable("Unable to deserialize connector_wallets_details") - .change_context(errors::ApiErrorResponse::InternalServerError) - }) - .transpose()?, }; Ok(response) } diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js index 6204c86f44a0..5ed6617ae42d 100644 --- a/cypress-tests/cypress/support/commands.js +++ b/cypress-tests/cypress/support/commands.js @@ -631,6 +631,11 @@ Cypress.Commands.add("connectorListByMid", (globalState) => { logRequestId(response.headers["x-request-id"]); expect(response.headers["content-type"]).to.include("application/json"); expect(response.body).to.be.an("array").and.not.empty; + response.body.forEach((item) => { + expect(item).to.not.have.property("metadata"); + expect(item).to.not.have.property("additional_merchant_data"); + expect(item).to.not.have.property("connector_wallets_details"); + }); }); });