本文整理汇总了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;
}