@ 2015-11-07T11:18:09Z <?php
<?php
class PaypalExpress extends PaypalAPI
{
protected $_logs = array();
public function home($params)
{
global $smarty;
return $this->display(__FILE__, 'shopping_cart.tpl');
}
public function getAuthorisation()
{
global $cookie;
// Getting cart informations
$cart = new Cart(intval($cookie->id_cart));
if (!Validate::isLoadedObject($cart))
$this->_logs[] = $this->l('Not a valid cart');
$currency = new Currency(intval($cart->id_currency)); //оригинал
// $currency = new Currency(2);
if (!Validate::isLoadedObject($currency))
$this->_logs[] = $this->l('Not a valid currency');
if (sizeof($this->_logs))
return false;
// Making request
$returnURL = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/paypalapi/express/submit.php';
$cancelURL = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'order.php';
$paymentAmount = number_format(floatval($cart->getOrderTotal()), 2, '.', ''); //оригинал
// $paymentAmount = number_format(floatval(Tools::convertPrice($cart->getOrderTotal(),$currency)), 2, '.', '');
$currencyCodeType = strval($currency->iso_code);
$paymentType = 'Sale';
$request = '&Amt='.urlencode($paymentAmount).'&PAYMENTACTION='.urlencode($paymentType).'&ReturnUrl='.urlencode($returnURL).'&CANCELURL='.urlencode($cancelURL).'&CURRENCYCODE='.urlencode($currencyCodeType);
if ($this->_header) $request .= '&HDRIMG='.urlencode($this->_header);
//print_r($request);exit;
// Calling PayPal API
include(_PS_MODULE_DIR_.'paypalapi/api/PaypalLib.php');
$ppAPI = new PaypalLib();
$result = $ppAPI->makeCall($this->getAPIURL(), $this->getAPIScript(), 'SetExpressCheckout', $request);
$this->_logs = array_merge($this->_logs, $ppAPI->getLogs());
return $result;
}
public function getCustomerInfos()
{
global $cookie;
// Making request
$request = '&TOKEN='.urlencode(strval($cookie->paypal_token));
// Calling PayPal API
include(_PS_MODULE_DIR_.'paypalapi/api/PaypalLib.php');
$ppAPI = new PaypalLib();
$result = $ppAPI->makeCall($this->getAPIURL(), $this->getAPIScript(), 'GetExpressCheckoutDetails', $request);
$this->_logs = array_merge($this->_logs, $ppAPI->getLogs());
return $result;
}
public function getLogs()
{
return $this->_logs;
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.6.15 0.010 0.070 18.28 5.6.14 0.003 0.037 18.15 5.6.13 0.013 0.087 18.15 5.6.12 0.003 0.050 21.12 5.6.11 0.007 0.087 21.07 5.6.10 0.003 0.077 20.98 5.6.9 0.013 0.077 21.09 5.6.8 0.013 0.033 20.48 5.5.30 0.010 0.063 18.04 5.5.29 0.010 0.083 17.92 5.5.28 0.023 0.050 20.96 5.5.27 0.017 0.070 20.78 5.5.26 0.017 0.077 20.86 5.5.25 0.017 0.070 20.77 5.5.24 0.017 0.063 20.23
preferences:dark mode live preview
140.42 ms | 1394 KiB | 7 Q