Add integration test: webhook checkout.session.completed creates subscription in DB #652

Open
opened 2026-04-11 09:04:41 -04:00 by pook · 0 comments
Owner

Write an integration test following existing test patterns that: (1) Seeds a user and stripe_customer record in the test database, (2) Sends POST to /api/billing/webhook with a mock Stripe checkout.session.completed event payload with customer ID, subscription ID, and price ID, (3) Signs the payload with the test webhook secret, (4) Asserts 200 response, (5) Queries stripe_subscriptions table and verifies a row with status='active', correct stripe_subscription_id, matching customer_id. This validates the critical billing path for compliance document generation. Without it, paying customers cannot generate documents. Depends on the stripe_customers/subscriptions migration. Acceptance: Test passes, covers subscription creation via webhook happy path.


Generated by CEO Planner (priority: 2)

Write an integration test following existing test patterns that: (1) Seeds a user and stripe_customer record in the test database, (2) Sends POST to /api/billing/webhook with a mock Stripe `checkout.session.completed` event payload with customer ID, subscription ID, and price ID, (3) Signs the payload with the test webhook secret, (4) Asserts 200 response, (5) Queries stripe_subscriptions table and verifies a row with status='active', correct stripe_subscription_id, matching customer_id. This validates the critical billing path for compliance document generation. Without it, paying customers cannot generate documents. Depends on the stripe_customers/subscriptions migration. Acceptance: Test passes, covers subscription creation via webhook happy path. --- *Generated by CEO Planner (priority: 2)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#652
No description provided.