Skip to content

Commit

Permalink
closes #46
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Jun 1, 2017
1 parent 328929f commit 54b4341
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Cron/Ecommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Ecommerce
* @var \Ebizmarts\MailChimp\Model\Api\Subscriber
*/
private $_apiSubscribers;
private $_webhook;

/**
* Ecommerce constructor.
* @param \Magento\Store\Model\StoreManager $storeManager
Expand All @@ -67,8 +67,6 @@ class Ecommerce
* @param \Ebizmarts\MailChimp\Model\Api\Subscriber $apiSubscriber
* @param \Ebizmarts\MailChimp\Model\MailChimpSyncBatches $mailChimpSyncBatches
* @param \Ebizmarts\MailChimp\Model\MailChimpSyncEcommerce $chimpSyncEcommerce
* @param \Ebizmarts\MailChimp\Model\ResourceModel\MailChimpWebhookRequest\CollectionFactory $webhookCollection
* @param \Magento\Customer\Model\CustomerFactory $customer
*/
public function __construct(
\Magento\Store\Model\StoreManager $storeManager,
Expand All @@ -80,8 +78,7 @@ public function __construct(
\Ebizmarts\MailChimp\Model\Api\Cart $apiCart,
\Ebizmarts\MailChimp\Model\Api\Subscriber $apiSubscriber,
\Ebizmarts\MailChimp\Model\MailChimpSyncBatches $mailChimpSyncBatches,
\Ebizmarts\MailChimp\Model\MailChimpSyncEcommerce $chimpSyncEcommerce,
\Ebizmarts\MailChimp\Cron\Webhook $webhook
\Ebizmarts\MailChimp\Model\MailChimpSyncEcommerce $chimpSyncEcommerce
)
{
$this->_storeManager = $storeManager;
Expand All @@ -94,7 +91,6 @@ public function __construct(
$this->_apiCart = $apiCart;
$this->_apiSubscribers = $apiSubscriber;
$this->_chimpSyncEcommerce = $chimpSyncEcommerce;
$this->_webhook = $webhook;
}

public function execute()
Expand All @@ -120,8 +116,6 @@ public function execute()
}
}
}
$this->_webhook->processWebhooks();

}

protected function _processStore($storeId, $mailchimpStoreId)
Expand Down
4 changes: 4 additions & 0 deletions Cron/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public function __construct(
$this->_webhookCollection = $webhookCollection;
$this->_customer = $customer;
}
public function execute()
{
$this->processWebhooks();
}
public function processWebhooks()
{
$collection = $this->_webhookCollection->create();
Expand Down
3 changes: 3 additions & 0 deletions etc/crontab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
<job name="ebizmarts_ecommerce" instance="Ebizmarts\MailChimp\Cron\Ecommerce" method="execute">
<schedule>*/5 * * * *</schedule>
</job>
<job name="ebizmarts_webhooks" instance="Ebizmarts\MailChimp\Cron\Webhook" method="execute">
<schedule>*/5 * * * *</schedule>
</job>
</group>
</config>

0 comments on commit 54b4341

Please sign in to comment.