'storefrontUrl'
);
$recipientId =
$this->
getNewsletterRecipientId($data['email'
],
$context);
if (isset($recipientId)) { /** @var NewsletterRecipientEntity $recipient */
$recipient =
$this->newsletterRecipientRepository->
search(new Criteria([$recipientId]),
$context->
getContext())->
first();
// If the user was previously subscribed but has unsubscribed now, the `getConfirmedAt()`
// will still be set. So we need to check for the status as well.
if ($recipient->
getStatus() !== self::STATUS_OPT_OUT &&
$recipient->
getConfirmedAt()) { return new NoContentResponse();
} } $data =
$this->
completeData($data,
$context);
$this->newsletterRecipientRepository->
upsert([$data],
$context->
getContext());
$recipient =
$this->
getNewsletterRecipient('email',
$data['email'
],
$context->
getContext());
if (!
$this->
isNewsletterDoi($context)) {