Skip to content

Commit

Permalink
Merge pull request #217 from mailchimp/Issue216
Browse files Browse the repository at this point in the history
closes #216
  • Loading branch information
gonzaloebiz authored Feb 21, 2018
2 parents 65ac09d + ae228ab commit 3130520
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Model/Api/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ public function processResponses($storeId, $isMailChimpStoreId = false, $mailchi
foreach ($collection as $item) {
try {
$files = $this->getBatchResponse($item->getBatchId(), $storeId);
if (count($files)) {
if (is_array($files)&&count($files)) {
$this->processEachResponseFile($files, $item->getBatchId(), $mailchimpStoreId, $storeId);
$item->setStatus('completed');
$item->getResource()->save($item);
} elseif($files === false) {
$item->setStatus('canceled');
$item->getResource()->save($item);
continue;
}
$baseDir = $this->_helper->getBaseDir();
if (is_dir($baseDir . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . self::MAILCHIMP_TEMP_DIR . DIRECTORY_SEPARATOR . $item->getBatchId())) {
Expand Down Expand Up @@ -118,6 +122,7 @@ public function getBatchResponse($batchId, $storeId = null)
}
} catch (\Mailchimp_Error $e) {
$this->_helper->log($e->getMessage());
return false;
} catch (\Exception $e) {
$this->_helper->log($e->getMessage());
}
Expand Down

0 comments on commit 3130520

Please sign in to comment.