PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Routes / Square / Square.php

Square.php in The Innovative Form Builder – IvyForms 1.5, at backend/src/Routes/Square/Square.php

81 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Routes\Square;
4
5 use IvyForms\Controllers\Square\SquareAuthTokenController;
6 use IvyForms\Controllers\Square\SquareAuthUrlController;
7 use IvyForms\Controllers\Square\SquareDisconnectController;
8 use IvyForms\Controllers\Square\SquareLocationsController;
9 use IvyForms\Controllers\Square\SquareWebhookController;
10 use IvyForms\Vendor\DI\Container;
11 use WP_REST_Server;
12
13 /**
14 * Square payment integration REST routes (OAuth pattern matches MailChimp).
15 */
16 class Square
17 {
18 public static function registerRoutes(Container $container, string $namespace): void
19 {
20 register_rest_route(
21 $namespace,
22 '/integration/square/connect',
23 [
24 'methods' => WP_REST_Server::CREATABLE,
25 'callback' => $container->get(SquareAuthUrlController::class),
26 'permission_callback' => static function () {
27 return current_user_can('manage_options');
28 },
29 ]
30 );
31
32 register_rest_route(
33 $namespace,
34 '/integration/square/authorization/token',
35 [
36 'methods' => WP_REST_Server::CREATABLE,
37 'callback' => $container->get(SquareAuthTokenController::class),
38 'permission_callback' => static function () {
39 return true;
40 },
41 ]
42 );
43
44 register_rest_route(
45 $namespace,
46 '/integration/square/disconnect',
47 [
48 'methods' => WP_REST_Server::CREATABLE,
49 'callback' => $container->get(SquareDisconnectController::class),
50 'permission_callback' => static function () {
51 return current_user_can('manage_options');
52 },
53 ]
54 );
55
56 register_rest_route(
57 $namespace,
58 '/integration/square/webhook',
59 [
60 'methods' => WP_REST_Server::CREATABLE,
61 'callback' => $container->get(SquareWebhookController::class),
62 'permission_callback' => static function () {
63 return true;
64 },
65 ]
66 );
67
68 register_rest_route(
69 $namespace,
70 '/integration/square/locations',
71 [
72 'methods' => WP_REST_Server::READABLE,
73 'callback' => $container->get(SquareLocationsController::class),
74 'permission_callback' => static function () {
75 return current_user_can('manage_options');
76 },
77 ]
78 );
79 }
80 }
81