Skip to content

Commit

Permalink
Fixed clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuthaDev committed Nov 6, 2024
1 parent 5465965 commit fb9aaa4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 49 deletions.
38 changes: 19 additions & 19 deletions crates/hyperswitch_domain_models/src/payments/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,31 +294,32 @@ pub enum PaymentIntentUpdate {
routing_algorithm_id: Option<id_type::RoutingId>,
capture_method: Option<common_enums::CaptureMethod>,
authentication_type: Option<common_enums::AuthenticationType>,
billing_address: Option<Encryptable<Secret<Address>>>,
shipping_address: Option<Encryptable<Secret<Address>>>,
billing_address: Box<Option<Encryptable<Secret<Address>>>>,
shipping_address: Box<Option<Encryptable<Secret<Address>>>>,
customer_id: Option<id_type::CustomerId>,
customer_present: Option<common_enums::PresenceOfCustomerDuringPayment>,
description: Option<common_utils::types::Description>,
return_url: Option<common_utils::types::Url>,
return_url: Box<Option<common_utils::types::Url>>,
setup_future_usage: Option<storage_enums::FutureUsage>,
apply_mit_exemption: Option<common_enums::MitExemptionRequest>,
// TODO: Check if it is supported
// payment_method_token: Option<String>,
statement_descriptor: Option<StatementDescriptor>,
order_details: Option<Vec<Secret<OrderDetailsWithAmount>>>,
allowed_payment_method_types: Option<pii::SecretSerdeValue>,
metadata: Option<pii::SecretSerdeValue>,
connector_metadata: Option<pii::SecretSerdeValue>,
feature_metadata: Option<pii::SecretSerdeValue>,
order_details: Box<Option<Vec<Secret<OrderDetailsWithAmount>>>>,
allowed_payment_method_types: Box<Option<pii::SecretSerdeValue>>,
metadata: Box<Option<pii::SecretSerdeValue>>,
connector_metadata: Box<Option<pii::SecretSerdeValue>>,
feature_metadata: Box<Option<pii::SecretSerdeValue>>,
payment_link_enabled: Option<common_enums::EnablePaymentLinkRequest>,
payment_link_config: Option<api_models::admin::PaymentLinkConfigRequest>,
// TODO: check how to use this
// payment_link_config: Box<Option<api_models::admin::PaymentLinkConfigRequest>>,
request_incremental_authorization: Option<common_enums::RequestIncrementalAuthorization>,
session_expiry: Option<PrimitiveDateTime>,
frm_metadata: Option<pii::SecretSerdeValue>,
frm_metadata: Box<Option<pii::SecretSerdeValue>>,
request_external_three_ds_authentication: Option<External3dsAuthenticationRequest>,

// updated_by is set internally, field not present in request
updated_by: String,
updated_by: Box<String>,
},
}

Expand Down Expand Up @@ -491,7 +492,6 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
connector_metadata,
feature_metadata,
payment_link_enabled,
payment_link_config,
request_incremental_authorization,
session_expiry,
frm_metadata,
Expand All @@ -513,7 +513,7 @@ impl From<PaymentIntentUpdate> 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,
Expand All @@ -525,18 +525,18 @@ impl From<PaymentIntentUpdate> for diesel_models::PaymentIntentUpdateInternal {
.collect::<Result<Vec<_>, _>>()
})
.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,
},
}
}
Expand Down
56 changes: 26 additions & 30 deletions crates/router/src/core/payments/operations/payment_update_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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},
Expand Down Expand Up @@ -174,32 +172,31 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentUpdateData<F>, 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 {
Expand Down Expand Up @@ -296,10 +293,10 @@ impl<F: Clone + Send> Domain<F, PaymentsUpdateIntentRequest, payments::PaymentUp
#[instrument(skip_all)]
async fn get_customer_details<'a>(
&'a self,
state: &SessionState,
payment_data: &mut payments::PaymentUpdateData<F>,
merchant_key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
_state: &SessionState,
_payment_data: &mut payments::PaymentUpdateData<F>,
_merchant_key_store: &domain::MerchantKeyStore,
_storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, PaymentsUpdateIntentRequest, payments::PaymentUpdateData<F>>,
Expand Down Expand Up @@ -330,12 +327,11 @@ impl<F: Clone + Send> Domain<F, PaymentsUpdateIntentRequest, payments::PaymentUp
#[instrument(skip_all)]
async fn perform_routing<'a>(
&'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<F>,
mechant_key_store: &domain::MerchantKeyStore,
_merchant_account: &domain::MerchantAccount,
_business_profile: &domain::Profile,
_state: &SessionState,
_payment_data: &mut payments::PaymentUpdateData<F>,
_mechant_key_store: &domain::MerchantKeyStore,
) -> CustomResult<api::ConnectorCallType, errors::ApiErrorResponse> {
Ok(api::ConnectorCallType::Skip)
}
Expand Down

0 comments on commit fb9aaa4

Please sign in to comment.