Skip to content

Commit

Permalink
Merge pull request #456 from mailchimp/Issue455
Browse files Browse the repository at this point in the history
closes #455
  • Loading branch information
gonzaloebiz authored Nov 2, 2018
2 parents cf8b888 + 068cb3a commit 8b808c8
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions Cron/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,31 @@ public function processWebhooks()
* @var $item \Ebizmarts\MailChimp\Model\MailChimpWebhookRequest
*/
foreach ($collection as $item) {
$data = $this->_serializer->unserialize($item->getDataRequest());
$stores = $this->_helper->getMagentoStoreIdsByListId($data['list_id']);
if(count($stores)) {
switch ($item->getType()) {
case self::TYPE_SUBSCRIBE:
$this->_subscribe($data);
break;
case self::TYPE_UNSUBSCRIBE:
$this->_unsubscribe($data);
break;
case self::TYPE_CLEANED:
$this->_clean($data);
break;
case self::TYPE_UPDATE_EMAIL:
$this->_updateEmail($data);
break;
case self::TYPE_PROFILE:
$this->_profile($data);
try {
$data = $this->_serializer->unserialize($item->getDataRequest());
$stores = $this->_helper->getMagentoStoreIdsByListId($data['list_id']);
if (count($stores)) {
switch ($item->getType()) {
case self::TYPE_SUBSCRIBE:
$this->_subscribe($data);
break;
case self::TYPE_UNSUBSCRIBE:
$this->_unsubscribe($data);
break;
case self::TYPE_CLEANED:
$this->_clean($data);
break;
case self::TYPE_UPDATE_EMAIL:
$this->_updateEmail($data);
break;
case self::TYPE_PROFILE:
$this->_profile($data);
}
$processed = self::PROCESSED_OK;
} else {
$processed = self::PROCESSED_WITH_ERROR;
}
$processed = self::PROCESSED_OK;
} else {
} catch(\Exception $e) {
$processed = self::PROCESSED_WITH_ERROR;
}
$item->setProcessed($processed);
Expand Down

0 comments on commit 8b808c8

Please sign in to comment.