private function add($listId, License $license) { $body = ['email_address' => $license->getTechContactEmail(), 'status' => 'subscribed', 'merge_fields' => ['FNAME' => $license->getTechContactName()]]; $headers = ['auth' => ['', $this->apiKey], 'body' => json_encode($body)]; $url = 'https://' . $this->dc . '.api.mailchimp.com/3.0/lists/' . $listId . '/members'; try { $client = new Client(); $client->post($url, $headers); $this->output->writeln('Added ' . $license->getTechContactEmail() . ' to the ' . $listId); } catch (ClientException $e) { } }
private function getRecipients(License $license) { $recipients = []; if ($this->input->getOption('env') == 'prod') { $recipients[] = ['email' => $license->getTechContactEmail(), 'name' => $license->getTechContactName()]; if ($license->getTechContactEmail() != $license->getBillingContactEmail()) { $recipients[] = ['email' => $license->getBillingContactEmail(), 'name' => $license->getBillingContactName()]; } } else { $recipients[] = ['email' => $this->getContainer()->getParameter('vendor_email')]; } return $recipients; }