Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperswitch-bot[bot] committed Aug 20, 2024
1 parent 1f46ecb commit 2e7a9fd
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 32 deletions.
8 changes: 6 additions & 2 deletions crates/diesel_models/src/payment_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ impl From<&PaymentMethodNew> for PaymentMethod {
merchant_id: payment_method_new.merchant_id.clone(),
payment_method_id: payment_method_new.payment_method_id.clone(),
locker_id: payment_method_new.locker_id.clone(),
network_token_requestor_reference_id: payment_method_new.network_token_requestor_reference_id.clone(),
network_token_requestor_reference_id: payment_method_new
.network_token_requestor_reference_id
.clone(),
accepted_currency: payment_method_new.accepted_currency.clone(),
scheme: payment_method_new.scheme.clone(),
token: payment_method_new.token.clone(),
Expand Down Expand Up @@ -401,7 +403,9 @@ impl From<&PaymentMethodNew> for PaymentMethod {
.payment_method_billing_address
.clone(),
network_token_locker_id: payment_method_new.network_token_locker_id.clone(),
network_token_payment_method_data: payment_method_new.network_token_payment_method_data.clone(),
network_token_payment_method_data: payment_method_new
.network_token_payment_method_data
.clone(),
}
}
}
2 changes: 1 addition & 1 deletion crates/router/src/core/payment_methods/cards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ pub async fn add_payment_method_data(
payment_method: req.payment_method,
payment_method_issuer: req.payment_method_issuer,
payment_method_type: req.payment_method_type,
network_token_locker_id: None, // todo!
network_token_locker_id: None, // todo!
network_token_payment_method_data: None, //todo!
};

Expand Down
13 changes: 9 additions & 4 deletions crates/router/src/core/payment_methods/network_tokenization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ pub async fn do_status_check_for_network_token(
&state.into(),
type_name!(payment_method::PaymentMethod),
domain::types::CryptoOperation::DecryptOptional(
payment_method_info.network_token_payment_method_data.clone(),
payment_method_info
.network_token_payment_method_data
.clone(),
),
identifier,
key,
Expand All @@ -452,8 +454,9 @@ pub async fn do_status_check_for_network_token(
PaymentMethodsData::Card(crd) => Some(api::CardDetailFromLocker::from(crd)),
_ => None,
});
let network_token_requestor_reference_id =
payment_method_info.network_token_requestor_reference_id.clone();
let network_token_requestor_reference_id = payment_method_info
.network_token_requestor_reference_id
.clone();

is_token_active(
state,
Expand Down Expand Up @@ -568,7 +571,9 @@ pub async fn delete_network_token_from_locker_and_token_service(
&state,
customer_id,
merchant_id,
network_token_locker_id.as_ref().unwrap_or(&payment_method_id),
network_token_locker_id
.as_ref()
.unwrap_or(&payment_method_id),
)
.await?;
if delete_network_token_from_tokenization_service(
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/core/payments/tokenization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ where
.map(|card_network| card_network.to_string())
}),
network_token_requestor_ref_id, //todo!
network_token_locker_id, //todo!
network_token_locker_id, //todo!
pm_token_data_encrypted.map(Into::into), //todo!
)
.await?;
Expand Down
3 changes: 2 additions & 1 deletion crates/router/src/db/payment_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ impl PaymentMethodInterface for MockDb {
merchant_id: payment_method_new.merchant_id,
payment_method_id: payment_method_new.payment_method_id,
locker_id: payment_method_new.locker_id,
network_token_requestor_reference_id: payment_method_new.network_token_requestor_reference_id,
network_token_requestor_reference_id: payment_method_new
.network_token_requestor_reference_id,
accepted_currency: payment_method_new.accepted_currency,
scheme: payment_method_new.scheme,
token: payment_method_new.token,
Expand Down
47 changes: 24 additions & 23 deletions crates/router/src/types/api/mandates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,31 @@ impl MandateResponseExt for MandateResponse {
// payment_methods::transformers::get_card_detail(&payment_method, card)
// .change_context(errors::ApiErrorResponse::InternalServerError)
// .attach_printable("Failed while getting card details")?
let token_data =
if payment_method.network_token_locker_id.is_some() && state.conf.locker.locker_enabled {
let card = payment_methods::cards::get_card_from_locker(
state,
&payment_method.customer_id,
&payment_method.merchant_id,
payment_method
.network_token_locker_id
.as_ref()
.unwrap_or(&payment_method.payment_method_id),
)
.await?;
let token_data = if payment_method.network_token_locker_id.is_some()
&& state.conf.locker.locker_enabled
{
let card = payment_methods::cards::get_card_from_locker(
state,
&payment_method.customer_id,
&payment_method.merchant_id,
payment_method
.network_token_locker_id
.as_ref()
.unwrap_or(&payment_method.payment_method_id),
)
.await?;

payment_methods::transformers::get_card_detail(&payment_method, card)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while getting card details")?
} else {
payment_methods::cards::get_card_details_without_locker_fallback(
&payment_method,
state,
&key_store,
)
.await?
};
payment_methods::transformers::get_card_detail(&payment_method, card)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while getting card details")?
} else {
payment_methods::cards::get_card_details_without_locker_fallback(
&payment_method,
state,
&key_store,
)
.await?
};

Some(MandateCardDetails::from(token_data).into_inner())
} else {
Expand Down

0 comments on commit 2e7a9fd

Please sign in to comment.