getEventName example

$criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('appId', $appId));

        /** @var WebhookEntity[] $webhooks */
        $webhooks = $webhookRepository->search($criteria$this->context)->getElements();

        static::assertCount(3, $webhooks);
        \usort($webhooksstatic fn (WebhookEntity $a, WebhookEntity $b) => $a->getUrl() <=> $b->getUrl());

        $firstWebhook = $webhooks[0];
        static::assertEquals('https://test-flow.com', $firstWebhook->getUrl());
        static::assertEquals('telegram.send.message', $firstWebhook->getEventName());

        $secondWebhook = $webhooks[1];
        static::assertEquals('https://test.com/hook', $secondWebhook->getUrl());
        static::assertEquals('checkout.customer.before.login', $secondWebhook->getEventName());

        $thirdWebhook = $webhooks[2];
        static::assertEquals('https://test.com/hook2', $thirdWebhook->getUrl());
        static::assertEquals('checkout.order.placed', $thirdWebhook->getEventName());
    }

    private function assertDefaultTemplate(string $appId, bool $active = true): void
    {
$migration = new Migration1625583619MoveDataFromEventActionToFlow();
        $migration->internal = true;
        $migration->update($this->connection);

        $criteria = new Criteria();
        $criteria->addAssociation('sequences');

        /** @var FlowEntity $flow */
        $flow = $this->flowRepository->search($criteria, Context::createDefaultContext())->first();
        $flowSequences = $flow->getSequences();

        static::assertSame('checkout.order.placed', $flow->getEventName());
        static::assertInstanceOf(FlowSequenceCollection::class$flowSequences);
        static::assertCount(3, $flowSequences);

        foreach ($flowSequences->getElements() as $flowSequence) {
            if ($flowSequence->getActionName() === null) {
                continue;
            }

            $expectedRecipients = [
                'test@gmail.com' => 'Test',
                'john@gmail.com' => 'John',
            ];
$migration = new Migration1632215760MoveDataFromEventActionToFlow();
        $migration->update($this->connection);

        $criteria = new Criteria();
        $criteria->addAssociation('sequences');

        /** @var FlowEntity $flow */
        $flow = $this->flowRepository->search($criteria, Context::createDefaultContext())->first();
        $flowSequences = $flow->getSequences();

        static::assertSame('checkout.order.placed', $flow->getEventName());
        static::assertInstanceOf(FlowSequenceCollection::class$flowSequences);
        static::assertCount(3, $flowSequences);

        foreach ($flowSequences->getElements() as $flowSequence) {
            if ($flowSequence->getActionName() === null) {
                continue;
            }

            $expectedRecipients = [
                'test@gmail.com' => 'Test',
                'john@gmail.com' => 'John',
            ];
private function logWebhookWithEvent(WebhookEntity $webhook, WebhookEventMessage $webhookEventMessage): void
    {
        /** @var EntityRepository $webhookEventLogRepository */
        $webhookEventLogRepository = $this->container->get('webhook_event_log.repository');

        $webhookEventLogRepository->create([
            [
                'id' => $webhookEventMessage->getWebhookEventId(),
                'appName' => $webhook->getApp()?->getName(),
                'deliveryStatus' => WebhookEventLogDefinition::STATUS_QUEUED,
                'webhookName' => $webhook->getName(),
                'eventName' => $webhook->getEventName(),
                'appVersion' => $webhook->getApp()?->getVersion(),
                'url' => $webhook->getUrl(),
                'serializedWebhookMessage' => serialize($webhookEventMessage),
            ],
        ], Context::createDefaultContext());
    }

    /** * @param array<string> $affectedRoleIds */
    private function loadPrivileges(string $eventName, array $affectedRoleIds): void
    {
$migration = new Migration1639992771MoveDataFromEventActionToFlow();
        $migration->update($this->connection);

        $criteria = new Criteria();
        $criteria->addAssociation('sequences');

        /** @var FlowEntity $flow */
        $flow = $this->flowRepository->search($criteria, Context::createDefaultContext())->first();
        $flowSequences = $flow->getSequences();

        static::assertSame('checkout.order.placed', $flow->getEventName());
        static::assertInstanceOf(FlowSequenceCollection::class$flowSequences);
        static::assertCount(3, $flowSequences);

        foreach ($flowSequences->getElements() as $flowSequence) {
            if ($flowSequence->getActionName() === null) {
                continue;
            }

            $expectedRecipients = [
                'test@gmail.com' => 'Test',
                'john@gmail.com' => 'John',
            ];
Home | Imprint | This part of the site doesn't use cookies.