public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $params->addChild('codigo_hotel', $this->hotel_code); $params->addChild('nombre_cliente', $this->client_name); $params->addChild('observaciones', $this->requests); $params->addChild('num_mensaje', ''); $params->addChild('forma_pago', self::DEFAULT_PAYMENT_TYPE); $param_line = $params->addChild('res'); foreach ($this->rate_keys as $line) { $param_line->addChild('lin', $line); } $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->n_localizador)) { $locator = (array) $response->parametros->n_localizador; return ['locator' => $locator[0]]; } else { throw new ServiceHotelPreBookingException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceHotelPreBookingException($e->getMessage()); } }
function GetReportageDate() { $request = new ServiceRequest($this->_configuration); $rServiceUrl = $this->GetReportageServiceUrl(); $reportageUrl = $rServiceUrl . 'Reportage/scormreports/api/getReportDate.php?appId=' . $this->_configuration->getAppId(); return $request->submitHttpPost($reportageUrl); }
/** * @param ServiceRequest $request * @param array $api_params * @param string $location_type * @throws ServiceLocationListException */ public function __construct(ServiceRequest $request, $location_type) { try { $this->request = $request->setOptions("locations")->setOptions($location_type); } catch (ServiceRequestException $e) { throw new ServiceLocationListException($e->getMessage()); } }
/** * @return mixed * @throws ServiceTypesListException */ public function __invoke() { try { $response = $this->request->send()->getBody(); return json_decode($response, true); } catch (ServiceRequestException $e) { throw new ServiceTypesListException($e->getMessage()); } }
public function GetAccountInfo() { $request = new ServiceRequest($this->_configuration); $params = array('appid' => $this->_configuration->getAppId()); $request->setMethodParams($params); $response = $request->CallService("rustici.reporting.getAccountInfo"); //error_log($response); return $response; }
/** * @param ServiceRequest $request * @param Holder $holder * @param Rooms $rooms * @param ClientReference $client_reference * @throws ServiceHotelBookingException */ public function __construct(ServiceRequest $request, Holder $holder, Rooms $rooms, ClientReference $client_reference) { try { $this->request_data = ["holder" => $holder->getHolderData(), "rooms" => $rooms->getRooms(), "clientReference" => $client_reference->getReference()]; $this->response = $request->setHeaders(['json' => $this->request_data])->setOptions("bookings")->send("POST"); } catch (\Exception $e) { throw new ServiceHotelBookingException($e->getMessage()); } }
/** * @param ServiceRequest $request * @param string $reference * @param string $language * @throws ServiceHotelBookingException */ public function __construct(ServiceRequest $request, $reference, $language = "ENG") { try { $this->request_data = ["cancellationFlag" => "CANCELLATION"]; $this->response = $request->setOptions("bookings")->setOptions($reference)->setQueryStringParams($this->request_data)->send("DELETE"); } catch (\Exception $e) { $request_data = json_encode($this->request_data, true); throw new ServiceHotelCancellationException($request->getRequestUrl() . " - " . $e->getMessage() . " - " . $request_data); } }
public function GetUploadLink($importRedirectUrl) { write_log('UploadService.GetUploadLink() being called...'); $token = $this->GetUploadToken(); $serviceUrl = "http://" . $token->getServer() . "/EngineWebServices"; $request = new ServiceRequest($this->_configuration); $mParams = array('token' => $token->getTokenId()); $mParams["redirecturl"] = $importRedirectUrl; $request->setMethodParams($mParams); return $request->ConstructUrl("rustici.upload.uploadFile", $serviceUrl); }
public function CloudAuthPing($throw = false) { write_log('rustici.debug.authPing being called...'); $request = new ServiceRequest($this->_configuration); try { $response = $request->CallService("rustici.debug.authPing"); write_log('rustici.debug.authPing returned : ' . $response); } catch (Exception $e) { write_log('rustici.debug.authPing threw Exception: ' . $e->getMessage()); return false; } $xml = simplexml_load_string($response); return $xml['stat'] == 'ok'; }
public function GetReportUrl($auth, $reportUrl) { //If url is relative, put on server name if (substr($reportUrl, 0, 10) == '/Reportage') { $rServiceUrl = str_replace('EngineWebServices', '', $this->_configuration->getScormEngineServiceUrl()); $reportUrl = $rServiceUrl . $reportUrl; } $request = new ServiceRequest($this->_configuration); $params = array('appid' => $this->_configuration->getAppId()); $params['auth'] = $auth; $params['reporturl'] = $reportUrl; $request->setMethodParams($params); $response = $request->ConstructUrl("rustici.reporting.launchReport"); //error_log($response); return $response; }
public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->provincias)) { return (array) $response->parametros->provincias; } else { throw new ServiceProvincesException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceProvincesException($e->getMessage()); } }
/** * @return array * @throws ServiceHotelRoomsException */ public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $params->addChild('codhot', $this->hotel_code); $response = $this->service_request->send($request_xml); $hotusa_rooms = []; if (!isset($response->parametros->habitaciones)) { return $hotusa_rooms; } $hotusa_rooms = (array) $response->parametros->habitaciones; return $hotusa_rooms; } catch (ServiceRequestException $e) { throw new ServiceHotelRoomsException($e->getMessage()); } }
public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $params->addChild('localizador', $this->locator); $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->reserva->localizador_largo)) { $book = (array) $response->parametros->reserva; $long_locator = $book['localizador_largo']; $short_locator = $book['localizador_corto']; return ["long_locator" => $long_locator, "short_locator" => $short_locator, "reference" => $long_locator, "raw_response" => json_encode((array) $response, true)]; } else { throw new ServiceHotelBookingVoucherException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceHotelBookingVoucherException($e->getMessage()); } }
public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $request_xml->addChild('datos_reserva'); $hotel = $request_xml->addChild('hotel', $this->hotel_code); foreach ($this->rate_keys as $line) { $hotel->addChild('lin', $line); } $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->politicaCanc)) { return (array) $response->parametros->politicaCanc; } else { throw new ServiceHotelCancellationPoliciesException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceHotelCancellationPoliciesException($e->getMessage()); } }
public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('peticion'); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $request_xml->addChild('parametros'); $request_xml->addChild('comprimido', '2'); $request_xml->addChild('localizador_largo', $this->long_locator); $request_xml->addChild('localizador_corto', $this->short_locator); $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->localizador)) { $long_locator = (array) $response->parametros->localizador; $short_locator = (array) $response->parametros->localizador_corto; return ["long_locator" => $long_locator[0], "short_locator" => $short_locator[0]]; } else { ServiceHotelBookingCancellationException::throwBecauseIncorrectResponse($response); } } catch (ServiceRequestException $e) { throw new ServiceHotelBookingCancellationException($e->getMessage()); } }
/** * @return mixed * @throws ServiceHotelsAvailabilityException */ public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $request_xml->addChild('parametros'); $request_xml->addChild('comprimido', '2'); $request_xml->addChild('radio', '9'); $request_xml->addChild('tarifas_reembolsables', '1'); $request_xml->addChild('afiliacion', $this->request_configuration['afiliacio']); $request_xml->addChild('usuario', $this->request_configuration['codusu']); foreach ($this->request_params as $param_key => $param_value) { $param_value = $this->prepareHotelCodes($param_key, $param_value); if (in_array($param_key, $this->available_request_params)) { $request_xml->addChild($param_key, $param_value); } else { throw new ServiceHotelsAvailabilityException("Parameter '{$param_key}' isn't available for this service."); } } $response = $this->service_request->send($request_xml); if ($response && isset($response->param->hotls)) { $hotels = json_decode(json_encode($response->param->hotls), true); if (0 >= $hotels['@attributes']["num"]) { $hotels_codes = $this->request_params['hotel']; throw new ServiceHotelsAvailabilityException("No available rooms for the hotels {$hotels_codes}. Num: {$hotels['@attributes']["num"]}"); } elseif (1 >= $hotels['@attributes']["num"]) { return [$hotels['hot']]; } return $hotels['hot']; } elseif (isset($response->param->error->descripcion)) { throw new ServiceHotelsAvailabilityException($response->param->error->descripcion); } else { throw new ServiceHotelsAvailabilityException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceHotelsAvailabilityException($e->getMessage()); } }
public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $params->addChild('localizador', $this->locator); $params->addChild('accion', self::BOOKING_ACTION); $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->localizador)) { $long_locator = (array) $response->parametros->localizador; $short_locator = (array) $response->parametros->localizador_corto; $status = (array) $response->parametros->estado; $raw_response = json_decode(json_encode($response), true); return ["long_locator" => $long_locator[0], "short_locator" => $short_locator[0], "status" => "00" == $status[0] ? "confirmed" : "invalid", "raw_response" => $raw_response]; } else { throw new ServiceHotelBookingException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceHotelBookingException($e->getMessage()); } }
public function __invoke() { try { $request_xml = $this->hotusa_xml->init(); $request_xml->addChild('tipo', self::HOTUSA_SERVICE); $params = $request_xml->addChild('parametros'); $params->addChild('comprimido', '2'); $params->addChild('localizador_largo', $this->long_locator); $params->addChild('localizador_corto', $this->short_locator); $response = $this->service_request->send($request_xml); if ($response && isset($response->parametros->localizador)) { $long_locator = (array) $response->parametros->localizador; $cancellation_reference = (array) $response->parametros->localizador_baja; $status = (array) $response->parametros->estado; $raw_response = json_encode($response); $cancelled_status = ["00", "09"]; return ["long_locator" => $long_locator[0], "cancellation_reference" => $cancellation_reference[0], "status" => in_array($status[0], $cancelled_status) ? static::CANCELLED_STATUS : static::INVALID_STATUS, "raw_response" => $raw_response]; } else { throw new ServiceHotelCancellationException("Empty response from Hotusa"); } } catch (ServiceRequestException $e) { throw new ServiceHotelCancellationException($e->getMessage()); } }
@author Leandro Curioso <*****@*****.**> @copyright Leandro Curioso © 2015 */ try { //Report all errors error_reporting(E_ALL); //Require the http handler class require_once "class/HttpHandler.class.php"; //Require the utility class require_once "class/Utility.class.php"; //Require the service request class require_once "class/ServiceRequest.class.php"; //Options for service request $options = array("authorization_prefix" => "Authorization", "host" => "http://*****:*****@email.com", "password" => "123456"], null, false); Utility::debug($auth); //Set the token for authenticated methods $userToken = $auth->payload->data->token; //Example of get request to an unauthenticated route to list user echo "<h2 style='color:green;'>[GET] Service route: /user/list_user [TOKEN: {$userToken}]</h2>"; $listUser = $serviceRequest->get("/user/list_user", null, null, false); Utility::debug($listUser); //Example of get request to an unauthenticated route to read single user echo "<h2 style='color:green;'>[GET] Service route: /user/read_user [TOKEN: {$userToken}]</h2>"; $readUser = $serviceRequest->get("/user/read_user", ["id" => 1], null, false);
public function GetDispatchDownloadUrl($destinationId = null, $courseId = null, $dispatchId = null, $tagList = null, $cssUrl = null) { $request = new ServiceRequest($this->_configuration); $params = array(); if ($destinationId != null) { $params['destinationid'] = $destinationId; } if ($courseId != null) { $params['courseid'] = $courseId; } if ($dispatchId != null) { $params['dispatchid'] = $dispatchId; } if ($tagList != null && count($tagList) > 0) { $params['tags'] = implode(',', $tagList); } if ($cssUrl != null) { $params['cssurl'] = $cssUrl; } $request->setMethodParams($params); return $request->ConstructUrl("rustici.dispatch.downloadDispatches"); }
public function UpdateLearnerInfo($learnerid, $fname, $lname, $newid = null) { $request = new ServiceRequest($this->_configuration); $params = array('learnerid' => $learnerid); $params['fname'] = $fname; $params['lname'] = $lname; if (isset($newid)) { $params['newid'] = $newid; } $request->setMethodParams($params); $response = $request->CallService("rustici.registration.updateLearnerInfo"); return $response; }
/** * @param ServiceRequest $request */ public function __construct(ServiceRequest $request, $request_params) { $body = ""; $this->response = $request->setOptions("hotels")->setBody($body)->send("POST"); }
$client = new Client(); $filter = array(); if (isset($_POST["searchCount"])) { $count = 1; for ($count = 1; $count <= $_POST["searchCount"]; $count++) { if (!isset($_POST["search_key" . $count]) && !isset($_POST["filter_type" . $count])) { continue; } $filter[$_POST["filter_type" . $count]] = array("%" . $_POST["search_key" . $count] . "%", Like); } } elseif ($clientID) { $filter = array("client_id" => array($clientID, Equal)); } $clientDetails = $client->getClients(array("client_id" => "ASC"), $filter); $resultCount = count($clientDetails); $serviceRequest = new ServiceRequest(); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <title>Kusina Sa Plaza</title> <link href="Styles/tables.css" rel="stylesheet" /> <link href="Styles/tables-min.css" rel="stylesheet" /> <link href="Styles/buttons-core-min.css" rel="stylesheet" /> <link href="Styles/buttons-core.css" rel="stylesheet" />> <link href="Styles/buttons.css" rel="stylesheet" /> <link href="Styles/buttons-min.css" rel="stylesheet" />
public function DeleteSecretKey($appid, $keyId) { $request = new ServiceRequest($this->_configuration); $params = array('appid' => $appid, 'secretkeyid' => $keyId); $request->SetMethodParams($params); $request->CallService("rustici.application.deleteSecretKey"); }
/** * @param ServiceRequest $request */ public function __construct(ServiceRequest $request) { $this->response = $request->setOptions("hotels")->send(); }
public function GetLaunchInfo($launchId) { $request = new ServiceRequest($this->_configuration); $params = array('launchid' => $launchId); $request->setMethodParams($params); $response = $request->CallService("rustici.registration.getLaunchInfo"); return $response; }
public function UpdateAssetsFromUploadedFile($courseId, $uploadLocation) { $request = new ServiceRequest($this->_configuration); $params = array('courseid' => $courseId, 'path' => $uploadLocation); $request->setMethodParams($params); $response = $request->CallService('rustici.course.updateAssets'); return $response; }
public function __construct(ServiceRequest $request, $hotels_code, $api_params) { $request_data = $api_params; $request_data['hotels']['hotel'] = $hotels_code; $this->response = $request->setOptions("hotels")->setHeaders(['json' => $request_data])->send("POST"); }
<?php include_once "include/common.php"; include_once "include/ServiceRequest.php"; include_once 'include/AccessRights/SuperadminAdminClient.php'; $serviceRequestID = isset($_REQUEST["id"]) ? $_REQUEST["id"] : ""; $serviceRequest = new ServiceRequest(); $serviceRequestDetails = $serviceRequest->getServiceRequest(array("service_no" => "ASC"), array("service_no" => array($serviceRequestID, Equal))); $serviceRequestDetails = $serviceRequestDetails[0]; $package = new Package(); if ($serviceRequestID == "" || 0 == count($serviceRequestDetails)) { //$file = substr($_SERVER["PHP_SELF"],strripos($_SERVER["PHP_SELF"], "/"),strlen($_SERVER["PHP_SELF"])); //header("Location:NotFound.php?prev=".$file."?".$_SERVER["QUERY_STRING"]); header("Location:NotFound.php"); } $payments = $serviceRequestDetails->getPayments(); $hasPayments = count($payments) > 0; if (isset($_POST['cancelBtn'])) { if ($serviceRequestDetails->delete($serviceRequestID)) { header('Location: ServiceRequestList.php'); } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <title>Kusina Sa Plaza</title>
$formValid = false; } if (isset($_POST["service_thm"]) && $_POST["service_thm"] == "") { $errorMessage .= "Theme is required. </br>"; $formValid = false; } if (isset($_POST["service_part"]) && ($_POST["service_part"] == "" || !is_numeric($_POST["service_part"]))) { $errorMessage .= "Number of Guest/Participants is required and must be numeric. </br>"; $formValid = false; } if (isset($_POST["service_occ"]) && $_POST["service_occ"] == "") { $errorMessage .= "Occasion is required. </br>"; $formValid = false; } if (isset($_POST["reserve"]) && $formValid) { $serviceRequest = new ServiceRequest($_POST); //check for if date has been reserved $mktime = strtotime($_POST["service_date"]); $serviceDate = date("Y-m-d", $mktime); $res = $serviceRequest->getServiceRequest(array("service_date" => "DESC"), array("service_date" => array($serviceDate, Equal), "client_id" => array($serviceRequest->getClient_id(), Equal))); if (count($res) > 0 && !$serviceRequestID) { $errorMessage = "You already filed a service request for this date!"; } else { if ($serviceRequest->save()) { $_SESSION["formInput"] = array(); $_POST = array(); $successMessage = "Service Request successfully filed."; // uncomment if you desire to redirect to same page //header('Location: '.$_SERVER['PHP_SELF'].'?message='.$successMessage); //this will redirect to service request list page header('Location:ServiceRequestList.php ');