Skip to content

Convert webhooks module to TypeScript#1369

Merged
alexanmtz merged 3 commits intomasterfrom
copilot/convert-webhooks-to-typescript
Feb 1, 2026
Merged

Convert webhooks module to TypeScript#1369
alexanmtz merged 3 commits intomasterfrom
copilot/convert-webhooks-to-typescript

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Description

Migrated all 13 JavaScript files in ./src/modules/webhooks to TypeScript with proper type annotations and ES6 module syntax.

Changes

Converted files:

  • constants.ts - Type-safe currency mappings and utility functions
  • Webhook handlers: balanceAvailable, chargeFailed, chargeSucceeded, chargeUpdated, checkoutSessionCompleted, customerSourceCreated
  • Invoice handlers: invoiceCreated, invoiceFinalized, invoicePaid, invoicePaymentFailed, invoicePaymentSucceeded, invoiceUpdated

Technical updates:

  • CommonJS require()/module.exports → ES6 import/export default
  • Added type annotations for event, request, and response parameters
  • Removed duplicate currency keys (gel, mkd, rsd, hrk, uah, kes, sgd) in constants
  • Updated webhook-platform.ts controller imports to reference new TypeScript modules
  • Fixed type errors for error handlers and i18n message parameters
// Before
const models = require('../../models')
module.exports = async function chargeFailed(event, paid, status, req, res) {
  // ...
}

// After
import Models from '../../models'
const models = Models as any
export default async function chargeFailed(event: any, paid: any, status: any, req: any, res: any) {
  // ...
}

TypeScript compilation passes with zero errors. Test suite runs successfully (28 passing).

Thank you for your contribution!


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 1, 2026 19:11
Co-authored-by: alexanmtz <88840+alexanmtz@users.noreply.github.com>
Co-authored-by: alexanmtz <88840+alexanmtz@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert webhooks module to TypeScript Convert webhooks module to TypeScript Feb 1, 2026
Copilot AI requested a review from alexanmtz February 1, 2026 19:16
@alexanmtz alexanmtz marked this pull request as ready for review February 1, 2026 19:19
@dosubot
Copy link

dosubot bot commented Feb 1, 2026

Related Documentation

No published documentation to review for changes on this repository.

Write your first living document

How did I do? Any feedback?  Join Discord

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 1, 2026
@alexanmtz alexanmtz merged commit d0e7f67 into master Feb 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Generation lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants