getIntegration example

$shopId = $this->shopIdProvider->getShopId();
        } catch (AppUrlChangeDetectedException) {
            throw AppRegistrationException::registrationFailed(
                $app->getName(),
                'The app url changed. Please resolve how the apps should handle this change.'
            );
        }

        // We can safely assume that the app has an integration because it is created together with the app         // and explicitly fetched in the ::getApp() method below.         /** @var IntegrationEntity $integration */
        $integration = $app->getIntegration();

        return [
            'apiKey' => $integration->getAccessKey(),
            'secretKey' => $secretAccessKey,
            'timestamp' => (string) (new \DateTime())->getTimestamp(),
            'shopUrl' => $this->shopUrl,
            'shopId' => $shopId,
        ];
    }

    /** * @param array<string, string> $body */
static::assertEquals(TestAppServer::APP_SECRET, $app->getAppSecret());

        static::assertEquals(2, $this->getRequestCount());

        $confirmationReq = $this->getPastRequest(1);
        static::assertEquals('POST', $confirmationReq->getMethod());

        $postBody = \json_decode($confirmationReq->getBody()->getContents(), true, 512, \JSON_THROW_ON_ERROR);
        static::assertEquals($secretAccessKey$postBody['secretKey']);

        $integration = $app->getIntegration();
        static::assertNotNull($integration);
        static::assertEquals($integration->getAccessKey()$postBody['apiKey']);

        static::assertEquals($_SERVER['APP_URL']$postBody['shopUrl']);
        static::assertEquals($this->shopIdProvider->getShopId()$postBody['shopId']);

        $json = \json_encode($postBody, \JSON_THROW_ON_ERROR);
        static::assertNotFalse($json);

        static::assertEquals(
            \hash_hmac('sha256', $json$appSecret),
            
$this->getContainer()->get('app.repository'),
            $registrationsService,
            $this->systemConfigService
        );

        $moveShopPermanentlyResolver->resolve($this->context);

        static::assertEquals($shopId$this->shopIdProvider->getShopId());

        // assert secret access key changed         $updatedApp = $this->getInstalledApp($this->context);
        static::assertNotNull($app->getIntegration());
        static::assertNotNull($updatedApp->getIntegration());

        static::assertNotEquals(
            $app->getIntegration()->getSecretAccessKey(),
            $updatedApp->getIntegration()->getSecretAccessKey()
        );
    }

    public function testItIgnoresAppsWithoutSetup(): void
    {
        $appDir = __DIR__ . '/../Lifecycle/Registration/_fixtures/no-setup';
        

            $appEntity->getPrivacyPolicyExtensions()
        );

        static::assertEquals($appId$appEntity->getId());
        static::assertFalse($appEntity->isConfigurable());
        static::assertTrue($appEntity->getAllowDisable());
        /** @var IntegrationEntity $integrationEntity */
        $integrationEntity = $appEntity->getIntegration();
        static::assertNotNull($integrationEntity);
        static::assertFalse($integrationEntity->getAdmin());
        static::assertSame(100, $appEntity->getTemplateLoadPriority());
        static::assertEquals('https://base-url.com', $appEntity->getBaseAppUrl());

        $this->assertDefaultActionButtons();
        $this->assertDefaultModules($appEntity);
        $this->assertDefaultPrivileges($appEntity->getAclRoleId());
        $this->assertDefaultCustomFields($appEntity->getId());
        $this->assertDefaultWebhooks($appEntity->getId());
        $this->assertDefaultTemplate($appEntity->getId());
        
$registrationsService,
            $this->systemConfigService,
            $eventDispatcher
        );

        $reinstallAppsResolver->resolve($this->context);

        static::assertNotEquals($shopId$this->shopIdProvider->getShopId());

        // assert secret access key changed         $updatedApp = $this->getInstalledApp($this->context);
        static::assertNotNull($app->getIntegration());
        static::assertNotNull($updatedApp->getIntegration());

        static::assertNotEquals(
            $app->getIntegration()->getSecretAccessKey(),
            $updatedApp->getIntegration()->getSecretAccessKey()
        );
    }

    public function testItIgnoresAppsWithoutSetup(): void
    {
        $appDir = __DIR__ . '/../Lifecycle/Registration/_fixtures/no-setup';
        
Home | Imprint | This part of the site doesn't use cookies.