Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript
674 B
Raw Blame
import { Database } from 'bun:sqlite';
import { applyPaidProjection, createBoundUserLookup, readOrdersInBatch, WebhookDispatcher } from './platform';

// The current invoice.paid path updates the local projection and audit only.
// The proposed payment_intent.succeeded PaymentService and email path do not exist.
export function existingDispatcher(db: Database): WebhookDispatcher {
  const dispatcher = new WebhookDispatcher();
  dispatcher.register('invoice.paid', request => applyPaidProjection(db, request, {
    lookupUser: createBoundUserLookup(db, request.accountId),
    readOrders: readOrdersInBatch,
    afterCommit: async () => {},
  }));
  return dispatcher;
}