TaxProviderEntity example


    }

    public function testProcess(): void
    {
        $cart = $this->createCart();
        $salesChannelContext = static::createMock(SalesChannelContext::class);
        $salesChannelContext
            ->method('getTotalRounding')
            ->willReturn(new CashRoundingConfig(2, 0.01, true));

        $taxProvider = new TaxProviderEntity();
        $taxProvider->setId(Uuid::randomHex());
        $taxProvider->setActive(true);
        $taxProvider->setPriority(1);
        $taxProvider->setIdentifier(TestConstantTaxRateProvider::class);

        $collection = new TaxProviderCollection([$taxProvider]);

        $result = new EntitySearchResult(
            TaxProviderDefinition::ENTITY_NAME,
            1,
            $collection,
            
/** * @param array<TaxProvider> $providers * * @return EntitySearchResult<TaxProviderCollection> */
    private function existingProviders(array $providers = [], ?string $appId = null, ?string $appName = null): EntitySearchResult
    {
        $result = new TaxProviderCollection();

        foreach ($providers as $provider) {
            $taxProvider = new TaxProviderEntity();
            $taxProvider->setId($this->ids->get('tax-provider-' . $provider->getIdentifier()));
            $taxProvider->setActive(true);
            $taxProvider->setName($provider->getName());
            $taxProvider->setIdentifier(
                \sprintf('app\\%s_%s', $appName ?? self::META_APP_NAME, $provider->getIdentifier()),
            );

            $result->add($taxProvider);

            if (!$appId || !$appName) {
                continue;
            }
Home | Imprint | This part of the site doesn't use cookies.