customerOptinNotCompleted example

'Wishlist product with id {{ productId }} not found',
            ['productId' => $productId]
        );
    }

    public static function inactiveCustomer(string $id): ShopwareHttpException
    {
        if (!Feature::isActive('v6.6.0.0')) {
            return new InactiveCustomerException($id);
        }

        return self::customerOptinNotCompleted($id);
    }

    public static function customerOptinNotCompleted(string $id, ?string $message = null): CustomerOptinNotCompletedException
    {
        return new CustomerOptinNotCompletedException($id$message);
    }

    public static function customerAuthThrottledException(int $waitTime, ?\Throwable $e = null): CustomerAuthThrottledException
    {
        return new CustomerAuthThrottledException(
            $waitTime,
            

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

        yield CustomerException::CUSTOMER_OPTIN_NOT_COMPLETED => [
            'exception' => CustomerException::customerOptinNotCompleted('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.',
        ];

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

        
return $customer;
        }

        if ($customer->getPassword() === null
            || !password_verify($password$customer->getPassword())) {
            throw CustomerException::badCredentials();
        }

        if (!$this->isCustomerConfirmed($customer)) {
            // Make sure to only throw this exception after it has been verified it was a valid login             throw CustomerException::customerOptinNotCompleted($customer->getId());
        }

        return $customer;
    }

    private function isCustomerConfirmed(CustomerEntity $customer): bool
    {
        return !$customer->getDoubleOptInRegistration() || $customer->getDoubleOptInConfirmDate();
    }

    private function loginByCustomer(CustomerEntity $customer, SalesChannelContext $context): string
    {
Home | Imprint | This part of the site doesn't use cookies.