Skip to content

Commit

Permalink
refactor(router): remove metadata, additional_merchant_data and conne…
Browse files Browse the repository at this point in the history
…ctor_wallets_details from connector list api (#6583)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
AkshayaFoiger and hyperswitch-bot[bot] authored Nov 20, 2024
1 parent 0f563b0 commit 5611769
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 116 deletions.
21 changes: 0 additions & 21 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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
Expand Down
21 changes: 0 additions & 21 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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
Expand Down
22 changes: 0 additions & 22 deletions crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1313,10 +1313,6 @@ pub struct MerchantConnectorListResponse {
]))]
pub payment_methods_enabled: Option<Vec<PaymentMethodsEnabled>>,

/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))]
pub metadata: Option<pii::SecretSerdeValue>,

/// 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<bool>,
Expand Down Expand Up @@ -1349,13 +1345,6 @@ pub struct MerchantConnectorListResponse {

#[schema(value_type = ConnectorStatus, example = "inactive")]
pub status: api_enums::ConnectorStatus,

#[schema(value_type = Option<AdditionalMerchantData>)]
pub additional_merchant_data: Option<AdditionalMerchantData>,

/// The connector_wallets_details is used to store wallet details such as certificates and wallet credentials
#[schema(value_type = Option<ConnectorWalletDetails>)]
pub connector_wallets_details: Option<ConnectorWalletDetails>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -1423,10 +1412,6 @@ pub struct MerchantConnectorListResponse {
]))]
pub payment_methods_enabled: Option<Vec<PaymentMethodsEnabled>>,

/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))]
pub metadata: Option<pii::SecretSerdeValue>,

/// A boolean value to indicate if the connector is disabled. By default, its value is false.
#[schema(default = false, example = false)]
pub disabled: Option<bool>,
Expand All @@ -1443,13 +1428,6 @@ pub struct MerchantConnectorListResponse {

#[schema(value_type = ConnectorStatus, example = "inactive")]
pub status: api_enums::ConnectorStatus,

#[schema(value_type = Option<AdditionalMerchantData>)]
pub additional_merchant_data: Option<AdditionalMerchantData>,

/// The connector_wallets_details is used to store wallet details such as certificates and wallet credentials
#[schema(value_type = Option<ConnectorWalletDetails>)]
pub connector_wallets_details: Option<ConnectorWalletDetails>,
}

#[cfg(feature = "v2")]
Expand Down
52 changes: 0 additions & 52 deletions crates/router/src/types/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,6 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
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,
Expand All @@ -1037,31 +1036,6 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
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::<router_types::AdditionalMerchantData>(
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::<api_models::admin::ConnectorWalletDetails>(
"ConnectorWalletDetails",
)
.attach_printable("Unable to deserialize connector_wallets_details")
.change_context(errors::ApiErrorResponse::InternalServerError)
})
.transpose()?,
};
#[cfg(feature = "v2")]
let response = Self {
Expand All @@ -1071,37 +1045,11 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
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::<router_types::AdditionalMerchantData>(
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::<api_models::admin::ConnectorWalletDetails>(
"ConnectorWalletDetails",
)
.attach_printable("Unable to deserialize connector_wallets_details")
.change_context(errors::ApiErrorResponse::InternalServerError)
})
.transpose()?,
};
Ok(response)
}
Expand Down
5 changes: 5 additions & 0 deletions cypress-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});
});

Expand Down

0 comments on commit 5611769

Please sign in to comment.