PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.8.8
ووسلام – همگام سازی ووکامرس و باسلام v1.8.8
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 / Config / Endpoints.php

Endpoints.php in ووسلام – همگام سازی ووکامرس و باسلام 1.8.8, at includes/Config/Endpoints.php

139 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Config;
4
5 defined('ABSPATH') || exit;
6
7 final class Endpoints
8 {
9 // Base hosts
10 const OPENAPI_BASE = 'https://openapi.basalam.com';
11 const ORDER_BASE = 'https://order-processing.basalam.com';
12 const CORE_BASE = 'https://core.basalam.com';
13 const UPLOAD_BASE = 'https://uploadio.basalam.com';
14 const CATEGORY_BASE = 'https://categorydetection.basalam.com';
15 const APPS_BASE = 'https://apps-api.basalam.com';
16 const HAMSALAM_BASE = 'https://api.hamsalam.ir/api/v1';
17 const BASALAM_ACCOUNTS = 'https://basalam.com/accounts/sso';
18
19 // Products
20
21 /** GET all categories */
22 const CATEGORIES = self::OPENAPI_BASE . '/v1/categories';
23
24 /** GET category attributes — sprintf($url, $categoryId) */
25 const CATEGORY_ATTRIBUTES = self::OPENAPI_BASE . '/v1/categories/%d/attributes?exclude_multi_selects=true';
26
27 /** POST create product for a vendor — sprintf($url, $vendorId) */
28 const PRODUCT_CREATE = self::OPENAPI_BASE . '/v1/vendors/%d/products';
29
30 /** PATCH update an existing product — sprintf($url, $basalamProductId) */
31 const PRODUCT_UPDATE = self::OPENAPI_BASE . '/v1/products/%d';
32
33 /** POST batch-update products for a vendor */
34 const PRODUCT_BATCH_UPDATE = self::OPENAPI_BASE . '/v1/vendors/%d/products/batch-updates?continue_on_error=true';
35
36 /** GET vendor information — sprintf($url, $vendorId) */
37 const VENDOR_INFO = self::OPENAPI_BASE . '/v1/vendors/%d';
38
39 /** GET category-detection prediction — append encoded title as query param */
40 const CATEGORY_DETECT = self::CATEGORY_BASE . '/category_detection/api_v1.0/predict/';
41
42 /** POST / PUT file upload */
43 const FILE_UPLOAD = self::UPLOAD_BASE . '/v3/files';
44
45 /** GET product data list */
46 const PRODUCTS_DATA = self::CORE_BASE . '/v4/products';
47
48 /** GET commission percentage */
49 const COMMISSION = self::CORE_BASE . '/api_v2/commission/get_percent';
50
51 /** GET/POST/PATCH/DELETE webhooks */
52 const WEBHOOKS = self::OPENAPI_BASE . '/v1/webhooks';
53
54 /** GET vendor parcels (orders) */
55 const VENDOR_PARCELS = self::OPENAPI_BASE . '/v1/vendor-parcels';
56
57 // Orders
58
59 /** POST confirm order (set preparation) */
60 const ORDER_CONFIRM = self::ORDER_BASE . '/v1/vendor/set-preparation-order';
61
62 /** POST cancel order */
63 const ORDER_CANCEL = self::ORDER_BASE . '/v1/vendor/set-cancel';
64
65 /** GET/POST cancel request for a specific order — sprintf($url, $orderId) */
66 const ORDER_CANCEL_REQUEST = self::ORDER_BASE . '/v1/vendor/order/%d/cancel-request';
67
68 /** POST delay / overdue agreement request */
69 const ORDER_DELAY = self::ORDER_BASE . '/v1/vendor/orders/%d/new-agreement';
70
71 /** POST set order as shipped (with tracking code) */
72 const ORDER_TRACKING = self::ORDER_BASE . '/v2/vendor/set-posted-order';
73
74 /** GET/POST auto-confirm automation config */
75 const ORDER_AUTO_CONFIRM_CONFIG = self::ORDER_BASE . '/v1/vendor/automation-config';
76
77 /** GET/PATCH specific order — sprintf($url, $vendorId, $invoiceId) */
78 const ORDER_DETAIL = self::ORDER_BASE . '/v2/vendors/%d/orders/%d';
79
80 // Discounts
81
82 /** GET/POST vendor discounts — sprintf($url, $vendorId) */
83 const VENDOR_DISCOUNTS = self::OPENAPI_BASE . '/v1/vendors/%d/discounts';
84
85 // Hamsalam
86
87 /** GET OAuth proxy data */
88 const HAMSALAM_OAUTH_DATA = self::HAMSALAM_BASE . '/basalam-proxy/wp-oauth-data';
89
90 /** POST OAuth get-token proxy */
91 const HAMSALAM_OAUTH_TOKEN = self::HAMSALAM_BASE . '/basalam-proxy/wp-get-token';
92
93 /** GET plugin version detail */
94 const HAMSALAM_VERSION_DETAIL = self::HAMSALAM_BASE . '/wp-sites/version-detail';
95
96 /** GET announcements */
97 const HAMSALAM_ANNOUNCEMENTS = self::HAMSALAM_BASE . '/announcements';
98
99 /** GET/POST all-businesses */
100 const HAMSALAM_BUSINESSES = self::HAMSALAM_BASE . '/all-businesses';
101
102 /** GET Hamsalam auth token */
103 const HAMSALAM_AUTH_TOKEN = self::HAMSALAM_BASE . '/auth/basalam/get-token';
104
105 // Tickets (Hamsalam)
106
107 /** GET/POST ticket list */
108 const TICKET_LIST = self::HAMSALAM_BASE . '/tickets';
109
110 /** GET ticket subjects */
111 const TICKET_SUBJECTS = self::HAMSALAM_BASE . '/tickets/subjects';
112
113 /** GET single ticket — sprintf($url, $ticketId) */
114 const TICKET_DETAIL = self::HAMSALAM_BASE . '/tickets/%d';
115
116 /** POST ticket reply items — sprintf($url, $ticketId) */
117 const TICKET_ITEMS = self::HAMSALAM_BASE . '/tickets/%d/ticket-items';
118
119 /** POST upload ticket media */
120 const TICKET_MEDIA_UPLOAD = self::HAMSALAM_BASE . '/media?type=ticket_item&collection=IMAGE';
121
122 // App Store
123
124 /** POST app review */
125 const APP_REVIEW = self::APPS_BASE . '/v1/apps/13/reviews';
126
127 // Helpers
128
129 /** Build the SSO login URL */
130 public static function oauthLoginUrl(string $clientId, string $scopes, string $redirectUri, string $siteUrl): string
131 {
132 return self::BASALAM_ACCOUNTS
133 . '?client_id=' . $clientId
134 . '&scope=' . $scopes
135 . '&redirect_uri=' . $redirectUri
136 . '&state=' . $siteUrl;
137 }
138 }
139