if (version_compare(_PS_VERSION_, '1.5', '>') && version_compare(_PS_VERSION_, '1.5.2', '<')) { $order->current_state = $order_history->id_order_state; $order->update(); } } } } else { PayplugLock::addLock($cart->id); if ($status == Payplug::PAYMENT_STATUS_PAID) { $extra_vars = array(); /** Data is an object */ $extra_vars['transaction_id'] = $data->id_transaction; $currency = (int) $cart->id_currency; $customer = new Customer((int) $cart->id_customer); /** Get the right order status following module configuration (Sandbox or not) */ $order_state = Payplug::getOsConfiguration('paid'); $amount = (double) $data->amount / 100; $payplug->validateOrder($cart->id, $order_state, $amount, $payplug->displayName, null, $extra_vars, $currency, false, $customer->secure_key); if (version_compare(_PS_VERSION_, '1.5', '>') && version_compare(_PS_VERSION_, '1.5.2', '<')) { $order_id = Order::getOrderByCartId($cart->id); $order = new Order($order_id); $order_payment = end($order->getOrderPayments()); $order_payment->transaction_id = $extra_vars['transaction_id']; $order_payment->update(); } } PayplugLock::deleteLock($cart->id); } Configuration::updateValue('PAYPLUG_CONFIGURATION_OK', true); } else { echo 'Error : missing or wrong parameters.';
*/ if (!($ps = Tools::getValue('ps')) || $ps != 1) { Payplug::redirectForVersion('index.php?controller=order&step=1'); } if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$payplug->active) { Payplug::redirectForVersion('index.php?controller=order&step=1'); } /** * Check that this payment option is still available in case the customer changed his address just before the end of the checkout process */ if (!Payplug::moduleIsActive()) { die($payplug->l('This payment method is not available.', 'validation')); } $customer = new Customer((int) $cart->id_customer); if (!Validate::isLoadedObject($customer)) { Payplug::redirectForVersion('index.php?controller=order&step=1'); } $total = (double) $cart->getOrderTotal(true, Cart::BOTH); PayplugLock::check($cart->id); $order_id = Order::getOrderByCartId($cart->id); if (!$order_id) { PayplugLock::addLock($cart->id); /** Get the right order status following module configuration (Sandbox or not) */ $order_state = Payplug::getOsConfiguration('waiting'); $payplug->validateOrder($cart->id, $order_state, $total, $payplug->displayName, false, array(), (int) $currency->id, false, $customer->secure_key); PayplugLock::deleteLock($cart->id); $order_id = $payplug->currentOrder; } /** Change variable name, because $link is already instanciated */ $link_redirect = $order_confirmation_url . 'id_cart=' . $cart->id . '&id_module=' . $payplug->id . '&id_order=' . $order_id . '&key=' . $customer->secure_key; Payplug::redirectForVersion($link_redirect);