function route()
 {
     if (isset($_REQUEST['ngg_stripe_rtn']) && isset($_REQUEST['order'])) {
         $checkout = C_NextGen_Pro_Checkout::get_instance();
         $checkout->redirect_to_thank_you_page($_REQUEST['order']);
     }
 }
 function paypal_express_checkout_action()
 {
     $retval = array();
     $checkout = C_NextGen_Pro_Checkout::get_instance();
     $response = $checkout->set_express_checkout();
     unset($response['token']);
     // for security reasons
     return $response;
 }
 function process_paypal_responses()
 {
     // Process return from PayPal
     if (isset($_REQUEST['ngg_ppxc_rtn'])) {
         $checkout = C_NextGen_Pro_Checkout::get_instance();
         if ($order_hash = $checkout->create_paypal_express_order()) {
             $checkout->redirect_to_thank_you_page($order_hash);
         }
     } elseif (isset($_REQUEST['ngg_ppxc_ccl'])) {
         $checkout = C_NextGen_Pro_Checkout::get_instance();
         $checkout->redirect_to_cancel_page();
     }
 }
 function process_paypal_responses()
 {
     // Process return from PayPal
     if (isset($_REQUEST['ngg_pstd_rtn'])) {
         C_NextGen_Pro_Checkout::get_instance()->create_paypal_standard_order();
     } elseif (isset($_REQUEST['ngg_pstd_cnl'])) {
         $checkout = C_NextGen_Pro_Checkout::get_instance();
         $checkout->redirect_to_cancel_page();
     } elseif (isset($_REQUEST['ngg_pstd_nfy'])) {
         $checkout = C_NextGen_Pro_Checkout::get_instance();
         $checkout->paypal_ipn_listener();
     }
 }
 function is_order_verified_action()
 {
     $retval = array('verified' => FALSE);
     if ($order = C_Order_Mapper::get_instance()->find_by_hash($this->param('order'))) {
         if ($order->status == 'verified') {
             $retval['verified'] = TRUE;
             $checkout = C_NextGen_Pro_Checkout::get_instance();
             $retval['thank_you_page_url'] = $checkout->get_thank_you_page_url($order->hash, TRUE);
         }
     } else {
         $retval['error'] = __("We're sorry, but we couldn't find your order.", 'nextgen-gallery-pro');
     }
     return $retval;
 }
 function stripe_checkout_action()
 {
     $retval = array();
     $checkout = C_NextGen_Pro_Checkout::get_instance();
     return $checkout->create_stripe_charge();
 }
 function custom_edit_link($url)
 {
     global $post;
     // we can't always assume $post exists
     if (empty($post)) {
         return $url;
     }
     if ($post->post_type == 'ngg_pricelist') {
         $url = admin_url('/edit.php?post_type=ngg_pricelist&ngg_edit=1&id=' . $post->ID);
     } elseif ($post->post_type == 'ngg_order') {
         $mapper = C_Order_Mapper::get_instance();
         if ($order = $mapper->find($post->ID)) {
             $checkout = C_NextGen_Pro_Checkout::get_instance();
             $url = $checkout->get_thank_you_page_url($order->hash);
         }
     }
     return $url;
 }