public function __construct() { if (empty($this->_authorization)) { $this->_authorization = getAuthorization(); } if (empty($this->_headers)) { $this->_headers = array("Content-Type" => "application/json;charset=UTF-8", "Authorization" => $this->_authorization); } }
function submitConfirm() { global $cookie, $smarty, $ppPayment, $cart; if (!$cookie->isLogged()) { die('Not logged'); } elseif (!($id_currency = intval(Tools::getValue('currency_payement')))) { die('No currency'); } elseif (!$cart->getOrderTotalLC(true, 3)) { die('Empty cart'); } $currency = new Currency(intval($id_currency)); if (!Validate::isLoadedObject($currency)) { die('Invalid currency'); } $cookie->id_currency = intval($id_currency); getAuthorization(); }
include _PS_ROOT_DIR_ . '/footer.php'; die; } // ##### // Process !! /*if (!$cookie->isLogged(true)) { displayAccount(); die('Not logged'); }*/ if (!$cart->getOrderTotal(true, PayPal::BOTH)) { die('Empty cart'); } // No token, we need to get one by making PayPal Authorisation if (!isset($cookie->paypal_token) or !$cookie->paypal_token) { getAuthorization(); } else { // We have token, we need to confirm user informations (login or signup) if ((int) Tools::getValue('confirm')) { displayConfirm(); } elseif (Tools::isSubmit('submitAccount')) { submitAccount(); } elseif (Tools::isSubmit('submitLogin')) { submitLogin(); } elseif (Tools::isSubmit('submitPayment')) { submitConfirm(); } // We got an error or we still not submit form if (!Tools::isSubmit('submitAccount') and !Tools::isSubmit('submitLogin') or sizeof($errors)) { if (isset($cookie->paypal_token) and isset($cookie->paypal_token_date) and time() - 10800 > $cookie->paypal_token_date) { // Token expired, unset it
function submitConfirm() { global $cookie, $smarty, $ppPayment, $cart; if (!$cookie->isLogged(true)) { header('location:../../../'); exit; die('Not logged'); } elseif (!($id_currency = (int) Tools::getValue('currency_payement'))) { die('No currency'); } elseif (!$cart->getOrderTotal(true, PayPal::BOTH)) { die('Empty cart'); } $currency = new Currency((int) $id_currency); if (!Validate::isLoadedObject($currency)) { die('Invalid currency'); } $cookie->id_currency = (int) $id_currency; getAuthorization(); }