protected static function replaceTemplateVariables(&$html, License $license)
 {
     $mapping = ['%_TECH_CONTACT_%' => $license->getTechContactName(), '%_TECH_CONTACT_FIRST_NAME_%' => self::getFirstName($license->getTechContactName()), '%_ADDON_NAME_%' => $license->getAddonName(), '%_ADDON_KEY_%' => $license->getAddonKey(), '%_LICENSE_ID_%' => $license->getLicenseId(), '%_ADDON_URL_%' => self::buildAddonURL($license->getAddonKey()), '%_LICENSE_START_DATE_%' => $license->getStartDate()->format('Y-m-d'), '%_LICENSE_END_DATE_%' => $license->getEndDate()->format('Y-m-d')];
     foreach ($mapping as $token => $replacement) {
         $html = str_replace($token, $replacement, $html);
     }
 }
 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;
 }