hyperswitch
hyperswitch copied to clipboard
refactor(payment_methods): store `card_network` in locker
Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
We have card_brand
field in locker which is None
currently for all cards. When a card_network
is sent in the request, we map it to card_brand
and store it in locker.
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?
- Store a payment method in locker with
card_network
field in request.
curl --location 'http://localhost:8080/payment_methods' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: abc' \
--data '{
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_issuer": "Visa",
"card": {
"card_number": "4111111111111111",
"card_exp_month": "04",
"card_exp_year": "25",
"card_holder_name": "John",
"card_network": "Visa"
},
"customer_id": "cus_spLo0JPwK16PTtBuIk1b",
"metadata": {
"city": "NY",
"unit": "245"
}
}'
- Retrieve stored card with
list_customer_payment_methods
and verify whether card_network is populated.
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