refactor: centralize V2 delete payment method endpoint
Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Centralizes the Delete Payment Method V2 endpoint by moving it from PaymentHelpersV2.res into APIUtils.res, improving maintainability and consistency with V1 endpoints.
Fixes https://github.com/juspay/hyperswitch/issues/9317
📋 Changes Made
APIUtils.res
- ✅ Added
DeletePaymentMethodV2variant toapiCallV2type - ✅ Added
pmSessionId: option<string>toapiParamstype - ✅ Extended
generateApiUrlfunction to handle V2 update payment method path - ✅ Organized V2 endpoints under clear case pattern matching
PaymentHelpersV2.res
- ✅ Replaced hardcoded URL
- ✅ Removed direct endpoint construction
How did you test it?
Only build test
Checklist
- [x] I ran
npm run re:build - [x] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
Hey @Krriishhhhhh you have added the usage of generateApiUrl correctly, can you also please add how fetchApiWithLogging is used, for reference you can see fetchPaymentMethodList in PaymentHelpers.res
@sakksham7 i made the changes , also while running npm run re:build i am getting these warnings
I am unsure whether to remove that unwanted code or not .
Hey @Krriishhhhhh , Thank you for your contribution! Please fill this form: Link
Hey @AbhishekChorotiya , thanks for the review , just wanted to ask what is the purpose of the form?