本文整理汇总了PHP中LogPagSeguro类的典型用法代码示例。如果您正苦于以下问题:PHP LogPagSeguro类的具体用法?PHP LogPagSeguro怎么用?PHP LogPagSeguro使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogPagSeguro类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkTransaction
/**
* Returns a transaction from a notification code
*
* @param PagSeguroCredentials $credentials
* @param String $notificationCode
* @throws PagSeguroServiceException
* @throws Exception
* @return a transaction
* @see PagSeguroTransaction
*/
public static function checkTransaction(PagSeguroCredentials $credentials, $notificationCode)
{
LogPagSeguro::info("PagSeguroNotificationService.CheckTransaction(notificationCode={$notificationCode}) - begin");
$connectionData = new PagSeguroConnectionData($credentials, self::serviceName);
try {
$connection = new PagSeguroHttpConnection();
$connection->get(self::buildTransactionNotificationUrl($connectionData, $notificationCode), $connectionData->getServiceTimeout(), $connectionData->getCharset());
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
// parses the transaction
$transaction = PagSeguroTransactionParser::readTransaction($connection->getResponse());
LogPagSeguro::info("PagSeguroNotificationService.CheckTransaction(notificationCode={$notificationCode}) - end " . $transaction->toString() . ")");
break;
case 'BAD_REQUEST':
$errors = PagSeguroTransactionParser::readErrors($connection->getResponse());
$e = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::info("PagSeguroNotificationService.CheckTransaction(notificationCode={$notificationCode}) - error " . $e->getOneLineMessage());
throw $e;
break;
default:
$e = new PagSeguroServiceException($httpStatus);
LogPagSeguro::info("PagSeguroNotificationService.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;
}
}
示例2: createRequest
/**
* @param PagSeguroCredentials $credentials
* @param $transactionCode
* @throws Exception
* @throws PagSeguroServiceException
*/
public static function createRequest(PagSeguroCredentials $credentials, $transactionCode)
{
LogPagSeguro::info("PagSeguroCancelService.Register(" . $transactionCode . ") - begin");
$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
try {
$connection = new PagSeguroHttpConnection();
$connection->post(self::buildCancelURL($connectionData, $transactionCode), array(), $connectionData->getServiceTimeout(), $connectionData->getCharset());
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
$result = PagSeguroCancelParser::readSuccessXml($connection->getResponse());
LogPagSeguro::info("PagSeguroCancelService.createRequest(" . $result . ") - end ");
break;
case 'BAD_REQUEST':
$errors = PagSeguroCancelParser::readErrors($connection->getResponse());
$err = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::error("PagSeguroCancelService.createRequest() - error " . $err->getOneLineMessage());
throw $err;
break;
default:
$err = new PagSeguroServiceException($httpStatus);
LogPagSeguro::error("PagSeguroCancelService.createRequest() - error " . $err->getOneLineMessage());
throw $err;
break;
}
return isset($result) ? $result : false;
} catch (PagSeguroServiceException $err) {
throw $err;
} catch (Exception $err) {
LogPagSeguro::error("Exception: " . $err->getMessage());
throw $err;
}
}
示例3: getSession
public static function getSession($credentials)
{
$connectionData = new PagSeguroConnectionData($credentials, 'sessionService');
$url = self::buildSessionURL($connectionData) . "?" . $connectionData->getCredentialsUrlQuery();
try {
$connection = new PagSeguroHttpConnection();
$connection->post($url, array(), $connectionData->getServiceTimeout(), $connectionData->getCharset());
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
$session = PagSeguroSessionParser::readResult($connection->getResponse());
return $session->getId();
LogPagSeguro::info("PagSeguroSessionService.getSession()(" . $session->toString() . ") - end {1}");
break;
case 'BAD_REQUEST':
$errors = PagSeguroSessionParser::readErrors($connection->getStatus());
$e = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::error("PagSeguroSessionService.getSession() - error " . $e->getOneLineMessage());
throw $e;
break;
default:
$e = new PagSeguroServiceException($httpStatus);
LogPagSeguro::error("PagSeguroSessionService.getSession() - error " . $e->getOneLineMessage());
throw $e;
break;
}
} catch (PagSeguroServiceException $e) {
throw $e;
} catch (Exception $e) {
LogPagSeguro::error("Exception: " . $e->getMessage());
throw $e;
}
}
示例4: 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;
}
}
示例5: __construct
private function __construct()
{
self::$path = dirname(__FILE__);
PagSeguroAutoloader::init();
self::$resources = PagSeguroResources::init();
self::$config = PagSeguroConfig::init();
self::$log = LogPagSeguro::init();
}
示例6: printLog
private static function printLog($strType = null)
{
$count = 4;
echo "<h2>Receive notifications</h2>";
if ($strType) {
echo "<h4>notifcationType: {$strType}</h4>";
}
echo "<p>Last <strong>{$count}</strong> items in <strong>log file:</strong></p><hr>";
echo LogPagSeguro::getHtml($count);
}
示例7: __construct
private function __construct()
{
self::$path = dirname(__FILE__);
if (function_exists('spl_autoload_register')) {
require_once "loader" . DIRECTORY_SEPARATOR . "PagSeguroAutoLoader.class.php";
PagSeguroAutoloader::init();
} else {
require_once "loader" . DIRECTORY_SEPARATOR . "PagSeguroAutoLoader.php";
}
self::$resources = PagSeguroResources::init();
self::$config = PagSeguroConfig::init();
self::$log = LogPagSeguro::init();
}
示例8: __construct
public function __construct()
{
if (self::verifyDependencies()) {
if (self::$library == null) {
self::$path = dirname(__FILE__);
PagSeguroAutoloader::init();
self::$resources = PagSeguroResources::init();
self::$config = PagSeguroConfig::init();
self::$log = LogPagSeguro::init();
self::$library = $this;
}
}
return self::$library;
}
示例9: getRetorno
public static function getRetorno($code, $type)
{
$this->ci->log_message('error', $code . '|' . $type);
if ($code && $type) {
$notificationType = new PagSeguroNotificationType($type);
$strType = $notificationType->getTypeFromValue();
switch ($strType) {
case 'TRANSACTION':
return self::transactionNotification($code);
break;
default:
LogPagSeguro::error("Unknown notification type [" . $notificationType->getValue() . "]");
show_error('PagSeguroLibrary: Unknown notification type [' . $notificationType->getValue() . ']');
break;
}
} else {
LogPagSeguro::error("Invalid notification parameters.");
show_error('PagSeguroLibrary: Invalid notification parameters.');
}
}
示例10: main
public static function main()
{
$code = self::verifyData($_POST['notificationCode']);
$type = self::verifyData($_POST['notificationtype']);
if ($code && $type) {
$notificationType = new NotificationType($type);
$strType = $notificationType->getTypeFromValue();
switch ($strType) {
case 'TRANSACTION':
self::TransactionNotification($code);
break;
default:
LogPagSeguro::error("Tipo de notificação não reconhecido [" . $notificationType->getValue() . "]");
}
self::saveLog($strType);
} else {
LogPagSeguro::error("Os parâmetros de notificação (notificationCode e notificationType) não foram recebidos.");
self::saveLog();
}
}
示例11: getInstallments
public static function getInstallments($credentials, $session, $amount, $cardBrand)
{
$connectionData = new PagSeguroConnectionData($credentials, 'installmentService');
$url = self::buildInstallmentURL($connectionData) . "?sessionId=" . $session . "&amount=" . $amount . "&creditCardBrand=" . $cardBrand;
LogPagSeguro::info("PagSeguroInstallmentService.getInstallments(" . $amount . "," . $cardBrand . ") - begin");
try {
$connection = new PagSeguroHttpConnection();
$connection->get($url, $connectionData->getServiceTimeout(), $connectionData->getCharset());
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
$installments = PagSeguroInstallmentParser::readInstallments($connection->getResponse());
if (is_array($installments)) {
LogPagSeguro::info("PagSeguroInstallmentService.getInstallments() - end {1}");
} else {
LogPagSeguro::info("PagSeguroInstallmentService.getInstallments() - error" . $installments->message);
throw new Exception($installments->message);
}
break;
case 'BAD_REQUEST':
$errors = PagSeguroInstallmentParser::readErrors($connection->getResponse());
$e = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::error("PagSeguroInstallmentService.getInstallments() - error " . $e->getOneLineMessage());
throw $e;
break;
default:
$e = new PagSeguroServiceException($httpStatus);
LogPagSeguro::error("PagSeguroInstallmentService.getInstallments() - error " . $e->getOneLineMessage());
throw $e;
break;
}
return isset($installments) ? $installments : false;
} catch (PagSeguroServiceException $e) {
throw $e;
} catch (Exception $e) {
LogPagSeguro::error("Exception: " . $e->getMessage());
throw $e;
}
}
示例12: getResult
/**
* @param $connection
* @return null|PagSeguroParserData
* @throws PagSeguroServiceException
*/
private function getResult($connection)
{
$httpStatus = new PagSeguroHttpStatus($connection->getStatus());
switch ($httpStatus->getType()) {
case 'OK':
$cancel = PagSeguroCancelParser::readSuccessXml($connection->getResponse());
LogPagSeguro::info("PagSeguroCancelService.createRequest(" . $cancel . ") - end ");
break;
case 'BAD_REQUEST':
$errors = PagSeguroCancelParser::readErrors($connection->getResponse());
$err = new PagSeguroServiceException($httpStatus, $errors);
LogPagSeguro::error("PagSeguroCancelService.createRequest() - error " . $err->getOneLineMessage());
throw $err;
break;
default:
$err = new PagSeguroServiceException($httpStatus);
LogPagSeguro::error("PagSeguroCancelService.createRequest() - error " . $err->getOneLineMessage());
throw $err;
break;
}
return isset($cancel) ? $cancel : false;
}
示例13: createLog
private function createLog()
{
/*** Retrieving configurated default charset */
PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
/*** Retrieving configurated default log info */
if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
}
LogPagSeguro::info("PagSeguroAbandoned.Search( 'Pesquisa de transações abandonadas realizada em " . date("d/m/Y H:i") . ".')");
}
示例14: activeLog
public static function activeLog($fileName = null)
{
self::setData('log', 'active', true);
self::setData('log', 'fileLocation', $fileName ? $fileName : '');
LogPagSeguro::reLoad();
}
示例15: createLog
public function createLog($type, $dados)
{
/*** Retrieving configurated default charset */
PagSeguroConfig::setApplicationCharset(Configuration::get('PAGSEGURO_CHARSET'));
/*** Retrieving configurated default log info */
if (Configuration::get('PAGSEGURO_LOG_ACTIVE')) {
PagSeguroConfig::activeLog(_PS_ROOT_DIR_ . Configuration::get('PAGSEGURO_LOG_FILELOCATION'));
}
switch ($type) {
case 'search':
LogPagSeguro::info("PagSeguroConciliation.Search( 'Pesquisa de conciliação realizada em " . date("d/m/Y H:i") . " em um intervalo de " . $dados['days'] . " dias.')");
break;
default:
LogPagSeguro::info("PagSeguroConciliation.Register( 'Alteração de Status da compra '" . $dados['idOrder'] . "' para o Status '" . $dados['newStatus'] . "(" . $dados['newIdStatus'] . ")' - '" . date("d/m/Y H:i") . "') - end");
break;
}
}