====== Check method ====== Availability check. This method also returns a total price for all passengers. ===== Valid content types ===== * valid for ''all content types'' ===== Description ===== public array check( array $searchData, array $trip, array $headerData ) ===== Parameters ===== * ''searchData (array)'' : search parameters. This parameter is optional but is preffered you use the same search parameters that you've used with [[trips|trips method]], because this will ensure that session won't expire, * ''trip (array)'' : trip parameters (you will get this info from [[trips|trips method]]). Required params are (''hsc'' and ''toc'', also ''sid'' when using ''trips'' content type. * ''headerData (array)'' : [[soap_header|SOAP Header Information]] ===== Return Values ===== Returns availability status and total price for all passengers. If session hasn't expired then this method will also return offer and trip info. Array ( [offerTripInfo] => Array ( [xmlReq] => [searchtermin_xmlReq] => [header] => Array ( [typ] => hotel [offers] => 1 [rgc] => [rgn] => 0 [rgg] => [rggn] => [pages] => 1 [perpage] => 20 [offset] => [sid] => 4u1u6nof70tngqqq3tgc0preo0 ) [offer] => Array ( [pic] => http://www.ors.si/giata-pics/71088//full.jpg [gid] => 71088 [htn] => Feral [stc] => 4.0 [ovr] => 0 [oid] => 23887 [hon] => Brna [fcts] => bea=1,ben=1,chf=0,clb=0,ani=0,pol=1,wel=0,spt=1,sgl=0,stn=0,ski=0 [dtemp] => [wtemp] => [rgc] => 659 [rgn] => Dalmatia [rgg] => 100023 [rggn] => Croatia [geo] => 1 [lat] => 42.9045823966052000 [lon] => 16.8566189525687980 ) [trip] => Array ( [sub] => catalog [gid] => 71088 [toc] => PALM [tockoda] => 80657677 [ton] => Palma [rgc] => 659 [oid] => 2288 [zac] => EC [zackoda] => 6967 [zan] => economy room [vpc] => AI [vpckoda] => 6573 [vpn] => all inclusive [od] => aid=,iid=,lid=,vid=,zid=palm_22411 [htc] => LEHRV5041414 [svc] => 22411 EC AI [ahckoda] => [vnd] => 2014-10-16 [bsd] => 2014-10-18 [tdc] => 2 [md5p] => 35a59b162e642f1df7c7c5664e46ffef [md5t] => 172984d5ecb727f81e54a2f5db03a100 [hsc] => 172984d5ecb727f81e54a2f5db03a100 [ppc] => 76 [alt] => 0 [top] => 0 [tocpic] => http://www.ors.si/ibe/ikonce/toc/palm.gif [aid] => [atx] => [iid] => [itx] => [lid] => [ltx] => [vid] => [vtx] => [zid] => palm_22411 [ztx] => 1/2 ECO AC; ALL LIGHT ) ) [xmlReq] => [xmlRes] => [response] => Array ( [mid] => 712 [ttp] => 152.00 [ttpd] => 0.00 [ppc] => 76.00 [ppct] => 1 [txt] => Reservation possible, insert B command [status] => 1 ) [offer] => Array ( [typ] => hotel [sub] => catalog [toc] => PALM [ton] => Palma [tocp] => http://www.ors.si/ibe/ikonce/toc/palm.gif [htc] => LEHRV504141486 [gid] => 71088 [hon] => KORČULA [oid] => [desc] => [zac] => EC [zan] => economy room [vpc] => AI [vpn] => all inclusive [svc] => 22411 EC AI [stc] => [htn] => Hotel Feral 4* [zhc] => DBV [zhn] => Dubrovnik (Kroatien) [ahc] => [ahn] => [vnd] => 16.10.2014 [bsd] => 18.10.2014 [tdc] => 2 [sid] => [sin] => [idp] => [IDP] [ovr] => 0 [pic] => http://www.ors.si/giata-pics/71088/full.jpg ) [actions] => Array ( ) [extras] => Array ( [0] => Array ( [info] => Array ( [id] => 27104:9:1 [name] => POLPENZION [price] => 6.00 [included] => 0 ) ) [1] => Array ( [info] => Array ( [id] => 27104:9:2 [name] => POLNI PENZION [price] => 13.00 [included] => 0 ) ) [2] => Array ( [info] => Array ( [id] => 27104:9:3 [name] => KRAJŠE BIVANJE NA VPRAŠANJE [price] => 0 [included] => 1 ) ) ) [operator] => Array ( [act] => BA [toc] => PALM [hsc] => 172984d5ecb727f81e54a2f5db03a100 [agt] => 454085 ) [travellers] => Array ( [0] => Array ( [id] => 1 [typ] => H [sur] => UDBBCSVN [pre] => LTULCFCH [tvp] => 76 [age] => ) [1] => Array ( [id] => 2 [typ] => H [sur] => JLEJAETI [pre] => FUVFXQCG [tvp] => 76 [age] => ) ) [included] => Array ( [0] => Array ( [group] => Array ( [code] => ExtracostOnPlace [description] => Dodatni stroški ) [items] => Array ( [0] => Array ( [code] => LT [name] => Turistična pristojbina [cost] => 1.00 [cost_type] => PER PERSON ) [1] => Array ( [code] => TW [name] => Brisače [cost] => 10.00 [cost_type] => PER PERSON ) [2] => Array ( [code] => BW [name] => Posteljnina ob prihodu [cost] => 10.00 [cost_type] => PER PERSON ) [3] => Array ( [code] => FC [name] => Končno čiščenje [cost] => 15.00 [cost_type] => PER PERSON ) [4] => Array ( [code] => EG [name] => Stroški elektrike [cost] => 35.00 [cost_type] => PER PERSON/WEEK ) [5] => Array ( [code] => DE [name] => Plačilo varščine z gotovino [cost] => 100.00 [cost_type] => PER ITEM ) ) ) ) [info] => Array ( [0] => Room type: 1/2 ECO AC; ALL LIGHT [1] => Hotel Feral 4* [2] => Code: LEHRV504141486 [3] => City: KORCULA [4] => Room: economy room [5] => Service: all inclusive [6] => Service code: 22411 EC AI [7] => CRS powered by ORS XTREME ) [exInfo] => Array ( ) [errorNr] => [error] => ) ===== Return parameters ===== * ''offerTripInfo'' (array) : offer and trip info (check [[offertripinfo|offertripinfo]]) * ''xmlReq'' : for internal use only * ''searchtermin_xmlReq'' : for internal use only * ''header (array)'' : information about a selected region and paging information (check [[trips|trips method]] for this return array) * ''offer (array)'' : check [[trips|trips method]] for this return array * ''trip (array)'' : check [[trips|trips method]] for this return array * ''xmlReq'' : ors xml request used with this method * ''xmlRes'' : ors xml response used with this method * ''response (array)'' : availability status, message and a total price * ''mid'' : availability message ID (check [[Message IDs]] for a list of possible values) * ''txt'' : availability text message (message is in selected language and it depends on ''mid'' value) * ''status'' : availability status. * **0** : offer is not free * **1** : offer is free (available to book) * **2** : offer is on request. If offer is on request, a person can still book this offer but he/she must wait for a touroperator confirmation. * **3** : communication error (something went wrong with communication between ORS and touroperator). * **4** : offer is sold out (same as status 0) * **5** : booking is not possible, you must check availability text message for detailed description of a problem * ''ttp'' : total price for all passengers * ''ppc'' : price per person (in situations when there is a price per room then this value will be empty or zero) * ''ttpd'' : this is a reserved parameter! * ''ppct'' : price type (0 - price per person, 1 - price per unit) * ''offer (array)'' : this are an offer information directly from touroperator. This values may differ from ''offerTripInfo'' information! * ''typ'' : content type * ''sub'' : sub category * ''toc'' : touroperator code * ''ton'' : touroperator name * ''tocp'' : touroperator logo * ''htc'' : hotel code (or product code) * ''gid'' : accommodation GIATA ID * ''hon'' : city name * ''oid'' : city ID * ''desc'' : reserved parameter * ''zac'' : room type code * ''zan'' : room type name * ''vpc'' : service type code * ''vpn'' : service type name * ''svc'' : service code * ''htn'' : accommodation name * ''stc'' : hotel category * ''zhc'' : destination code (IATA code) * ''zhn'' : destination name * ''ahc'' : departure airport code (IATA code) * ''ahn'' : departure airport name * ''vnd'' : checkin date * ''bsd'' : checkout date * ''tdc'' : duration * ''sid'' : bus stop id (only for ''trips'' content type) * ''sin'' : bus stop name * ''idp'' : offer ID (use this to search ''extras'' services that are in combination with accommodation) * ''ovr'' : overall rating * ''pic'' : full picture * ''actions (array)'' : promotions used with this offer. This is currently experimental because not all * ''extras (array)'' : extra surcharges that can be booked * ''info (array'' : extras information * ''id'' : extras id * ''name'' : extras name * ''price'' : extras price * ''included'' : if value equals 1 then this extras in included in price * ''operator (array)'' : used action, touroperator info and trip hash code * ''act'' : action * ''toc'' : touroperator code * ''hsc'' : unique trip hash code used for this check method * ''agt'' : agency number * ''travellers (array)'' : passengers info * ''id'' : passenger sequence number * ''typ'' : passenger sex / type. Possible values: * **H** : mr. * **D** : mrs. * **K** : child * **B** : baby (infant) * ''sur'' : last name * ''pre'' : first name * ''age'' : age / birthday * ''tvp'' : price for this person * ''included'' (array) : additional information about what is included in price (**currently not supported**) * ''group'' (array) : group information * ''code'' : group code * ''description'' : group description (in selected language) * ''items'' (array) : items in this group * ''code'' : item code * ''name'' : item name (in selected language) * ''cost'' : item cost * ''cost_type'' : price type (PER PERSON, PER PERSON/WEEK, PER ITEM,...) * ''info'' : touroperator information text. This text is directly from selectged touroperator and can be in different language. Usually this text contains important information about checked offer. * ''errorNr'' : error number * ''error'' : error message ===== Examples ===== * Example of availability check $searchParams = array( 'vnd' => '30.10.2014', // start date 'bsd' => '15.11.2014', // end date 'tdc' => '1-4', // duration [min-max] days 'epc' => '2', // number of adults 'gid' => '71088', // selected hotel by GIATA ID ); $trip = array( 'hsc' => '172984d5ecb727f81e54a2f5db03a100', // unique trip hash code 'toc' => 'PALM' // toruoperator code ); // availability check $check = $soapClient->orsxml_hotel_api_call( 'check', $searchParams, $trip, $headerData ); // check availability status and total price if ($check['response']['status'] == 1) { echo "Offer is available. \n"; echo "Total price: " . $check['response']['ttp']; } if ($check['response']['status'] == 2) { echo "Offer is on request.\n"; echo "Total price: " . $register['check']['ttp']; } if ($check['response']['status'] == 0 || $check['response']['status'] == 4) { echo "Offer is not available"; } if ($check['response']['status'] == 3) { echo "Communication error. Please try again. \n"; echo "Touroperator message: " . $check['response']['txt']; } if ($check['response']['status'] == 5) { echo "Unable to check offer, Check touroperator message: " . $check['response']['txt']; } ===== JSON Examples ===== @see [[ors-soap-api:public:json_api]] how to post request. { "requestType" : "check", "action": "check", "search": { "typ": "hotel", "hsc": "509fd42d2fe71bc3396830b207d4bb92", "toc": "PALM", "epc": "2" }, "header": { "lang": "[lang]", "usr" : "[usr]", "pass": "[pass]", "agid": "[agid]" } } ===== Examples (Extras) ===== Before making a check request with extras, you must fist make ''offers'' request to get extras hash codes. Check [[offers method|offers]] on how to get different extras. * Example of check availability with extras (packages accommodation + extras). When booking packages a ''$searchParams'' is a bit different. Accommodations and extras are entered as arrays. You can book different accommodations with more then one room (be careful that you place persons correctly). $searchParams = array( 'vnd' => '30.10.2014', // start date 'bsd' => '15.11.2014', // end date 'tdc' => '1-4', // duration [min-max] days 'epc' => '4', // number of adults // accommodations 'hotel' => array( // first accommodation '2262:4862:ZAD22627102:7102:OV:2014-08-16:2014-08-23' => array( // first room (for 1st and 2nd person) 0 => array( 'hsc' => '2262:4862:ZAD22627102:7102:OV:2014-08-16:2014-08-23', // offer hash code 'psn' => '1,2', // 1st and 2nd person ), // second room (for 3rd and 4th person) 1 => array( 'hsc' => '2262:4862:ZAD22627102:7102:OV:2014-08-16:2014-08-23', // offer hash code 'psn' => '3,4', // 3rd and 4th person ) ) ) // extras 'extras' => array( // 1st extras (for all persons) '199|0||0|2014-08-18|2014-08-18|2014-08-18' => array( 'hsc' => '199|0||0|2014-08-18|2014-08-18|2014-08-18', 'psn' => '1,2,3,4' ), // 2nd extras (for first two persons) '751|0||0|2014-08-18|2014-08-18|2014-08-18' => array( 'hsc' => '751|0||0|2014-08-18|2014-08-18|2014-08-18', 'psn' => '1,2' ) ), ); $trip = array( 'hsc' => 'x', // when booking packages, then just place 'x' for this parameter 'toc' => 'CMT' // touroperator code ); // check method $check = $soapClient->orsxml_hotel_api_call( 'check', $searchParams, $trip, $headerData ); * Example of check availability only extra services (without accommodation) $searchParams = array( 'epc' => '2', // number of adults // extras 'extras' => array( // 1st extras (for all persons) '199|0||0|2014-08-18|2014-08-18|2014-08-18' => array( 'hsc' => '199|0||0|2014-08-18|2014-08-18|2014-08-18', 'psn' => '1,2' ), ), ); $trip = array( 'hsc' => 'x', // when booking packages, then just place 'x' for this parameter 'toc' => 'CMT' // touroperator code ); // check method (when using only extras, use 'extras' API call!!) $check = $soapClient->orsxml_extras_api_call( 'check', $searchParams, $trip, $headerData );