cancelOrder($id, $logging); }); $answer['success'] = 1; $answer['message'] = 'Order cancelled.'; notify_node('order_updated', [], $company_id); emit_notification_user($company_id, $user_id, 'Order Cancelled', 'The sales order has been cancelled.', 'warning'); } catch (PDOException $e) { $answer['message'] = 'Database error, please try again.'; http_response_code(500); } catch (Exception $e) { $answer['message'] = $e->getMessage(); http_response_code(400); } exit(json_encode($answer)); ?>