inactiveCustomer example



        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',
        ];

        if (!Feature::isActive('v6.6.0.0')) {
            yield CustomerException::CUSTOMER_IS_INACTIVE => [
                'exception' => CustomerException::inactiveCustomer('id-1'),
                'statusCode' => Response::HTTP_UNAUTHORIZED,
                'errorCode' => CustomerException::CUSTOMER_IS_INACTIVE,
                'message' => 'The customer with the id "id-1" is inactive.',
            ];
        } else {
            yield CustomerException::CUSTOMER_IS_INACTIVE => [
                'exception' => CustomerException::inactiveCustomer('id-1'),
                'statusCode' => Response::HTTP_UNAUTHORIZED,
                'errorCode' => CustomerException::CUSTOMER_OPTIN_NOT_COMPLETED,
                'message' => 'The customer with the id "id-1" has not completed the opt-in.',
            ];
        }
try {
            $customer = $this->accountService->getCustomerByLogin(
                $email,
                $data->get('password'),
                $context
            );
        } catch (CustomerNotFoundException|BadCredentialsException $exception) {
            throw new UnauthorizedHttpException('json', $exception->getMessage());
        } catch (CustomerOptinNotCompletedException $exception) {
            if (!Feature::isActive('v6.6.0.0')) {
                throw CustomerException::inactiveCustomer($exception->getParameters()['customerId']);
            }

            throw $exception;
        }

        if (isset($cacheKey)) {
            $this->rateLimiter->reset(RateLimiter::LOGIN_ROUTE, $cacheKey);
        }

        $context = $this->restorer->restore($customer->getId()$context);
        $newToken = $context->getToken();

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