Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(payment_methods): set requires-cvv to false for cards in customer payment methods list if making an off-session payment #4075

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/router/src/core/payment_methods/cards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2736,6 +2736,16 @@ pub async fn list_customer_payment_method(
}
};

let off_session_payment_flag = payment_intent
.as_ref()
.map(|pi| {
matches!(
pi.setup_future_usage,
Some(common_enums::FutureUsage::OffSession)
)
})
.unwrap_or(false);

let customer = db
.find_customer_by_customer_id_merchant_id(
customer_id,
Expand Down Expand Up @@ -2872,7 +2882,8 @@ pub async fn list_customer_payment_method(
bank_transfer: pmd,
bank: bank_details,
surcharge_details: None,
requires_cvv,
requires_cvv: requires_cvv
&& !(off_session_payment_flag && pm.connector_mandate_details.is_some()),
last_used_at: Some(pm.last_used_at),
default_payment_method_set: customer.default_payment_method_id.is_some()
&& customer.default_payment_method_id == Some(pm.payment_method_id),
Expand Down
Loading