@ 2015-11-07T11:18:51Z <?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.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 Fatal error: Uncaught Error: Class "PaypalAPI" not found in /in/cDG1P:3
Stack trace:
#0 {main}
thrown in /in/cDG1P on line 3
Process exited with code 255 . Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught Error: Class "PaypalAPI" not found in /in/cDG1P:3
Stack trace:
#0 {main}
thrown in /in/cDG1P on line 3
Process exited with code 255 . Output for 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Fatal error: Uncaught Error: Class 'PaypalAPI' not found in /in/cDG1P:3
Stack trace:
#0 {main}
thrown in /in/cDG1P on line 3
Process exited with code 255 . Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 Fatal error: Class 'PaypalAPI' not found in /in/cDG1P on line 3
Process exited with code 255 . Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Fatal error: Class 'PaypalAPI' not found in /in/cDG1P on line 4
Process exited with code 255 . preferences:dark mode live preview
239.53 ms | 401 KiB | 327 Q