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 / Controllers / Square / SquareDisconnectController.php

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

36 lines 949 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Controllers\Square;
4
5 use IvyForms\Common\Sanitizer\Sanitizer;
6 use IvyForms\Controllers\Controller;
7 use IvyForms\Services\Payment\SquareOAuthService;
8 use IvyForms\Services\Translations\BackendStrings;
9 use WP_REST_Request;
10 use WP_REST_Response;
11
12 class SquareDisconnectController extends Controller
13 {
14 private SquareOAuthService $squareOAuthService;
15
16 public function __construct(SquareOAuthService $squareOAuthService)
17 {
18 $this->squareOAuthService = $squareOAuthService;
19 }
20
21 public function handle(WP_REST_Request $data): WP_REST_Response
22 {
23 Sanitizer::verifyNonce($data->get_header('X-WP-Nonce'));
24
25 $this->squareOAuthService->disconnect();
26
27 return new WP_REST_Response(
28 [
29 'message' => BackendStrings::getPaymentStrings()['square_disconnected'],
30 'data' => ['connected' => false],
31 ],
32 200
33 );
34 }
35 }
36