/**
  * AJAX payload
  */
 public function payload()
 {
     WC_POS_Server::check_ajax_referer();
     $this->params = new WC_POS_Params();
     $payload = array('templates' => $this->templates_payload(), 'settings' => $this->settings, 'params' => $this->params->payload(), 'i18n' => WC_POS_i18n::payload());
     WC_POS_Server::response($payload);
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     // this should only be init after woocommerce_init
     global $wp_actions;
     if (!isset($wp_actions['woocommerce_init'])) {
         return;
     }
     // common params
     $this->accounting = $this->accounting();
     $this->ajaxurl = admin_url('admin-ajax.php', 'relative');
     $this->customers = $this->customers();
     $this->i18n = WC_POS_i18n::translations();
     $this->nonce = wp_create_nonce(WC_POS_PLUGIN_NAME);
     $this->wc_api = get_woocommerce_api_url('');
     $this->emulateHTTP = get_option('woocommerce_pos_emulateHTTP') === '1';
     // frontend params
     if (!is_admin()) {
         $this->auto_print = wc_pos_get_option('checkout', 'auto_print_receipt');
         $this->denominations = WC_POS_i18n::currency_denominations();
         $this->discount_keys = wc_pos_get_option('general', 'discount_quick_keys');
         $this->hotkeys = wc_pos_get_option('hotkeys', 'hotkeys');
         $this->shipping = $this->shipping_labels();
         $this->tabs = $this->product_tabs();
         $this->tax = $this->tax();
         $this->tax_classes = WC_POS_Tax::tax_classes();
         $this->tax_rates = WC_POS_Tax::tax_rates();
         $this->user = $this->user();
     }
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     // this should only be init after woocommerce_init
     global $wp_actions;
     if (!isset($wp_actions['woocommerce_init'])) {
         return;
     }
     // common params
     $this->accounting = $this->accounting();
     $this->ajaxurl = admin_url('admin-ajax.php', 'relative');
     $this->customers = $this->customers();
     $this->debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG;
     $this->nonce = wp_create_nonce(WC_POS_PLUGIN_NAME);
     $this->wc_api = get_woocommerce_api_url('');
     $this->emulateHTTP = get_option('woocommerce_pos_emulateHTTP') === '1';
     $this->idbVersion = WC_POS_Settings::get_idb_version();
     // frontend params
     if (is_pos()) {
         $this->auto_print = wc_pos_get_option('checkout', 'auto_print_receipt');
         $this->denominations = WC_POS_i18n::currency_denominations();
         $this->discount_keys = wc_pos_get_option('general', 'discount_quick_keys');
         $this->hotkeys = wc_pos_get_option('hotkeys', 'hotkeys');
         $this->menu = $this->menu();
         $this->shipping = $this->shipping_labels();
         $this->store = array('name' => get_bloginfo('name'));
         $this->tabs = $this->product_tabs();
         $this->tax = $this->tax();
         $this->tax_classes = WC_POS_Tax::tax_classes();
         $this->tax_rates = WC_POS_Tax::tax_rates();
         $this->user = $this->user();
     }
     // admin params
     if (is_admin()) {
         $this->search_customers_nonce = wp_create_nonce('search-customers');
     }
 }