Dadouh Posted December 16, 2014 Share Posted December 16, 2014 Bonjour, J'ai un réel souci avec Paypal, après que le client ait validé son paiement, la redirection plante sur une page blanche et une erreur: Prestashop v1.5.6.2 / PayPal v3.8.1 - Undefined index: PAYMENTREQUEST_0_SHIPPINGAMT in /www/modules/paypal/paypal_orders.php on line 70 Voici la page de mon ftp : <?php /* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) exit; /* * PayPal notification fields */ define('ID_INVOICE', 'invoice'); define('ID_PAYER', 'payer_id'); define('ID_TRANSACTION', 'txn_id'); define('CURRENCY', 'mc_currency'); define('PAYER_EMAIL', 'payer_email'); define('PAYMENT_DATE', 'payment_date'); define('TOTAL_PAID', 'mc_gross'); define('SHIPPING', 'shipping'); define('VERIFY_SIGN', 'verify_sign'); class PayPalOrder { /* * Get PayPal order data * - ID Order * - ID Transaction * - ID Invoice * - Currency (ISO) * - Total paid * - Shipping * - Capture (bool) * - Payment date * - Payment method (int) * - Payment status */ public static function getTransactionDetails($ppec = false, $payment_status = false) { if ($ppec && $payment_status) { $transaction_id = pSQL($ppec->result['PAYMENTINFO_0_TRANSACTIONID']); return array( 'currency' => pSQL($ppec->result['PAYMENTINFO_0_CURRENCYCODE']), 'id_invoice' => null, 'id_transaction' => $transaction_id, 'transaction_id' => $transaction_id, 'total_paid' => (float)$ppec->result['PAYMENTINFO_0_AMT'], 'shipping' => (float)$ppec->result['PAYMENTREQUEST_0_SHIPPINGAMT'], 'payment_date' => pSQL($ppec->result['PAYMENTINFO_0_ORDERTIME']), 'payment_status' => pSQL($payment_status) ); } else { $transaction_id = pSQL(Tools::getValue(ID_TRANSACTION)); return array( 'currency' => pSQL(Tools::getValue(CURRENCY)), 'id_invoice' => pSQL(Tools::getValue(ID_INVOICE)), 'id_transaction' => $transaction_id, 'transaction_id' => $transaction_id, 'total_paid' => (float)Tools::getValue(TOTAL_PAID), 'shipping' => (float)Tools::getValue(SHIPPING), 'payment_date' => pSQL(Tools::getValue(PAYMENT_DATE)), 'payment_status' => pSQL($payment_status) ); } } public static function getOrderById($id_order) { return Db::getInstance()->getRow( 'SELECT * FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_order` = '.(int)$id_order ); } public static function getIdOrderByTransactionId($id_transaction) { $sql = 'SELECT `id_order` FROM `'._DB_PREFIX_.'paypal_order` WHERE `id_transaction` = \''.pSQL($id_transaction).'\''; $result = Db::getInstance()->getRow($sql); if ($result != false) return (int)$result['id_order']; return 0; } public static function saveOrder($id_order, $transaction) { $order = new Order((int)$id_order); $total_paid = (float)$transaction['total_paid']; if (!isset($transaction['payment_status']) || !$transaction['payment_status']) $transaction['payment_status'] = 'NULL'; Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'paypal_order` (`id_order`, `id_transaction`, `id_invoice`, `currency`, `total_paid`, `shipping`, `capture`, `payment_date`, `payment_method`, `payment_status`) VALUES ('.(int)$id_order.', \''.pSQL($transaction['id_transaction']).'\', \''.pSQL($transaction['id_invoice']).'\', \''.pSQL($transaction['currency']).'\', \''.$total_paid.'\', \''.(float)$transaction['shipping'].'\', \''.(int)Configuration::get('PAYPAL_CAPTURE').'\', \''.pSQL($transaction['payment_date']).'\', \''.(int)Configuration::get('PAYPAL_PAYMENT_METHOD').'\', \''.pSQL($transaction['payment_status']).'\')' ); } public static function updateOrder($id_order, $transaction) { $total_paid = (float)$transaction['total_paid']; if (!isset($transaction['payment_status']) || !$transaction['payment_status']) $transaction['payment_status'] = 'NULL'; $sql = 'UPDATE `'._DB_PREFIX_.'paypal_order` SET `payment_status` = \''.pSQL($transaction['payment_status']).'\' WHERE `id_order` = \''.(int)$id_order.'\' AND `id_transaction` = \''.pSQL($transaction['id_transaction']).'\' AND `currency` = \''.pSQL($transaction['currency']).'\''; if ((int)Configuration::get('PAYPAL_SANDBOX') != 1) $sql .= 'AND `total_paid` = \''.$transaction['total_paid'].'\' AND `shipping` = \''.(float)$transaction['shipping'].'\';'; Db::getInstance()->Execute($sql); } } Pourriez vous m'aider, car là je sèche complètement. Merci Link to comment Share on other sites More sharing options...
ai-dev Posted December 17, 2014 Share Posted December 17, 2014 Bonjour, Il n'y a pas de lignes, mais l'erreur viens de là : 'shipping' => (float)$ppec->result['PAYMENTREQUEST_0_SHIPPINGAMT'], Il semble que ce champs n'existe pas dans le résultat reçu. Cette valeur est envoyée lors du checkout : $fields['PAYMENTREQUEST_0_SHIPPINGAMT'] = sprintf('%.2f', $shipping_cost_wt); $shipping_cost_wt fait appel à une fonction native de Prestashop pour être calculé, il doit y avoir un souci dans le calcul. Avez vous une boutique identique en test qui pourrait permettre de tracer cette valeur ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now