Пример #1
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();
     }
 }
Пример #2
0
	**/
	$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;