Commit c0322ee7 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлен класс проверяющий на отписку

parent 22e3eee9
<?php
namespace common\modules\triggers\components\conditions\conditions;
use common\components\UnisenderAPI;
use common\modules\triggers\components\conditions\vendor\ConditionBase;
use common\modules\triggers\components\conditions\vendor\ConditionInterface;
class CheckEmailToUnsubscribed extends ConditionBase implements ConditionInterface{
const CONDITION_ID = 4;
public $name = 'Пользователь отписался';
/**
* @param null|string $conditionName
* @return $this mixed
*/
public static function init($conditionName=__CLASS__){
return parent::init($conditionName);
}
/**
* @param $message
* @return bool
*/
public function check($message){
if (!is_null($message)) {
// Создаем объект унисендера
$sender=new UnisenderAPI();
// Делаем запрос на получение статуса сообщения
$sender->getMessageStatuses($message->message_id);
return $sender->isUnsubscribed();
}
return true;
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment