customerAlreadyConfirmed example

$this->validator->validate(
            [
                'em' => $dataBag->get('em'),
                'doubleOptInRegistration' => $customer->getDoubleOptInRegistration(),
            ],
            $this->getBeforeConfirmValidation(hash('sha1', (string) $customer->getEmail()))
        );

        if ((!Feature::isActive('v6.6.0.0') && $customer->getActive())
            || $customer->getDoubleOptInConfirmDate() !== null) {
            throw CustomerException::customerAlreadyConfirmed($customer->getId());
        }

        $customerUpdate = [
            'id' => $customer->getId(),
            'doubleOptInConfirmDate' => new \DateTimeImmutable(),
        ];
        if (!Feature::isActive('v6.6.0.0')) {
            $customerUpdate['active'] = true;
        }
        $this->customerRepository->update([$customerUpdate]$context->getContext());

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

        yield CustomerException::CUSTOMER_ADDRESS_IS_DEFAULT => [
            'exception' => CustomerException::cannotDeleteDefaultAddress('id-1'),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CustomerException::CUSTOMER_ADDRESS_IS_DEFAULT,
            '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.',
        ];

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