Skip to content

Fix webhook registration rejecting events unknown to the Event enum - #101

Closed
smety wants to merge 1 commit into
shoptet:masterfrom
pobo-builder:fix-webhook
Closed

Fix webhook registration rejecting events unknown to the Event enum#101
smety wants to merge 1 commit into
shoptet:masterfrom
pobo-builder:fix-webhook

Conversation

@smety

@smety smety commented Aug 12, 2026

Copy link
Copy Markdown

Problem

Item::setEvent() (RegisterNewWebhookRequest) hard-validates event strings against the bundled Webhook\Event enum and throws InvalidArgumentException for anything it does not know. The enum currently contains 56 events, while the webhook event types code list publishes 113 — the SDK therefore refuses to register events the API itself
accepts.

Reproduction

Sdk::registerNewWebhook(['data' => [[
    'event' => 'eshop:settingsInformation', // published in the code list
    'url' => 'https://example.com/webhook',
]]]);
// InvalidArgumentException: "eshop:settingsInformation" is not valid webhook event type value

The same applies to the whole product:, category:, productVariant:* families (including all mass events), order:paid, supplier:* and ~50 more.

  1. Item::setEvent() no longer validates strings against the enum. The API is the validation authority — an unknown event is rejected server-side with a proper error response. Client-side validation against
    a bundled list inevitably drifts and blocks legitimate registrations. Event enum values keep working exactly as before.
  2. Webhook\Event synced with the current code list (+55 cases). Existing cases are untouched — no BC break. Events marked beta in the code list (product:, productVariant:, productVariantPrice:, incl. mass variants) are included, consistent with the beta stock: events that have been part of the enum already.
  3. Unit tests for Item::setEvent() — enum input, known string, unknown/future string, serialization.

@smety
smety requested a review from a team as a code owner August 12, 2026 18:45
@xmalda

xmalda commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Thank you for suggesting this change.
We fully agree with it.

We have processed the change in the original repository and it will be merged as part of the PR #103
I am closing this pull request as duplicity.

@xmalda xmalda closed this Aug 13, 2026
xmalda added a commit that referenced this pull request Aug 13, 2026
> [!NOTE]
> This PR copies content from the source repo.
> Source repo commit
[d16b6dc](shoptet/cms4@d16b6dc)

This change is credited to @smety
Original PR #101

**List of changes:**
- Fix webhook registration rejecting events unknown to the Event enum

Co-authored-by: xmalda <24293733+xmalda@users.noreply.github.com>
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.

3 participants