ord; $orderrooms = $this->orderrooms; $tars = $this->tars; $payment = $this->payment; $vbo_tn = $this->vbo_tn; /** * Include the VBOCore JS class. */ VikBooking::getVboApplication()->loadCoreJS(); // availability helper $av_helper = VikBooking::getAvailabilityInstance(); // room stay dates in case of split stay $room_stay_dates = []; if ($ord['split_stay']) { if ($ord['status'] == 'confirmed') { $room_stay_dates = $av_helper->loadSplitStayBusyRecords($ord['id']); } else { $room_stay_dates = VBOFactory::getConfig()->getArray('split_stay_' . $ord['id'], []); } } // construct booking registry try { $registry = VBOBookingRegistry::getInstance($this->ord, $this->orderrooms); } catch (Exception $e) { // do nothing $registry = null; } $currencysymb = VikBooking::getCurrencySymb(); $nowdf = VikBooking::getDateFormat(); if ($nowdf == "%d/%m/%Y") { $df = 'd/m/Y'; } elseif ($nowdf == "%m/%d/%Y") { $df = 'm/d/Y'; } else { $df = 'Y/m/d'; } $datesep = VikBooking::getDateSeparator(); $ptmpl = VikRequest::getString('tmpl', '', 'request'); $pitemid = VikRequest::getInt('Itemid', 0, 'request'); $bestitemid = VikBooking::findProperItemIdType(['booking']); $now_info = getdate(); $wdays_map = [ JText::translate('VBWEEKDAYZERO'), JText::translate('VBWEEKDAYONE'), JText::translate('VBWEEKDAYTWO'), JText::translate('VBWEEKDAYTHREE'), JText::translate('VBWEEKDAYFOUR'), JText::translate('VBWEEKDAYFIVE'), JText::translate('VBWEEKDAYSIX') ]; // count payment processor instances $payProcessorInstances = 0; $isdue = 0; $isdue_orig = 0; $imp = 0; $pricenames = array(); $optbought = array(); $extraservices = array(); $roomsnames = array(); $is_package = !empty($ord['pkg']) ? true : false; foreach ($orderrooms as $kor => $or) { $num = $kor + 1; $roomsnames[] = $or['name']; // determine proper values for this room $room_stay_checkin = $ord['checkin']; $room_stay_checkout = $ord['checkout']; $room_stay_nights = $ord['days']; if ($ord['split_stay'] && count($room_stay_dates) && isset($room_stay_dates[$kor]) && $room_stay_dates[$kor]['idroom'] == $or['idroom']) { $room_stay_checkin = !empty($room_stay_dates[$kor]['checkin_ts']) ? $room_stay_dates[$kor]['checkin_ts'] : $room_stay_dates[$kor]['checkin']; $room_stay_checkout = !empty($room_stay_dates[$kor]['checkout_ts']) ? $room_stay_dates[$kor]['checkout_ts'] : $room_stay_dates[$kor]['checkout']; $room_stay_nights = $av_helper->countNightsOfStay($room_stay_checkin, $room_stay_checkout); // inject nights calculated for this room $room_stay_dates[$kor]['nights'] = $room_stay_nights; } if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { // package cost or cust_cost may not be inclusive of taxes if prices tax included is off $calctar = VikBooking::sayPackagePlusIva($or['cust_cost'], $or['cust_idiva']); $isdue += $calctar; $isdue_orig += $calctar; $imp += VikBooking::sayPackageMinusIva($or['cust_cost'], $or['cust_idiva']); $pricenames[$num] = (!empty($or['pkg_name']) ? $or['pkg_name'] : (!empty($or['otarplan']) ? $or['otarplan'] : JText::translate('VBOROOMCUSTRATEPLAN'))); } elseif (array_key_exists($num, $tars) && is_array($tars[$num])) { $display_rate = $ord['status'] != 'confirmed' && !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num]['cost']; $calctar = VikBooking::sayCostPlusIva($display_rate, $tars[$num]['idprice']); $tars[$num]['calctar'] = $calctar; $isdue += $calctar; $isdue_orig += $or['room_cost']; $imp += VikBooking::sayCostMinusIva($display_rate, $tars[$num]['idprice']); $pricenames[$num] = VikBooking::getPriceName($tars[$num]['idprice'], $vbo_tn); } if (!empty($or['optionals'])) { $stepo = explode(";", $or['optionals']); foreach ($stepo as $roptkey => $one) { if (empty($one)) { continue; } $stept = explode(":", $one); $actopt = VikBooking::getSingleOption($stept[0], $vbo_tn); if (!$actopt) { continue; } $chvar = ''; if (!empty($actopt['ageintervals']) && $or['children'] > 0 && strstr($stept[1], '-') != false) { $optagenames = VikBooking::getOptionIntervalsAges($actopt['ageintervals']); $optagepcent = VikBooking::getOptionIntervalsPercentage($actopt['ageintervals']); $optageovrct = VikBooking::getOptionIntervalChildOverrides($actopt, $or['adults'], $or['children']); $child_num = VikBooking::getRoomOptionChildNumber($or['optionals'], $actopt['id'], $roptkey, $or['children']); $optagecosts = VikBooking::getOptionIntervalsCosts(isset($optageovrct['ageintervals_child' . ($child_num + 1)]) ? $optageovrct['ageintervals_child' . ($child_num + 1)] : $actopt['ageintervals']); $agestept = explode('-', $stept[1]); $stept[1] = $agestept[0]; $chvar = $agestept[1]; if (array_key_exists(($chvar - 1), $optagepcent) && $optagepcent[($chvar - 1)] == 1) { //percentage value of the adults tariff if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { $optagecosts[($chvar - 1)] = $or['cust_cost'] * $optagecosts[($chvar - 1)] / 100; } else { $display_rate = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num]['cost']; $optagecosts[($chvar - 1)] = $display_rate * $optagecosts[($chvar - 1)] / 100; } } elseif (array_key_exists(($chvar - 1), $optagepcent) && $optagepcent[($chvar - 1)] == 2) { //VBO 1.10 - percentage value of room base cost if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { $optagecosts[($chvar - 1)] = $or['cust_cost'] * $optagecosts[($chvar - 1)] / 100; } else { $display_rate = isset($tars[$num]['room_base_cost']) ? $tars[$num]['room_base_cost'] : (!empty($or['room_cost']) ? $or['room_cost'] : $tars[$num]['cost']); $optagecosts[($chvar - 1)] = $display_rate * $optagecosts[($chvar - 1)] / 100; } } $actopt['chageintv'] = $chvar; $actopt['name'] .= ' (' . ($optagenames[($chvar - 1)] ?? '') . ')'; $realcost = (intval($actopt['perday']) == 1 ? (floatval($optagecosts[($chvar - 1)] ?? 0) * $room_stay_nights * $stept[1]) : (floatval($optagecosts[($chvar - 1)] ?? 0) * $stept[1])); } else { // VBO 1.11 - options percentage cost of the room total fee if ($is_package === true || (!empty($or['cust_cost']) && $or['cust_cost'] > 0.00)) { $deftar_basecosts = $or['cust_cost']; } else { $deftar_basecosts = !empty($or['room_cost']) ? $or['room_cost'] : $tars[$num]['cost']; } $actopt['cost'] = (int)$actopt['pcentroom'] ? ($deftar_basecosts * $actopt['cost'] / 100) : $actopt['cost']; // $realcost = (intval($actopt['perday']) == 1 ? ($actopt['cost'] * $room_stay_nights * $stept[1]) : ($actopt['cost'] * $stept[1])); } if (!empty($actopt['maxprice']) && $actopt['maxprice'] > 0 && $realcost > $actopt['maxprice']) { $realcost = $actopt['maxprice']; if (intval($actopt['hmany']) == 1 && intval($stept[1]) > 1) { $realcost = $actopt['maxprice'] * $stept[1]; } } if ($actopt['perperson'] == 1) { $realcost = $realcost * $or['adults']; } /** * Trigger event to allow third party plugins to apply a custom calculation for the option/extra fee or tax. * * @since 1.17.7 (J) - 1.7.7 (WP) */ $custom_calculation = VBOFactory::getPlatform()->getDispatcher()->filter('onCalculateBookingOptionFeeCost', [$realcost, &$actopt, $ord, $or]); if ($custom_calculation) { $realcost = (float) $custom_calculation[0]; } $tmpopr = VikBooking::sayOptionalsPlusIva($realcost, $actopt['idiva']); $isdue += $tmpopr; $isdue_orig += $tmpopr; $imp += VikBooking::sayOptionalsMinusIva($realcost, $actopt['idiva']); if (!isset($optbought[$num])) { $optbought[$num] = ''; } $optbought[$num] .= "
".($stept[1] > 1 ? $stept[1] . " " : "") . $actopt['name'] . " " . VikBooking::formatCurrencyNumber(VikBooking::numberFormat($tmpopr), $currencysymb, ['%s', '%s']) . "
"; } } // custom extra costs if (!empty($or['extracosts'])) { $extraservices[$num] = ''; $cur_extra_costs = json_decode($or['extracosts'], true); foreach ($cur_extra_costs as $eck => $ecv) { $ecplustax = !empty($ecv['idtax']) ? VikBooking::sayOptionalsPlusIva($ecv['cost'], $ecv['idtax']) : $ecv['cost']; $isdue += $ecplustax; $isdue_orig += $ecplustax; $imp += !empty($ecv['idtax']) ? VikBooking::sayOptionalsMinusIva($ecv['cost'], $ecv['idtax']) : $ecv['cost']; $extraservices[$num] .= "
".$ecv['name']." " . VikBooking::formatCurrencyNumber(VikBooking::numberFormat($ecplustax), $currencysymb, ['%s' , '%s']) . "
"; } } } $tax = $isdue - $imp; $usedcoupon = false; $origisdue = $isdue; if (strlen((string)$ord['coupon']) > 0) { $usedcoupon = true; $expcoupon = explode(";", $ord['coupon']); $isdue = $isdue - $expcoupon[1]; $isdue_orig = $isdue_orig - $expcoupon[1]; } if ($ord['refund'] > 0) { $isdue -= $ord['refund']; $isdue_orig -= $ord['refund']; } //Check whether the booking total amount has changed due to rates modifications for these dates, made after this booking $rooms_total_changed = ($ord['status'] == 'confirmed' && number_format($isdue, 2) != number_format($ord['total'], 2) && number_format($origisdue, 2) != number_format($ord['total'], 2)); $only_roomsrates_changed = ($rooms_total_changed === true && number_format($isdue_orig, 2) == number_format($ord['total'], 2)); //booking modification, cancellation and request $resmodcanc = VikBooking::getReservationModCanc(); $resmodcanc = $this->days_to_arrival < 1 ? 0 : $resmodcanc; $resmodcancmin = VikBooking::getReservationModCancMin(); $mod_allowed = ($resmodcanc > 1 && $resmodcanc != 3 && $this->days_to_arrival >= $resmodcancmin); $canc_allowed = ($resmodcanc > 1 && $resmodcanc != 2 && $this->is_refundable > 0 && $this->daysadv_refund <= $this->days_to_arrival && $this->days_to_arrival >= $resmodcancmin); $ts_info = getdate($ord['ts']); $checkin_info = getdate($ord['checkin']); $checkout_info = getdate($ord['checkout']); /** * Custom listing check-in and check-out times. * * @since 1.18.3 (J) - 1.8.3 (WP) */ $listing_params = ''; $listing_custom_checkin = ''; $listing_custom_checkout = ''; if (($ord['roomsnum'] ?? 0) == 1) { $listing_params = VikBooking::getRoomInfo(($orderrooms[(key($orderrooms))]['idroom'] ?? 0), ['params'], true, true)['params'] ?? ''; $listing_custom_checkin = VikBooking::getRoomParam('checkin', $listing_params); $listing_custom_checkout = VikBooking::getRoomParam('checkout', $listing_params); } // the current booking URI $current_booking_uri = JRoute::rewrite('index.php?option=com_vikbooking&view=booking&sid='.(!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']).'&ts='.$ord['ts'].(!empty($bestitemid) ? '&Itemid='.$bestitemid : (!empty($pitemid) ? '&Itemid='.$pitemid : ''))); ?>

2 && strpos($custdata_parts[0], ':') !== false && strpos($custdata_parts[1], ':') !== false) { //attempt to format labels and values foreach ($custdata_parts as $custdet) { if (strlen((string)$custdet) < 1) { continue; } $custdet_parts = explode(':', $custdet); $custd_lbl = ''; $custd_val = ''; if (count($custdet_parts) < 2) { $custd_val = $custdet; } else { $custd_lbl = $custdet_parts[0]; unset($custdet_parts[0]); $custd_val = trim(implode(':', $custdet_parts)); } ?>
days_to_arrival >= $resmodcancmin) || $otalogo || count($this->upselling))) { ?>
loadTemplate('upgrade'); } if ($canc_allowed && !$isotabooking) { ?>
days_to_arrival >= $resmodcancmin && !$isotabooking) { ?> upselling)) { ?>
$or) { // 1-based index $num = $kor + 1; // access current listing parameters if (($ord['roomsnum'] ?? 0) > 1 || !$listing_params) { // load parameters $listing_params = VikBooking::getRoomInfo($or['idroom'], ['params'], true, true)['params'] ?? ''; } ?>
0) { ?>
0) { ?>
countNightsOfStay($room_stay_checkin, $room_stay_checkout); // inject nights calculated for this room $room_stay_dates[$kor]['nights'] = $room_stay_nights; ?>
1 ? JText::translate('VBDAYS') : JText::translate('VBDAY')); ?>
0.00)) { ?>
%s', '%s']); ?>
getRatePlanData(($or['cust_cpolicy_id'] ?? 0) ?: 0); if ($rate_plan_data) { // describe cancellation policy for custom rate $canc_policy_type = ''; $canc_policy_descr = ''; if ($rate_plan_data['free_cancellation'] == 1) { if ($rate_plan_data['canc_deadline'] > 0) { $canc_policy_type = JText::sprintf('VBFREECANCELLATIONWITHIN', $rate_plan_data['canc_deadline']); } else { $canc_policy_type = JText::translate('VBFREECANCELLATION'); } if (!empty($rate_plan_data['canc_policy'])) { $canc_policy_descr = strpos($rate_plan_data['canc_policy'], '<') !== false ? $rate_plan_data['canc_policy'] : nl2br($rate_plan_data['canc_policy']); } } else { $canc_policy_type = JText::translate('VBONONREFUNDRATE'); } ?>
%s', ' 0 ? ' data-vborigprice="'.VikBooking::numberFormat($or['room_cost']).'"' : '') . '>%s']); ?>
0) || (array_key_exists($num, $extraservices) && strlen((string)$extraservices[$num]) > 0)) { ?>
0) { ?>
0) { ?>
time()) { // attempt to obtain the door access control passcode details try { // obtain the passcode details for this booking $passcodeDetails = VBOFactory::getDoorAccessControl()->getBookingDevicePasscodes($registry); } catch (Exception $e) { // do nothing on error $passcodeDetails = null; } ?>

- %s', '%s']); ?>
0) { ?>
%s', '%s']); ?>
%s', '%s']); ?>
0 && ($ord['totpaid'] + ($this->damage_deposit_payment['damagedep_gross'] ?? 0)) < $ord['total'] && $ord['paymcount'] > 0) || $ord['payable'] > 0); $ota_will_pay = false; $dd_payable_later = false; if ($payable && $ord['status'] == 'confirmed' && !empty($ord['idorderota']) && $ord['payable'] > 0 && !$this->prev_dd_payments) { if (($this->damage_deposit_payment['damagedep_gross'] ?? 0) == $ord['payable'] && ($this->damage_deposit_payment['payment_window']['pay_id'] ?? 0)) { // upselling event must have added the damage deposit to an OTA booking, and this is the only outstanding amount that will be paid separately $payable = false; // check if the damage deposit is payable later if (!($this->damage_deposit_payment['payment_window']['payable'] ?? 0) && ($this->damage_deposit_payment['payment_window']['payment_from_dt'] ?? null)) { $dd_payable_later = true; } } } if ($payable && !empty($ord['idorderota']) && !empty($ord['channel']) && $ord['cmms'] && ($ord['total'] - $ord['totpaid'] - $ord['cmms']) < 1) { // the difference of the amount paid is equal to the OTA commissions amount $payable = false; if ($ord['payable'] > 0 && $ord['total'] > $ord['totpaid'] && round(($ord['total'] - $ord['totpaid']), 0) == round($ord['payable'], 0)) { // there must have been an upselling event or a payment request $payable = true; } } if ($payable && $isotabooking && !((float) $ord['payable'])) { // access OTA payout events $prev_ota_payments = VikBooking::getBookingHistoryInstance($ord['id']) ->getEventsWithData('PO', null, false); if (!$prev_ota_payments) { // the OTA will pay the remaining balance $payable = false; $ota_will_pay = true; } } /** * Check if we have an outstanding balance after a deposit paid for a direct booking. * * @since 1.18.6 (J) - 1.8.6 (WP) */ $pay_balance_days_adv = (int) VBOFactory::getConfig()->get('depbalancedays'); if ($pay_balance_days_adv > 0 && !((float) $ord['payable']) && $ord['status'] == 'confirmed' && empty($ord['idorderota']) && $ord['totpaid'] > 0 && $ord['total'] > $ord['totpaid']) { // ensure the outstanding balance for direct booking is payable at this time if ($ord['ts'] < strtotime(sprintf('-%d days', $pay_balance_days_adv), $ord['checkin'])) { // outstanding balance not yet payable according to settings $payable = false; } } if ($ord['status'] == 'confirmed' && is_array($payment) && VikBooking::multiplePayments() && $ord['total'] > 0 && $payable) { // write again the payment form because the order was not fully paid if (VBOPlatformDetection::isWordPress()) { /** * @wponly * * @since 1.0.5 */ $return_url = JUri::root() . "index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']; $error_url = JUri::root() . "index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']; $notify_url = JUri::root() . "index.php?option=com_vikbooking&task=notifypayment&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&tmpl=component"; /** * @wponly the URLs must be routed differently for WP */ $model = JModel::getInstance('vikbooking', 'shortcodes', 'admin'); $itemid = $model->best(['booking'], (!empty($ord['lang']) ? $ord['lang'] : null)); if ($itemid) { $return_url = str_replace(JUri::root(), '', $return_url); $error_url = str_replace(JUri::root(), '', $error_url); $notify_url = str_replace(JUri::root(), '', $notify_url); $return_url = JRoute::rewrite($return_url . "&Itemid={$itemid}", false); $error_url = JRoute::rewrite($error_url . "&Itemid={$itemid}", false); $notify_url = JRoute::rewrite($notify_url . "&Itemid={$itemid}", false); } } else { $return_url = VikBooking::externalroute("index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'], false, (!empty($bestitemid) ? $bestitemid : null)); $error_url = VikBooking::externalroute("index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'], false, (!empty($bestitemid) ? $bestitemid : null)); $notify_url = VikBooking::externalroute("index.php?option=com_vikbooking&task=notifypayment&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&tmpl=component", false, null); } $transaction_name = VikBooking::getPaymentName(); $leave_deposit = 0; $percentdeposit = ""; // calculate the outstanding balance to pay if ($ord['payable'] > 0) { $remainingamount = $ord['payable']; } else { $prev_dd_paid = 0; if ($this->prev_dd_payments || ($this->damage_deposit_payment['payment_window'] ?? [])) { $prev_dd_paid = $this->damage_deposit_payment['damagedep_gross'] ?? 0; } $prev_recorded_payment = $ord['totpaid'] + $prev_dd_paid; $remainingamount = $ord['total'] - $prev_recorded_payment; } $array_order = []; $array_order['details'] = $ord; if (empty($array_order['details']['sid']) && !empty($array_order['details']['idorderota']) && !empty($array_order['details']['channel'])) { $array_order['details']['sid'] = $array_order['details']['idorderota']; $ord['sid'] = $ord['idorderota']; } $array_order['customer_email'] = $ord['custmail']; $array_order['account_name'] = VikBooking::getPaypalAcc(); $array_order['transaction_currency'] = VikBooking::getCurrencyCodePp(); $array_order['rooms_name'] = implode(", ", $roomsnames); $array_order['transaction_name'] = !empty($transaction_name) ? $transaction_name : (JText::translate('VBORDERNUMBER') . ' ' . $ord['id']); $array_order['order_total'] = $remainingamount; $array_order['currency_symb'] = $currencysymb; $array_order['net_price'] = $remainingamount; $array_order['tax'] = 0; $array_order['return_url'] = $return_url; $array_order['error_url'] = $error_url; $array_order['notify_url'] = $notify_url; $array_order['total_to_pay'] = $remainingamount; $array_order['total_net_price'] = $remainingamount; $array_order['total_tax'] = 0; $array_order['leave_deposit'] = $leave_deposit; $array_order['percentdeposit'] = $percentdeposit; $array_order['payment_info'] = $payment; $array_order = array_merge($ord, $array_order); ?>
%s', '%s']); ?>
%s', '%s']); ?>
$ord['id'], 'source' => (($ord['channel'] ?? '') ?: 'Website'), 'ota_booking_id' => (($ord['idorderota'] ?? '') ?: ''), ]; // increase payment processor instances $payProcessorInstances++; /** * Trigger event to allow third-party plugins to manipulate the transaction data. * * @since 1.18.5 (J) - 1.8.5 (WP) */ VBOFactory::getPlatform()->getDispatcher()->trigger('onInitPaymentTransaction', [&$array_order, &$payment['params'], []]); if (VBOPlatformDetection::isWordPress()) { /** * @wponly The payment gateway is now loaded * using the apposite dispatcher. * * @since 1.0.5 */ JLoader::import('adapter.payment.dispatcher'); $obj = JPaymentDispatcher::getInstance('vikbooking', $payment['file'], $array_order, $payment['params']); // remember to echo the payment echo $obj->showPayment(); } else { /** * @joomlaonly The Payment Factory library will invoke the gateway. * * @since 1.14.3 */ require_once VBO_ADMIN_PATH . DIRECTORY_SEPARATOR . 'payments' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'factory.php'; $obj = VBOPaymentFactory::getPaymentInstance($payment['file'], $array_order, $payment['params']); $obj->showPayment(); } ?>
0 && $ord['totpaid'] > 0 && $ord['totpaid'] < $ord['total']) { /** * Calculate the amount paid so far, by considering the damage deposit and its payment. * * @since 1.17.6 (J) - 1.7.6 (WP) */ $paid_so_far = $ord['totpaid']; if (($this->damage_deposit_payment['damagedep_gross'] ?? 0) > 0 && $this->prev_dd_payments) { $paid_so_far += $this->damage_deposit_payment['damagedep_gross']; } // calculate the remainig balance to be paid $remainingamount = $ord['total'] - $paid_so_far; ?>
%s', '%s']); ?>
0 && !$is_rembal_ota_cmms) { ?>
%s', '%s']); ?>
damage_deposit_payment['payment_window']['payment_from_dt'] ?? '')); ?>
0 && $this->days_to_arrival >= $resmodcancmin) || count($this->upselling)) { ?> days_to_arrival >= $resmodcancmin) { ?>

getTag(), 0, 2); if (VBOPlatformDetection::isWordPress()) { /** * @wponly * * @since 1.0.5 */ $return_url = JUri::root() . "index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&lang=".$langtag; $error_url = JUri::root() . "index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&lang=".$langtag; $notify_url = JUri::root() . "index.php?option=com_vikbooking&task=notifypayment&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&lang=".$langtag."&tmpl=component"; /** * @wponly the URLs must be routed differently for WP */ $model = JModel::getInstance('vikbooking', 'shortcodes', 'admin'); $itemid = $model->best(['booking'], (!empty($ord['lang']) ? $ord['lang'] : null)); if ($itemid) { $return_url = str_replace(JUri::root(), '', $return_url); $error_url = str_replace(JUri::root(), '', $error_url); $notify_url = str_replace(JUri::root(), '', $notify_url); $return_url = JRoute::rewrite($return_url . "&Itemid={$itemid}", false); $error_url = JRoute::rewrite($error_url . "&Itemid={$itemid}", false); $notify_url = JRoute::rewrite($notify_url . "&Itemid={$itemid}", false); } } else { $return_url = VikBooking::externalroute("index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'] ."&lang=" . $langtag, false, (!empty($bestitemid) ? $bestitemid : null)); $error_url = VikBooking::externalroute("index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'] ."&lang=" . $langtag, false, (!empty($bestitemid) ? $bestitemid : null)); $notify_url = VikBooking::externalroute("index.php?option=com_vikbooking&task=notifypayment&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'] . "&lang=" . $langtag . "&tmpl=component", false); } $transaction_name = VikBooking::getPaymentName(); $leave_deposit = 0; $percentdeposit = ""; $array_order = []; $array_order['details'] = $ord; if (empty($array_order['details']['sid']) && !empty($array_order['details']['idorderota']) && !empty($array_order['details']['channel'])) { $array_order['details']['sid'] = $array_order['details']['idorderota']; $ord['sid'] = $ord['idorderota']; } $array_order['customer_email'] = $ord['custmail']; $array_order['account_name'] = VikBooking::getPaypalAcc(); $array_order['transaction_currency'] = VikBooking::getCurrencyCodePp(); $array_order['rooms_name'] = implode(", ", $roomsnames); $array_order['transaction_name'] = !empty($transaction_name) ? $transaction_name : (JText::translate('VBORDERNUMBER') . ' ' . $ord['id']); $array_order['order_total'] = $isdue; $array_order['currency_symb'] = $currencysymb; $array_order['net_price'] = $imp; $array_order['tax'] = $tax; $array_order['return_url'] = $return_url; $array_order['error_url'] = $error_url; $array_order['notify_url'] = $notify_url; $array_order['total_to_pay'] = $isdue; $array_order['total_net_price'] = $imp; $array_order['total_tax'] = $tax; /** * Check for damage deposit payment data and eventually deduct payment amounts. * * @since 1.17.6 (J) - 1.7.6 (WP) */ if (($this->damage_deposit_payment['payment_window'] ?? []) && ($this->damage_deposit_payment['damagedep_gross'] ?? 0) > 0 && $this->damage_deposit_payment['damagedep_gross'] < $array_order['total_to_pay']) { // damage deposit will have to be paid separately $array_order['total_to_pay'] -= $this->damage_deposit_payment['damagedep_gross']; if (($this->damage_deposit_payment['damagedep_net'] ?? 0) > 0 && $this->damage_deposit_payment['damagedep_net'] < $array_order['total_tax']) { $array_order['total_net_price'] -= $this->damage_deposit_payment['damagedep_net']; } if (($this->damage_deposit_payment['damagedep_tax'] ?? 0) > 0 && $this->damage_deposit_payment['damagedep_tax'] < $array_order['total_tax']) { $array_order['total_tax'] -= $this->damage_deposit_payment['damagedep_tax']; } } $totalchanged = false; if ($payment['charge'] > 0.00) { $totalchanged = true; if ($payment['ch_disc'] == 1) { // charge if ($payment['val_pcent'] == 1) { // fixed value $array_order['total_net_price'] += $payment['charge']; $array_order['total_tax'] += $payment['charge']; $array_order['total_to_pay'] += $payment['charge']; $newtotaltopay = $array_order['total_to_pay']; } else { // percent value $percent_net = $array_order['total_net_price'] * $payment['charge'] / 100; $percent_tax = $array_order['total_tax'] * $payment['charge'] / 100; $percent_to_pay = $array_order['total_to_pay'] * $payment['charge'] / 100; $array_order['total_net_price'] += $percent_net; $array_order['total_tax'] += $percent_tax; $array_order['total_to_pay'] += $percent_to_pay; $newtotaltopay = $array_order['total_to_pay']; } } else { // discount if ($payment['val_pcent'] == 1) { // fixed value $array_order['total_net_price'] -= $payment['charge']; $array_order['total_tax'] -= $payment['charge']; $array_order['total_to_pay'] -= $payment['charge']; $newtotaltopay = $array_order['total_to_pay']; } else { // percent value $percent_net = $array_order['total_net_price'] * $payment['charge'] / 100; $percent_tax = $array_order['total_tax'] * $payment['charge'] / 100; $percent_to_pay = $array_order['total_to_pay'] * $payment['charge'] / 100; $array_order['total_net_price'] -= $percent_net; $array_order['total_tax'] -= $percent_tax; $array_order['total_to_pay'] -= $percent_to_pay; $newtotaltopay = $array_order['total_to_pay']; } } } $percentdeposit = false; if (!VikBooking::payTotal() && $this->nodep != 1 && VikBooking::allowDepositFromRates($tars)) { $percentdeposit = VikBooking::getAccPerCent(); $percentdeposit = VikBooking::calcDepositOverride($percentdeposit, $ord['days']); if ($percentdeposit > 0 && VikBooking::depositAllowedDaysAdv($ord['checkin'])) { $leave_deposit = 1; if (VikBooking::getTypeDeposit() == "fixed") { $array_order['total_to_pay'] = $percentdeposit; $array_order['total_net_price'] = $percentdeposit; $array_order['total_tax'] = ($array_order['total_to_pay'] - $array_order['total_net_price']); } else { $array_order['total_to_pay'] = $array_order['total_to_pay'] * $percentdeposit / 100; $array_order['total_net_price'] = $array_order['total_net_price'] * $percentdeposit / 100; $array_order['total_tax'] = ($array_order['total_to_pay'] - $array_order['total_net_price']); } } } $array_order['leave_deposit'] = $leave_deposit; $array_order['percentdeposit'] = $percentdeposit; $array_order['payment_info'] = $payment; $array_order = array_merge($ord, $array_order); if (VBOPlatformDetection::isWordPress()) { $elapsed_redirect_uri = $return_url; } else { $elapsed_redirect_uri = JRoute::rewrite('index.php?option=com_vikbooking&view=booking&sid='.(!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']).'&ts='.$ord['ts'].(!empty($bestitemid) ? '&Itemid='.$bestitemid : (!empty($pitemid) ? '&Itemid='.$pitemid : '')), false); } // count minutes elapsed from booking creation date $mins_elapsed = floor(($now_info[0] - $ord['ts']) / 60); /** * Check if we are dealing with a pending booking solution of a quote. * * @since 1.18.8 (J) - 1.8.8 (WP) */ if ($this->quoteValidUntilDt) { // get the date interval of difference between valid until date and current date $validityDiff = $this->quoteValidUntilDt->diff(JFactory::getDate('now')); // count the number of minutes still available (expected validity to be in the future) $minautoremove = ($validityDiff->days * 1440) + ($validityDiff->h * 60) + $validityDiff->i; // add up the minutes elapsed to allow an accurate calcilation of the remaining minutes $minautoremove += $mins_elapsed; } else { // global booking auto-removal minutes $minautoremove = VikBooking::getMinutesAutoRemove(); } // check if we should display a countdown for the automatic booking cancellation $remainmin = $minautoremove - $mins_elapsed; $remainmin = $remainmin < 1 ? 1 : $remainmin; if ($minautoremove > 0 && $minautoremove < 35791) { /** * Ensure the timeout milliseconds in 32-bit do not exceed * the maximum value of 2,147,483,647ms (~35791,39 minutes). * * @since 1.16.10 (J) - 1.6.10 (WP) */ $booktime_info = getdate($ord['ts']); $booktime_offset = date('Z', $ord['ts']) / 60; $remainmilsec = intval($remainmin * 60 * 1000) + 100; $remainmilsec = $remainmilsec < 100 ? 100 : $remainmilsec; // calculate the values for the timer $days_left = $remainmin > 1440 ? floor($remainmin / 1440) : 0; $remainmin -= $days_left * 1440; $hours_left = $remainmin > 59 ? floor($remainmin / 60) : 0; $minutes_left = $remainmin - ($hours_left * 60); $lbl_hour = strtolower(JText::translate('VBHOUR')); $lbl_hours = strtolower(JText::translate('VBHOURS')); $lbl_minute = strtolower(JText::translate('VBMINUTE')); $lbl_minutes = strtolower(JText::translate('VBMINUTES')); $lbl_day = strtolower(JText::translate('VBO_DAY')); $lbl_days = strtolower(JText::translate('VBO_DAYS')); $timer_str = $days_left > 0 ? '' . $days_left . ' ' . ($days_left == 1 ? $lbl_day : $lbl_days) . ' ' : ''; $timer_str .= $days_left > 0 || $hours_left > 0 ? '' . $hours_left . ' ' . ($hours_left == 1 ? $lbl_hour : $lbl_hours) . ' ' : ''; $timer_str .= '' . $minutes_left . ' ' . ($minutes_left == 1 ? $lbl_minute : $lbl_minutes) . ''; ?>
0) { // we expect a very high number of remaining minutes to be expressed in days ?>

(%s', '%s']); } else { echo '' . VikBooking::numberFormat($payment['charge']) . ' %'; } ?>) %s', '%s']); ?>

$ord['id'], 'source' => (($ord['channel'] ?? '') ?: 'Website'), 'ota_booking_id' => (($ord['idorderota'] ?? '') ?: ''), ]; // increase payment processor instances $payProcessorInstances++; /** * Trigger event to allow third-party plugins to manipulate the transaction data. * * @since 1.18.5 (J) - 1.8.5 (WP) */ VBOFactory::getPlatform()->getDispatcher()->trigger('onInitPaymentTransaction', [&$array_order, &$payment['params'], []]); if (VBOPlatformDetection::isWordPress()) { /** * @wponly The payment gateway is now loaded * using the apposite dispatcher. * * @since 1.0.5 */ JLoader::import('adapter.payment.dispatcher'); $obj = JPaymentDispatcher::getInstance('vikbooking', $payment['file'], $array_order, $payment['params']); // remember to echo the payment echo $obj->showPayment(); } else { /** * @joomlaonly The Payment Factory library will invoke the gateway. * * @since 1.14.3 */ require_once VBO_ADMIN_PATH . DIRECTORY_SEPARATOR . 'payments' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'factory.php'; $obj = VBOPaymentFactory::getPaymentInstance($payment['file'], $array_order, $payment['params']); $obj->showPayment(); } ?>
damage_deposit_payment['damagedep_gross'] ?? 0) > 0 && ($this->damage_deposit_payment['payment_window']['payable'] ?? false) && !$this->prev_dd_payments) { // damage deposit can be paid separately $dd_payment = !empty($this->damage_deposit_payment['payment_window']['pay_id']) ? VikBooking::getPayment($this->damage_deposit_payment['payment_window']['pay_id'], $vbo_tn) : $payment; // build transaction URIs if (VBOPlatformDetection::isWordPress()) { $return_url = JUri::root() . "index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']; $error_url = JUri::root() . "index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']; $notify_url = JUri::root() . "index.php?option=com_vikbooking&task=notifypayment&dd=1&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&tmpl=component"; $model = JModel::getInstance('vikbooking', 'shortcodes', 'admin'); $itemid = $model->best(['booking'], (!empty($ord['lang']) ? $ord['lang'] : null)); if ($itemid) { $return_url = str_replace(JUri::root(), '', $return_url); $error_url = str_replace(JUri::root(), '', $error_url); $notify_url = str_replace(JUri::root(), '', $notify_url); $return_url = JRoute::rewrite($return_url . "&Itemid={$itemid}", false); $error_url = JRoute::rewrite($error_url . "&Itemid={$itemid}", false); $notify_url = JRoute::rewrite($notify_url . "&Itemid={$itemid}", false); } } else { $return_url = VikBooking::externalroute("index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'], false, (!empty($bestitemid) ? $bestitemid : null)); $error_url = VikBooking::externalroute("index.php?option=com_vikbooking&view=booking&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts'], false, (!empty($bestitemid) ? $bestitemid : null)); $notify_url = VikBooking::externalroute("index.php?option=com_vikbooking&task=notifypayment&dd=1&sid=" . (!empty($ord['idorderota']) && !empty($ord['channel']) ? $ord['idorderota'] : $ord['sid']) . "&ts=" . $ord['ts']."&tmpl=component", false, null); } // build payment instructions $array_order = []; $array_order['details'] = $ord; if (empty($array_order['details']['sid']) && !empty($array_order['details']['idorderota']) && !empty($array_order['details']['channel'])) { $array_order['details']['sid'] = $array_order['details']['idorderota']; $ord['sid'] = $ord['idorderota']; } $array_order['customer_email'] = $ord['custmail']; $array_order['account_name'] = VikBooking::getPaypalAcc(); $array_order['transaction_currency'] = VikBooking::getCurrencyCodePp(); $array_order['rooms_name'] = implode(", ", $roomsnames); $array_order['transaction_name'] = !empty($transaction_name) ? $transaction_name : (JText::translate('VBORDERNUMBER') . ' ' . $ord['id']); $array_order['transaction_name'] .= ' - ' . JText::translate('VBO_DAMAGE_DEPOSIT'); $array_order['order_total'] = $this->damage_deposit_payment['damagedep_gross']; $array_order['currency_symb'] = $currencysymb; $array_order['net_price'] = $this->damage_deposit_payment['damagedep_net']; $array_order['tax'] = $this->damage_deposit_payment['damagedep_tax']; $array_order['return_url'] = $return_url; $array_order['error_url'] = $error_url; $array_order['notify_url'] = $notify_url; $array_order['total_to_pay'] = $this->damage_deposit_payment['damagedep_gross']; $array_order['total_net_price'] = $this->damage_deposit_payment['damagedep_net']; $array_order['total_tax'] = $this->damage_deposit_payment['damagedep_tax']; $array_order['leave_deposit'] = 0; $array_order['percentdeposit'] = ''; $array_order['payment_info'] = $dd_payment; $array_order = array_merge($ord, $array_order); if (is_array($dd_payment) && !empty($dd_payment['note'])) { ?>
$ord['id'], 'source' => (($ord['channel'] ?? '') ?: 'Website'), 'ota_booking_id' => (($ord['idorderota'] ?? '') ?: ''), 'damage_deposit' => 1, ]; // increase payment processor instances $payProcessorInstances++; /** * Trigger event to allow third-party plugins to manipulate the transaction data. * * @since 1.18.5 (J) - 1.8.5 (WP) */ VBOFactory::getPlatform()->getDispatcher()->trigger('onInitPaymentTransaction', [&$array_order, &$payment['params'], []]); if (VBOPlatformDetection::isWordPress()) { /** * @wponly The payment gateway is now loaded * using the apposite dispatcher. * * @since 1.0.5 */ JLoader::import('adapter.payment.dispatcher'); $obj = JPaymentDispatcher::getInstance('vikbooking', $dd_payment['file'], $array_order, $dd_payment['params']); // remember to echo the payment echo $obj->showPayment(); } else { /** * @joomlaonly The Payment Factory library will invoke the gateway. * * @since 1.14.3 */ require_once VBO_ADMIN_PATH . DIRECTORY_SEPARATOR . 'payments' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'factory.php'; $obj = VBOPaymentFactory::getPaymentInstance($dd_payment['file'], $array_order, $dd_payment['params']); $obj->showPayment(); } ?>
$sn) { $raw_rev_services[$sn['service_name']] = $sk; } // translate services $vbo_tn->translateContents($rev_services, '#__vikbooking_greview_service'); ?>
1) { // some services have been reviewed ("review_score" is always present) ?>
$servicescore) { if ($servicename == 'review_score') { // protected keyword for the global review score $counter++; continue; } $stars_count = floor($servicescore / 2); ?>

upselling); if ($tot_upselling) { // at least one room has options that can be up-sold $formatparts = explode(':', VikBooking::getNumberFormatData()); ?>

upselling as $kor => $uproom) { if (!isset($uproom->upsellable) || !count($uproom->upsellable)) { // no upsellable options for this room continue; } ?>
1) { // write the room name and adults/children in case of multiple rooms booked ?>
name; ?> adults; ?> adults == 1 ? JText::translate('VBSEARCHRESADULT') : JText::translate('VBSEARCHRESADULTS')); ?> 0) { ?>
id) { $room_stay_nights = $room_stay_dates[$kor]['nights']; } foreach ($uproom->upsellable as $o) { if ((int)$o['pcentroom']) { // make sure we have a cost for the room, or we should skip this type of option for "incomplete" bookings if (!isset($orderrooms[$kor]) || (empty($orderrooms[$kor]['cust_cost']) && empty($orderrooms[$kor]['room_cost']))) { continue; } $o['cost'] = ((!empty($orderrooms[$kor]['cust_cost']) ? $orderrooms[$kor]['cust_cost'] : $orderrooms[$kor]['room_cost']) * $o['cost'] / 100); } $optcost = intval($o['perday']) == 1 ? ($o['cost'] * $room_stay_nights) : $o['cost']; if (!empty($o['maxprice']) && $o['maxprice'] > 0 && $optcost > $o['maxprice']) { $optcost = $o['maxprice']; } if ($o['perperson'] == 1) { $optcost = $optcost * $orderrooms[$kor]['adults']; } $optcost = $optcost * 1; /** * Trigger event to allow third party plugins to apply a custom calculation for the option/extra fee or tax. * * @since 1.17.7 (J) - 1.7.7 (WP) */ $custom_calculation = VBOFactory::getPlatform()->getDispatcher()->filter('onCalculateBookingOptionFeeCost', [$optcost, &$o, $ord, $orderrooms[$kor]]); if ($custom_calculation) { $optcost = (float) $custom_calculation[0]; } $optquaninp = ''; $optquanbtn = ''; if (intval($o['hmany']) == 1) { if (intval($o['maxquant']) > 0) { $optquaninp = "\n"; } else { $optquaninp = ""; } $optquanbtn = ''; } else { $optquanbtn = ''; } ?>
'; ?>
%s', '%s']); ?>
0) { // -1 means that VCM is not enabled $chat_available = true; // check if chat can still be displayed to the guest $chat_params = VikBooking::getChatParams(); if (!isset($chat_params->res_status) || !in_array($ord['status'], $chat_params->res_status)) { // chat is disabled for this reservation status $chat_available = false; } if (isset($chat_params->av_type) && isset($chat_params->av_days)) { // check days of validity after checkin or checkout $chat_lim_ts = $chat_params->av_type == 'checkin' ? strtotime("+{$chat_params->av_days} days", $ord['checkin']) : strtotime("+{$chat_params->av_days} days", $ord['checkout']); // compare limits at midnight $now_midnight = mktime(0, 0, 0, date('n'), date('j'), date('Y')); $lim_midnight = mktime(0, 0, 0, date('n', $chat_lim_ts), date('j', $chat_lim_ts), date('Y', $chat_lim_ts)); if ($now_midnight > $lim_midnight) { // limit date is in the past $chat_available = false; } } if ($chat_available) { // attempt to get the class instance $messaging = VikBooking::getVcmChatInstance([$ord['id'], $ord['ts']], 'vikbooking'); } } if (!is_null($messaging)) { $tot_unread = VCMChatHandler::countUnreadMessages($ord['id']); ?>
payment) && $this->payment['outposition'] != 'bottom') || (isset($dd_payment) && is_array($dd_payment) && $dd_payment['outposition'] != 'bottom')) { // move the payment window, if available $payment_position = isset($dd_payment) && is_array($dd_payment) && $dd_payment['outposition'] != 'bottom' ? $dd_payment['outposition'] : $this->payment['outposition']; ?>