public function setOrder($customerData = NULL, $suggestedStay = NULL, $creditCardData = NULL, $otherNoteData = NULL, $merchantId = 0, $orderType = NULL, $userNotes = NULL, $label = NULL, $cultureCode = NULL, $processOrder = NULL, $priceType = NULL) { $userId = ''; $user = JFactory::getUser(); if ($user->id != 0) { $userId = $user->id . "|" . $user->username . "|" . $_SERVER["SERVER_NAME"]; } if (!isset($creditCardData) || empty($creditCardData)) { $creditCardData = ""; // }else{ // $creditCardData = BFCHelper::getJsonEncodeString($creditCardData); } if (!isset($otherNoteData) || empty($otherNoteData)) { $otherNoteData = ""; } if (!isset($userNotes) || empty($userNotes)) { $userNotes = ""; } //$suggestedStay = null; $options = array('path' => $this->urlCreateOrder, 'data' => array('customerData' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($customerData)), 'suggestedStay' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($suggestedStay)), 'creditCardData' => $creditCardData, 'otherNoteData' => BFCHelper::getQuotedString($otherNoteData), 'merchantId' => $merchantId, 'orderType' => BFCHelper::getQuotedString($orderType), 'userNotes' => BFCHelper::getQuotedString($userNotes), 'label' => BFCHelper::getQuotedString($label), 'cultureCode' => BFCHelper::getQuotedString($cultureCode), 'processOrder' => $processOrder, 'priceType' => BFCHelper::getQuotedString($priceType), 'addedBy' => BFCHelper::getQuotedString($userId), '$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 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 setMerchantAndUser($customerData = NULL, $password = NULL, $merchantType = 0, $merchantCategory = 0, $company = NULL, $userPhone = NULL, $webSite = NULL) { $options = array('path' => $this->urlCreateMerchantAndUser, 'data' => array('customerData' => BFCHelper::getQuotedString(BFCHelper::getJsonEncodeString($customerData)), 'password' => BFCHelper::getQuotedString($password), 'company' => BFCHelper::getQuotedString($company), 'userPhone' => BFCHelper::getQuotedString($userPhone), 'webSite' => BFCHelper::getQuotedString($webSite), 'merchantType' => $merchantType, 'merchantCategory' => $merchantCategory, '$format' => 'json')); $url = $this->helper->getQuery($options); $userId = -1; //$r = $this->helper->executeQuery($url); $r = $this->helper->executeQuery($url, "POST"); if (isset($r)) { $res = json_decode($r); $tmpuserId = $res->d->results ?: $res->d; $userId = $tmpuserId->CreateMerchantAndUser; } return $userId; }
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 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]; }