Skip to content

feat: filter and parse crypto payment_intent events#51

Merged
geminimir merged 1 commit intogeminimir:mainfrom
techydavepy:feat/filter-parse-crypto-events
Mar 13, 2026
Merged

feat: filter and parse crypto payment_intent events#51
geminimir merged 1 commit intogeminimir:mainfrom
techydavepy:feat/filter-parse-crypto-events

Conversation

@techydavepy
Copy link
Contributor

Summary

After signature verification, filter Stripe webhook events to only process crypto payment method types (payment_intent.succeeded, payment_intent.processing, payment_intent.payment_failed). Extract chain, token, amount, and address metadata, converting Stripe cents to microUSDC for storage in the stripe_payment_events table.

Changes

  • Add event-store.tsEventStore interface with insertEvent / eventExists for DB abstraction
  • Add event-processor.tsprocessStripeEvent() that filters by event type, checks for crypto payment method, rejects duplicates by event ID, parses amount (cents → microUSDC), currency, chain hint, and token hint from metadata
  • Update webhook.ts — call processStripeEvent() after signature verification when an EventStore is provided
  • Add 8 tests covering all acceptance criteria and edge cases

How to Test

  1. npm ci
  2. npm run typecheck
  3. npm test

Tests

  • Tests added/updated
  • All tests pass (npm test) — 11 tests across 2 suites
  • Lint passes (npm run lint)
  • Type-check passes (npm run typecheck)
  • Formatting passes (npm run format:check) — all warnings are pre-existing, no issues in changed files

Checklist

  • No secrets or credentials committed
  • Migrations run cleanly up and down — no new migrations in this PR
  • Docker Compose starts without errors — no Docker changes in this PR

Related Issues

Closes #7

Made with Cursor

Add event processor that filters verified Stripe webhooks to only
process crypto payment_intent events (succeeded, processing, failed).
Extracts amount (converted to microUSDC), currency, chain hint, and
token hint from metadata. Duplicate event IDs are silently dropped
for idempotency.

Closes geminimir#7

Made-with: Cursor
@techydavepy techydavepy force-pushed the feat/filter-parse-crypto-events branch from 76021f2 to 43c9f93 Compare March 13, 2026 00:05
@geminimir geminimir merged commit 2d9d294 into geminimir:main Mar 13, 2026
1 check passed
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.

Filter and parse crypto-type payment_intent events

2 participants