/**
  * @return mixed|void
  */
 public function payload()
 {
     WC_POS_Server::check_ajax_referer();
     $this->params = new WC_POS_Params();
     $payload = array('templates' => $this->templates_payload(), 'params' => $this->params->payload(), 'i18n' => WC_POS_i18n::payload());
     WC_POS_Server::response($payload);
 }
 /**
  * POS Settings stored in options table
  */
 public function admin_settings()
 {
     WC_POS_Server::check_ajax_referer();
     $result = $this->process_admin_settings();
     WC_POS_Server::response($result);
 }
 /**
  * Verifies the AJAX request
  */
 public function check_ajax_referer()
 {
     $pass = check_ajax_referer(WC_POS_PLUGIN_NAME, 'security', false);
     if (!$pass) {
         $result = new WP_Error('woocommerce_pos_invalid_nonce', __('Invalid security nonce', 'woocommerce-pos'), array('status' => 401));
         WC_POS_Server::response($result);
     }
 }
 /**
  * Get all the ids for a given post_type
  * @return json
  */
 public static function get_all_ids()
 {
     $entity = isset($_REQUEST['type']) ? $_REQUEST['type'] : false;
     $updated_at_min = isset($_REQUEST['updated_at_min']) ? $_REQUEST['updated_at_min'] : false;
     $class_name = 'WC_POS_API_' . ucfirst($entity);
     $handler = new $class_name();
     if (method_exists($handler, 'get_ids')) {
         $result = call_user_func(array($handler, 'get_ids'), $updated_at_min);
     } else {
         $result = new WP_Error('woocommerce_pos_get_ids_error', sprintf(__('There was an error calling %s::%s', 'woocommerce'), 'WC_POS_API', $entity), array('status' => 500));
     }
     WC_POS_Server::response($result);
 }