hyperswitch
hyperswitch copied to clipboard
feat: add an api for retrieving the extended card info from redis
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
This PR adds a new endpoint to retrieve the extended card info (encrypted) stored in redis under a given merchant and payment.
Additional Changes
- [x] 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?
This PR cannot be tested until https://github.com/juspay/hyperswitch/issues/4482 goes in. For local testing I manually set redis entry and tried to hit this newly added endpoint.
- Create merchant account and api key
- Create a payment
- Got the payment id and merchant id and set the redis entry
set merchant_1713971568_pay_1nrIoi2hRnzsy1V2cEv6_extended_card_info "eyJlbmMiOiJBMjU2R0NNIiwidHlwIjoiSldUIiwiYWxnIjoiUlNBLU9BRVAtMjU2In0.sTmCdgRVEz4hZKZ5VxQxq4Dt_V6v9O_96dIXy5F6lzdePOVQ2CwYJQeMhrsFjfk8kZrdOsfeOfFV1FVmxhWjREUvVBZKld5p47HDi4GAEDCX10HH9hIE3SD-IfU4D9riyE2MpIiWoB6xMVNxOvZSWAh2r_-UBgMzAoTAvz7ecmFJopRa8691up8H-Bc7DsVUxfAnEPef9bUIXd2Ej8vWR_XNyx9giPPwhYqYwtcsyyBnpnkyJW26Cc0J-zgbkT-6SPzTfpt_ALUons8nj3uQkmurpaQGdbBj9Zb_BOjK7ytngohnr68Z6ftb0-K41XYMrl11v1Rb-S_enQBstMsyVA.kh4VJ86tKDm5mwh9.WzF74jEuhZMQrYvNgl3e8Ll8YVMXwOizKdgbdBF0i6VWywXKPCIlwD150gtKo15u1_Xvo-151jTAp56E1w3vT2vOUyXWf96MTFytZR3VE4ClLB27AIu_4oUPJ5iG9IVLcMsUxEp4-OM0kNtrpbUY-Fyb3COwZ5AtZ2Fhx_CSiUp1ZdyvoP7XEfkwWgSGU2qW1s9P5VxsaKyFtva7nPo2trJw8-805P3Qtdm-27XvFYNKcTRYUJ9XBDn-cinbo-qrqe2XFQ5lh7fClhHK2H_hiJdk_WBq4iZKBK-XJpeDjCCNtiAVDGw.e2duyijt4Py7nmU-1PygSg"
- Hit the endpoint to retrieve the payload
curl --location 'http://localhost:8080/payments/pay_1nrIoi2hRnzsy1V2cEv6/extended_card_info' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_KM55eCA115eJaTBYK6Z8DYLwI6EghXzZDUb9M1RzE6Ji1jMEhs71C8c43ndOubXw' \
--data ''
- If another merchant tries to retrieve the same payload by passing same payment_id, throw 4xx
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