/**
  * @param PagSeguroCredentials $credentials
  * @param $code
  * @return null|PagSeguroParserData
  * @throws Exception
  * @throws PagSeguroServiceException
  */
 public static function cancelPreApproval(PagSeguroCredentials $credentials, $code)
 {
     //Logging
     $log['text'] = "PagSeguroNotificationService.PreApprovalCancel({$code}) - begin";
     LogPagSeguro::info($log['text']);
     self::$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
     try {
         $connection = new PagSeguroHttpConnection();
         $connection->get(self::buildPreApprovalCancelUrl(self::$connectionData, $code), self::$connectionData->getServiceTimeout(), self::$connectionData->getCharset());
         self::$service = "PreApprovalCancel";
         return self::getResult($connection, $code);
     } catch (PagSeguroServiceException $err) {
         //Logging
         LogPagSeguro::error("PagSeguroServiceException: " . $err->getMessage());
         //Exception
         throw $err;
     } catch (Exception $err) {
         //Logging
         LogPagSeguro::error("Exception: " . $err->getMessage());
         //Exception
         throw $err;
     }
 }