WebhookDispatcher example

$customerId = Uuid::randomHex();
        $this->createCustomer($customerId);

        $customer = $this->getContainer()->get('customer.repository')->search(new Criteria([$customerId]), Context::createDefaultContext())->get($customerId);
        static::assertInstanceOf(CustomerEntity::class$customer);
        $event = new CustomerLoginEvent(
            $this->getContainer()->get(SalesChannelContextFactory::class)->create(Uuid::randomHex(), TestDefaults::SALES_CHANNEL),
            $customer,
            'testToken'
        );

        $webhookDispatcher = new WebhookDispatcher(
            $this->getContainer()->get('event_dispatcher'),
            $this->getContainer()->get(Connection::class),
            $this->getContainer()->get('shopware.app_system.guzzle'),
            $this->shopUrl,
            $this->getContainer(),
            $this->getContainer()->get(HookableEventFactory::class),
            Kernel::SHOPWARE_FALLBACK_VERSION,
            $this->bus,
            true
        );

        
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,
            '0.0.0',
            $this->bus,
            $isAdminWorkerEnabled
        );
    }

    
'url' => 'https://test.com',
            ],
        ], Context::createDefaultContext());

        $this->appendNewResponse(new Response(200));

        $event = new CustomerBeforeLoginEvent(
            $this->getContainer()->get(SalesChannelContextFactory::class)->create(Uuid::randomHex(), TestDefaults::SALES_CHANNEL),
            'test@example.com'
        );

        $webhookDispatcher = new WebhookDispatcher(
            $this->getContainer()->get('event_dispatcher'),
            $this->getContainer()->get(Connection::class),
            $this->getContainer()->get('shopware.app_system.guzzle'),
            $this->shopUrl,
            $this->getContainer(),
            $this->getContainer()->get(HookableEventFactory::class),
            Kernel::SHOPWARE_FALLBACK_VERSION,
            $this->bus,
            true
        );

        
Home | Imprint | This part of the site doesn't use cookies.