@ 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 git.master , git.master_jit , rfc.property-hooks 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 . This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches Archived branches Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:dark mode live preview
50.03 ms | 401 KiB | 8 Q