$params['id_cart'] = $cart->id; $params['id_customer'] = $cookie->id_customer; $params['id_mr_method'] = Tools::getValue('id_mr_method'); $params['relayPointInfo'] = Tools::getValue('relayPointInfo'); break; default: } // Try to instanciate the method object name and call the necessaries method try { if (class_exists($method, false)) { $obj = new $method($params); // Verify that the class implement correctly the interface // Else use a Management class to do some ajax stuff if ($obj instanceof IMondialRelayWSMethod) { $obj->init(); $obj->send(); $result = $obj->getResult(); } unset($obj); } elseif (($management = new MRManagement($params)) && method_exists($management, $method)) { $result = $management->{$method}(); } else { throw new Exception('Method Class : ' . $method . ' can\'t be found'); } unset($management); } catch (Exception $e) { echo MondialRelay::jsonEncode(array('other' => array('error' => array($e->getMessage())))); exit(-1); } echo MondialRelay::jsonEncode($result); exit(0);