public static function processarNotificacao($id_integracao, $notificationCode) { // Logar notificacao self::logarNotificacao($_POST); /* @var $integracao Integracao */ $integracao = Integracoes::getInstance()->getById($id_integracao); // Processar notificação if (strtolower($integracao->servico) == 'pagseguro') { $transacao = PagSeguroUtil::getTransacaoNotificacao($integracao, $notificationCode); if (get_class($transacao) == 'PagSeguroTransaction') { $return = Inscricoes::getInstance()->processarTransacaoPagSeguro($transacao); if (get_class($return) != 'Inscricao') { throw new Exception('PagSeguro - ' . $return); } } else { throw new Exception("Falha ao obter transação da notificação: {$notificationCode}"); } } elseif (strtolower($integracao->servico) == 'cielo') { // Me notificar pra eu entender a coisa $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; enviarEmail(TGO_EVENTO_ADMIN, 'Notificacao cielo', 'URL: ' . $actual_link . '<br><br>GET:<pre>' . print_r($_POST, true) . '</pre><br><br>POST<pre>:' . print_r($_POST, true) . '</pre>'); $transacao = $_POST; $return = Inscricoes::getInstance()->processarTransacaoCielo($transacao); if (get_class($return) != 'Inscricao') { throw new Exception('Cielo - ' . $return); } else { echo '<status>OK</status>'; } } }