Esempio n. 1
0
 private function addBookingOnWuBook(&$db, $order, $order_date_from, $order_date_to, $product_id, $order_bookings_id)
 {
     //$dfrom = '17/02/2016';
     //$dto = '18/02/2016';
     $dfrom = str_replace('-', '/', $order_date_from);
     $dto = str_replace('-', '/', $order_date_to);
     $object_id = " " . WuBookApi::getObjectWuBookId($db, $product_id);
     // пробел вначале обязателен
     $country = $this->getCountryName($db, $order->country);
     $rooms = array($object_id => array(1, 'nb'));
     $customer = array('lname' => $order->l_name, 'fname' => $order->f_name, 'email' => $order->email, 'city' => $order->city, 'phone' => $order->phone, 'street' => '', 'country' => $country, 'arrival_hour' => '12:00', 'notes' => $order->order_add_info);
     foreach ($customer as $c) {
         $c = WuBookApi::ToTranslit($c);
     }
     $amount = number_format($order->order_total, 1, '.', ' ');
     $answer = WuBookApi::sendNewReservation($dfrom, $dto, $rooms, $customer, $amount);
     //если ответ текстовый - сохраняем в поле ответа, если число - в код бронирования
     if (intval($answer) > 0) {
         WuBookApi::saveWuBookReservationCode($db, $order_bookings_id, $answer);
     } else {
         WuBookApi::saveWuBookAnswer($db, $order_bookings_id, $answer);
     }
 }
     break;
 case 'wubook-update-prices-on-site':
     WuBookApi::updatePricesOnSite($db);
     //
     break;
 case 'wubook-send-new-reservation':
     //13/07/2015
     $dfrom = '17/02/2016';
     $dto = '18/02/2016';
     $rooms = array(" 102926" => array(1, 'nb'));
     /*
      * для удаления 1446815225 
      */
     $customer = array('lname' => 'Test', 'fname' => 'Reservation', 'email' => '*****@*****.**', 'city' => 'Gomel', 'phone' => '+375297777777', 'street' => 'Chat 23-13', 'country' => 'RU', 'arrival_hour' => '12:00', 'notes' => 'Test Reservation');
     $amount = '70.3';
     WuBookApi::sendNewReservation($dfrom, $dto, $rooms, $customer, $amount);
     //
     break;
 case 'wubook-cancel-reservation':
     //$rcode = 1447078679;
     $rcode = isset($_GET['rcode']) ? $_GET['rcode'] : -1;
     if ($rcode > -1) {
         WuBookApi::cancelReservation($rcode);
     }
     //
     break;
 case 'fetch-plan-prices':
     $dfrom = '28/04/2016';
     $dto = '14/05/2016';
     $rows = WuBookApi::fetchPlanPrices('', $dfrom, $dto);
     //