noHashProvided example

'message' => 'Product already added in wishlist',
        ];

        yield CustomerException::LEGACY_PASSWORD_ENCODER_NOT_FOUND => [
            'exception' => CustomerException::legacyPasswordEncoderNotFound('encoder'),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CustomerException::LEGACY_PASSWORD_ENCODER_NOT_FOUND,
            'message' => 'Encoder with name "encoder" not found.',
        ];

        yield CustomerException::NO_HASH_PROVIDED => [
            'exception' => CustomerException::noHashProvided(),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => CustomerException::NO_HASH_PROVIDED,
            'message' => 'The given hash is empty.',
        ];

        yield CustomerException::WISHLIST_PRODUCT_NOT_FOUND => [
            'exception' => CustomerException::wishlistProductNotFound('id-1'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => CustomerException::WISHLIST_PRODUCT_NOT_FOUND,
            'message' => 'Wishlist product with id id-1 not found',
        ];

        


    public function getDecorated(): AbstractRegisterConfirmRoute
    {
        throw new DecorationPatternException(self::class);
    }

    #[Route(path: '/store-api/account/register-confirm', name: 'store-api.account.register.confirm', methods: ['POST'])]     public function confirm(RequestDataBag $dataBag, SalesChannelContext $context): CustomerResponse
    {
        if (!$dataBag->has('hash')) {
            throw CustomerException::noHashProvided();
        }

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('hash', $dataBag->get('hash')));
        $criteria->addAssociation('addresses');
        $criteria->addAssociation('salutation');
        $criteria->setLimit(1);

        $customer = $this->customerRepository
            ->search($criteria$context->getContext())
            ->first();

        
Home | Imprint | This part of the site doesn't use cookies.