/** * Change order state to refund by payplug */ $order_history->id_order = $order_id; /** Get the right order status following module configuration (Sandbox or not) */ $new_order_state = Payplug::getOsConfiguration('refund'); $order_history->changeIdOrderState((int) $new_order_state, $order_id); $order_history->save(); 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'];