public function executeRenderPayment()
 {
     $form_id = $this->getParameter('form_id');
     $response = null;
     if ($form_id) {
         $payment_disabled = AB_BookingConfiguration::isPaymentDisabled();
         $this->userData = new AB_UserBookingData($form_id);
         $this->userData->load();
         if ($this->userData->hasData()) {
             if ($this->userData->getServicePrice() <= 0) {
                 $payment_disabled = true;
             }
         }
         if ($payment_disabled == false) {
             $this->form_id = $form_id;
             $this->info_text = nl2br(esc_html(get_option('ab_appearance_text_info_fourth_step')));
             $this->info_text_coupon = $this->_prepareInfoText(4, $this->userData);
             if ($this->userData->hasData()) {
                 $employee = new AB_Staff();
                 $employee->load($this->userData->getStaffId());
                 $service = new AB_Service();
                 $service->load($this->userData->getServiceId());
                 $price = $this->getWpdb()->get_var($this->getWpdb()->prepare('
                     SELECT price FROM ab_staff_service WHERE staff_id = %d AND service_id = %d', $employee->get('id'), $service->get('id')));
                 $this->_prepareProgressTracker(4, $price);
                 // Set response.
                 $response = array('status' => 'success', 'html' => $this->render('payment', array(), false));
             } else {
                 if (isset($_SESSION['tmp_booking_data'])) {
                     $tmp_booking_data = AB_CommonUtils::getTemporaryBookingData();
                     if (!empty($tmp_booking_data)) {
                         $tmp_form_id = $tmp_booking_data['form_id'];
                         if (isset($_SESSION['appointment_booking'][$tmp_form_id]) && $_SESSION['appointment_booking'][$tmp_form_id]['cancelled'] === true) {
                             $employee = new AB_Staff();
                             $employee->load($tmp_booking_data['staff_id'][0]);
                             $service = new AB_Service();
                             $service->load($tmp_booking_data['service_id']);
                             $price = $this->getWpdb()->get_var($this->getWpdb()->prepare('
                             SELECT price FROM ab_staff_service WHERE staff_id = %d AND service_id = %d', $employee->get('id'), $service->get('id')));
                             // create a paypal object
                             $paypal = new PayPal();
                             $product = new stdClass();
                             $product->name = $service->get('title');
                             $product->desc = $service->getTitleWithDuration();
                             $product->price = $price;
                             $product->qty = 1;
                             $paypal->addProduct($product);
                             // get the products information from the $_POST and create the Product objects
                             $this->paypal = $paypal;
                             $this->_prepareProgressTracker(4, $price);
                             $error_msg = isset($_SESSION['appointment_booking'][$tmp_form_id]['paypal_error']) ? $_SESSION['appointment_booking'][$tmp_form_id]['paypal_error'] : "";
                             unset($_SESSION['appointment_booking'][$tmp_form_id]['paypal_error']);
                             // Set response.
                             $response = array('status' => 'success', 'html' => $this->render('payment', array('form_id' => $tmp_form_id, 'error_msg' => $error_msg), false));
                         }
                     }
                 }
             }
         }
     }
     // Output JSON response.
     if ($response === null) {
         $response = array('status' => 'no-data');
     }
     header('Content-Type: application/json');
     echo json_encode($response);
     exit(0);
 }