當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。