/** * Returns a pre approval from a notification code * @param PagSeguroCredentials $credentials * @param $notificationCode * @return bool|mixed|string * @throws Exception * @throws PagSeguroServiceException */ public static function checkPreApproval(PagSeguroCredentials $credentials, $notificationCode) { LogPagSeguro::info("PagSeguroNotificationService.CheckPreApproval(notificationCode={$notificationCode}) - begin"); $connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME); try { $connection = new PagSeguroHttpConnection(); $connection->get(self::buildPreApprovalNotificationUrl($connectionData, $notificationCode), $connectionData->getServiceTimeout(), $connectionData->getCharset()); self::$service = "CheckPreApproval"; return self::getResult($connection, $notificationCode); } catch (PagSeguroServiceException $err) { throw $err; } catch (Exception $err) { LogPagSeguro::error("Exception: " . $err->getMessage()); throw $err; } }