当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpStatus::getType方法代码示例

本文整理汇总了PHP中HttpStatus::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpStatus::getType方法的具体用法?PHP HttpStatus::getType怎么用?PHP HttpStatus::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpStatus的用法示例。


在下文中一共展示了HttpStatus::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createCheckoutRequest

 public static function createCheckoutRequest(Credentials $credentials, PaymentRequest $paymentRequest)
 {
     LogPagSeguro::info("PaymentService.Register(" . $paymentRequest->toString() . ") - begin");
     $connectionData = new PagSeguroConnectionData($credentials, self::serviceName);
     try {
         $connection = new HttpConnection();
         $connection->post(self::buildCheckoutRequestUrl($connectionData), PaymentParser::getData($paymentRequest), $connectionData->getServiceTimeout(), $connectionData->getCharset());
         $httpStatus = new HttpStatus($connection->getStatus());
         switch ($httpStatus->getType()) {
             case 'OK':
                 $PaymentParserData = PaymentParser::readSuccessXml($connection->getResponse());
                 $paymentUrl = self::buildCheckoutUrl($connectionData, $PaymentParserData->getCode());
                 LogPagSeguro::info("PaymentService.Register(" . $paymentRequest->toString() . ") - end {1}" . $PaymentParserData->getCode());
                 break;
             case 'BAD_REQUEST':
                 $errors = PaymentParser::readErrors($connection->getResponse());
                 $e = new PagSeguroServiceException($httpStatus, $errors);
                 LogPagSeguro::error("PaymentService.Register(" . $paymentRequest->toString() . ") - error " . $e->getOneLineMessage());
                 throw $e;
                 break;
             default:
                 $e = new PagSeguroServiceException($httpStatus);
                 LogPagSeguro::error("PaymentService.Register(" . $paymentRequest->toString() . ") - error " . $e->getOneLineMessage());
                 throw $e;
                 break;
         }
         return isset($paymentUrl) ? $paymentUrl : false;
     } catch (PagSeguroServiceException $e) {
         throw $e;
     } catch (Exception $e) {
         LogPagSeguro::error("Exception: " . $e->getMessage());
         throw $e;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:34,代码来源:PaymentService.class.php

示例2: checkTransaction

 /**
  * Returns a transaction from a notification code
  * 
  * @param Credentials $credentials
  * @param String $notificationCode
  * @throws PagSeguroServiceException
  * @throws Exception
  * @return a transaction
  * @see Transaction
  */
 public static function checkTransaction(Credentials $credentials, $notificationCode)
 {
     LogPagSeguro::info("NotificationService.CheckTransaction(notificationCode={$notificationCode}) - begin");
     $connectionData = new PagSeguroConnectionData($credentials, self::serviceName);
     try {
         $connection = new HttpConnection();
         $connection->get(self::buildTransactionNotificationUrl($connectionData, $notificationCode), $connectionData->getServiceTimeout(), $connectionData->getCharset());
         $httpStatus = new HttpStatus($connection->getStatus());
         switch ($httpStatus->getType()) {
             case 'OK':
                 // parses the transaction
                 $transaction = TransactionParser::readTransaction($connection->getResponse());
                 LogPagSeguro::info("NotificationService.CheckTransaction(notificationCode={$notificationCode}) - end " . $transaction->toString() . ")");
                 break;
             case 'BAD_REQUEST':
                 $errors = TransactionParser::readErrors($connection->getResponse());
                 $e = new PagSeguroServiceException($httpStatus, $errors);
                 LogPagSeguro::info("NotificationService.CheckTransaction(notificationCode={$notificationCode}) - error " . $e->getOneLineMessage());
                 throw $e;
                 break;
             default:
                 $e = new PagSeguroServiceException($httpStatus);
                 LogPagSeguro::info("NotificationService.CheckTransaction(notificationCode={$notificationCode}) - error " . $e->getOneLineMessage());
                 throw $e;
                 break;
         }
         return isset($transaction) ? $transaction : null;
     } catch (PagSeguroServiceException $e) {
         throw $e;
     } catch (Exception $e) {
         LogPagSeguro::error("Exception: " . $e->getMessage());
         throw $e;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:44,代码来源:NotificationService.class.php

示例3: searchAbandoned

 /**
  * Search transactions abandoned associated with this set of credentials within a date range
  *
  * @param Credentials $credentials
  * @param String $initialDate
  * @param String $finalDate
  * @param integer $pageNumber
  * @param integer $maxPageResults
  * @return a object of TransactionSerachResult class
  * @see TransactionSearchResult
  * @throws PagSeguroServiceException
  * @throws Exception
  */
 public static function searchAbandoned(Credentials $credentials, $initialDate, $finalDate, $pageNumber, $maxPageResults)
 {
     LogPagSeguro::info("TransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - begin");
     $connectionData = new PagSeguroConnectionData($credentials, self::serviceName);
     $searchParams = array('initialDate' => PagSeguroHelper::formatDate($initialDate), 'finalDate' => PagSeguroHelper::formatDate($finalDate), 'pageNumber' => $pageNumber, 'maxPageResults' => $maxPageResults);
     try {
         $connection = new HttpConnection();
         $connection->get(self::buildSearchUrlAbandoned($connectionData, $searchParams), $connectionData->getServiceTimeout(), $connectionData->getCharset());
         $httpStatus = new HttpStatus($connection->getStatus());
         switch ($httpStatus->getType()) {
             case 'OK':
                 $searchResult = TransactionParser::readSearchResult($connection->getResponse());
                 LogPagSeguro::info("TransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end " . $searchResult->toString());
                 break;
             case 'BAD_REQUEST':
                 $errors = TransactionParser::readErrors($connection->getResponse());
                 $e = new PagSeguroServiceException($httpStatus, $errors);
                 LogPagSeguro::error("TransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end " . $e->getOneLineMessage());
                 throw $e;
                 break;
             default:
                 $e = new PagSeguroServiceException($httpStatus);
                 LogPagSeguro::error("TransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end " . $e->getOneLineMessage());
                 throw $e;
                 break;
         }
         return isset($searchResult) ? $searchResult : false;
     } catch (PagSeguroServiceException $e) {
         throw $e;
     } catch (Exception $e) {
         LogPagSeguro::error("Exception: " . $e->getMessage());
         throw $e;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:47,代码来源:TransactionSearchService.class.php


注:本文中的HttpStatus::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。