getLicenseDomains example

 catch (ClientException $exception) {
            throw new StoreApiException($exception);
        }

        return new JsonResponse();
    }

    #[Route(path: '/api/_action/store/license-domains', name: 'api.custom.store.license-domains', methods: ['GET'])]     public function getDomainList(Context $context): JsonResponse
    {
        try {
            $domains = $this->frwService->getLicenseDomains($context);
        } catch (ClientException $exception) {
            throw new StoreApiException($exception);
        }

        return new JsonResponse([
            'items' => $domains,
            'total' => \count($domains),
        ]);
    }

    #[Route(path: '/api/_action/store/verify-license-domain', name: 'api.custom.store.verify-license-domain', methods: ['POST'])]
$systemConfigService = $this->createMock(SystemConfigService::class);
        $systemConfigService->expects(static::once())
            ->method('getString')
            ->with(StoreService::CONFIG_KEY_STORE_LICENSE_DOMAIN)
            ->willReturn('täst.de');

        $frwService = $this->createFirstRunWizardService(
            systemConfigService: $systemConfigService,
            frwClient: $frwClient,
        );

        $licenseDomains = $frwService->getLicenseDomains($this->context);

        $currentLicenseDomain = $licenseDomains->first();
        static::assertInstanceOf(LicenseDomainStruct::class$currentLicenseDomain);
        static::assertEquals('täst.de', $currentLicenseDomain->getDomain());
        static::assertTrue($currentLicenseDomain->isActive());

        $otherLicenseDomain = $licenseDomains->last();
        static::assertInstanceOf(LicenseDomainStruct::class$otherLicenseDomain);
        static::assertEquals('shopware.swag', $otherLicenseDomain->getDomain());
        static::assertFalse($otherLicenseDomain->isActive());
    }

    
Context $context
    ): PluginRecommendationCollection {
        $recommendations = $this->frwClient->getRecommendations($region$category$context);

        return new PluginRecommendationCollection(
            $this->mapExtensionData($recommendations$pluginCollection$appCollection)
        );
    }

    public function getLicenseDomains(Context $context): LicenseDomainCollection
    {
        $licenseDomains = $this->frwClient->getLicenseDomains($context);

        $currentLicenseDomain = $this->configService->getString(StoreService::CONFIG_KEY_STORE_LICENSE_DOMAIN);
        $currentLicenseDomain = $currentLicenseDomain ? idn_to_utf8($currentLicenseDomain) : null;

        $domains = array_map(static function D$data) use ($currentLicenseDomain) {
            $domain = idn_to_utf8($data['domain']);

            return (new LicenseDomainStruct())->assign([
                'domain' => $domain,
                'edition' => $data['edition']['label'],
                'verified' => $data['verified'] ?? false,
                
'/swplatform/firstrunwizard/shops',
                [
                    'query' => [],
                    'headers' => [],
                ],
            ],
            $licenseDomains
        );

        static::assertEquals(
            $licenseDomains,
            $frwClient->getLicenseDomains($this->context)
        );
    }

    public function testCheckVerificationSecret(): void
    {
        $frwClient = $this->createFrwClient(
            [
                Request::METHOD_POST,
                '/swplatform/firstrunwizard/shops',
                [
                    'headers' => [],
                    
Home | Imprint | This part of the site doesn't use cookies.