hyperswitch-web icon indicating copy to clipboard operation
hyperswitch-web copied to clipboard

refactor: centralize V2 delete payment method endpoint

Open Krriishhhhhh opened this issue 2 months ago • 5 comments

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 DeletePaymentMethodV2 variant to apiCallV2 type
  • ✅ Added pmSessionId: option<string> to apiParams type
  • ✅ Extended generateApiUrl function 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

Krriishhhhhh avatar Oct 01 '25 13:10 Krriishhhhhh

Review changes with  SemanticDiff

semanticdiff-com[bot] avatar Oct 01 '25 13:10 semanticdiff-com[bot]

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 avatar Oct 24 '25 09:10 sakksham7

@sakksham7 i made the changes , also while running npm run re:build i am getting these warnings

Screenshot from 2025-10-24 22-57-59

I am unsure whether to remove that unwanted code or not .

Krriishhhhhh avatar Oct 24 '25 17:10 Krriishhhhhh

Hey @Krriishhhhhh , Thank you for your contribution! Please fill this form: Link

AbhishekChorotiya avatar Oct 31 '25 11:10 AbhishekChorotiya

Hey @AbhishekChorotiya , thanks for the review , just wanted to ask what is the purpose of the form?

Krriishhhhhh avatar Nov 03 '25 18:11 Krriishhhhhh