private function checkout()
 {
     $payment = WPBDP_Payment::get($this->category->payment_id);
     if (!$payment) {
         return wpbdp_render_msg(_x('Invalid renewal state.', 'renewal', 'WPBDM'), 'error');
     }
     require_once WPBDP_PATH . 'core/view-checkout.php';
     $checkout = new WPBDP_Checkout_Page($payment);
     return $checkout->dispatch();
 }
 private function checkout()
 {
     $sticky_info = $this->upgrades_api->get_info($this->listing->get_id());
     if ($sticky_info->pending || !$sticky_info->upgradeable || !wpbdp_payments_possible()) {
         return;
     }
     $payment = new WPBDP_Payment(array('listing_id' => $this->listing->get_id()));
     $payment->add_item('upgrade', $sticky_info->upgrade->cost, _x('Listing upgrade to featured', 'submit', 'WPBDM'));
     $payment->save();
     update_post_meta($this->listing->get_id(), '_wpbdp[sticky]', 'pending');
     // FIXME: maybe this should be set automatically when saving the payment?
     require_once WPBDP_PATH . 'core/view-checkout.php';
     $checkout = new WPBDP_Checkout_Page($payment);
     return $checkout->dispatch();
 }
 protected function step_checkout()
 {
     global $wpbdp;
     if ($this->state->editing) {
         $this->state->advance(false);
         return $this->dispatch();
     }
     $payment = WPBDP_Payment::get($this->state->payment_id);
     if (!$payment) {
         return wpbdp_render_msg(_x('Invalid submit state.', 'submit_state', 'WPBDM'), 'error');
     }
     if ($payment->is_completed()) {
         $this->state->advance(false);
         return $this->dispatch();
     }
     require_once WPBDP_PATH . 'core/view-checkout.php';
     $checkout = new WPBDP_Checkout_Page($payment);
     return $checkout->dispatch();
 }
Example #4
0
 public function dispatch()
 {
     switch ($this->action) {
         case 'showlisting':
             return $this->show_listing();
             break;
         case 'browsecategory':
             return $this->browse_category();
             break;
         case 'browsetag':
             return $this->browse_tag();
             break;
         case 'editlisting':
         case 'submitlisting':
             require_once WPBDP_PATH . 'core/view-submit-listing.php';
             $submit_page = new WPBDP_Submit_Listing_Page(isset($_REQUEST['listing_id']) ? $_REQUEST['listing_id'] : 0);
             return $submit_page->dispatch();
             break;
         case 'sendcontactmessage':
             require_once WPBDP_PATH . 'core/view-listing-contact.php';
             $page = new WPBDP_Listing_Contact_View();
             return $page->dispatch();
             break;
         case 'deletelisting':
             require_once WPBDP_PATH . 'core/view-delete-listing.php';
             $v = new WPBDP_Delete_Listing_View();
             return $v->dispatch();
             break;
         case 'upgradetostickylisting':
             require_once WPBDP_PATH . 'core/view-upgrade-listing.php';
             $upgrade_page = new WPBDP_Upgrade_Listing_Page();
             return $upgrade_page->dispatch();
             break;
         case 'viewlistings':
             return $this->view_listings(true);
             break;
         case 'renewlisting':
             require_once WPBDP_PATH . 'core/view-renew-listing.php';
             $renew_page = new WPBDP_Renew_Listing_Page();
             return $renew_page->dispatch();
             break;
         case 'payment-process':
             return $this->process_payment();
             break;
         case 'search':
             return $this->search();
             break;
         case 'checkout':
             require_once WPBDP_PATH . 'core/view-checkout.php';
             $checkout_page = new WPBDP_Checkout_Page();
             return $checkout_page->dispatch();
             break;
         case 'manage-recurring':
             require_once WPBDP_PATH . 'core/view-manage-recurring.php';
             $page = new WPBDP_Manage_Subscriptions_View();
             return $page->dispatch();
             break;
         default:
             // Handle custom actions.
             $page = wpbdp_capture_action_array('wpbdp_action_page_' . $this->action);
             if ($page) {
                 return $page;
             }
             return $this->main_page();
             break;
     }
 }