PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.20
ووسلام – همگام سازی ووکامرس و باسلام v1.10.20
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
sync-basalam / includes / Services / Ticket / UpsertTicketSiteAccess.php

UpsertTicketSiteAccess.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.20, at includes/Services/Ticket/UpsertTicketSiteAccess.php

35 lines 908 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Services\Ticket;
4
5 use SyncBasalam\Config\Endpoints;
6 use SyncBasalam\Services\ApiServiceManager;
7
8 defined('ABSPATH') || exit;
9
10 class UpsertTicketSiteAccess
11 {
12 private $url;
13
14 public function __construct($businessId)
15 {
16 $this->url = sprintf(Endpoints::BUSINESS_SITE_ACCESS, intval($businessId));
17 }
18
19 public function execute($hamsalamToken, array $data): array
20 {
21 $apiService = syncBasalamContainer()->get(ApiServiceManager::class);
22 $headers = ['Authorization' => 'Bearer ' . $hamsalamToken];
23
24 try {
25 return $apiService->put($this->url, $data, $headers);
26 } catch (\Exception $e) {
27 return [
28 'status_code' => intval($e->getCode()) ?: 500,
29 'body' => null,
30 'error' => 'خطا در ذخیره اطلاعات دسترسی.',
31 ];
32 }
33 }
34 }
35