本文整理汇总了PHP中Logger::AddLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::AddLog方法的具体用法?PHP Logger::AddLog怎么用?PHP Logger::AddLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::AddLog方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPendingOrder
public function createPendingOrder($extra_vars = array(), $metodo_de_pago, $mensaje, $order_state)
{
try {
$payu = new PayULatam();
$date = date("Y-m-d H:i:s");
$sql = "INSERT INTO " . _DB_PREFIX_ . "sonda_payu (id_cart,date_add,`interval`,last_update, pasarela)\r\n VALUES(" . (int) $this->context->cart->id . ",'" . $date . "',";
if ($metodo_de_pago === 'Tarjeta_credito' || $metodo_de_pago === 'PSE') {
$sql .= 11;
} else {
$sql .= 61;
}
$sql .= ", '" . $date . "','" . $payu->name . "');";
if (!Db::getInstance()->Execute($sql)) {
Logger::AddLog('Error al guardar sonda_payu id_cart: ' . $this->context->cart->id, 2, null, null, null, true);
}
$payu->validateOrder((int) self::$cart->id, (int) Configuration::get($order_state), (double) self::$cart->getOrderTotal(), $metodo_de_pago, $mensaje, $extra_vars, NULL, false, self::$cart->secure_key);
} catch (Exception $e) {
exit('<pre>' . print_r($e, TRUE) . '</pre>');
}
}
示例2: validation
/**
* @brief Validate a payment, verify if everything is right
*/
public function validation()
{
if (!isset($_POST['sign']) && !isset($_POST['signature'])) {
Logger::AddLog('[Payulatam] the signature is missing.', 2, null, null, null, true);
} else {
$token = isset($_POST['sign']) ? $_POST['sign'] : $_POST['signature'];
}
if (!isset($_POST['reference_sale']) && !isset($_POST['referenceCode'])) {
Logger::AddLog('[Payulatam] the reference is missing.', 2, null, null, null, true);
} else {
$ref = isset($_POST['reference_sale']) ? $_POST['reference_sale'] : $_POST['referenceCode'];
}
if (!isset($_POST['value']) && !isset($_POST['amount'])) {
Logger::AddLog('[Payulatam] the amount is missing.', 2, null, null, null, true);
} else {
$amount = isset($_POST['value']) ? $_POST['value'] : $_POST['amount'];
}
if (!isset($_POST['merchant_id']) && !isset($_POST['merchantId'])) {
Logger::AddLog('[Payulatam] the merchantId is missing.', 2, null, null, null, true);
} else {
$merchantId = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : $_POST['merchantId'];
}
if (!isset($_POST['lap_state']) && !isset($_POST['state_pol'])) {
Logger::AddLog('[Payulatam] the lap_state is missing.', 2, null, null, null, true);
} else {
$statePol = isset($_POST['lap_state']) ? $_POST['lap_state'] : $_POST['state_pol'];
}
$idCart = substr($ref, 6 + strlen(Configuration::get('PS_SHOP_NAME')));
$this->context->cart = new Cart((int) $idCart);
if (!$this->context->cart->OrderExists()) {
Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have any order created', 2, null, null, null, true);
return false;
}
if (Validate::isLoadedObject($this->context->cart)) {
$id_orders = Db::getInstance()->ExecuteS('SELECT `id_order` FROM `' . _DB_PREFIX_ . 'orders` WHERE `id_cart` = ' . (int) $this->context->cart->id . '');
foreach ($id_orders as $val) {
$order = new Order((int) $val['id_order']);
if ($this->context->cart->getOrderTotal() != $amount) {
Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have the correct amount expected during payment validation', 2, null, null, null, true);
} else {
$currency = new Currency((int) $this->context->cart->id_currency);
if ($token == md5(Configuration::get('PAYU_API_KEY') . '~' . Tools::safeOutput(Configuration::get('PAYU_MERCHANT_ID')) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '~' . (double) $this->context->cart->getOrderTotal() . '~' . $currency->iso_code . '~' . $statePol)) {
if ($statePol == 7) {
$order->setCurrentState((int) Configuration::get('PAYU_WAITING_PAYMENT'));
} else {
if ($statePol == 4) {
$order->setCurrentState((int) Configuration::get('PS_OS_PAYMENT'));
} else {
$order->setCurrentState((int) Configuration::get('PS_OS_ERROR'));
Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' has been rejected by PayU state pol=' . (int) $statePol, 2, null, null, null, true);
}
}
} else {
Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' has an incorrect token given from payU during payment validation', 2, null, null, null, true);
}
}
if (_PS_VERSION_ >= 1.5) {
$payment = $order->getOrderPaymentCollection();
if (isset($payment[0])) {
$payment[0]->transaction_id = pSQL($ref);
$payment[0]->save();
}
}
}
} else {
Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' was not found during the payment validation step', 2, null, null, null, true);
}
}
示例3: validation
/**
* @brief Validate a payment, verify if everything is right
*/
public function validation()
{
$token = (int) Tools::getValue('Token');
$id_cart = (int) Tools::getValue('TransactionID');
$link = new Link();
$this->context->cart = new Cart($id_cart);
$this->context->link = $link;
if (Validate::isLoadedObject($this->context->cart)) {
$call = new Call();
try {
$result = $call->getTransaction($token);
} catch (Exception $e) {
Logger::AddLog('[MerchantWare] Problem to verify a payment. Cart id: ' . $id_cart . ', token: ' . $token . '.', 2);
}
if (isset($result->TransactionsByReferenceResult->TransactionReference4->ApprovalStatus)) {
if ($result->TransactionsByReferenceResult->TransactionReference4->ApprovalStatus == 'APPROVED') {
$amount = str_replace(',', '', $result->TransactionsByReferenceResult->TransactionReference4->Amount);
$tokenTransaction = new TokenTransaction((int) $this->context->cart->id);
$tokenTransaction->setToken($token);
$this->validateOrder((int) $this->context->cart->id, Configuration::get('PS_OS_PAYMENT'), $amount, 'merchantware', NULL, array(), NULL, false, $this->context->cart->secure_key);
} else {
$this->validateOrder((int) $this->context->cart->id, Configuration::get('PS_OS_ERROR'), $amount, 'merchantware', NULL, array(), NULL, false, $this->context->cart->secure_key);
}
} else {
Logger::AddLog('[MerchantWare] Problem to verify a payment. Cart id: ' . (int) $id_cart . ', token: ' . Tools::safeOutput($token) . '.', 2);
}
} else {
Logger::AddLog('[MerchantWare] The Shopping cart #' . (int) $id_cart . ' was not found during the payment validation step.', 2);
}
$url = 'index.php?controller=order-confirmation&';
if (_PS_VERSION_ < '1.5') {
$url = 'order-confirmation.php?';
}
header('location:' . __PS_BASE_URI__ . $url . 'id_module=' . (int) $this->id . '&id_cart=' . (int) $this->context->cart->id . '&key=' . $this->context->customer->secure_key);
exit;
}
示例4: validation
public function validation()
{
$cart = $this->context->cart;
if (Validate::isLoadedObject($cart) && !Order::getOrderByCartId((int) Tools::getValue('cart'))) {
$json_result = json_decode($this->_firstDataCall('{"gateway_id": "' . Configuration::get('FIRSTDATA_GATEWAY_ID') . '", "password": "' . Configuration::get('FIRSTDATA_PASSWORD') . '", "transaction_type": "00", "amount": "' . (double) $cart->getOrderTotal() . '", "cc_number": "' . Tools::safeOutput(Tools::getValue('x_card_num')) . '", "cc_expiry": "' . (Tools::getValue('x_exp_date_m') < 10 ? '0' . (int) Tools::getValue('x_exp_date_m') : (int) Tools::getValue('x_exp_date_m')) . (int) Tools::getValue('x_exp_date_y') . '", "cardholder_name": "' . Tools::safeOutput(Tools::getValue('firstdata_card_holder')) . '"}'));
if (isset($json_result->transaction_approved) && $json_result->transaction_approved) {
$this->_insertTransaction(array('id_cart' => (int) $cart->id, 'authorization_num' => pSQL($json_result->authorization_num), 'transaction_tag' => (int) $json_result->transaction_tag, 'date_add' => date('Y-m-d H:i:s')));
$this->validateOrder((int) $cart->id, (int) Configuration::get('PS_OS_PAYMENT'), (double) $json_result->amount, $this->displayName, pSQL($json_result->ctr), array(), null, false, $cart->secure_key);
/** @since 1.5.0 Attach the First Data Transaction ID to this Order */
if (version_compare(_PS_VERSION_, '1.5', '>=')) {
$new_order = new Order((int) $this->currentOrder);
if (Validate::isLoadedObject($new_order)) {
$payment = $new_order->getOrderPaymentCollection();
$payment[0]->transaction_id = (int) $json_result->transaction_tag;
$payment[0]->save();
}
}
/* Redirect the user to the order confirmation page / history */
if (_PS_VERSION_ < 1.5) {
$redirect = __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->id . '&id_order=' . (int) $this->currentOrder . '&key=' . $this->context->customer->secure_key;
} else {
$redirect = __PS_BASE_URI__ . 'index.php?controller=order-confirmation&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->id . '&id_order=' . (int) $this->currentOrder . '&key=' . $this->context->customer->secure_key;
}
header('Location: ' . $redirect);
exit;
} else {
if (isset($json_result->transaction_approved) && !$json_result->transaction_approved && isset($json_result->bank_message) && $json_result->bank_message != '') {
$error_msg = Tools::safeOutput($json_result->bank_message);
} else {
$error_msg = trim(substr($result, strpos($result, '-')));
}
Logger::AddLog('[FirstData] ' . Tools::safeOutput($error_msg), 2);
$checkout_type = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order';
$url = (_PS_VERSION_ >= '1.5' ? 'index.php?controller=' . $checkout_type . '&' : $checkout_type . '.php?') . 'step=3&cgv=1&firstdataError=' . $error_msg . '#firstdata-anchor';
if (!isset($_SERVER['HTTP_REFERER']) || strstr($_SERVER['HTTP_REFERER'], 'order')) {
Tools::redirect($url);
} elseif (strstr($_SERVER['HTTP_REFERER'], '?')) {
Tools::redirect(Tools::safeOutput($_SERVER['HTTP_REFERER']) . '&firstdataError=' . $error_msg . '#firstdata-anchor', '');
} else {
Tools::redirect(Tools::safeOutput($_SERVER['HTTP_REFERER']) . '?firstdataError=' . $error_msg . '#firstdata-anchor', '');
}
}
} else {
die('Unfortunately your order could not be validated. Error: "Invalid Cart ID", please contact us.');
}
}
示例5: get_order
public function get_order($id_cart)
{
try {
$sql = 'select ord.*
from ' . _DB_PREFIX_ . 'orders ord INNER JOIN ' . _DB_PREFIX_ . 'cart car ON(ord.id_cart=car.id_cart)
WHERE ord.id_cart=' . $id_cart . ' Limit 1';
if ($results = Db::getInstance()->ExecuteS($sql)) {
foreach ($results as $row) {
return $row;
}
}
return null;
} catch (Exception $exc) {
Logger::AddLog('payulatam [config.php] get_order() error: ' . $exc->getTraceAsString(), 2, null, null, null, true);
return null;
}
}
示例6: validationws
public function validationws()
{
require_once _PS_MODULE_DIR_ . 'payulatam/config.php';
$conf = new ConfPayu();
$keysPayu = $conf->keys();
$currency_iso_code = '';
if ($conf->isTest()) {
$currency_iso_code = 'USD';
} else {
$currency_iso_code = $params[9]['currency'];
}
if (!isset($_POST['sign']) && !isset($_POST['signature'])) {
Logger::AddLog('[Payulatam] the signature is missing.', 2, null, null, null, true);
} else {
$token = isset($_POST['sign']) ? $_POST['sign'] : $_POST['signature'];
}
if (!isset($_POST['reference_sale']) && !isset($_POST['referenceCode'])) {
Logger::AddLog('[Payulatam] the reference is missing.', 2, null, null, null, true);
} else {
$ref = isset($_POST['reference_sale']) ? $_POST['reference_sale'] : $_POST['referenceCode'];
}
if (!isset($_POST['value']) && !isset($_POST['amount'])) {
Logger::AddLog('[Payulatam] the amount is missing.', 2, null, null, null, true);
} else {
$amount = isset($_POST['value']) ? $_POST['value'] : $_POST['amount'];
}
if (!isset($_POST['merchant_id']) && !isset($_POST['merchantId'])) {
Logger::AddLog('[Payulatam] the merchantId is missing.', 2, null, null, null, true);
} else {
$merchantId = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : $_POST['merchantId'];
}
if (!isset($_POST['lap_state']) && !isset($_POST['state_pol'])) {
Logger::AddLog('[Payulatam] the lap_state is missing.', 2, null, null, null, true);
} else {
$statePol = isset($_POST['lap_state']) ? $_POST['lap_state'] : $_POST['state_pol'];
}
$idCart = explode('_', $ref)[2];
$this->context->cart = new Cart((int) $idCart);
$total_order = $this->context->cart->getOrderTotal();
if (!$this->context->cart->OrderExists()) {
Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have any order created', 2, null, null, null, true);
return false;
}
if (Validate::isLoadedObject($this->context->cart)) {
$id_orders = Db::getInstance()->ExecuteS('SELECT `id_order` FROM `' . _DB_PREFIX_ . 'orders` WHERE `id_cart` = ' . (int) $this->context->cart->id . '');
foreach ($id_orders as $val) {
$order = new Order((int) $val['id_order']);
if ($this->context->cart->getOrderTotal() != $amount) {
Logger::AddLog('[Payulatam] The shopping card ' . (int) $idCart . ' doesn\'t have the correct amount expected during payment validation.' . $keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '~' . number_format((double) $this->context->cart->getOrderTotal(), 2, '.', '') . '~' . $currency->iso_code . '~' . $statePol . "---" . $amount, 2, null, null, null, true);
} else {
$currency = new Currency((int) $this->context->cart->id_currency);
if ($token == md5($keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '_' . $conf->get_intentos($this->context->cart->id) . '~' . number_format((double) $total_order, 2, '.', '') . '~' . $currency_iso_code . '~' . $statePol) || $token == md5($keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '_' . $conf->get_intentos($this->context->cart->id) . '~' . number_format((double) $total_order, 1, '.', '') . '~' . $currency_iso_code . '~' . $statePol) || $token == md5($keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '_' . $conf->get_intentos($this->context->cart->id) . '~' . number_format((double) $total_order, 0, '.', '') . '~' . $currency_iso_code . '~' . $statePol)) {
// CUANDO SE ENVIAN # ENTEROS EN EL PAGO A PAYU, ESTE RETORNA 1 DECIMAL, CUANDO SE ENVIAN DECIMALES, PAYU RETORNA 2 DECIMALES. SE VALIDA TAMBIEN SIN DECIMALES EVG GPB
if ($statePol == 7) {
if ($order->getCurrentState() != (int) Configuration::get('PAYU_WAITING_PAYMENT')) {
$order->setCurrentState((int) Configuration::get('PAYU_WAITING_PAYMENT'));
}
} else {
if ($statePol == 4) {
if ($order->getCurrentState() != (int) Configuration::get('PS_OS_PAYMENT')) {
$order->setCurrentState((int) Configuration::get('PS_OS_PAYMENT'));
}
} else {
if ($order->getCurrentState() != (int) Configuration::get('PS_OS_ERROR')) {
$order->setCurrentState((int) Configuration::get('PS_OS_ERROR'));
}
Logger::AddLog('[PayU] (payulatam) The shopping card ' . (int) $idCart . ' has been rejected by PayU state pol=' . (int) $statePol, 2, null, null, null, true);
}
}
} else {
Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' has an incorrect token given from payU during payment validation.' . $keysPayu['apiKey'] . '~' . Tools::safeOutput($keysPayu['merchantId']) . '~payU_' . Configuration::get('PS_SHOP_NAME') . '_' . (int) $this->context->cart->id . '~' . number_format((double) $total_order, 2, '.', '') . '~' . $currency->iso_code . '~' . $statePol . "--" . number_format((double) $total_order, 1, '.', '') . "--" . $token, 2, null, null, null, true);
}
}
if (_PS_VERSION_ >= 1.5) {
$payment = $order->getOrderPaymentCollection();
if (isset($payment[0])) {
$payment[0]->transaction_id = pSQL("payU_" . md5(Configuration::get('PS_SHOP_NAME')) . "_" . $idCart);
$payment[0]->save();
}
}
}
} else {
Logger::AddLog('[PayU] The shopping card ' . (int) $idCart . ' was not found during the payment validation step', 2, null, null, null, true);
}
}
示例7: dirname
* @copyright 2007-2012 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once _PS_MODULE_DIR_ . 'alliedwallet/alliedwallet.php';
$allied = new AlliedWallet();
/* First we need to check that this script is called by an authorized IP address (from Allied Wallet) */
$ch = curl_init('https://sale.alliedwallet.com/ip_list.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
if (!in_array($_SERVER['REMOTE_ADDR'], explode('|', $content))) {
Logger::AddLog('[AlliedWallet] Hack attempt: Someone tried to validate a payment - ' . Tools::safeOutput($_SERVER['REMOTE_ADDR']), 2);
die($allied->l('Forbidden Action.'));
}
$siteId = Tools::getValue('SiteID');
if ($siteId != Configuration::get('ALLIEDWALLET_SITE_ID')) {
Logger::AddLog('[AlliedWallet] Hack attempt: Someone tried to validate a payment with a different site ID - ' . Tools::safeOutput($siteId), 2);
die($allied->l('Forbidden Action.'));
}
/* Then we load the current Shopping cart */
if (_PS_VERSION_ >= 1.5) {
Context::getContext()->cart = new Cart((int) Tools::getValue('MerchantReference'));
}
$cart = _PS_VERSION_ >= 1.5 ? Context::getContext()->cart : new Cart((int) Tools::getValue('MerchantReference'));
if (Validate::isLoadedObject($cart)) {
$allied->validateOrder((int) $cart->id, Configuration::get('PS_OS_PAYMENT'), (double) Tools::getValue('Amount'), $allied->name, NULL, array(), NULL, false, $cart->secure_key);
} else {
Logger::AddLog('[AlliedWallet] The Shopping cart #' . (int) Tools::getValue('MerchantReference') . ' was not found during the payment validation step.', 2);
}
示例8: uploadOneImage
/**
* Upload one image on the server
*
* @param $file
* @param $modulePath
* @param $langId
* @return bool|string
*/
private function uploadOneImage($file, $modulePath, $langId)
{
//check image errors
if ($file["error"] > 0) {
return false;
} else {
//TODO : keep real image extension name
$imageName = sha1(uniqid(mt_rand(), true)) . '-' . $langId . '.jpg';
$imagePath = $modulePath . 'images/';
//check image type
if ($file['type'] == 'image/png' || $file['type'] == 'image/jpg' || $file['type'] == 'image/gif' || $file['type'] == 'image/jpeg' || $file['type'] == 'image/pjpeg') {
if (file_exists($imagePath . $imageName)) {
return false;
} else {
if (!move_uploaded_file($file["tmp_name"], $imagePath . $imageName)) {
Logger::AddLog('[Module : ResponsiveSlider | Class : ResponsiveSliderClass | Message : Error while moving the slide image | PathToImage : ' . $imagePath . $imageName);
}
return $imageName;
}
} else {
return false;
}
}
}