getTypeFromValue(); switch ($strType) { case 'TRANSACTION': self::transactionNotification($code); break; case 'APPLICATION_AUTHORIZATION': self::authorizationNotification($code); break; case 'PRE_APPROVAL': self::preApprovalNotification($code); break; default: LogPagSeguro::error("Unknown notification type [" . $notificationType->getValue() . "]"); } self::printLog($strType); } else { LogPagSeguro::error("Invalid notification parameters."); self::printLog(); } } private static function transactionNotification($notificationCode) { $credentials = PagSeguroConfig::getAccountCredentials(); try { $transaction = PagSeguroNotificationService::checkTransaction($credentials, $notificationCode); // Do something with $transaction } catch (PagSeguroServiceException $e) { die($e->getMessage()); } } private static function authorizationNotification($notificationCode) { $credentials = PagSeguroConfig::getApplicationCredentials(); try { $authorization = PagSeguroNotificationService::checkAuthorization($credentials, $notificationCode); // Do something with $authorization } catch (PagSeguroServiceException $e) { die($e->getMessage()); } } private static function preApprovalNotification($preApprovalCode) { $credentials = PagSeguroConfig::getAccountCredentials(); try { $preApproval = PagSeguroNotificationService::checkPreApproval($credentials, $preApprovalCode); // Do something with $preApproval } catch (PagSeguroServiceException $e) { die($e->getMessage()); } } private static function printLog($strType = null) { $count = 4; echo "
Last $count items in log file: