/** * @route ajax/admin/skyport/refresh */ public function ajaxRefreshPackageInfo() { $expected = ['package', 'supplier', 'type']; if (!\Airship\all_keys_exist($expected, $_POST)) { echo 'Invalid POST request.', "\n"; return; } $post = $_POST ?? []; $type = ''; if (isset($post['type'])) { switch ($post['type']) { case 'cabin': $type = 'Cabin'; break; case 'gadget': $type = 'Gadget'; break; case 'motif': $type = 'Motif'; break; default: echo 'Invalid POST request.', "\n"; return; } } $this->skyport->manualRefresh($type, $_POST['supplier'], $_POST['package']); $this->lens('skyport/view', ['package' => $this->skyport->getDetails($_POST['type'], $_POST['supplier'], $_POST['package']), 'skyport_url' => $this->skyport->getURL($_POST['type'], $_POST['supplier'], $_POST['package'])]); }