Skip to content

Commit df15cef

Browse files
Akshay SAkshay S
authored andcommitted
resolved clippy errors
1 parent 7342046 commit df15cef

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

crates/diesel_models/src/payment_method.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ impl PaymentMethodUpdateInternal {
173173
PaymentMethod {
174174
metadata: metadata.map_or(source.metadata, |v| Some(v.into())),
175175
payment_method_data: payment_method_data
176-
.map_or(source.payment_method_data, |v| Some(v)),
176+
.map_or(source.payment_method_data,Some),
177177
last_used_at: last_used_at.unwrap_or(source.last_used_at),
178178
network_transaction_id: network_transaction_id
179-
.map_or(source.network_transaction_id, |v| Some(v)),
179+
.map_or(source.network_transaction_id, Some),
180180
status: status.unwrap_or(source.status),
181181
connector_mandate_details: connector_mandate_details
182-
.map_or(source.connector_mandate_details, |v| Some(v)),
182+
.map_or(source.connector_mandate_details, Some),
183183
..source
184184
}
185185
}
@@ -262,21 +262,21 @@ impl From<&PaymentMethodNew> for PaymentMethod {
262262
issuer_name: payment_method_new.issuer_name.clone(),
263263
issuer_country: payment_method_new.issuer_country.clone(),
264264
payer_country: payment_method_new.payer_country.clone(),
265-
is_stored: payment_method_new.is_stored.clone(),
265+
is_stored: payment_method_new.is_stored,
266266
swift_code: payment_method_new.swift_code.clone(),
267267
direct_debit_token: payment_method_new.direct_debit_token.clone(),
268-
created_at: payment_method_new.created_at.clone(),
269-
last_modified: payment_method_new.last_modified.clone(),
270-
payment_method: payment_method_new.payment_method.clone(),
271-
payment_method_type: payment_method_new.payment_method_type.clone(),
268+
created_at: payment_method_new.created_at,
269+
last_modified: payment_method_new.last_modified,
270+
payment_method: payment_method_new.payment_method,
271+
payment_method_type: payment_method_new.payment_method_type,
272272
payment_method_issuer: payment_method_new.payment_method_issuer.clone(),
273273
payment_method_issuer_code: payment_method_new.payment_method_issuer_code.clone(),
274274
metadata: payment_method_new.metadata.clone(),
275275
payment_method_data: payment_method_new.payment_method_data.clone(),
276-
last_used_at: payment_method_new.last_used_at.clone(),
276+
last_used_at: payment_method_new.last_used_at,
277277
connector_mandate_details: payment_method_new.connector_mandate_details.clone(),
278278
customer_acceptance: payment_method_new.customer_acceptance.clone(),
279-
status: payment_method_new.status.clone(),
279+
status: payment_method_new.status,
280280
network_transaction_id: payment_method_new.network_transaction_id.clone(),
281281
}
282282
}

crates/diesel_models/src/query/payment_method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl PaymentMethod {
161161
>(
162162
conn,
163163
dsl::payment_method_id.eq(self.payment_method_id.to_owned()),
164-
payment_method::PaymentMethodUpdateInternal::from(payment_method),
164+
payment_method,
165165
)
166166
.await
167167
{

crates/router/src/core/payment_methods/cards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub async fn create_payment_method(
8989
key_store: &domain::MerchantKeyStore,
9090
connector_mandate_details: Option<serde_json::Value>,
9191
network_transaction_id: Option<String>,
92-
storage_scheme: enums::MerchantStorageScheme,
92+
storage_scheme: MerchantStorageScheme,
9393
) -> errors::CustomResult<storage::PaymentMethod, errors::ApiErrorResponse> {
9494
let customer = db
9595
.find_customer_by_customer_id_merchant_id(customer_id, merchant_id, key_store)

crates/router/src/core/payments/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ pub async fn retrieve_card_with_permanent_token(
16871687
payment_method_id: &str,
16881688
payment_intent: &PaymentIntent,
16891689
card_token_data: Option<&CardToken>,
1690-
merchant_key_store: &domain::MerchantKeyStore,
1690+
_merchant_key_store: &domain::MerchantKeyStore,
16911691
storage_scheme: enums::MerchantStorageScheme,
16921692
) -> RouterResult<api::PaymentMethodData> {
16931693
let customer_id = payment_intent

crates/router/src/db/payment_method.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use common_utils::fallback_reverse_lookup_not_found;
22
use diesel_models::{kv, payment_method::PaymentMethodUpdateInternal};
3-
use error_stack::{report, IntoReport, ResultExt};
3+
use error_stack::{report, ResultExt};
44
use redis_interface::HsetnxReply;
55
use router_env::{instrument, tracing};
66
use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey};
@@ -283,13 +283,12 @@ impl PaymentMethodInterface for Store {
283283
let key_str = key.to_string();
284284
let field = format!("payment_method_id_{}", payment_method.payment_method_id);
285285

286-
let p_update: diesel_models::PaymentMethodUpdateInternal =
286+
let p_update: PaymentMethodUpdateInternal =
287287
payment_method_update.into();
288288
let updated_payment_method =
289289
p_update.clone().apply_changeset(payment_method.clone());
290290

291291
let redis_value = serde_json::to_string(&updated_payment_method)
292-
.into_report()
293292
.change_context(errors::StorageError::SerializationFailed)?;
294293

295294
let redis_entry = kv::TypedSql {
@@ -382,6 +381,7 @@ impl PaymentMethodInterface for Store {
382381
async fn find_payment_method(
383382
&self,
384383
payment_method_id: &str,
384+
_storage_scheme: MerchantStorageScheme
385385
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
386386
let conn = connection::pg_connection_read(self).await?;
387387
storage::PaymentMethod::find_by_payment_method_id(&conn, payment_method_id)
@@ -393,6 +393,7 @@ impl PaymentMethodInterface for Store {
393393
async fn find_payment_method_by_locker_id(
394394
&self,
395395
locker_id: &str,
396+
_storage_scheme: MerchantStorageScheme,
396397
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
397398
let conn = connection::pg_connection_read(self).await?;
398399
storage::PaymentMethod::find_by_locker_id(&conn, locker_id)
@@ -422,6 +423,7 @@ impl PaymentMethodInterface for Store {
422423
async fn insert_payment_method(
423424
&self,
424425
payment_method_new: storage::PaymentMethodNew,
426+
_storage_scheme: MerchantStorageScheme
425427
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
426428
let conn = connection::pg_connection_write(self).await?;
427429
payment_method_new
@@ -435,6 +437,7 @@ impl PaymentMethodInterface for Store {
435437
&self,
436438
payment_method: storage::PaymentMethod,
437439
payment_method_update: storage::PaymentMethodUpdate,
440+
_storage_scheme: MerchantStorageScheme
438441
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
439442
let conn = connection::pg_connection_write(self).await?;
440443
payment_method
@@ -502,7 +505,7 @@ impl PaymentMethodInterface for MockDb {
502505
async fn find_payment_method(
503506
&self,
504507
payment_method_id: &str,
505-
storage_scheme: MerchantStorageScheme,
508+
_storage_scheme: MerchantStorageScheme,
506509
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
507510
let payment_methods = self.payment_methods.lock().await;
508511
let payment_method = payment_methods
@@ -522,7 +525,7 @@ impl PaymentMethodInterface for MockDb {
522525
async fn find_payment_method_by_locker_id(
523526
&self,
524527
locker_id: &str,
525-
storage_scheme: MerchantStorageScheme,
528+
_storage_scheme: MerchantStorageScheme,
526529
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
527530
let payment_methods = self.payment_methods.lock().await;
528531
let payment_method = payment_methods
@@ -560,7 +563,7 @@ impl PaymentMethodInterface for MockDb {
560563
async fn insert_payment_method(
561564
&self,
562565
payment_method_new: storage::PaymentMethodNew,
563-
storage_scheme: MerchantStorageScheme,
566+
_storage_scheme: MerchantStorageScheme,
564567
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
565568
let mut payment_methods = self.payment_methods.lock().await;
566569

@@ -674,7 +677,7 @@ impl PaymentMethodInterface for MockDb {
674677
&self,
675678
payment_method: storage::PaymentMethod,
676679
payment_method_update: storage::PaymentMethodUpdate,
677-
storage_scheme: MerchantStorageScheme,
680+
_storage_scheme: MerchantStorageScheme,
678681
) -> CustomResult<storage::PaymentMethod, errors::StorageError> {
679682
let pm_update_res = self
680683
.payment_methods

0 commit comments

Comments
 (0)