feat(payment_method): add logic for setup_future_usage downgrade and add filter based on zero mandate config#7775
Merged
likhinbopanna merged 17 commits intomainfrom Apr 17, 2025
Merged
Conversation
kashif-m
reviewed
Apr 10, 2025
Contributor
kashif-m
left a comment
There was a problem hiding this comment.
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
Aprabhat19
reviewed
Apr 11, 2025
tsdk02
previously approved these changes
Apr 15, 2025
jarnura
requested changes
Apr 15, 2025
| extended_authorization_applied: None, | ||
| capture_before: None, | ||
| card_discovery: None, | ||
| setup_future_usage: old_payment_attempt.setup_future_usage, |
Member
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
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.
kashif-m
previously approved these changes
Apr 16, 2025
kashif-m
reviewed
Apr 17, 2025
jarnura
approved these changes
Apr 17, 2025
kashif-m
approved these changes
Apr 17, 2025
tsdk02
approved these changes
Apr 17, 2025
prasunna09
approved these changes
Apr 17, 2025
pixincreate
added a commit
that referenced
this pull request
Apr 21, 2025
…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 ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
setup_future_usageisoff_sessionfor a payment method, downgrade it toon_sessionfor that payment methodsetup_future_usagefield 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 --allcargo clippy