本文整理匯總了PHP中PagSeguroHelper::formatDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP PagSeguroHelper::formatDate方法的具體用法?PHP PagSeguroHelper::formatDate怎麽用?PHP PagSeguroHelper::formatDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PagSeguroHelper
的用法示例。
在下文中一共展示了PagSeguroHelper::formatDate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: searchByReference
/**
* @param PagSeguroCredentials $credentials
* @param $pageNumber
* @param $maxPageResults
* @param $initialDate
* @param null $finalDate
* @return null|PagSeguroParserData
* @throws Exception
* @throws PagSeguroServiceException
*/
public static function searchByReference(PagSeguroCredentials $credentials, $pageNumber, $maxPageResults, $initialDate, $finalDate = null, $reference)
{
//Logging
$log['text'] = "PagSeguroPreApprovalService.FindByReference(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ", reference=" . $reference . "begin";
LogPagSeguro::info($log['text']);
self::$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
$params = self::buildParams($pageNumber, $maxPageResults, $initialDate, $finalDate, $reference);
try {
$connection = new PagSeguroHttpConnection();
$connection->get(self::buildFindByReferenceUrl(self::$connectionData, $params), self::$connectionData->getServiceTimeout(), self::$connectionData->getCharset());
self::$service = "FindByReference";
return self::getResult($connection);
} catch (PagSeguroServiceException $err) {
//Logging
LogPagSeguro::error("PagSeguroServiceException: " . $err->getMessage());
//Exception
throw $err;
} catch (Exception $err) {
//Logging
LogPagSeguro::error("Exception: " . $err->getMessage());
//Exception
throw $err;
}
}
示例2: searchAbandoned
/**
* Search transactions abandoned associated with this set of credentials within a date range
*
* @param PagSeguroCredentials $credentials
* @param String $initialDate
* @param String $finalDate
* @param integer $pageNumber
* @param integer $maxPageResults
* @return PagSeguroTransactionSearchResult a object of PagSeguroTransactionSearchResult class
* @see PagSeguroTransactionSearchResult
* @throws PagSeguroServiceException
* @throws Exception
*/
public static function searchAbandoned(PagSeguroCredentials $credentials, $pageNumber, $maxPageResults, $initialDate, $finalDate = null)
{
LogPagSeguro::info("PagSeguroTransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - begin");
$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
$searchParams = array('initialDate' => PagSeguroHelper::formatDate($initialDate), 'pageNumber' => $pageNumber, 'maxPageResults' => $maxPageResults);
$searchParams['finalDate'] = $finalDate ? PagSeguroHelper::formatDate($finalDate) : null;
try {
$connection = new PagSeguroHttpConnection();
$connection->get(self::buildSearchUrlAbandoned($connectionData, $searchParams), $connectionData->getServiceTimeout(), $connectionData->getCharset());
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
$searchResult = PagSeguroTransactionParser::readSearchResult($connection->getResponse());
LogPagSeguro::info("PagSeguroTransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end " . $searchResult->toString());
break;
case 'BAD_REQUEST':
$errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
$e = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::error("PagSeguroTransactionSearchService.searchAbandoned(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end " . $e->getOneLineMessage());
throw $e;
break;
default:
$e = new PagSeguroServiceException($httpStatus);
LogPagSeguro::error("PagSeguroTransactionSearchService.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;
}
}
示例3: searchResult
private function searchResult($connection, $initialDate = null, $finalDate = null)
{
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
$searchResult = PagSeguroTransactionParser::readSearchResult($connection->getResponse());
LogPagSeguro::info(sprintf("PagSeguroTransactionSearchService.%s(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $searchResult->toString());
break;
case 'BAD_REQUEST':
$errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
$err = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::error(sprintf("PagSeguroTransactionSearchService.%s(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $err->getOneLineMessage());
throw $err;
break;
default:
$err = new PagSeguroServiceException($httpStatus);
LogPagSeguro::error(sprintf("PagSeguroTransactionSearchService.%s(initialDate=" . PagSeguroHelper::formatDate($initialDate) . ", finalDate=" . PagSeguroHelper::formatDate($finalDate) . ") - end ", self::$logService) . $err->getOneLineMessage());
throw $err;
break;
}
return isset($searchResult) ? $searchResult : false;
}