Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikke Srujan authored and Chikke Srujan committed Nov 7, 2024
1 parent 9d1037d commit bb7e4ac
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions crates/router/src/core/payment_methods/cards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2753,15 +2753,20 @@ pub async fn list_payment_methods(
.await
.transpose()?;
let setup_future_usage = payment_intent.as_ref().and_then(|pi| pi.setup_future_usage);
let is_cit_transaction = payment_attempt
.as_ref()
.and_then(|pa| Some(pa.mandate_details.is_some()))
.or_else(|| {
setup_future_usage
.map(|future_usage| future_usage == common_enums::FutureUsage::OffSession)
})
.unwrap_or(false);
println!("$$$$$is_cit_transation: {:?}",is_cit_transaction );

Check warning on line 2764 in crates/router/src/core/payment_methods/cards.rs

View workflow job for this annotation

GitHub Actions / Spell check

"transation" should be "transition" or "transaction" or "translation".
let payment_type = payment_attempt.as_ref().map(|pa| {
let amount = api::Amount::from(pa.net_amount.get_order_amount());
let mandate_type = if pa.mandate_id.is_some() {
Some(api::MandateTransactionType::RecurringMandateTransaction)
} else if pa.mandate_details.is_some()
|| setup_future_usage
.map(|future_usage| future_usage == common_enums::enums::FutureUsage::OffSession)
.unwrap_or(false)
{
} else if is_cit_transaction {
Some(api::MandateTransactionType::NewMandateTransaction)
} else {
None
Expand Down Expand Up @@ -3269,20 +3274,13 @@ pub async fn list_payment_methods(
.get(&connector_variant)
.map(|required_fields_final| {
let mut required_fields_hs = required_fields_final.common.clone();
if let Some(pa) = payment_attempt.as_ref() {
let is_cit_transaction = pa.mandate_details.is_some()
|| setup_future_usage
.map(|future_usage| future_usage == common_enums::enums::FutureUsage::OffSession)
.unwrap_or(false);
if is_cit_transaction {
required_fields_hs
.extend(required_fields_final.mandate.clone());
} else {
required_fields_hs
.extend(required_fields_final.non_mandate.clone());
}
}

required_fields_hs = should_collect_shipping_or_billing_details_from_wallet_connector(
&payment_method,
element.payment_experience.as_ref(),
Expand Down

0 comments on commit bb7e4ac

Please sign in to comment.