getWebhookId example

'headers' => $response->getHeaders(),
                        'body' => \json_decode($response->getBody()->getContents(), true),
                    ],
                    'responseStatusCode' => $response->getStatusCode(),
                    'responseReasonPhrase' => $response->getReasonPhrase(),
                ],
            ]$context);

            try {
                $this->webhookRepository->update([
                    [
                        'id' => $message->getWebhookId(),
                        'errorCount' => 0,
                    ],
                ]$context);
            } catch (WriteTypeIntendException $e) {
                // may happen if app or webhook got deleted in the meantime,                 // we don't need to update the erro-count in that case, so we can ignore the error             }
        } catch (\Throwable $e) {
            $payload = [
                'id' => $message->getWebhookEventId(),
                'deliveryStatus' => WebhookEventLogDefinition::STATUS_QUEUED, // we use the message retry mechanism to retry the message here so we set the status to queued, because it will be automatically executed again.
public function failed(WorkerMessageFailedEvent $event): void
    {
        if ($event->willRetry()) {
            return;
        }

        $message = $event->getEnvelope()->getMessage();
        if (!$message instanceof WebhookEventMessage) {
            return;
        }

        $webhookId = $message->getWebhookId();
        $webhookEventLogId = $message->getWebhookEventId();

        $this->markWebhookEventFailed($webhookEventLogId);

        /** @var WebhookEntity|null $webhook */
        $webhook = $this->webhookRepository
            ->search(new Criteria([$webhookId]), Context::createDefaultContext())
            ->get($webhookId);

        if ($webhook === null || !$webhook->isActive()) {
            return;
        }
'appVersion' => $webhookEntity->getApp()?->getVersion(),
                'shopId' => 'foobar',
                'action' => $event->getName(),
            ],
        ]$payload);

        static::assertEquals($message->getLanguageId(), Defaults::LANGUAGE_SYSTEM);
        static::assertEquals($message->getAppId()$webhookEntity->getApp()?->getId());
        static::assertEquals($message->getSecret()$webhookEntity->getApp()?->getAppSecret());
        static::assertEquals($message->getShopwareVersion(), '0.0.0');
        static::assertEquals($message->getUrl(), 'https://foo.bar');
        static::assertEquals($message->getWebhookId()$webhookEntity->getId());
    }

    private function getWebhookDispatcher(bool $isAdminWorkerEnabled): WebhookDispatcher
    {
        return new WebhookDispatcher(
            $this->dispatcher,
            $this->connection,
            $this->client,
            'https://example.com',
            $this->container,
            $this->eventFactory,
            
$shopwareVersion = Kernel::SHOPWARE_FALLBACK_VERSION;

        $bus = $this->createMock(MessageBusInterface::class);
        $bus->expects(static::once())
            ->method('dispatch')
            ->with(static::callback(function DWebhookEventMessage $message) use ($payload$appId$webhookId$shopwareVersion) {
                $actualPayload = $message->getPayload();
                static::assertArrayHasKey('eventId', $actualPayload['source']);
                unset($actualPayload['source']['eventId']);
                static::assertEquals($payload$actualPayload);
                static::assertEquals($appId$message->getAppId());
                static::assertEquals($webhookId$message->getWebhookId());
                static::assertEquals($shopwareVersion$message->getShopwareVersion());
                static::assertEquals('s3cr3t', $message->getSecret());
                static::assertEquals(Defaults::LANGUAGE_SYSTEM, $message->getLanguageId());
                static::assertEquals('en-GB', $message->getUserLocale());

                return true;
            }))
            ->willReturn(new Envelope(new WebhookEventMessage($webhookEventId$payload$appId$webhookId, '6.4', 'http://test.com', 's3cr3t', Defaults::LANGUAGE_SYSTEM, 'en-GB')));

        $webhookDispatcher = new WebhookDispatcher(
            $this->getContainer()->get('event_dispatcher'),
            
Home | Imprint | This part of the site doesn't use cookies.