Skip to content

refactor: deduplicate payment route handlers#283

Open
Benalex8797 wants to merge 1 commit into
nathydre21:mainfrom
Benalex8797:refactor/deduplicate-payment-routes
Open

refactor: deduplicate payment route handlers#283
Benalex8797 wants to merge 1 commit into
nathydre21:mainfrom
Benalex8797:refactor/deduplicate-payment-routes

Conversation

@Benalex8797

@Benalex8797 Benalex8797 commented Jun 17, 2026

Copy link
Copy Markdown

closes #271

Summary

Extracts shared logic from 6 duplicated payment route handlers into 2 reusable functions.

Changes

  • handlePayment(): shared by POST /api/v1/payment, /api/v2/payment, /api/payment
  • handleMultiProviderPayment(): shared by POST /api/v1/payment/multi-provider, /api/v2/payment/multi-provider, /api/payment/multi-provider
  • Removed unnecessary (result as any) casts from legacy handler

Result

  • 115 fewer lines, zero behaviour change
  • All API response formats, status codes, and headers preserved

- Extract handlePayment() shared by v1, v2, and legacy /api/payment routes
- Extract handleMultiProviderPayment() shared by v1, v2, and legacy routes
- Remove unnecessary (result as any) casts from legacy payment handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor Duplicate Payment Route Logic in Server.ts

1 participant