public static function searchByInterval()
 {
     // Substitute the code below
     $days = 20;
     try {
         /**
          * @todo
          * #### Credentials #####
          * Replace the parameters below with your credentials (e-mail and token)
          * You can also get your credentials from a config file. See an example:
          * $credentials = PagSeguroConfig::getAccountCredentials();
          */
         $credentials = PagSeguroConfig::getAccountCredentials();
         $result = PagSeguroPreApprovalSearchService::searchByInterval($credentials, $days);
         self::printResult($result);
     } catch (PagSeguroServiceException $e) {
         die($e->getMessage());
     }
 }
 public static function searchByNotification()
 {
     // Substitute the code below with a valid code notification for your account
     $notificationCode = "29B0BEC9D653D653435EE42F3FAEF4461091";
     try {
         /**
          * @todo
          * #### Credentials #####
          * Replace the parameters below with your credentials (e-mail and token)
          * You can also get your credentials from a config file. See an example:
          * $credentials = PagSeguroConfig::getAccountCredentials();
          */
         $credentials = PagSeguroConfig::getAccountCredentials();
         $result = PagSeguroPreApprovalSearchService::findByNotification($credentials, $notificationCode);
         self::printResult($result);
     } catch (PagSeguroServiceException $e) {
         die($e->getMessage());
     }
 }
Example #3
0
 public static function searchByCode()
 {
     // Substitute the code below with a valid pre-approval code for your account
     $preApprovalCode = "0FEBE545C6C657A77402DF878C539E56";
     try {
         /**
          * @todo
          * #### Credentials #####
          * Replace the parameters below with your credentials (e-mail and token)
          * You can also get your credentials from a config file. See an example:
          * $credentials = PagSeguroConfig::getAccountCredentials();
          */
         $credentials = PagSeguroConfig::getAccountCredentials();
         $result = PagSeguroPreApprovalSearchService::searchByCode($credentials, $preApprovalCode);
         self::printResult($result);
     } catch (PagSeguroServiceException $e) {
         die($e->getMessage());
     }
 }
Example #4
0
 public static function searchByDate()
 {
     // Substitute the information below
     $page = 1;
     $maxPageResults = 1000;
     $initialDate = "2015-03-10T00:00:00";
     $finalDate = "2015-04-06T00:00:00";
     try {
         /**
          * @todo
          * #### Credentials #####
          * Replace the parameters below with your credentials (e-mail and token)
          * You can also get your credentials from a config file. See an example:
          * $credentials = PagSeguroConfig::getAccountCredentials();
          */
         $credentials = PagSeguroConfig::getAccountCredentials();
         $result = PagSeguroPreApprovalSearchService::searchByDate($credentials, $page, $maxPageResults, $initialDate, $finalDate);
         self::printResult($result, $initialDate, $finalDate);
     } catch (PagSeguroServiceException $e) {
         die($e->getMessage());
     }
 }
 /**
  * @param PagSeguroCredentials $credentials
  * @param $notificationCode
  * @return null|PagSeguroParserData
  * @throws Exception
  * @throws PagSeguroServiceException
  */
 public static function findByNotification(PagSeguroCredentials $credentials, $notificationCode)
 {
     LogPagSeguro::info("PagSeguroPreApprovalService.FindByNotification({$notificationCode}) - begin");
     self::$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
     try {
         $connection = new PagSeguroHttpConnection();
         $connection->get(self::buildFindByNotificationUrl(self::$connectionData, $notificationCode), self::$connectionData->getServiceTimeout(), self::$connectionData->getCharset());
         self::$service = "FindByNotification";
         return self::getResult($connection, $notificationCode);
     } catch (PagSeguroServiceException $err) {
         //Logging
         LogPagSeguro::error("PagSeguroServiceException: " . $err->getMessage());
         //Exception
         throw $err;
     } catch (Exception $err) {
         //Logging
         LogPagSeguro::error("Exception: " . $err->getMessage());
         //Exception
         throw $err;
     }
 }