Skip to content

Commit

Permalink
chore: fix clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayaFoiger committed Dec 20, 2024
1 parent 71f623b commit f956a62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
9 changes: 5 additions & 4 deletions crates/hyperswitch_interfaces/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,9 @@ pub trait ConnectorValidation: ConnectorCommon + ConnectorSpecifications {
pmt: Option<PaymentMethodType>,
) -> CustomResult<(), errors::ConnectorError> {
let capture_method = capture_method.unwrap_or_default();
let default_capture_method =
vec![CaptureMethod::Automatic, CaptureMethod::SequentialAutomatic];
let is_default_capture_method =
[CaptureMethod::Automatic, CaptureMethod::SequentialAutomatic]
.contains(&capture_method);
let is_feature_supported = match self.get_supported_payment_methods() {
Some(supported_payment_methods) => {
let connector_payment_method_type_info = get_connector_payment_method_type_info(
Expand All @@ -450,9 +451,9 @@ pub trait ConnectorValidation: ConnectorCommon + ConnectorSpecifications {
.supported_capture_methods
.contains(&capture_method)
})
.unwrap_or_else(|| default_capture_method.contains(&capture_method))
.unwrap_or_else(|| is_default_capture_method)
}
None => default_capture_method.contains(&capture_method),
None => is_default_capture_method,
};

if is_feature_supported {
Expand Down
15 changes: 9 additions & 6 deletions crates/router/src/routes/feature_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ pub async fn generate_feature_matrix(
.into_iter()
.filter_map(|connector_name| {
api_types::ConnectorData::convert_connector(&connector_name.to_string())
.inspect_err(|_| {
router_env::logger::warn!("Failed to fetch {:?} details", connector_name)
})
.ok()
.and_then(|connector| {
build_connector_feature_details(
Expand Down Expand Up @@ -79,12 +82,12 @@ fn build_connector_feature_details(
let connector_integration_features = connector.get_supported_payment_methods();
connector_integration_features.map(|connector_integration_feature_data| {
let supported_payment_methods = connector_integration_feature_data
.into_iter()
.iter()
.flat_map(|(payment_method, supported_payment_method_types)| {
build_payment_method_wise_feature_details(
state,
&connector_name,
payment_method,
*payment_method,
supported_payment_method_types,
)
})
Expand All @@ -97,7 +100,7 @@ fn build_connector_feature_details(
feature_matrix::ConnectorFeatureMatrixResponse {
name: connector_name,
description: connector_about.map(|about| about.description.clone()),
category: connector_about.map(|about| about.connector_type.clone()),
category: connector_about.map(|about| about.connector_type),
supported_webhook_flows,
supported_payment_methods,
}
Expand All @@ -107,11 +110,11 @@ fn build_connector_feature_details(
fn build_payment_method_wise_feature_details(
state: &app::SessionState,
connector_name: &str,
payment_method: &enums::PaymentMethod,
payment_method: enums::PaymentMethod,
supported_payment_method_types: &PaymentMethodTypeMetadata,
) -> Vec<feature_matrix::SupportedPaymentMethod> {
supported_payment_method_types
.into_iter()
.iter()
.map(|(payment_method_type, feature_metadata)| {
let payment_method_type_config =
state
Expand All @@ -134,7 +137,7 @@ fn build_payment_method_wise_feature_details(
payment_method_type_config.and_then(|config| config.currency.clone());

feature_matrix::SupportedPaymentMethod {
payment_method: *payment_method,
payment_method,
payment_method_type: *payment_method_type,
mandates: feature_metadata.mandates,
refunds: feature_metadata.refunds,
Expand Down

0 comments on commit f956a62

Please sign in to comment.