countryNotFound example

'message' => 'Provided languageId is not a valid uuid',
        ];

        yield SalesChannelException::NO_CONTEXT_DATA_EXCEPTION => [
            'exception' => SalesChannelException::noContextData('myCustomScn'),
            'statusCode' => Response::HTTP_PRECONDITION_FAILED,
            'errorCode' => SalesChannelException::NO_CONTEXT_DATA_EXCEPTION,
            'message' => 'No context data found for SalesChannel "myCustomScn"',
        ];

        yield SalesChannelException::COUNTRY_DOES_NOT_EXISTS_EXCEPTION => [
            'exception' => SalesChannelException::countryNotFound('myCustomCountry'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => SalesChannelException::COUNTRY_DOES_NOT_EXISTS_EXCEPTION,
            'message' => 'Country with id "myCustomCountry" not found!.',
        ];

        yield SalesChannelException::COUNTRY_STATE_DOES_NOT_EXISTS_EXCEPTION => [
            'exception' => SalesChannelException::countryStateNotFound('myCustomCountryState'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => SalesChannelException::COUNTRY_STATE_DOES_NOT_EXISTS_EXCEPTION,
            'message' => 'Country state with id "myCustomCountryState" not found!.',
        ];

        
$this->context->buildViolation($constraint->getMessage())
            ->setParameter('{{ iso }}', $this->formatValue($country->getIso()))
            ->setCode(CustomerZipCode::ZIP_CODE_INVALID)
            ->addViolation();
    }

    private function getCountry(string $countryId): CountryEntity
    {
        $country = $this->countryRepository->search(new Criteria([$countryId]), Context::createDefaultContext())->get($countryId);

        if (!$country instanceof CountryEntity) {
            throw CustomerException::countryNotFound($countryId);
        }

        return $country;
    }
}
static::assertEquals($statusCode$caughtException->getStatusCode());
        static::assertEquals($errorCode$caughtException->getErrorCode());
        static::assertEquals($message$caughtException->getMessage());
    }

    /** * @return array<string, array{exception: ShopwareHttpException|CountryException, statusCode: int, errorCode: string, message: string}> */
    public static function exceptionDataProvider(): iterable
    {
        yield CountryException::COUNTRY_NOT_FOUND => [
            'exception' => CountryException::countryNotFound('id-1'),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CountryException::COUNTRY_NOT_FOUND,
            'message' => 'Country with id "id-1" not found.',
        ];

        yield CountryException::COUNTRY_STATE_NOT_FOUND => [
            'exception' => CountryException::countryStateNotFound('id-1'),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CountryException::COUNTRY_STATE_NOT_FOUND,
            'message' => 'Country state with id "id-1" not found.',
        ];
    }


        $countryId = $options[SalesChannelContextService::COUNTRY_ID] ?? $salesChannel->getCountryId();
        \assert(\is_string($countryId) && Uuid::isValid($countryId));

        $criteria = new Criteria([$countryId]);
        $criteria->setTitle('base-context-factory::country');

        $country = $this->countryRepository->search($criteria$context)->get($countryId);

        if (!$country instanceof CountryEntity) {
            throw SalesChannelException::countryNotFound($countryId);
        }

        return ShippingLocation::createFromCountry($country);
    }

    /** * @param array<string, mixed> $sessionOptions * @param array<string> $availableLanguageIds * * @return non-empty-array<string> */
    

        }

        return false;
    }

    private function requiredVatIdField(string $countryId, SalesChannelContext $context): bool
    {
        $country = $this->countryRepository->search(new Criteria([$countryId])$context)->get($countryId);

        if (!$country instanceof CountryEntity) {
            throw CustomerException::countryNotFound($countryId);
        }

        return $country->getVatIdRequired();
    }

    private function getConfirmUrl(SalesChannelContext $context, CustomerEntity $customer): string
    {
        $urlTemplate = $this->systemConfigService->get(
            'core.loginRegistration.confirmationUrl',
            $context->getSalesChannelId()
        );
        


        yield CustomerException::CUSTOMER_AUTH_THROTTLED => [
            'exception' => CustomerException::customerAuthThrottledException(100),
            'statusCode' => Response::HTTP_TOO_MANY_REQUESTS,
            'errorCode' => CustomerException::CUSTOMER_AUTH_THROTTLED,
            'message' => 'Customer auth throttled for 100 seconds.',
        ];

        if (!Feature::isActive('v6.6.0.0')) {
            yield CustomerException::COUNTRY_NOT_FOUND => [
                'exception' => CustomerException::countryNotFound('100'),
                'statusCode' => Response::HTTP_BAD_REQUEST,
                'errorCode' => CountryException::COUNTRY_NOT_FOUND,
                'message' => 'Country with id "100" not found.',
            ];
        } else {
            yield CustomerException::COUNTRY_NOT_FOUND => [
                'exception' => CustomerException::countryNotFound('100'),
                'statusCode' => Response::HTTP_BAD_REQUEST,
                'errorCode' => CustomerException::COUNTRY_NOT_FOUND,
                'message' => 'Country with id "100" not found.',
            ];
        }
Home | Imprint | This part of the site doesn't use cookies.