hyperswitch
hyperswitch copied to clipboard
fix(locker): handle card duplication in payouts flow
Type of Change
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Explained in #3950
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
Note - DM for postman collection
For ensuring card duplication is handled in payouts flow, we use below procedure (assuming merchant accounts and connector accounts are created)
- Create a new customer
- Save a card for this customer using /payment_methods endpoint
- Create a new payout for this customer using the same card number
- Payouts flow would try to persist these details in locker
- Test # 1 - listing customer's PMs should return a single PM
- Create a new payout using SPM
- Payout flow would try to persist these details again
- Test # 2 - listing customer's PMs should return a single PM
- Try to save the same card details for this user using /payment_methods again
- Test # 3 - listing customer's PMs should return a single PM
Above test cases are present in postman collection.
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a CHANGELOG entry if applicable