Overview
  • Namespace
  • Class

Namespaces

  • None
  • WC_POS
    • Admin
      • Settings
        • Receipt
    • API
    • Gateways
    • Integrations
    • Products

Classes

  • WC_POS\Activator
  • WC_POS\Admin
  • WC_POS\Admin\Gateways
  • WC_POS\Admin\Menu
  • WC_POS\Admin\Notices
  • WC_POS\Admin\Orders
  • WC_POS\Admin\Page
  • WC_POS\Admin\Permalink
  • WC_POS\Admin\Plugins
  • WC_POS\Admin\Products
  • WC_POS\Admin\Settings
  • WC_POS\Admin\Settings\Access
  • WC_POS\Admin\Settings\Checkout
  • WC_POS\Admin\Settings\Customers
  • WC_POS\Admin\Settings\Gateways
  • WC_POS\Admin\Settings\General
  • WC_POS\Admin\Settings\HotKeys
  • WC_POS\Admin\Settings\Page
  • WC_POS\Admin\Settings\Receipt\Options
  • WC_POS\Admin\Settings\Receipt\Template
  • WC_POS\Admin\Settings\Receipts
  • WC_POS\Admin\Settings\Status
  • WC_POS\Admin\Settings\Tools
  • WC_POS\Admin\Status
  • WC_POS\Ajax
  • WC_POS\API
  • WC_POS\API\Coupons
  • WC_POS\API\Customers
  • WC_POS\API\Gateways
  • WC_POS\API\i18n
  • WC_POS\API\Orders
  • WC_POS\API\Params
  • WC_POS\API\Payload
  • WC_POS\API\Products
  • WC_POS\API\Settings
  • WC_POS\API\Support
  • WC_POS\API\Templates
  • WC_POS\Customers
  • WC_POS\Deactivator
  • WC_POS\Gateways
  • WC_POS\Gateways\Card
  • WC_POS\Gateways\Cash
  • WC_POS\i18n
  • WC_POS\Integrations\Bookings
  • WC_POS\Products
  • WC_POS\Products\Visibility
  • WC_POS\Setup
  • WC_POS\Status
  • WC_POS\Tax
  • WC_POS\Template

Functions

  • is_pos
  • is_pos_admin
  • wc_pos_get_option
  • wc_pos_json_encode
  • wc_pos_locate_template
  • wc_pos_trim_html_string
  • wc_pos_update_option
  • wc_pos_url
 1 <?php
 2 
 3 /**
 4  * POS Payload
 5  *
 6  * @class    WC_POS_API_Payload
 7  * @package  WooCommerce POS
 8  * @author   Paul Kilmurray <paul@kilbot.com.au>
 9  * @link     http://www.woopos.com.au
10  */
11 
12 namespace WC_POS\API;
13 
14 use WC_API_Resource;
15 use WC_API_Server;
16 
17 class Payload extends WC_API_Resource {
18 
19   protected $base = '/pos';
20 
21   /**
22    * Register routes for POS Params
23    *
24    * GET /pos
25    *
26    * @param array $routes
27    * @return array
28    */
29   public function register_routes( array $routes ) {
30 
31     # GET /pos
32     $routes[ $this->base ] = array(
33       array( array( $this, 'get_payload' ), WC_API_Server::READABLE )
34     );
35 
36     return $routes;
37 
38   }
39 
40 
41   /**
42    * @param null $wc_pos_admin
43    * @return array
44    */
45   public function get_payload( $wc_pos_admin = null ) {
46     $wc_api = WC()->api;
47 
48     $payload = array(
49       'i18n'      => $wc_api->{'\WC_POS\API\i18n'}->get_translations( $wc_pos_admin ),
50       'params'    => $wc_api->{'\WC_POS\API\Params'}->get_params( $wc_pos_admin ),
51       'templates' => $wc_api->{'\WC_POS\API\Templates'}->get_templates( $wc_pos_admin ),
52     );
53 
54     if( $wc_pos_admin ){
55       $payload['params']['settings'] = $wc_api->{'\WC_POS\API\Settings'}->get_settings( '', $wc_pos_admin );
56     } else {
57       $payload['params']['gateways'] = $wc_api->{'\WC_POS\API\Gateways'}->get_gateways();
58     }
59 
60     return $payload;
61   }
62 
63 }
API documentation generated by ApiGen