Skip to content

Commit

Permalink
https://github.com/thehcginstitute-com/m1/issues/590
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed May 2, 2024
1 parent a43cbd7 commit ddf4f02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
23 changes: 5 additions & 18 deletions app/code/community/Ebizmarts/MailChimp/Model/ProcessWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ final class Ebizmarts_MailChimp_Model_ProcessWebhook {
* @used-by Aoe_Scheduler_Model_Observer::dispatch() (app/code/community/Ebizmarts/MailChimp/etc/config.xml)
*/
function __construct() {
$this->_helper = hcg_mc_h();
$this->_dateHelper = Mage::helper('mailchimp/date');
$this->_tags = new Tags;
$this->_interestGroupHandle = Mage::getModel('mailchimp/api_subscribers_InterestGroupHandle');
Expand All @@ -22,7 +21,7 @@ function __construct() {
* @used-by Aoe_Scheduler_Model_Observer::dispatch() (app/code/community/Ebizmarts/MailChimp/etc/config.xml)
*/
function deleteProcessed():void {
$helper = $this->getHelper();
$helper = hcg_mc_h();
$resource = $helper->getCoreResource();
$connection = $resource->getConnection('core_write');
$tableName = $resource->getTableName('mailchimp/webhookrequest');
Expand All @@ -41,7 +40,7 @@ function processWebhookData():void {
$collection->getSelect()->limit(self::BATCH_LIMIT);

foreach ($collection as $webhookRequest) {
$data = $this->_helper->unserialize($webhookRequest->getDataRequest());
$data = hcg_mc_h()->unserialize($webhookRequest->getDataRequest());

if ($data) {
switch ($webhookRequest->getType()) {
Expand Down Expand Up @@ -78,7 +77,7 @@ private function _saveProcessedWebhook($webhookRequest):void {$webhookRequest->s
* @return void
*/
private function _updateEmail(array $data):void {
$helper = $this->getHelper();
$helper = hcg_mc_h();
$listId = $data['list_id'];
$old = $data['old_email'];
$new = $data['new_email'];
Expand Down Expand Up @@ -107,7 +106,7 @@ private function _updateEmail(array $data):void {
*/
private function _clean(array $data):void {
//Delete subscriber from Magento
$helper = $this->getHelper();
$helper = hcg_mc_h();
$s = $helper->loadListSubscriber($data['list_id'], $data['email']);

if ($s && $s->getId()) {
Expand Down Expand Up @@ -141,7 +140,7 @@ private function _subscribe(array $data):void {
* @return void
*/
private function _unsubscribe(array $data):void {
$helper = $this->getHelper();
$helper = hcg_mc_h();
$subscriber = $helper->loadListSubscriber($data['list_id'], $data['email']);
if ($subscriber && $subscriber->getId()) {
try {
Expand Down Expand Up @@ -201,14 +200,6 @@ private function getInterestGroupHandleModel()
*/
private function getMailchimpTagsModel():Tags {return $this->_tags;}

/**
* @return Ebizmarts_MailChimp_Helper_Data
*/
private function getHelper($type='')
{
return $this->_helper;
}

/**
* @return Ebizmarts_MailChimp_Helper_Date|Mage_Core_Helper_Abstract
*/
Expand All @@ -219,10 +210,6 @@ private function getDateHelper()

const BATCH_LIMIT = 200;

/**
* @var Ebizmarts_MailChimp_Helper_Data
*/
private $_helper;
private $_dateHelper;

/**
Expand Down
5 changes: 5 additions & 0 deletions app/code/local/HCG/MailChimp/lib/h/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
* @used-by Ebizmarts_MailChimp_Model_ClearEcommerce::__construct()
* @used-by Ebizmarts_MailChimp_Model_Cron::__construct()
* @used-by Ebizmarts_MailChimp_Model_Observer::makeHelper()
* @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::_clean()
* @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::_unsubscribe()
* @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::_updateEmail()
* @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::deleteProcessed()
* @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::processWebhookData()
* @used-by Ebizmarts_MailChimp_Model_System_Config_Backend_Active::makeHelper()
* @used-by Ebizmarts_MailChimp_Model_System_Config_Backend_Apikey::makeHelper()
* @used-by Ebizmarts_MailChimp_Model_System_Config_Backend_Ecommerce::makeHelper()
Expand Down

0 comments on commit ddf4f02

Please sign in to comment.