test: add integration tests for Stripe webhook handlers #11

Open
opened 2026-02-20 11:08:47 +00:00 by Clotho · 0 comments
Member

Issue

Per TODO.md (P2-068), integration tests are needed for StripeWebhookController event handlers.

Current Coverage

  • tests/Feature/WebhookTest.php covers BTCPay webhooks
  • No tests for Stripe webhook event handlers

Stripe Events to Test

  1. charge.succeeded - Payment captured
  2. charge.failed - Payment declined
  3. payment_intent.succeeded - Payment intent completed
  4. payment_intent.payment_failed - Payment intent failed
  5. invoice.payment_succeeded - Subscription invoice paid
  6. invoice.payment_failed - Subscription invoice failed
  7. customer.subscription.updated - Subscription modified
  8. customer.subscription.deleted - Subscription cancelled

Required Test Cases

  1. Signature verification: Valid/invalid webhook signatures
  2. Idempotency: Duplicate event handling (webhook_events table)
  3. Order fulfillment: charge.succeeded triggers OrderPaid event
  4. Fraud checks: Radar outcome processing in charge.succeeded
  5. Rate limiting: Per-IP limits via WebhookRateLimiter
  6. Error handling: Malformed payloads, missing order references

Test Location

tests/Feature/StripeWebhookTest.php


Created by discovery scan (issue #2) - References TODO.md P2-068

## Issue Per TODO.md (P2-068), integration tests are needed for `StripeWebhookController` event handlers. ## Current Coverage - ✅ `tests/Feature/WebhookTest.php` covers BTCPay webhooks - ❌ No tests for Stripe webhook event handlers ## Stripe Events to Test 1. **charge.succeeded** - Payment captured 2. **charge.failed** - Payment declined 3. **payment_intent.succeeded** - Payment intent completed 4. **payment_intent.payment_failed** - Payment intent failed 5. **invoice.payment_succeeded** - Subscription invoice paid 6. **invoice.payment_failed** - Subscription invoice failed 7. **customer.subscription.updated** - Subscription modified 8. **customer.subscription.deleted** - Subscription cancelled ## Required Test Cases 1. **Signature verification:** Valid/invalid webhook signatures 2. **Idempotency:** Duplicate event handling (webhook_events table) 3. **Order fulfillment:** charge.succeeded triggers OrderPaid event 4. **Fraud checks:** Radar outcome processing in charge.succeeded 5. **Rate limiting:** Per-IP limits via WebhookRateLimiter 6. **Error handling:** Malformed payloads, missing order references ## Test Location `tests/Feature/StripeWebhookTest.php` --- _Created by discovery scan (issue #2) - References TODO.md P2-068_
Clotho added the
discovery
label 2026-02-20 11:08:47 +00:00
Charon added
PHP
testing
P2
and removed
discovery
labels 2026-02-20 12:17:12 +00:00
Clotho was assigned by Charon 2026-02-20 12:21:06 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:41 +00:00
Sign in to join this conversation.
No description provided.