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;
 }
$cLanguageList = BFCHelper::parseArrayList(JTEXT::_('COM_BOOKINGFORCONNECTOR_VIEW_CONSTANTS_LANGUAGESLIST'));
$cCCTypeList = BFCHelper::parseArrayList(JTEXT::_('COM_BOOKINGFORCONNECTOR_DEFAULT_FORM_CCTYPELIST'));
$nation = "";
$culture = "";
$checkinId = uniqid('checkin');
$checkoutId = uniqid('checkout');
$checkin = new DateTime();
$minyear = date("y");
$maxyear = $minyear + 5;
$checkout = new DateTime();
$checkout->modify('+1 day');
$formRoute = "index.php?option=com_bookingforconnector&task=sendOrder";
$privacy = BFCHelper::GetPrivacy($this->language);
$additionalPurpose = BFCHelper::GetAdditionalPurpose($this->language);
$policy = BFCHelper::GetPolicy($resource->ResourceId, $this->language);
$stayrequest = htmlspecialchars(json_encode(BFCHelper::getState('stayrequest', 'resource')), ENT_COMPAT, 'UTF-8');
$staysuggested = '';
$stay = null;
$completestay = $this->stay;
if (!empty($completestay->SuggestedStay)) {
    $stay = $completestay->SuggestedStay;
}
$selVariationId = $this->selVariationId;
$totalWithVariation = $this->totalWithVariation;
$selVariation = $this->selVariation;
$deposit = 0;
if (!empty($stay)) {
    $currstay = $stay;
    $currstay->DiscountedPrice = $totalWithVariation;
    $currstay->RatePlanStay = $completestay;
    unset($currstay->RatePlanStay->SuggestedStay);
 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;
 }