customerGroupRegistrationConfigurationNotFound example

'message' => 'Customer address with id "id-1" is a default address and cannot be deleted.',
        ];

        yield CustomerException::CUSTOMER_IS_ALREADY_CONFIRMED => [
            'exception' => CustomerException::customerAlreadyConfirmed('id-1'),
            'statusCode' => Response::HTTP_PRECONDITION_FAILED,
            'errorCode' => CustomerException::CUSTOMER_IS_ALREADY_CONFIRMED,
            'message' => 'The customer with the id "id-1" is already confirmed.',
        ];

        yield CustomerException::CUSTOMER_GROUP_REGISTRATION_NOT_FOUND => [
            'exception' => CustomerException::customerGroupRegistrationConfigurationNotFound('id-1'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => CustomerException::CUSTOMER_GROUP_REGISTRATION_NOT_FOUND,
            'message' => 'Customer group registration for id id-1 not found.',
        ];

        yield CustomerException::CUSTOMER_NOT_FOUND_BY_HASH => [
            'exception' => CustomerException::customerNotFoundByHash('id-1'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => CustomerException::CUSTOMER_NOT_FOUND_BY_HASH,
            'message' => 'No matching customer for the hash "id-1" was found.',
        ];

        


    #[Route(path: '/store-api/customer-group-registration/config/{customerGroupId}', name: 'store-api.customer-group-registration.config', methods: ['GET'])]     public function load(string $customerGroupId, SalesChannelContext $context): CustomerGroupRegistrationSettingsRouteResponse
    {
        $criteria = new Criteria([$customerGroupId]);
        $criteria->addFilter(new EqualsFilter('registrationActive', 1));
        $criteria->addFilter(new EqualsFilter('registrationSalesChannels.id', $context->getSalesChannel()->getId()));

        $result = $this->customerGroupRepository->search($criteria$context->getContext());
        if ($result->getTotal() === 0) {
            throw CustomerException::customerGroupRegistrationConfigurationNotFound($customerGroupId);
        }

        $customerGroup = $result->first();
        \assert($customerGroup instanceof CustomerGroupEntity);

        return new CustomerGroupRegistrationSettingsRouteResponse($customerGroup);
    }
}
Home | Imprint | This part of the site doesn't use cookies.