当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::addLog方法代码示例

本文整理汇总了PHP中Logger::addLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::addLog方法的具体用法?PHP Logger::addLog怎么用?PHP Logger::addLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logger的用法示例。


在下文中一共展示了Logger::addLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _processWebhook

 private function _processWebhook()
 {
     $webhook = new \beGateway\Webhook();
     if ($webhook->isAuthorized() && ($webhook->isSuccess() || $webhook->isFailed())) {
         $Status = $webhook->getStatus();
         $Currency = $webhook->getResponse()->transaction->currency;
         $Amount = new \beGateway\Money();
         $Amount->setCurrency($Currency);
         $Amount->setCents($webhook->getResponse()->transaction->amount);
         $TransId = $webhook->getUid();
         $orderno = $webhook->getTrackingId();
         $cart = new Cart((int) $orderno);
         if (!Validate::isLoadedObject($cart)) {
             Logger::addLog($this->l('Webhook: error to load cart'), 4);
             die($this->l('Critical error to load order cart'));
         }
         $customer = new Customer((int) $cart->id_customer);
         if (!Validate::isLoadedObject($customer)) {
             Logger::addLog($this->l('Webhook: error to load customer details'), 4);
             die($this->l('Critical error to load customer'));
         }
         $shop_ptype = trim(Configuration::get('BEGATEWAY_SHOP_PAYTYPE'));
         $payment_status = $webhook->isSuccess() ? Configuration::get('PS_OS_PAYMENT') : Configuration::get('PS_OS_ERROR');
         $this->be_gateway->validateOrder((int) $orderno, $payment_status, $Amount->getAmount(), $this->be_gateway->displayName, $webhook->getMessage(), array('transaction_id' => $TransId), NULL, false, $customer->secure_key);
         $order_new = empty($this->be_gateway->currentOrder) ? $orderno : $this->be_gateway->currentOrder;
         Db::getInstance()->Execute('
     INSERT INTO ' . _DB_PREFIX_ . 'begateway_transaction (type, id_begateway_customer, id_cart, id_order,
       uid, amount, status, currency, date_add)
       VALUES ("' . $shop_ptype . '", ' . $cart->id_customer . ', ' . $orderno . ', ' . $order_new . ', "' . $TransId . '", ' . $Amount->getAmount() . ', "' . $Status . '", "' . $Currency . '", NOW())');
         die('OK');
     }
 }
开发者ID:beGateway,项目名称:prestashop-payment-module,代码行数:32,代码来源:validation.php

示例2: verifyResponse

 private function verifyResponse()
 {
     if (!$this->verified) {
         Logger::addLog('PayPal response NOT verified');
         exit(0);
     }
     $errmsg = '';
     //        if ($_POST['receiver_email'] != $this->paypalEmailAddress) {
     //            $errmsg .= "'receiver_email' does not match: ";
     //            $errmsg .= $_POST['receiver_email']."\n";
     //        }
     if (!empty($errmsg)) {
         throw new Exception("IPN failed fraud checks: \n" . $errmsg . "\n\n");
     }
     switch ($_POST['txn_type']) {
         case TxnType::recurring_payment_profile_created:
             $this->createdNewRecurringProfile();
             break;
         case TxnType::recurring_payment:
             $this->paymentCompletedSuccessfully();
             break;
         case TxnType::recurring_payment_failed:
         case TxnType::recurring_payment_profile_cancel:
             $this->paymentFailedOrCanceled();
             break;
     }
     Logger::addLog($this->listener->getTextReport());
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:28,代码来源:PayPalIPNRequest.php

示例3: fireCurl

function fireCurl($data, $url)
{
    $domain = Configuration::get('PS_SHOP_DOMAIN');
    $auth_token = Configuration::get('PS_AUTH_TOKEN');
    Tools::getValue('id_order');
    $data_string = Tools::jsonEncode($data);
    $hash_code = hash_hmac('sha256', $data_string, $auth_token);
    Logger::addLog('Riskified URL is ' . $url, 1);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $headers = array('Content-Type: application/json', 'Content-Length: ' . Tools::strlen($data_string), 'X_RISKIFIED_SHOP_DOMAIN:' . $domain, 'X_RISKIFIED_HMAC_SHA256:' . $hash_code);
    array_push($headers, 'X_RISKIFIED_SUBMIT_NOW:ok');
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_getinfo($ch);
    $result = curl_exec($ch);
    $decoded_response = Tools::jsonDecode($result);
    $order_id = null;
    $status = null;
    if (!is_null($decoded_response) && isset($decoded_response->order)) {
        $order_id = $decoded_response->order->id;
        $status = $decoded_response->order->status;
        if ($status != 'captured' && $order_id) {
            switch ($status) {
                case 'approved':
                    echo 'Reviewed and approved by Riskified';
                    break;
                case 'declined':
                    echo 'Reviewed and declined by Riskified';
                    break;
                case 'submitted':
                    echo 'Order under review by Riskified';
                    break;
            }
        }
    } else {
        if (!is_null($decoded_response) && isset($decoded_response->error)) {
            $error_message = $decoded_response->error->message;
            Logger::addLog('Error occured when submitting an order to Riskified.');
            echo 'Error: ' . $error_message;
        } else {
            $error_message = print_r($decoded_response, true);
            echo 'Error occured: ' . $error_message;
            Logger::addLog('Error occured when submitting an order to Riskified.');
        }
    }
    die;
}
开发者ID:tomideru,项目名称:PrestaShop-modules,代码行数:50,代码来源:riskajax.php

示例4: initContent

 public function initContent()
 {
     $order_id = (int) Tools::getValue('merchantReference');
     Logger::addLog('Adyen module: incoming notification for id_order ' . $order_id);
     if ($this->validateNotificationCredential()) {
         $psp_reference = (string) Tools::getValue('pspReference');
         $event_code = (string) Tools::getValue('eventCode');
         $auth_result = (string) Tools::getValue('authResult');
         $payment_method = (string) Tools::getValue('paymentMethod');
         $success = (string) Tools::getValue('success');
         $event_data = !empty($event_code) ? $event_code : $auth_result;
         // check if notification is already executed on server based on psp_reference and event_code
         if ((int) $order_id > 0 && !$this->isDuplicate($psp_reference, $event_code)) {
             // save notification to table so notification is handled only once
             Db::getInstance()->insert('adyen_event_data', array('psp_reference' => pSQL($psp_reference), 'adyen_event_code' => pSQL($event_code), 'adyen_event_result' => pSQL($event_data), 'id_order' => (int) $order_id, 'payment_method' => pSQL($payment_method), 'created_at' => date('Y-m-d H:i:s')));
             // get the order
             $order = new Order($order_id);
             $history = new OrderHistory();
             $history->id_order = (int) $order->id;
             if (strcmp($success, 'false') == 0 || $success == '' || $event_code == 'CANCELLATION') {
                 // failed if post value success is false or not filled in
                 $history->changeIdOrderState((int) Configuration::get('ADYEN_STATUS_CANCELLED'), (int) $order->id);
                 $history->add();
                 Logger::addLog('Adyen module: status for id_order ' . $order->id . ' is changed to cancelled');
             } else {
                 // if success is not false then check if eventCode is AUTHORISATION so that order status is accepted
                 if ($event_code == 'AUTHORISATION') {
                     $history->changeIdOrderState((int) Configuration::get('ADYEN_STATUS_AUTHORIZED'), (int) $order->id);
                     $history->add();
                     Logger::addLog('Adyen module: status for id_order ' . $order->id . ' is changed to authorized');
                 } else {
                     Logger::addLog('Adyen module: status for id_order ' . $order->id . ' is ' . $event_code . ' and is ignored');
                 }
             }
         } else {
             Logger::addLog('Adyen module: incoming notification ignored because it is already handled for id_order ' . $order_id);
         }
     } else {
         Logger::addLog('Adyen module: invalid credential for incoming notification of id_order ' . $order_id, 4);
         // unauthorized
         header('HTTP/1.1 401 Unauthorized', true, 401);
         exit;
     }
     // always return accepted
     die('[accepted]');
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:46,代码来源:notification.php

示例5: makeRequestSoap

 public function makeRequestSoap($params)
 {
     // Test server url: http://packandship-ws-test.kiala.com/psws-web-1.0.0/order?wsdl
     $client = new SoapClient(Configuration::get('KIALASMALL_WS_URL'), array('trace' => true, 'exceptions' => false));
     $result = $client->createOrder($params);
     if (isset($result->trackingNumber)) {
         return $result->trackingNumber;
     } else {
         // Uncomment for debug mode
         /*
         p('KIALASMALL error - [SOAP]: '.$result->getMessage()
           .' [faultCode]: '.(isset($result->detail->orderFault->faultCode) ? $result->detail->orderFault->faultCode : '')
           .' [message]: '.(isset($result->detail->orderFault->message) ? $result->detail->orderFault->message : '')
         );
         echo htmlentities($client->__getLastRequest());
         die();
         */
         Logger::addLog('KIALASMALL error - [SOAP]: ' . $result->getMessage() . ' [faultCode]: ' . $result->detail->orderFault->faultCode . ' [message]: ' . $result->detail->orderFault->message, 4, 1, null, null, true);
     }
     return false;
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:21,代码来源:SmKialaRequest.php

示例6: process

 public function process()
 {
     parent::process();
     $params = $this->initParams();
     $call = new Call();
     try {
         $result = $call->createTransaction($params);
     } catch (Exception $e) {
         //d($e);
     }
     if (isset($result->CreateTransactionResult) && isset($result->CreateTransactionResult->TransportKey) && $result->CreateTransactionResult->TransportKey != '') {
         self::$smarty->assign('formLink', $this->_paymentLink[Configuration::get('MERCHANT_WARE_MODE')]);
         self::$smarty->assign('transportKey', Tools::safeOutput($result->CreateTransactionResult->TransportKey));
     } elseif (isset($result->CreateTransactionResult)) {
         Logger::addLog('Module merchantware: ' . $result->CreateTransactionResult->Messages->Message[0]->Information, 2);
         self::$smarty->assign('error', true);
     } else {
         self::$smarty->assign('error', true);
         Logger::addLog('Module merchantware: no message returned', 2);
     }
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:21,代码来源:payment.php

示例7: displayParameterAsDeprecated

 /**
  * Display a warning message indicating that the parameter is deprecated
  */
 public static function displayParameterAsDeprecated($parameter)
 {
     if (_PS_DISPLAY_COMPATIBILITY_WARNING_) {
         $backtrace = debug_backtrace();
         $callee = next($backtrace);
         trigger_error('Parameter <strong>' . $parameter . '</strong> in function <strong>' . $callee['function'] . '()</strong> is deprecated in <strong>' . $callee['file'] . '</strong> on line <strong>' . $callee['Line'] . '</strong><br />', E_USER_WARNING);
         $message = Tools::displayError('The parameter') . ' ' . $parameter . ' ' . Tools::displayError(' in function ') . ' ' . $callee['function'] . ' (' . Tools::displayError('Line') . ' ' . $callee['Line'] . ') ' . Tools::displayError('is deprecated and will be removed in the next major version.');
         Logger::addLog($message, 3, $callee['class']);
     }
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:13,代码来源:Tools.php

示例8: curl_init

}
/* Do the CURL request ro Authorize.net */
$request = curl_init($url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $postString);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$postResponse = curl_exec($request);
curl_close($request);
$response = explode('|', $postResponse);
if (!isset($response[7]) || !isset($response[3]) || !isset($response[9])) {
    $msg = 'Authorize.net returned a malformed response for cart';
    if (isset($response[7])) {
        $msg .= ' ' . (int) $response[7];
    }
    Logger::addLog($msg, 4);
    die('Authorize.net returned a malformed response, aborted.');
}
$message = $response[3];
$payment_method = 'Authorize.net AIM';
switch ($response[0]) {
    case 1:
        // Payment accepted
        $authorizeaim->setTransactionDetail($response);
        $authorizeaim->validateOrder((int) $cart->id, Configuration::get('PS_OS_PAYMENT'), (double) $response[9], $payment_method, $message, NULL, NULL, false, $customer->secure_key);
        break;
    case 4:
        // Hold for review
        $authorizeaim->validateOrder((int) $cart->id, Configuration::get('AUTHORIZE_AIM_HOLD_REVIEW_OS'), (double) $response[9], $authorizeaim->displayName, $response[3], NULL, NULL, false, $customer->secure_key);
        break;
    default:
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:31,代码来源:validation.php

示例9: hookDisplayPayment

 /**
  * @return string
  */
 public function hookDisplayPayment()
 {
     if (!Currency::exists('EUR', 0)) {
         return '<p class="payment_module" style="color:red;">' . $this->l('Mollie Payment Methods are only available when Euros are activated.') . '</p>';
     }
     $issuer_setting = $this->getConfigValue('MOLLIE_ISSUERS');
     try {
         $methods = $this->api->methods->all();
         $issuer_list = in_array($issuer_setting, array(self::ISSUERS_ALWAYS_VISIBLE, self::ISSUERS_ON_CLICK)) ? $this->_getIssuerList() : array();
     } catch (Mollie_API_Exception $e) {
         $methods = array();
         $issuer_list = array();
         if ($this->getConfigValue('MOLLIE_DEBUG_LOG') == self::DEBUG_LOG_ERRORS) {
             Logger::addLog(__METHOD__ . ' said: ' . $e->getMessage(), Mollie::ERROR);
         }
         if ($this->getConfigValue('MOLLIE_DISPLAY_ERRORS')) {
             return '<p class="payment_module" style="color:red;">' . $e->getMessage() . '</p>';
         }
     }
     $this->smarty->assign(array('methods' => $methods, 'issuers' => $issuer_list, 'issuer_setting' => $issuer_setting, 'images' => $this->getConfigValue('MOLLIE_IMAGES'), 'warning' => $this->warning, 'msg_pay_with' => $this->lang['Pay with %s'], 'msg_bankselect' => $this->lang['Select your bank:'], 'module' => $this));
     return $this->display(__FILE__, 'mollie_methods.tpl');
 }
开发者ID:javolero,项目名称:Prestashop,代码行数:25,代码来源:mollie.php

示例10: hookPaymentReturn

 public function hookPaymentReturn($params)
 {
     if (!$this->active) {
         return;
     }
     $order = $params['objOrder'];
     $state = $order->getCurrentState();
     if ($state == _PS_OS_ERROR_) {
         $status = 'callback';
         $msg = 'SimplePay: Confirmation failed';
         Logger::addLog($msg, 2, 0, 'Order', $order->id);
     } else {
         $status = 'ok';
     }
     $this->smarty->assign('status', $status);
     return $this->display(__FILE__, 'views/templates/hook/confirmation.tpl');
 }
开发者ID:simplepayng,项目名称:simplepay-prestashop,代码行数:17,代码来源:simplepay.php

示例11: _createPayment

 /**
  * @param array $data
  * @return Mollie_API_Object_Payment|null
  */
 protected function _createPayment($data)
 {
     $payment = null;
     if ($this->module->getConfigValue('MOLLIE_USE_PROFILE_WEBHOOK')) {
         unset($data['webhookUrl']);
     }
     try {
         /** @var Mollie_API_Object_Payment $payment */
         $payment = $this->module->api->payments->create($data);
     } catch (Mollie_API_Exception $e) {
         try {
             if ($e->getField() == "webhookUrl") {
                 if ($this->module->getConfigValue('MOLLIE_DEBUG_LOG') == Mollie::DEBUG_LOG_ERRORS) {
                     Logger::addLog(__METHOD__ . ' said: Could not reach generated webhook url, falling back to profile webhook url.', Mollie::WARNING);
                 }
                 unset($data['webhookUrl']);
                 $payment = $this->module->api->payments->create($data);
             } else {
                 throw $e;
             }
         } catch (Mollie_API_Exception $e) {
             if ($this->module->getConfigValue('MOLLIE_DEBUG_LOG') == Mollie::DEBUG_LOG_ERRORS) {
                 Logger::addLog(__METHOD__ . ' said: ' . $e->getMessage(), Mollie::CRASH);
             }
             if ($this->module->getConfigValue('MOLLIE_DISPLAY_ERRORS')) {
                 die($this->module->lang['There was an error while processing your request: '] . '<br /><i>' . $e->getMessage() . '</i><br /><br />' . '<a href="' . _PS_BASE_URL_ . __PS_BASE_URI__ . '">' . $this->module->lang['Click here to continue'] . '</a>.');
             } else {
                 Tools::redirect(_PS_BASE_URL_ . __PS_BASE_URI__);
             }
         }
     }
     return $payment;
 }
开发者ID:javolero,项目名称:Prestashop,代码行数:37,代码来源:payment.php

示例12: updateTracking

function updateTracking($static = false, $idShop = 0, $idGroupShop = 0)
{
    $api = new ShipwireTracking();
    $api->retrieveFull();
    $d = $api->sendData();
    if ($d['Status']) {
        if ($static) {
            return false;
        } else {
            die('KO');
        }
    }
    if ($d['TotalOrders'] > 0) {
        foreach ($d['Order'] as $order) {
            $o = array();
            if (isset($order['@attributes'])) {
                $o = $order['@attributes'];
            }
            if (!isset($o['id'])) {
                Logger::addLog('Shipwire: Order ID not defined. >>>>' . print_r($d, true) . '<<<<', 4);
                continue;
            }
            $orderExists = Db::getInstance()->ExecuteS('SELECT `id_order`
				FROM `' . _DB_PREFIX_ . 'shipwire_order`
				WHERE `id_order` = ' . (int) $o['id'] . ' LIMIT 1');
            if (isset($orderExists[0]['id_order']) && !empty($orderExists[0]['id_order'])) {
                Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'shipwire_order` SET ' . (isset($order['TrackingNumber']) ? '`tracking_number` = \'' . pSQL($order['TrackingNumber']) . '\',' : '') . (isset($o['shipped']) ? '`shipped` = \'' . pSQL($o['shipped']) . '\'' : '') . (isset($o['shipper']) ? ',`shipper` = \'' . pSQL($o['shipper']) . '\'' : '') . (isset($o['shipDate']) ? ',`shipDate` = \'' . pSQL($o['shipDate']) . '\'' : '') . (isset($o['expectedDeliveryDate']) ? ',`expectedDeliveryDate` = \'' . pSQL($o['expectedDeliveryDate']) . '\'' : '') . (isset($o['href']) ? ',`href` = \'' . pSQL($o['href']) . '\'' : '') . (isset($o['shipperFullName']) ? ',`shipperFullName` = \'' . pSQL($o['shipperFullName']) . '\'' : '') . ' WHERE `id_order` = ' . (int) $o['id']);
            } else {
                Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'shipwire_order`
				(`id_order`, `id_shop`, `id_group_shop`, `tracking_number`, `shipped`, `shipper`, `shipDate`, `expectedDeliveryDate`, `href`, `shipperFullName`)
				VALUES (
				\'' . pSQL($o['id']) . '\'' . ',' . (int) $idShop . ',' . (int) $idGroupShop . (isset($order['TrackingNumber']) ? ',\'' . pSQL($order['TrackingNumber']) . '\'' : ',\'\'') . (isset($o['shipped']) ? ',\'' . pSQL($o['shipped']) . '\'' : ',\'\'') . (isset($o['shipper']) ? ',\'' . pSQL($o['shipper']) . '\'' : ',\'\'') . (isset($o['shipDate']) ? ',\'' . pSQL($o['shipDate']) . '\'' : ',\'\'') . (isset($o['expectedDeliveryDate']) ? ',\'' . pSQL($o['expectedDeliveryDate']) . '\'' : ',\'\'') . (isset($o['href']) ? ',\'' . pSQL($o['href']) . '\'' : ',\'\'') . (isset($o['shipperFullName']) ? ',\'' . pSQL($o['shipperFullName']) . '\'' : ',\'\'') . ')');
            }
            $result = Db::getInstance()->getValue('SELECT `transaction_ref`
				FROM `' . _DB_PREFIX_ . 'shipwire_order`
				WHERE `id_order` = ' . (int) $o['id']);
            if (empty($result)) {
                $module = new Shipwire();
                $module->updateOrderStatus((int) $o['id'], true);
            }
            if (isset($order['TrackingNumber'])) {
                Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'orders`
										SET `shipping_number` = \'' . pSQL($order['TrackingNumber']) . '\'
										WHERE `id_order` = ' . (int) $o['id']);
                if ($o['id']) {
                    $psOrder = new Order($o['id']);
                    if ($psOrder->id) {
                        $history = new OrderHistory();
                        $history->id_order = $o['id'];
                        if (isset($o['shipped']) && $o['shipped'] == 'YES') {
                            $history->changeIdOrderState(Configuration::get('SHIPWIRE_SENT_ID'), $o['id']);
                        }
                        $history->addWithemail();
                    }
                }
            }
        }
    }
    if (Configuration::get('PS_CIPHER_ALGORITHM')) {
        $cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
    } else {
        $cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
    }
    $shipWireInventoryUpdate = new ShipwireInventoryUpdate(Configuration::get('SHIPWIRE_API_USER'), $cipherTool->decrypt(Configuration::get('SHIPWIRE_API_PASSWD')));
    $shipWireInventoryUpdate->getInventory();
    if ($static) {
        return true;
    } else {
        die('OK');
    }
}
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:71,代码来源:ShipwireTracking.php

示例13: processPayment

    /**
     * Process a payment
     *
     * @param string $token Stripe Transaction ID (token)
     */
    public function processPayment($token)
    {
        /* If 1.4 and no backward, then leave */
        if (!$this->backward) {
            return;
        }
        include dirname(__FILE__) . '/lib/Stripe.php';
        Stripe::setApiKey(Configuration::get('STRIPE_MODE') ? Configuration::get('STRIPE_PRIVATE_KEY_LIVE') : Configuration::get('STRIPE_PRIVATE_KEY_TEST'));
        /* Case 1: Charge an existing customer (or create it and charge it) */
        /* Case 2: Just process the transaction, do not save Stripe customer's details */
        if (Configuration::get('STRIPE_SAVE_TOKENS') && !Configuration::get('STRIPE_SAVE_TOKENS_ASK') || Configuration::get('STRIPE_SAVE_TOKENS') && Configuration::get('STRIPE_SAVE_TOKENS_ASK') && Tools::getIsset('stripe_save_token') && Tools::getValue('stripe_save_token')) {
            /* Get or Create a Stripe Customer */
            $stripe_customer = Db::getInstance()->getRow('
			SELECT id_stripe_customer, stripe_customer_id, token
			FROM ' . _DB_PREFIX_ . 'stripe_customer
			WHERE id_customer = ' . (int) $this->context->cookie->id_customer);
            if (!isset($stripe_customer['id_stripe_customer'])) {
                try {
                    $stripe_customer_exists = false;
                    $customer_stripe = Stripe_Customer::create(array('card' => $token, 'description' => $this->l('PrestaShop Customer ID:') . ' ' . (int) $this->context->cookie->id_customer));
                    $stripe_customer['stripe_customer_id'] = $customer_stripe->id;
                } catch (Exception $e) {
                    /* If the Credit card is invalid */
                    $this->_errors['invalid_customer_card'] = true;
                    if (class_exists('Logger')) {
                        Logger::addLog($this->l('Stripe - Invalid Credit Card'), 1, null, 'Cart', (int) $this->context->cart->id, true);
                    }
                }
            } else {
                $stripe_customer_exists = true;
                /* Update the credit card in the database */
                if ($token && $token != $stripe_customer['token']) {
                    try {
                        $cu = Stripe_Customer::retrieve($stripe_customer['stripe_customer_id']);
                        $cu->card = $token;
                        $cu->save();
                        Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'stripe_customer SET token = \'' . pSQL($token) . '\' WHERE id_customer_stripe = ' . (int) $stripe_customer['id_stripe_customer']);
                    } catch (Exception $e) {
                        /* If the new Credit card is invalid, do not replace the old one - no warning or error message required */
                        $this->_errors['invalid_customer_card'] = true;
                        if (class_exists('Logger')) {
                            Logger::addLog($this->l('Stripe - Invalid Credit Card (replacing an old card)'), 1, null, 'Cart', (int) $this->context->cart->id, true);
                        }
                    }
                }
            }
        }
        try {
            $charge_details = array('amount' => $this->context->cart->getOrderTotal() * 100, 'currency' => $this->context->currency->iso_code, 'description' => $this->l('PrestaShop Customer ID:') . ' ' . (int) $this->context->cookie->id_customer . ' - ' . $this->l('PrestaShop Cart ID:') . ' ' . (int) $this->context->cart->id);
            /* If we have a Stripe's customer ID for this buyer, charge the customer instead of the card */
            if (isset($stripe_customer['stripe_customer_id']) && !isset($this->_errors['invalid_customer_card'])) {
                $charge_details['customer'] = $stripe_customer['stripe_customer_id'];
            } else {
                $charge_details['card'] = $token;
            }
            $result_json = Tools::jsonDecode(Stripe_Charge::create($charge_details));
            /* Save the Customer ID in PrestaShop to re-use it later */
            if (isset($stripe_customer_exists) && !$stripe_customer_exists) {
                Db::getInstance()->Execute('
				INSERT INTO ' . _DB_PREFIX_ . 'stripe_customer (id_stripe_customer, stripe_customer_id, token, id_customer, cc_last_digits, date_add)
				VALUES (NULL, \'' . pSQL($stripe_customer['stripe_customer_id']) . '\', \'' . pSQL($token) . '\', ' . (int) $this->context->cookie->id_customer . ', ' . (int) Tools::substr(Tools::getValue('StripLastDigits'), 0, 4) . ', NOW())');
            }
            // catch the stripe error the correct way.
        } catch (Stripe_CardError $e) {
            $body = $e->getJsonBody();
            $err = $body['error'];
            //$type = $err['type'];
            $message = $err['message'];
            //$code = $err['code'];
            //$charge = $err['charge'];
            if (class_exists('Logger')) {
                Logger::addLog($this->l('Stripe - Payment transaction failed') . ' ' . $message, 1, null, 'Cart', (int) $this->context->cart->id, true);
            }
            $this->context->cookie->__set("stripe_error", 'There was a problem with your payment');
            $controller = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc.php' : 'order.php';
            $location = $this->context->link->getPageLink($controller) . (strpos($controller, '?') !== false ? '&' : '?') . 'step=3#stripe_error';
            header('Location: ' . $location);
            exit;
        } catch (Exception $e) {
            $message = $e->getMessage();
            if (class_exists('Logger')) {
                Logger::addLog($this->l('Stripe - Payment transaction failed') . ' ' . $message, 1, null, 'Cart', (int) $this->context->cart->id, true);
            }
            /* If it's not a critical error, display the payment form again */
            if ($e->getCode() != 'card_declined') {
                $this->context->cookie->__set("stripe_error", $e->getMessage());
                $controller = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc.php' : 'order.php';
                header('Location: ' . $this->context->link->getPageLink($controller) . (strpos($controller, '?') !== false ? '&' : '?') . 'step=3#stripe_error');
                exit;
            }
        }
        /* Log Transaction details */
        if (!isset($message)) {
            if (!isset($result_json->fee)) {
                $result_json->fee = 0;
//.........这里部分代码省略.........
开发者ID:alexsegura,项目名称:prestashop-stripejs,代码行数:101,代码来源:stripejs.php

示例14: die

    Logger::addLog('Missing x_invoice_num', 4);
    die('An unrecoverable error occured: Missing parameter');
}
if (!Validate::isLoadedObject($cart)) {
    Logger::addLog('Cart loading failed for cart ' . (int) $_POST['x_invoice_num'], 4);
    die('An unrecoverable error occured with the cart ' . (int) $_POST['x_invoice_num']);
}
if ($cart->id != $_POST['x_invoice_num']) {
    Logger::addLog('Conflict between cart id order and customer cart id');
    die('An unrecoverable conflict error occured with the cart ' . (int) $_POST['x_invoice_num']);
}
$customer = new Customer((int) $cart->id_customer);
$invoiceAddress = new Address((int) $cart->id_address_invoice);
$currency = new Currency((int) $cart->id_currency);
if (!Validate::isLoadedObject($customer) || !Validate::isLoadedObject($invoiceAddress) && !Validate::isLoadedObject($currency)) {
    Logger::addLog('Issue loading customer, address and/or currency data');
    die('An unrecoverable error occured while retrieving you data');
}
if (Tools::safeOutput(Configuration::get('PAYFORT_START_TEST_MODE'))) {
    $start_payments_secret_api = Tools::safeOutput(Configuration::get('PAYFORT_START_TEST_SECRET_KEY'));
} else {
    $start_payments_secret_api = Tools::safeOutput(Configuration::get('PAYFORT_START_LIVE_SECRET_KEY'));
}
if (Tools::safeOutput(Configuration::get('PAYFORT_START_CAPTURE'))) {
    $capture = 0;
} else {
    $capture = 1;
}
$order_description = "Charge for order";
$order_id = $_POST['x_invoice_num'];
$email = $_POST['payment_email'];
开发者ID:smgom,项目名称:payfort_start_all_versions,代码行数:31,代码来源:validation.php

示例15: displayParameterAsDeprecated

 /**
  * Display a warning message indicating that the parameter is deprecated
  * (display in firefox console if Firephp is enabled)
  */
 public static function displayParameterAsDeprecated($parameter)
 {
     if (_PS_DISPLAY_COMPATIBILITY_WARNING_) {
         $backtrace = debug_backtrace();
         $callee = next($backtrace);
         trigger_error('Parameter <strong>' . $parameter . '</strong> in function <strong>' . $callee['function'] . '()</strong> is deprecated in <strong>' . $callee['file'] . '</strong> on line <strong>' . $callee['Line'] . '</strong><br />', E_USER_WARNING);
         if (PS_USE_FIREPHP) {
             FB::trace('Parameter <strong>' . $parameter . '</strong> in function <strong>' . $callee['function'] . '()</strong> is deprecated in <strong>' . $callee['file'] . '</strong> on line <strong>' . $callee['Line'] . '</strong><br />', 'deprecated parameter');
         } else {
             $message = sprintf(Tools::displayError('The parameter %1$s in function %2$s (Line %3$s) is deprecated and will be removed in the next major version.'), $parameter, $callee['function'], $callee['Line']);
         }
         Logger::addLog($message, 3, $callee['class']);
     }
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:18,代码来源:_Tools.php


注:本文中的Logger::addLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。