public function setAlertOnSell($customerData = NULL, $searchData = NULL, $merchantId = NULL, $type = NULL, $label = NULL, $cultureCode = NULL, $processRequest = NULL, $enabled = NULL) { $options = array('path' => $this->urlCreateUserAlert, 'data' => array('customerData' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($customerData)), 'searchData' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($searchData)), 'merchantId' => $merchantId, 'type' => BFCHelper::getQuotedString($type), 'label' => BFCHelper::getQuotedString($label), 'cultureCode' => BFCHelper::getQuotedString($cultureCode), 'processUserAlert' => $processRequest, 'enabled' => $enabled, '$format' => 'json')); $url = $this->helper->getQuery($options); $alert = null; //$r = $this->helper->executeQuery($url); $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); $alert = (int) $res->d->CreateUserAlert; //$alert = $res->d->results ?: $res->d; } return $alert; }
public function getPrivacyFromService($language = '') { $options = array('path' => $this->urlGetPrivacy, 'data' => array('cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); $url = $this->helper->getQuery($options); $return = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $return = $res->d->results->GetPrivacy; } elseif (!empty($res->d)) { $return = $res->d->GetPrivacy; } } return $return; }
public function setInfoRequest($customerData = NULL, $suggestedStay = NULL, $creditCardData = NULL, $otherNoteData = NULL, $merchantId = 0, $type = NULL, $userNotes = NULL, $label = NULL, $cultureCode = NULL, $processInfoRequest = NULL, $mailFrom = NULL) { $options = array('path' => $this->urlCreateInfoRequest, 'data' => array('customerData' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($customerData)), 'suggestedStay' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($suggestedStay)), 'otherNoteData' => BFCHelper::getQuotedString($otherNoteData), 'infoRequestType' => BFCHelper::getQuotedString($type), 'userNotes' => BFCHelper::getQuotedString($userNotes), 'label' => BFCHelper::getQuotedString($label), 'cultureCode' => BFCHelper::getQuotedString($cultureCode), 'processInfoRequest' => $processInfoRequest, 'mailFrom' => $mailFrom, '$format' => 'json')); if (!empty($merchantId) && intval($merchantId) > 0) { $options['data']['merchantId'] = $merchantId; } $url = $this->helper->getQuery($options); $order = null; //$r = $this->helper->executeQuery($url); $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); $order = $res->d->results ?: $res->d; } return $order; }
public function GetResourcesByIds($listsId, $language = '') { $options = array('path' => $this->urlGetResourcesByIds, 'data' => array('ids' => '\'' . $listsId . '\'', 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json', '$select' => 'Area,Rooms,Description,MerchantId,ResourceId,MerchantName,LocationName,Address,ImageUrl,LogoUrl,XPos,YPos,LocationZone,IsNewBuilding,IsReservedPrice,IsAddressVisible,IsShowcase,IsForeground,AddedOn,IsHighlight,MainMerchantCategoryId')); $url = $this->helper->getQuery($options); $resources = null; $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $resources = json_encode($res->d->results); } elseif (!empty($res->d)) { $resources = json_encode($res->d); } } return $resources; }
public function GetCondominiumsByIds($listsId, $language = '') { $options = array('path' => $this->urlGetCondominiumsByIds, 'data' => array('ids' => '\'' . $listsId . '\'', 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json', '$select' => 'CondominiumId,Name,Description,MerchantId,AddressData,DefaultImg,XGooglePos,YGooglePos')); $url = $this->helper->getQuery($options); $resources = null; $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $resources = json_encode($res->d->results); } elseif (!empty($res->d)) { $resources = json_encode($res->d); } } return $resources; }
public function setRating($name = NULL, $city = NULL, $typologyid = NULL, $email = NULL, $nation = NULL, $merchantId = NULL, $value1 = NULL, $value2 = NULL, $value3 = NULL, $value4 = NULL, $value5 = NULL, $totale = NULL, $pregi = NULL, $difetti = NULL, $userId = NULL, $cultureCode = NULL, $checkin = NULL, $resourceId = NULL, $orderId = NULL, $label = NULL) { $options = array('path' => $this->urlCreateRating, 'data' => array('name' => BFCHelper::getQuotedString($name), 'city' => BFCHelper::getQuotedString($city), 'typologyid' => $typologyid, 'email' => BFCHelper::getQuotedString($email), 'nation' => BFCHelper::getQuotedString($nation), 'merchantId' => $merchantId, 'value1' => $value1, 'value2' => $value2, 'value3' => $value3, 'value4' => $value4, 'value5' => $value5, 'total' => $totale, 'notesData' => BFCHelper::getQuotedString($pregi), 'notesData1' => BFCHelper::getQuotedString($difetti), 'userId' => $userId, 'orderId' => $orderId, 'resourceId' => $resourceId, 'checkin' => BFCHelper::getQuotedString($checkin), 'label' => BFCHelper::getQuotedString($label), 'cultureCode' => BFCHelper::getQuotedString($cultureCode), 'processRating' => 1, '$format' => 'json')); $url = $this->helper->getQuery($options); $ratingId = 0; //$r = $this->helper->executeQuery($url); $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); //$ratingId = $res->d->results ?: $res->d; // $resRating = $res->d->results ?: $res->d; if (!empty($res->d->results)) { $ratingId = $res->d->results->CreateRating; } elseif (!empty($res->d)) { $ratingId = $res->d->CreateRating; } // $ratingId = $resRating->CreateRating; } return $ratingId; }
public function setCrew($customerData = NULL, $merchantId = NULL, $orderId = NULL) { $params = $this->getState('params'); if ($customerData == null) { $customerData = $params['customerData']; } if (COM_BOOKINGFORCONNECTOR_USEEXTERNALUPDATEORDER) { $this->urlCreateCrew = '/CreateCrewFrom' . COM_BOOKINGFORCONNECTOR_USEEXTERNALUPDATEORDERSYSTEM; } $options = array('path' => $this->urlCreateCrew, 'data' => array('crewData' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($customerData)), 'merchantId' => $merchantId, 'orderId' => $orderId, '$format' => 'json', '$expand' => 'ChildCrews')); $url = $this->helper->getQuery($options); $crew = null; //$r = $this->helper->executeQuery($url); $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); $crew = $res->d->results ?: $res->d; } return $crew[0]; }
public function getCriteoConfiguration($pagetype = 0, $merchantsList = array(), $orderId = null) { $language = JFactory::getLanguage()->getTag(); $options = array('path' => $this->GetCriteoConfiguration, 'data' => array('cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json', 'pagetype' => $pagetype, 'callerUrl' => BFCHelper::getQuotedString(JURI::current()), 'merchantsList' => BFCHelper::getQuotedString(join(',', $merchantsList)))); if (isset($orderId) && !empty($orderId)) { $options["data"]["orderId"] = $orderId; } $url = $this->helper->getQuery($options); $return = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $return = $res->d->results; } elseif (!empty($res->d)) { $return = json_decode($res->d->GetCriteoConfiguration); } } return $return; }
public function getTotal() { $userId = ''; $user = JFactory::getUser(); if ($user->id != 0) { $userId = $user->id . "|" . $user->username . "|" . $_SERVER["SERVER_NAME"]; } else { return 0; } $language = JFactory::getLanguage()->getTag(); $options = array('path' => $this->urlGetOrdersCount, 'data' => array('userid' => BFCHelper::getQuotedString($userId), 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); // $this->applyDefaultFilter($options); $url = $this->helper->getQuery($options); $count = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $count = (int) $r; // $res = json_decode($r); // $count = $res->d->GetOffersCount; } return $count; }
public function setCounterByResourceId($resourceId = null, $what = '', $language = '') { $params = $this->getState('params'); if ($merchantId == null) { $merchantId = $params['merchantId']; } $options = array('path' => $this->urlResourceCounter, 'data' => array('resourceId' => $resourceId, 'what' => BFCHelper::getQuotedString($what), 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); $url = $this->helper->getQuery($options); $res = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $resReturn = $res->d->results; } elseif (!empty($res->d)) { $resReturn = $res->d; } if (!empty($resReturn)) { $res = $resReturn->OnSellUnitCounter; } } return $res; }
public function getServicesByIds($listsId, $language = '') { // with randor order is not possible to otrder by another field $options = array('path' => $this->urlServicesbyid, 'data' => array('$format' => 'json', 'ids' => '\'' . $listsId . '\'', 'cultureCode' => BFCHelper::getQuotedString($language))); $url = $this->helper->getQuery($options); $services = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $services = $res->d->results; } elseif (!empty($res->d)) { $services = $res->d; } } return $services; }
public function getServicesForSearchOnSell($language = '') { $options = array('path' => $this->urlServices, 'data' => array('$format' => 'json', 'cultureCode' => BFCHelper::getQuotedString($language), 'typeId' => 2)); $url = $this->helper->getQuery($options); $services = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $services = $res->d->results; } elseif (!empty($res->d)) { $services = $res->d; } } return $services; }
public function getResourcesFromService($start, $limit, $ordering, $direction, $ignorePagination = false, $jsonResult = false) { $store = $this->getStoreId(); $language = JFactory::getLanguage()->getTag(); $this->currentOrdering = $ordering; $this->currentDirection = $direction; $params = $this->getState('params'); $newsearch = $params['newsearch']; $tagId = $params['tagId']; $searchid = "resources" . $tagId; $merchantResults = $params['show_grouped']; // $condominiumsResults = $params['condominiumsResults']; $sessionkey = 'tags.' . $searchid . '.results'; $session = JFactory::getSession(); $results = null; if ($newsearch == "0") { $cachedresults = $session->get($sessionkey); try { if (isset($cachedresults) && !empty($cachedresults)) { $results = (array) json_decode(gzuncompress(base64_decode($cachedresults))); } } catch (Exception $e) { // echo 'Exception: ', $e->getMessage(), "<br />"; //echo 'Caught exception: ', $e->getMessage(), "\n"; } // }else{ // BFCHelper::setFilterSearchParamsSession(null); } if ($results == null) { $options = array('path' => $this->urlResources, 'data' => array('$format' => 'json', 'topRresult' => 0, 'calculate' => 0, 'cultureCode' => BFCHelper::getQuotedString($language), 'lite' => 1, 'tagids' => BFCHelper::getQuotedString($tagId))); // $this->applyDefaultFilter($options); $url = $this->helper->getQuery($options); $results = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); // $results = $res->d->results ?: $res->d; if (!empty($res->d->results)) { $results = $res->d->results; } elseif (!empty($res->d)) { $results = $res->d; } try { if (!empty($results)) { shuffle($results); } } catch (Exception $e) { //echo 'Caught exception: ', $e->getMessage(), "\n"; } } // saves parameters into session // BFCHelper::setSearchParamsSession($params); try { // save current search in session to disable all further calculations upon reordering and filtering $compr = base64_encode(gzcompress(json_encode($results), true)); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } $session->set($sessionkey, $compr); //ciclo per filtrare i possibili filtri // $filtersenabled = array(); // // $filtersenabled['count'] = 0; // if(!empty($results)){ // $filtersenabled['count'] = count($results); // //per condominiumsResults non \E8 necessario filtrare i condomini per caratteristiche, sio basano sulle risorse // if ($merchantResults) { // $tmpstars = array_unique(array_map(function ($i) { return $i->MrcRating; }, $results)); // $filtersenabled['stars'] = implode(',',$tmpstars); // $tmplocationzones = array_unique(array_map(function ($i) { return $i->MrcZoneId; }, $results)); // $filtersenabled['locationzones'] = implode(',',$tmplocationzones); // }else{ // $tmpstars = array_unique(array_map(function ($i) { return $i->ResRating; }, $results)); // $filtersenabled['stars'] = implode(',',$tmpstars); // $tmplocationzones = array_unique(array_map(function ($i) { return $i->ResZoneId; }, $results)); // $filtersenabled['locationzones'] = implode(',',$tmplocationzones); // } // // $tmpmastertypologies = array_unique(array_map(function ($i) { return $i->MasterTypologyId; }, $results)); // $filtersenabled['mastertypologies'] = implode(',',$tmpmastertypologies); // // elenco merchantGroup presenti nella ricerca // $tmpmerchantgroups = array_unique(explode(",",array_reduce($results, // function($returnedList, $item){ // $val = preg_replace('/\s+/', '', $item->MrcTagsIdList); // if (!empty($val)) { // $returnedList .= "," .$val; // } // return $returnedList; // } // ))); // foreach( $tmpmerchantgroups as $key => $value ) { // if( empty( $tmpmerchantgroups[ $key ] ) ) // unset( $tmpmerchantgroups[ $key ] ); // } // $filtersenabled['merchantgroups'] = implode(',',$tmpmerchantgroups); // elenco Servizi presenti nella ricerca // $tmpservices = array_unique(explode(",",array_reduce($results, // function($returnedList, $item){ // $val = preg_replace('/\s+/', '', $item->MrcServiceIdList); // if (!empty($val)) { // $returnedList .= "," .$val; // } // $val = preg_replace('/\s+/', '', $item->ResServiceIdList); // if (!empty($val)) { // $returnedList .= "," .$val; // } // // return $returnedList; // } // ))); // foreach( $tmpservices as $key => $value ) { // if( empty( $tmpservices[ $key ] ) ) // unset( $tmpservices[ $key ] ); // } // $filtersenabled['services'] = implode(',',$tmpservices); // // // elenco BookingType presenti nella ricerca // $tmpbookingtype = array_unique(array_map(function ($i) { return $i->BookingType; }, $results)); // foreach( $tmpbookingtype as $key => $value ) { // if( empty( $tmpbookingtype[ $key ] ) ) // unset( $tmpbookingtype[ $key ] ); // } // $filtersenabled['bookingtypes'] = implode(',',$tmpbookingtype); // //// $tmpoffers = array_unique(array_map(function ($i) { return $i->TotalPrice>$i->Price; }, $results)); // $tmpoffers = array_unique(array_map(function ($i) { return $i->IsOffer; }, $results)); //// $tmpoffers = array_unique(array_map(function ($i) { return !empty($i->DiscountId); }, $results)); // foreach( $tmpoffers as $key => $value ) { // if( empty( $tmpoffers[ $key ] ) ) // unset( $tmpoffers[ $key ] ); // } // $filtersenabled['offers'] = implode(',',$tmpoffers); // // // // $prices = array_map(function ($i) { return $i->Price; }, $results) ; // // $filtersenabled['pricemin'] = round(min($prices)-1, 0, PHP_ROUND_HALF_DOWN); // $filtersenabled['pricemax'] = round(max($prices)+1, 0, PHP_ROUND_HALF_UP); // } // BFCHelper::setEnabledFilterSearchParamsSession($filtersenabled); } // $results = $this->filterResults($results); // ordering is taking place here only for simple results, merchants are ordered by the grouping function if (isset($ordering) && !$merchantResults && !empty($results)) { switch (strtolower($ordering)) { case 'stay': usort($results, function ($a, $b) use($ordering, $direction) { return BFCHelper::orderBy($a, $b, 'TotalPrice', $direction); }); break; case 'rooms': usort($results, function ($a, $b) use($ordering, $direction) { return BFCHelper::orderBy($a, $b, 'Rooms', $direction); }); break; case 'offer': usort($results, function ($a, $b) use($ordering, $direction) { // return BFCHelper::orderBySingleDiscount($a, $b, $direction); return BFCHelper::orderBy($a, $b, 'PercentVariation', $direction); }); break; } } // if ($condominiumsResults && !empty($results)) { // // grouping and ordering // $results = $this->groupResultsByCondominium($results); // } if ($merchantResults && !empty($results)) { // grouping and ordering $results = $this->groupResultsByMerchant($results, $ordering, $direction); } $this->count = count($results); if (!$ignorePagination && isset($start) && (isset($limit) && $limit > 0) && !empty($results)) { $results = array_slice($results, $start, $limit); $params = $this->getState('params'); // $checkin = $params['checkin']; // $duration = $params['duration']; // $persons = $params['paxes']; // $paxages = $params['paxages']; } if ($jsonResult && !empty($results)) { $arr = array(); foreach ($results as $result) { $val = new StdClass(); if ($merchantResults) { $val->MerchantId = $result->MerchantId; $val->XGooglePos = $result->XGooglePos; $val->YGooglePos = $result->YGooglePos; } elseif ($condominiumsResults) { $val->Resource = new StdClass(); $val->Resource->ResourceId = $result->CondominiumId; $val->Resource->XGooglePos = $result->XGooglePos; $val->Resource->YGooglePos = $result->YGooglePos; } else { $val->Resource = new StdClass(); $val->Resource->ResourceId = $result->ResourceId; $val->Resource->XGooglePos = $result->ResLat; $val->Resource->YGooglePos = $result->ResLng; } $arr[] = $val; } return json_encode($arr); } return $results; //return $jsonResult ? json_encode($results) : $results; }
public function getMerchantRatingsFromService($start, $limit, $merchantId = null, $language = '') { $params = $this->getState('params'); if ($merchantId == null) { $merchantId = $params['merchantId']; } if ($language == null) { $language = BFCHelper::getState('merchantdetails', 'language'); } $options = array('path' => $this->urlMerchantRating, 'data' => array('cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); if (isset($start) && $start > 0) { $options['data']['skip'] = $start; } if (isset($limit) && $limit > 0) { $options['data']['top'] = $limit; } if (isset($merchantId) && $merchantId > 0) { $options['data']['MerchantId'] = $merchantId; } $filters = $params['filters']; // typologyid filtering if ($filters != null && $filters['typologyid'] != null && $filters['typologyid'] != "0") { // $options['data']['$filter'] .= ' and TypologyId eq ' .$filters['typologyid']; $options['data']['tipologyId'] = $filters['typologyid']; } $url = $this->helper->getQuery($options); $ratings = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); // $ratings = $res->d->results ?: $res->d; if (!empty($res->d->results)) { $ratings = $res->d->results; } elseif (!empty($res->d)) { $ratings = $res->d; } } return $ratings; }
public function GetResourcesCalculateByIds($listsId, $language = '') { $params = $this->getState('params'); $ci = $params['checkin']; $du = $params['duration']; //$px = array_fill(0,(int)$params['paxes'],BFCHelper::$defaultAdultsAge); //$ex = $params['extras']; $paxages = $params['paxages']; if ($ci == null || $du == null || $paxages == null) { return null; } $options = array('path' => $this->urlGetCalculateResourcesByIds, 'data' => array('ids' => '\'' . $listsId . '\'', 'checkin' => '\'' . $ci->format('Ymd') . '\'', 'duration' => $du, 'paxages' => '\'' . implode('|', $paxages) . '\'', 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); $url = $this->helper->getQuery($options); $resources = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $resources = json_encode($res->d->results); } elseif (!empty($res->d)) { $resources = json_encode($res->d); } } return $resources; }
public function getMerchantOfferFromService($language = null) { $params = $this->getState('params'); $offerId = $params['offerId']; if ($language == null) { $language = BFCHelper::getState('merchantdetails', 'language'); } $options = array('path' => $this->urlMerchantOffer, 'data' => array('id' => $offerId, 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); $url = $this->helper->getQuery($options); $offer = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); // $offer = $res->d->results ?: $res->d; if (!empty($res->d->GetVariationPlanById)) { $offer = $res->d->GetVariationPlanById; } elseif (!empty($res->d)) { $offer = $res->d; } } return $offer; }
public function getOrderFromService($orderId = null) { $params = $this->getState('params'); $checkmode = $params['checkmode']; $donation = $params['donation']; $data = array('checkMode' => $checkmode, '$format' => 'json'); if ($checkmode & OrderCheckMode::OrderId) { $orderId = $params['orderId']; $data['orderId'] = $orderId; } if ($checkmode & OrderCheckMode::ExternalOrderId) { $externalOrderId = $params['externalOrderId']; $data['externalOrderId'] = BFCHelper::getQuotedString($externalOrderId); } if ($checkmode & OrderCheckMode::CustomerId) { $customerId = $params['customerId']; $data['customerId'] = $customerId; } if ($checkmode & OrderCheckMode::ExternalCustomerId) { $externalCustomerId = $params['externalCustomerId']; $data['externalCustomerId'] = BFCHelper::getQuotedString($externalCustomerId); } if ($checkmode & OrderCheckMode::CheckIn) { $checkIn = $params['checkIn']; $data['checkIn'] = BFCHelper::getQuotedString($checkIn); } if ($checkmode & OrderCheckMode::CheckOut) { $checkOut = $params['checkOut']; $data['checkOut'] = BFCHelper::getQuotedString($checkOut); } if ($checkmode & OrderCheckMode::CustomerFirstname) { $customerFirstname = $params['customerFirstname']; $data['customerFirstname'] = BFCHelper::getQuotedString($customerFirstname); } if ($checkmode & OrderCheckMode::CustomerLastname) { $customerLastname = $params['customerLastname']; $data['customerLastname'] = BFCHelper::getQuotedString($customerLastname); } if ($checkmode & OrderCheckMode::Email) { $email = $params['email']; $data['email'] = BFCHelper::getQuotedString($email); } if (COM_BOOKINGFORCONNECTOR_USEEXTERNALUPDATEORDER) { $this->urlGetOrder = '/GetOrderFrom' . COM_BOOKINGFORCONNECTOR_USEEXTERNALUPDATEORDERSYSTEM; $data['cultureCode'] = BFCHelper::getQuotedString($params['cultureCode']); $data['merchantCode'] = BFCHelper::getQuotedString(COM_BOOKINGFORCONNECTOR_EXTERNALMERCHANTCODE); } $options = array('path' => $this->urlGetOrder, 'data' => $data); $url = $this->helper->getQuery($options); $order = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); // $order = $res->d->results ?: $res->d; if (!empty($res->d->results)) { $order = $res->d->results; } elseif (!empty($res->d)) { $order = $res->d; } } return $order; }
public function setOrderPayment($orderId = NULL, $status = 0, $sendEmails = false, $amount, $bankId, $paymentData = NULL, $cultureCode = NULL, $processOrder = NULL) { if (COM_BOOKINGFORCONNECTOR_USEEXTERNALUPDATEORDER) { $this->urlCreateOrderPayment = '/CreateOrderPaymentFrom' . COM_BOOKINGFORCONNECTOR_USEEXTERNALUPDATEORDERSYSTEM; } $options = array('path' => $this->urlCreateOrderPayment, 'data' => array('orderId' => $orderId, 'amount' => BFCHelper::getQuotedString((string) $amount), 'bankId' => BFCHelper::getQuotedString($bankId), 'status' => $status, 'sendEmails' => $sendEmails, 'cultureCode' => BFCHelper::getQuotedString($cultureCode), 'processOrder' => $processOrder, 'paymentData' => BFCHelper::getQuotedString($paymentData), '$format' => 'json')); $url = $this->helper->getQuery($options); $order = null; //$r = $this->helper->executeQuery($url); $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); // $order = $res->d->results ?: $res->d; if (!empty($res->d->results)) { $order = $res->d->results; } elseif (!empty($res->d)) { $order = $res->d; } } return $order; }
public function getSearchResults($start, $limit, $ordering, $direction, $merchantid, $condominiumid = null, $ignorePagination = false, $jsonResult = false, $excludedResources = array(), $requiredOffers = array(), $overrideFilters = null) { $this->currentOrdering = $ordering; $this->currentDirection = $direction; $params = $this->getState('params'); $searchid = ''; $newsearch = true; //$pricerange = $params['pricerange']; $merchantResults = false; $condominiumsResults = false; //$sessionkey = 'search.' . $searchid . '.results'; $language = JFactory::getLanguage()->getTag(); $session = JFactory::getSession(); $results = null; if ($results == null) { // echo 'No result: <br />'; $filterData = array('$format' => 'json', 'getAllResults' => 1, 'merchantId' => $merchantid, 'cultureCode' => BFCHelper::getQuotedString($language), 'lite' => 1); if (!$ignorePagination && isset($limit) && $limit > 0) { $filterData['topRresult'] = $limit; } if (!$ignorePagination && isset($start) && $start > 0) { $filterData['skip'] = $start; } if (isset($condominiumid)) { $filterData['condominiumId'] = $condominiumid; } if (!empty($excludedResources)) { if (is_array($excludedResources)) { $filterData['excludedIds'] = BFCHelper::getQuotedString(implode(',', $excludedResources)); } else { $filterData['excludedIds'] = BFCHelper::getQuotedString($excludedResources); } } if (!empty($requiredOffers)) { if (is_array($requiredOffers)) { $filterData['variationPlanIds'] = BFCHelper::getQuotedString(implode(',', $requiredOffers)); } else { $filterData['variationPlanIds'] = BFCHelper::getQuotedString($requiredOffers); } } $options = array('path' => $this->urlSearchAllCalculate, 'data' => $filterData); $this->applyDefaultFilter($options, $overrideFilters); $url = $this->helper->getQuery($options); $results = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); // $results = $res->d->results ?: $res->d; if (!empty($res->d->results)) { $results = $res->d->results; } elseif (!empty($res->d)) { $results = $res->d; } try { if (!empty($results)) { shuffle($results); } } catch (Exception $e) { //echo 'Caught exception: ', $e->getMessage(), "\n"; } } $onlystay = '1'; if (!empty($results) && $onlystay == '1') { $results = array_filter($results, function ($result) { return $result->Price > 0; }); } } return $results; //return $jsonResult ? json_encode($results) : $results; }
public function getMerchantsByIds($listsId, $language = '') { $options = array('path' => $this->urlGetMerchantsByIds, 'data' => array('ids' => '\'' . $listsId . '\'', 'cultureCode' => BFCHelper::getQuotedString($language), '$format' => 'json')); $url = $this->helper->getQuery($options); $merchants = null; $r = $this->helper->executeQuery($url); if (isset($r)) { $res = json_decode($r); if (!empty($res->d->results)) { $merchants = json_encode($res->d->results); } elseif (!empty($res->d)) { $merchants = json_encode($res->d); } } return $merchants; }