PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / trunk
WCPOS – Point of Sale (POS) plugin for WooCommerce vtrunk
1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 1.9.13 1.9.12 1.9.11 1.9.10 All 159 releases
woocommerce-pos / includes / API / V2 / Order_Email_Controller.php

Order_Email_Controller.php in WCPOS – Point of Sale (POS) plugin for WooCommerce trunk, at includes/API/V2/Order_Email_Controller.php

56 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WCPOS REST API v2 service pass-through.
4 *
5 * @package WCPOS\WooCommercePOS\API\V2
6 */
7
8 namespace WCPOS\WooCommercePOS\API\V2;
9
10 use WP_REST_Server;
11
12 /**
13 * The email ACTION promotes; the data routes stay frozen at v1.
14 */
15 class Order_Email_Controller extends \WCPOS\WooCommercePOS\API\V1\Orders_Controller {
16 /**
17 * Endpoint namespace.
18 *
19 * @var string
20 */
21 protected $namespace = 'wcpos/v2';
22
23 /**
24 * Register the order-email action only.
25 */
26 public function register_routes(): void {
27 register_rest_route(
28 $this->namespace,
29 '/' . $this->rest_base . '/(?P<order_id>[\d]+)/email',
30 array(
31 array(
32 'methods' => WP_REST_Server::CREATABLE,
33 'callback' => array( $this, 'wcpos_send_email' ),
34 'permission_callback' => array( $this, 'wcpos_send_email_permissions_check' ),
35 'args' => array_merge(
36 $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
37 array(
38 'email' => array(
39 'type' => 'string',
40 'description' => /* translators: REST API schema field label or error message. */ __( 'Email address', 'woocommerce-pos' ),
41 'required' => true,
42 ),
43 'save_to' => array(
44 'type' => 'string',
45 'description' => __( 'Save email to order', 'woocommerce-pos' ),
46 'required' => false,
47 ),
48 )
49 ),
50 ),
51 'schema' => array( $this, 'wcpos_get_public_send_email_schema' ),
52 )
53 );
54 }
55 }
56