<?php include dirname(__FILE__) . '/../../../../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../../../../init.php'; include dirname(__FILE__) . '/../paypal.php'; // create an instance of the payment module $paypal = new CartAPI_Module_PayPal(); // run the original module's hookpayment and ignore the result, this fills all the info in smarty $params = array('cart' => $cart); $paypal->hookPayment($params); // output $smarty->force_compile = true; // remove after tpl debug $smarty->display(dirname(__FILE__) . '/paypal.tpl');
<?php include dirname(__FILE__) . '/../../../../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../../../../init.php'; include dirname(__FILE__) . '/../paypal.php'; // code taken from modules/paypal/payment/submit.php displayConfirm(), to skip the extra confirmation page if (!$cookie->isLogged()) { die('Error: not logged in'); } $paypal = new CartAPI_Module_PayPal(); unset($cookie->paypal_token); if ($cart->id_currency != $paypal->getCurrency((int) $cart->id_currency)->id) { $cart->id_currency = (int) $paypal->getCurrency((int) $cart->id_currency)->id; $cookie->id_currency = (int) $cart->id_currency; $cart->update(); } $currency_id = $paypal->getCurrency((int) $cart->id_currency)->id; Tools::redirect('modules/paypal/payment/submit.php?submitPayment=1¤cy_payement=' . $currency_id . '&');
<?php include dirname(__FILE__) . '/../../../../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../../../../init.php'; include dirname(__FILE__) . '/../paypal.php'; include dirname(__FILE__) . '/paypalpayment.php'; // code taken from modules/paypal/payment/submit.php validOrder(), to display errors nicely echo '<h1>Paypal Error</h1>'; if (!$cookie->isLogged()) { die('Error: not logged in'); } if (!isset($cookie->paypal_token) or !$cookie->paypal_token) { // before authorization, try to get the authorization error again $ppPayment = new CartAPI_Module_PayPalPayment(); $result = $ppPayment->getAuthorisation(); $logs = $ppPayment->getLogs(); $ppPayment->displayPayPalAPIError($ppPayment->l('Authorisation to PayPal failed', 'submit'), $logs); } else { // after authorization $paypal = new CartAPI_Module_PayPal(); if (!($payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('PayerID'))))) { die('Invalid payerID'); } $paypal->makePayPalAPIValidation($cookie, $cart, $cart->id_currency, $payerID, 'payment'); }