/**
  * this is body of mail + pm
  * @see NotificationEvent::getMessage()
  */
 public function getMessage(NotificationType $notificationType, $additionalVariables = array())
 {
     $additionalVariables = array_merge($additionalVariables, $this->getObject()->getData());
     $key = $this->languageCategory . '.' . $this->getEventName() . '.' . $notificationType->getName();
     $tmp = $this->getLanguageVariable($key, $additionalVariables);
     if ($tmp) {
         return $tmp;
     } else {
         $key = $this->languageCategory . '.' . $this->getEventName() . '.' . self::FALLBACK_NOTIFICATION_TYPE;
         return $this->getLanguageVariable($key, $additionalVariables);
     }
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function toString()
 {
     if ($this->isAll()) {
         return 'ssdp:all';
     }
     return parent::toString();
 }
Exemple #3
0
 public static function main()
 {
     $code = self::verifyData($_POST['notificationCode']);
     $type = self::verifyData($_POST['notificationtype']);
     if ($code && $type) {
         $notificationType = new NotificationType($type);
         $strType = $notificationType->getTypeFromValue();
         switch ($strType) {
             case 'TRANSACTION':
                 self::TransactionNotification($code);
                 break;
             default:
                 LogPagSeguro::error("Tipo de notificação não reconhecido [" . $notificationType->getValue() . "]");
         }
         self::saveLog($strType);
     } else {
         LogPagSeguro::error("Os parâmetros de notificação (notificationCode e notificationType) não foram recebidos.");
         self::saveLog();
     }
 }
 public function duplicatedName($attribute, $params)
 {
     if ($this->isNewRecord) {
         if (count(NotificationType::model()->findALl('name=:name', array("name" => $this->name))) > 0) {
             $this->addError($attribute, str_replace("{attribute}", $attribute, Yii::app()->params["templateDuplicatedValueErrorMessage"]));
         }
     } else {
         if (count(NotificationType::model()->findALl('id<>:id and name=:name', array("name" => $this->name, "id" => $this->id))) > 0) {
             $this->addError($attribute, str_replace("{attribute}", $attribute, Yii::app()->params["templateDuplicatedValueErrorMessage"]));
         }
     }
 }
 /**
  *	@covers ::delete
  */
 public function testDelete()
 {
     $mockdb = new \TMT\MockDB();
     $mockdb->expectPrepare("DELETE FROM notificationTypes WHERE guid=:guid");
     $mockdb->expectExecute(array(":guid" => "guid1"));
     $accessor = new NotificationType($mockdb);
     $accessor->delete("guid1");
     $mockdb->verify();
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return NotificationType the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = NotificationType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #7
0
 /**
  * @inheritdoc
  */
 protected function getValidTokens()
 {
     $validTokens = parent::getValidTokens();
     array_unshift($validTokens, self::SSDP_TOKEN);
     return $validTokens;
 }
 public function getNotificationTypesList()
 {
     return CHtml::listData(NotificationType::model()->findAll(), 'id', 'name');
 }
	* then repeating all values sent: that's our VALIDATION.
	**/
	$oseMscConfig= oseRegistry :: call('msc')->getConfig(null, 'obj');
	$apiEmail= oseRegistry :: call('member')->getInstance('email');
	$account = $oseMscConfig->pagseguro_account;
	$token = $oseMscConfig->pagseguro_token;
	$config= new JConfig();
	$mailfrom= $config->mailfrom;
	$fromname= $config->fromname;
	
	$code = (isset($_POST['notificationCode']) && trim($_POST['notificationCode']) !== ""  ? trim($_POST['notificationCode']) : null);
    $type = (isset($_POST['notificationType']) && trim($_POST['notificationType']) !== ""  ? trim($_POST['notificationType']) : null);
	
    if ( $code && $type ) 
    {
   		$notificationType = new NotificationType($type);
    	$strType = $notificationType->getTypeFromValue();
			
		switch($strType) 
		{
				
			case 'TRANSACTION':
				$credentials = new AccountCredentials($account, $token);
		    	try 
		    	{
		    		$transaction = NotificationService::checkTransaction($credentials, $code);
		    	} catch (PagSeguroServiceException $e) 
		    	{
		    		$error = $e->getMessage();
		    	}
				break;
Exemple #10
0
 /**
  * Set the Notification Type
  *
  * @param NotificationType $type
  * @return void
  */
 private function setType(NotificationType $type)
 {
     $this->type = $type->tag();
 }
 /**
  * Returns the NotificationType to be registered with the sfNotificationsPlugin.
  *
  * @return NotificationType
  */
 public static function getNotificationType()
 {
     $type = new NotificationType();
     return $type->setName('Validtest');
 }
 /**
  * Returns the NotificationType to be registered with the sfNotificationsPlugin.
  *
  * @return NotificationType
  */
 public static function getNotificationType()
 {
     $type = new NotificationType();
     return $type->setName('SimpleFile');
 }