Conversation
Changes: - New DB table: `paddle_transactions` tracks all Paddle webhook events for audit/debugging - Idempotent webhooks: Duplicate events ignored via `eventId` uniqueness constraint - Error handling: Distinguishes expected vs unexpected failures, fails webhook appropriately for Paddle retries - Discord notifications: Success, error, refund, and missing `userId` alerts - DB transaction reuse: Refactored upsertFairyAccess to accept DB connection, renamed wrapper to grantFairyAccessWithDb - Critical path: Fairy access grant is critical - webhook fails if it fails so Paddle retries - ### Change type - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds robust Paddle webhook handling with DB-backed idempotency/logging and refactors fairy-access upsert to reuse a provided DB connection. > > - **Payments (Paddle Webhooks)**: > - Add `paddle_transactions` table with indexes to log events, enforce idempotency (`eventId`), and track processing/errors. > - Implement signature verification, event parsing, and per-event row lock (`FOR UPDATE`) to prevent concurrent handling. > - Process `transaction.completed` by granting fairy access via `upsertFairyAccess(..., db)`; mark processed or store errors. > - Send Discord notifications for success, errors, refunds/cancellations, and missing `userId`. > - **Admin/Invites**: > - Refactor `upsertFairyAccess` to accept a DB; add wrapper `upsertFairyAccessWithDb` and update routes (`grant/remove/enable` and invite redemption) to use it. > - **Schema/Migrations**: > - Add `TlaPaddleTransaction` to shared types and `DB` mapping. > - New migration `028_add_paddle_transactions.sql` creating table and indexes. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c7fb36e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Describe what your pull request does. If you can, add GIFs or images showing the before and after of your change. ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit 9dcd1cd. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )