Skip to content

Delegate webhook pipeline to fluent WebhookProcessor#8

Merged
sandervanhooft merged 7 commits intomainfrom
sandervanhooft/pull-latest
Mar 13, 2026
Merged

Delegate webhook pipeline to fluent WebhookProcessor#8
sandervanhooft merged 7 commits intomainfrom
sandervanhooft/pull-latest

Conversation

@sandervanhooft
Copy link
Copy Markdown
Member

Summary

What changed

Controller: Now injects WebhookProcessor only, delegates handle(payload, signature), catches signature errors → 403.

Service provider: Registers WebhookProcessor singleton with all three reactions (SyncSubscriptionOnStarted, CancelSubscriptionOnCanceled, StoreOrderOnPaid). Removes bootEventListeners().

Repositories: EloquentSubscriptionRepository and EloquentOrderRepository now resolve customer_idowner_type/owner_id morph columns in create(), so fluent reactions work seamlessly with Eloquent.

Removed: All listeners, event wrappers, VerifyVatlyWebhookSignature middleware, BillableInterface wrapper, dead exception classes, Subscription::handleImmediateCancellation/handleGracePeriodCancellation.

Breaking changes

  • Events dispatched are now Vatly\Fluent\Events\* (not Vatly\Laravel\Events\*)
  • Removed public event/listener classes
  • Removed Subscription::handleImmediateCancellation() / handleGracePeriodCancellation()
  • Removed Vatly\Laravel\Contracts\BillableInterface (use Vatly\Fluent\Contracts\BillableInterface)

Test plan

  • All 49 tests pass
  • PHPStan level 6 clean
  • Integration tests for full webhook flow (subscription create, order create, cancellation)
  • Signature verification tests (valid, invalid, missing)

sandervanhooft and others added 7 commits March 12, 2026 17:21
Replace the Laravel-specific webhook handling (middleware, event listeners,
cascading) with the fluent package's WebhookProcessor. This removes
significant duplication between the packages.

Key changes:
- Register WebhookProcessor in service provider with all three reactions
- Simplify controller to delegate to WebhookProcessor
- Remove VerifyVatlyWebhookSignature middleware (processor verifies internally)
- Remove all event listeners (replaced by fluent reactions)
- Remove empty event/exception wrappers (use fluent's directly)
- Remove BillableInterface wrapper (use Vatly\Fluent\Contracts\BillableInterface)
- Add customer_id → owner morph resolution in repositories
- Clean up Subscription model (remove webhook handler methods)

BREAKING: Events are now dispatched from Vatly\Fluent\Events namespace.
Remove VCS repository override and dev branch constraint now that
the fluent-php osaka branch has been merged and released as
v0.3.0-alpha.2 on Packagist.
@sandervanhooft sandervanhooft merged commit 8bbd70b into main Mar 13, 2026
5 checks passed
@sandervanhooft sandervanhooft deleted the sandervanhooft/pull-latest branch March 13, 2026 13:21
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.

1 participant