function cancelReservation() { if (isset($_POST['reservation_id'])) { global $wpdb; $reservationId = $_POST['reservation_id']; echo $reservationId; $wpdb->update(DOPBSP_Reservations_table, array('status' => 'canceled'), array('id' => $reservationId)); $DOPemail = new DOPBookingSystemPROEmail(); $settings = $wpdb->get_row('SELECT * FROM ' . DOPBSP_Settings_table . ' WHERE calendar_id="' . $_POST['calendar_id'] . '"'); $reservation = $wpdb->get_row('SELECT * FROM ' . DOPBSP_Reservations_table . ' WHERE id="' . $reservationId . '"'); $DOPemail->sendMessage('booking_canceled', $reservation->language, $_POST['calendar_id'], $reservationId, $reservation->check_in, $reservation->check_out, $reservation->start_hour, $reservation->end_hour, $reservation->no_items, $reservation->currency, $reservation->price, $reservation->deposit, $reservation->total_price, $reservation->discount, json_decode($reservation->info), $reservation->no_people, $reservation->no_children, $reservation->email, false, true); echo ''; die; } }
' chargeback: A reversal has occurred on this transaction due to a chargeback by your customer. ' guarantee: A reversal has occurred on this transaction due to your customer triggering a money-back guarantee. ' buyer-complaint: A reversal has occurred on this transaction due to a complaint about the transaction from your customer. ' refund: A reversal has occurred on this transaction because you have given the customer a refund. ' other: A reversal has occurred on this transaction due to a reason not listed above. */ // $reasonCode = $resArray["PAYMENTINFO_0_REASONCODE"]; // ================================================================= WP Settings require_once '../../../../../wp-load.php'; require_once '../../dopbsp-email.php'; require_once '../../dopbsp-backend-reservations.php'; $language = isset($_SESSION['DOPBookingSystemPROFrontEndLanguage' . $DOPBSP_CalendarID_holder]) ? $_SESSION['DOPBookingSystemPROFrontEndLanguage' . $DOPBSP_CalendarID_holder] : 'en'; global $wpdb; $wp_settings = $wpdb->get_row('SELECT * FROM ' . DOPBSP_Settings_table . ' WHERE calendar_id="' . $DOPBSP_CalendarID_holder . '"'); $wpdb->insert(DOPBSP_Reservations_table, array('calendar_id' => $DOPBSP_CalendarID_holder, 'check_in' => $DOPBSP_CheckIn_holder, 'check_out' => $DOPBSP_CheckOut_holder, 'start_hour' => $DOPBSP_StartHour_holder, 'end_hour' => $DOPBSP_EndHour_holder, 'no_items' => $DOPBSP_NoItems_holder, 'currency' => $DOPBSP_Currency_holder, 'currency_code' => $DOPBSP_CurrencyCode_holder, 'total_price' => $DOPBSP_PriceValue_holder, 'discount' => $DOPBSP_DiscountValue_holder, 'price' => $DOPBSP_PriceToPayValue_holder, 'deposit' => $DOPBSP_PriceDepositValue_holder, 'language' => $language, 'email' => $DOPBSP_Email_holder, 'no_people' => $DOPBSP_NoPeople_holder, 'no_children' => $DOPBSP_NoChildren_holder, 'info' => json_encode($DOPBSP_Form_holder), 'payment_method' => '2', 'paypal_transaction_id' => $transactionId, 'status' => 'approved')); $DOPemail = new DOPBookingSystemPROEmail(); $reservationId = $wpdb->insert_id; $DOPemail->sendMessage('booking_paypal', $language, $DOPBSP_CalendarID_holder, $reservationId, $DOPBSP_CheckIn_holder, $DOPBSP_CheckOut_holder, $DOPBSP_StartHour_holder, $DOPBSP_EndHour_holder, $DOPBSP_NoItems_holder, $DOPBSP_Currency_holder, $DOPBSP_PriceToPayValue_holder, $DOPBSP_PriceDepositValue_holder, $DOPBSP_PriceValue_holder, $DOPBSP_DiscountValue_holder, $DOPBSP_Form_holder, $DOPBSP_NoPeople_holder, $DOPBSP_NoChildren_holder, $DOPBSP_Email_holder, true, true, $transactionId); // ================================================================= Change Schedule $DOPreservations = new DOPBookingSystemPROBackEndReservations(); $DOPreservations->approveReservationCalendarChange($reservationId, $wp_settings); // ================================================================= $_SESSION['DOPBSP_PayPal' . $DOPBSP_CalendarID_holder] = 'success'; echo '<script type="text/JavaScript"> window.location.href = "' . $DOPBSP_Page_holder . '"; </script>'; // header('Location:'.$DOPBSP_Page_holder); // ================================================================= } else { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
function bookRequest() { if (session_id() == "") { session_start(); } if (isset($_POST['calendar_id'])) { global $wpdb; $language = isset($_SESSION['DOPBookingSystemPROFrontEndLanguage' . $_POST['calendar_id']]) ? $_SESSION['DOPBookingSystemPROFrontEndLanguage' . $_POST['calendar_id']] : 'en'; $form = $_POST['form']; $settings = $wpdb->get_row('SELECT * FROM ' . DOPBSP_Settings_table . ' WHERE calendar_id="' . $_POST['calendar_id'] . '"'); $wpdb->insert(DOPBSP_Reservations_table, array('calendar_id' => $_POST['calendar_id'], 'check_in' => $_POST['check_in'], 'check_out' => $_POST['check_out'], 'start_hour' => $_POST['start_hour'], 'end_hour' => $_POST['end_hour'], 'no_items' => $_POST['no_items'], 'currency' => $_POST['currency'], 'currency_code' => $_POST['currency_code'], 'total_price' => $_POST['total_price'], 'discount' => $_POST['discount'], 'price' => $_POST['price'], 'deposit' => $_POST['deposit'], 'language' => $language, 'email' => $_POST['email'], 'no_people' => $_POST['no_people'], 'no_children' => $_POST['no_children'], 'status' => $settings->instant_booking == 'false' ? 'pending' : 'approved', 'info' => json_encode($form), 'payment_method' => $_POST['payment_method'])); $reservationId = $wpdb->insert_id; $DOPemail = new DOPBookingSystemPROEmail(); if ($settings->instant_booking == 'false') { $DOPemail->sendMessage('booking_without_approval', $language, $_POST['calendar_id'], $reservationId, $_POST['check_in'], $_POST['check_out'], $_POST['start_hour'], $_POST['end_hour'], $_POST['no_items'], $_POST['currency'], $_POST['price'], $_POST['deposit'], $_POST['total_price'], $_POST['discount'], $form, $_POST['no_people'], $_POST['no_children'], $_POST['email'], true, true); } else { $DOPemail->sendMessage('booking_with_approval', $language, $_POST['calendar_id'], $reservationId, $_POST['check_in'], $_POST['check_out'], $_POST['start_hour'], $_POST['end_hour'], $_POST['no_items'], $_POST['currency'], $_POST['price'], $_POST['deposit'], $_POST['total_price'], $_POST['discount'], $form, $_POST['no_people'], $_POST['no_children'], $_POST['email'], true, true); $DOPreservations = new DOPBookingSystemPROBackEndReservations(); $DOPreservations->approveReservationCalendarChange($reservationId, $settings); $ci = explode('-', $_POST['check_in']); echo $ci[0] . '-' . (int) $ci[1]; } } echo ''; die; }