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(); } }
switch($strType) { case 'TRANSACTION': $credentials = new AccountCredentials($account, $token); try { $transaction = NotificationService::checkTransaction($credentials, $code); } catch (PagSeguroServiceException $e) { $error = $e->getMessage(); } break; default: $error = $notificationType->getValue(); break; } }else{ $error = "Invalid notification parameters."; } if($transaction) { $status = $transaction->getStatus (); $reference = $transaction->getReference(); $db= oseDB :: instance(); $where= array(); $where[]= "`order_number` = ".$db->quote($reference); $payment= oseRegistry :: call('payment'); $orderInfo = $payment->getOrder($where, 'obj');