-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(payment_method): add logic for setup_future_usage downgrade and add filter based on zero mandate config #7775
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, added some nits and comments
crates/router/src/configs/defaults/payment_connector_required_fields.rs
Outdated
Show resolved
Hide resolved
crates/router/src/configs/defaults/payment_connector_required_fields.rs
Outdated
Show resolved
Hide resolved
crates/router/src/configs/defaults/payment_connector_required_fields.rs
Outdated
Show resolved
Hide resolved
crates/router/src/configs/defaults/payment_connector_required_fields.rs
Outdated
Show resolved
Hide resolved
crates/router/src/configs/defaults/payment_connector_required_fields.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
@@ -4500,6 +4500,7 @@ impl AttemptType { | |||
extended_authorization_applied: None, | |||
capture_before: None, | |||
card_discovery: None, | |||
setup_future_usage: old_payment_attempt.setup_future_usage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retry is this use the old attempts setup future usage or this should be none and calculate actual future usage while doing the next attempt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For each new payment_attempt of retry, the setup_future_usage will be picked from payment_intent since retry calls call_connector_service on every attempt meaning the downgrade logic is ran everytime.
cypress-tests/cypress/e2e/spec/Payment/00014-SaveCardFlow.cy.js
Outdated
Show resolved
Hide resolved
cypress-tests/cypress/e2e/spec/Payment/00015-ZeroAuthMandate.cy.js
Outdated
Show resolved
Hide resolved
…acilitapay-pix-pmt * 'main' of github.com:juspay/hyperswitch: (21 commits) refactor(required_fields): move pm required fields to pm crate (#7539) fix(connector): [noon] address `next_action_url` being `null` for cards in 3ds payment (#7832) refactor(middleware): add middleware to record metrics for request count and duration (#7803) chore(version): 2025.04.18.0 chore(postman): update Postman collection files fix(connector): [globalpay] handle edge case where currency comes as empty upon payment decline (#7812) refactor(cypress-v2): change `Authorization` and `payment_methods_enabled` for v2 cypress tests (#7805) fix(connector): [Cybersource] send type selection indicator for co-batch cards (#7828) feat(payment_method): add logic for setup_future_usage downgrade and add filter based on zero mandate config (#7775) refactor(accounts): move dashboard_metadata table to accounts_schema and point v2 to v1 dashboard_metadata (#7793) chore(analytics): opensearch client creation based on config (#7810) ci(postman): update assertion error message for nmi collection (#7765) feat: add primary key not null query to generic filter function (#7785) chore(version): 2025.04.17.0 chore: change payment method files ownership to `hyperswitch-payment-methods` (#7808) feat(vsaas): modify api key auth to support vsaas cases (#7593) ci(cypress): verify mandate id to be `null` if payment id not `succeeded` (#7749) feat(connector): [chargebee] consumes required fields to support transaction monitoring (#7774) ci(configs): remove vault private key from configs (#7825) chore(version): 2025.04.16.0 ...
Type of Change
Description
setup_future_usage
isoff_session
for a payment method, downgrade it toon_session
for that payment methodsetup_future_usage
field to payment_attempt to keep track of it for every attempt madeBelow contains the new filtering logic:

Below represents the PaymentType for each payment_method_type during list call based the following parameters:

Additional Changes
Motivation and Context
How did you test it?
Testing Payment Method List for Merchant:
Curls:
Scenarios:
Case 1: Non-zero amount and setup_future_usage as on_session
Result:
Case 2: Non-zero amount and setup_future_usage as off_session
Result:
Case 3: Zero amount and setup_future_usage as on_session
Result:
Case 4: Zero amount and setup_future_usage as off_session
Result:
Testing setup_future_usage downgrade logic:
Curls:
Payment Create+Confirm:
Scenarios:
Case 1: Create a payment with cards for Adyen with setup_future_usage as off_session
Result:
Reason:
Case 2: Create a payment with gift cards for Adyen with setup_future_usage as off_session
Result:
Reason:
Checklist
cargo +nightly fmt --all
cargo clippy