From fb9aaa40fe028f3d1b20e6b115a2a6fa38fd76d9 Mon Sep 17 00:00:00 2001 From: Anurag Thakur Date: Wed, 6 Nov 2024 17:15:14 +0530 Subject: [PATCH] Fixed clippy --- .../src/payments/payment_intent.rs | 38 ++++++------- .../operations/payment_update_intent.rs | 56 +++++++++---------- 2 files changed, 45 insertions(+), 49 deletions(-) diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs index 3e7befb05a2f..357ad5463772 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs @@ -294,31 +294,32 @@ pub enum PaymentIntentUpdate { routing_algorithm_id: Option, capture_method: Option, authentication_type: Option, - billing_address: Option>>, - shipping_address: Option>>, + billing_address: Box>>>, + shipping_address: Box>>>, customer_id: Option, customer_present: Option, description: Option, - return_url: Option, + return_url: Box>, setup_future_usage: Option, apply_mit_exemption: Option, // TODO: Check if it is supported // payment_method_token: Option, statement_descriptor: Option, - order_details: Option>>, - allowed_payment_method_types: Option, - metadata: Option, - connector_metadata: Option, - feature_metadata: Option, + order_details: Box>>>, + allowed_payment_method_types: Box>, + metadata: Box>, + connector_metadata: Box>, + feature_metadata: Box>, payment_link_enabled: Option, - payment_link_config: Option, + // TODO: check how to use this + // payment_link_config: Box>, request_incremental_authorization: Option, session_expiry: Option, - frm_metadata: Option, + frm_metadata: Box>, request_external_three_ds_authentication: Option, // updated_by is set internally, field not present in request - updated_by: String, + updated_by: Box, }, } @@ -491,7 +492,6 @@ impl From for diesel_models::PaymentIntentUpdateInternal { connector_metadata, feature_metadata, payment_link_enabled, - payment_link_config, request_incremental_authorization, session_expiry, frm_metadata, @@ -513,7 +513,7 @@ impl From for diesel_models::PaymentIntentUpdateInternal { customer_id, customer_present: customer_present.map(|val| val.as_bool()), description, - return_url, + return_url: *return_url, setup_future_usage, apply_mit_exemption: apply_mit_exemption.map(|val| val.as_bool()), statement_descriptor, @@ -525,18 +525,18 @@ impl From for diesel_models::PaymentIntentUpdateInternal { .collect::, _>>() }) .and_then(|r| r.ok()), - allowed_payment_method_types, - metadata, - connector_metadata, - feature_metadata, + allowed_payment_method_types: *allowed_payment_method_types, + metadata: *metadata, + connector_metadata: *connector_metadata, + feature_metadata: *feature_metadata, payment_link_enabled: payment_link_enabled.map(|val| val.as_bool()), request_incremental_authorization, session_expiry, - frm_metadata, + frm_metadata: *frm_metadata, request_external_three_ds_authentication: request_external_three_ds_authentication .map(|val| val.as_bool()), - updated_by, + updated_by: *updated_by, }, } } diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs index 3bd8e9a49bc9..2ac55acafd0a 100644 --- a/crates/router/src/core/payments/operations/payment_update_intent.rs +++ b/crates/router/src/core/payments/operations/payment_update_intent.rs @@ -8,9 +8,7 @@ use common_utils::{ types::MinorUnit, }; use error_stack::ResultExt; -use hyperswitch_domain_models::payments::{ - payment_intent::PaymentIntentUpdate, AmountDetails, PaymentIntent, -}; +use hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate; use masking::Secret; use router_env::{instrument, tracing}; @@ -19,7 +17,7 @@ use crate::{ core::{ errors::{self, RouterResult}, payment_methods::cards::create_encrypted_data, - payments::{self, helpers, operations}, + payments::{self, operations}, }, db::errors::StorageErrorExt, routes::{app::ReqState, SessionState}, @@ -174,32 +172,31 @@ impl GetTracker, PaymentsUpda .map(|details| details.currency()), merchant_reference_id: request.merchant_reference_id.clone(), routing_algorithm_id: request.routing_algorithm_id.clone(), - capture_method: request.capture_method.clone(), - authentication_type: request.authentication_type.clone(), - billing_address, - shipping_address, + capture_method: request.capture_method, + authentication_type: request.authentication_type, + billing_address: Box::new(billing_address), + shipping_address: Box::new(shipping_address), customer_id: request.customer_id.clone(), customer_present: request.customer_present.clone(), description: request.description.clone(), - return_url: request.return_url.clone(), - setup_future_usage: request.setup_future_usage.clone(), + return_url: Box::new(request.return_url.clone()), + setup_future_usage: request.setup_future_usage, apply_mit_exemption: request.apply_mit_exemption.clone(), statement_descriptor: request.statement_descriptor.clone(), - order_details, - allowed_payment_method_types: request.allowed_payment_method_types.clone(), - metadata: request.metadata.clone(), - connector_metadata: request.connector_metadata.clone(), - feature_metadata: request.feature_metadata.clone(), + order_details: Box::new(order_details), + allowed_payment_method_types: Box::new(request.allowed_payment_method_types.clone()), + metadata: Box::new(request.metadata.clone()), + connector_metadata: Box::new(request.connector_metadata.clone()), + feature_metadata: Box::new(request.feature_metadata.clone()), payment_link_enabled: request.payment_link_enabled.clone(), - payment_link_config: request.payment_link_config.clone(), - request_incremental_authorization: request.request_incremental_authorization.clone(), - session_expiry: session_expiry, + request_incremental_authorization: request.request_incremental_authorization, + session_expiry, // TODO: Does frm_metadata need more processing? - frm_metadata: request.frm_metadata.clone(), + frm_metadata: Box::new(request.frm_metadata.clone()), request_external_three_ds_authentication: request .request_external_three_ds_authentication .clone(), - updated_by: storage_scheme.to_string(), + updated_by: Box::new(storage_scheme.to_string()), }; let payment_data = payments::PaymentUpdateData { @@ -296,10 +293,10 @@ impl Domain( &'a self, - state: &SessionState, - payment_data: &mut payments::PaymentUpdateData, - merchant_key_store: &domain::MerchantKeyStore, - storage_scheme: enums::MerchantStorageScheme, + _state: &SessionState, + _payment_data: &mut payments::PaymentUpdateData, + _merchant_key_store: &domain::MerchantKeyStore, + _storage_scheme: enums::MerchantStorageScheme, ) -> CustomResult< ( BoxedOperation<'a, F, PaymentsUpdateIntentRequest, payments::PaymentUpdateData>, @@ -330,12 +327,11 @@ impl Domain( &'a self, - merchant_account: &domain::MerchantAccount, - business_profile: &domain::Profile, - state: &SessionState, - // TODO: do not take the whole payment data here - payment_data: &mut payments::PaymentUpdateData, - mechant_key_store: &domain::MerchantKeyStore, + _merchant_account: &domain::MerchantAccount, + _business_profile: &domain::Profile, + _state: &SessionState, + _payment_data: &mut payments::PaymentUpdateData, + _mechant_key_store: &domain::MerchantKeyStore, ) -> CustomResult { Ok(api::ConnectorCallType::Skip) }