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

142 lines 5.2 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 full category tree with max preparation days (core v3) */
52 const CATEGORIES_PREPARATION = self::CORE_BASE . '/v3/categories';
53
54 /** GET/POST/PATCH/DELETE webhooks */
55 const WEBHOOKS = self::OPENAPI_BASE . '/v1/webhooks';
56
57 /** GET vendor parcels (orders) */
58 const VENDOR_PARCELS = self::OPENAPI_BASE . '/v1/vendor-parcels';
59
60 // Orders
61
62 /** POST confirm order (set preparation) */
63 const ORDER_CONFIRM = self::ORDER_BASE . '/v1/vendor/set-preparation-order';
64
65 /** POST cancel order */
66 const ORDER_CANCEL = self::ORDER_BASE . '/v1/vendor/set-cancel';
67
68 /** GET/POST cancel request for a specific order — sprintf($url, $orderId) */
69 const ORDER_CANCEL_REQUEST = self::ORDER_BASE . '/v1/vendor/order/%d/cancel-request';
70
71 /** POST delay / overdue agreement request */
72 const ORDER_DELAY = self::ORDER_BASE . '/v1/vendor/orders/%d/new-agreement';
73
74 /** POST set order as shipped (with tracking code) */
75 const ORDER_TRACKING = self::ORDER_BASE . '/v2/vendor/set-posted-order';
76
77 /** GET/POST auto-confirm automation config */
78 const ORDER_AUTO_CONFIRM_CONFIG = self::ORDER_BASE . '/v1/vendor/automation-config';
79
80 /** GET/PATCH specific order — sprintf($url, $vendorId, $invoiceId) */
81 const ORDER_DETAIL = self::ORDER_BASE . '/v2/vendors/%d/orders/%d';
82
83 // Discounts
84
85 /** GET/POST vendor discounts — sprintf($url, $vendorId) */
86 const VENDOR_DISCOUNTS = self::OPENAPI_BASE . '/v1/vendors/%d/discounts';
87
88 // Hamsalam
89
90 /** GET OAuth proxy data */
91 const HAMSALAM_OAUTH_DATA = self::HAMSALAM_BASE . '/basalam-proxy/wp-oauth-data';
92
93 /** POST OAuth get-token proxy */
94 const HAMSALAM_OAUTH_TOKEN = self::HAMSALAM_BASE . '/basalam-proxy/wp-get-token';
95
96 /** GET plugin version detail */
97 const HAMSALAM_VERSION_DETAIL = self::HAMSALAM_BASE . '/wp-sites/version-detail';
98
99 /** GET announcements */
100 const HAMSALAM_ANNOUNCEMENTS = self::HAMSALAM_BASE . '/announcements';
101
102 /** GET/POST all-businesses */
103 const HAMSALAM_BUSINESSES = self::HAMSALAM_BASE . '/all-businesses';
104
105 /** GET Hamsalam auth token */
106 const HAMSALAM_AUTH_TOKEN = self::HAMSALAM_BASE . '/auth/basalam/get-token';
107
108 // Tickets (Hamsalam)
109
110 /** GET/POST ticket list */
111 const TICKET_LIST = self::HAMSALAM_BASE . '/tickets';
112
113 /** GET ticket subjects */
114 const TICKET_SUBJECTS = self::HAMSALAM_BASE . '/tickets/subjects';
115
116 /** GET single ticket — sprintf($url, $ticketId) */
117 const TICKET_DETAIL = self::HAMSALAM_BASE . '/tickets/%d';
118
119 /** POST ticket reply items — sprintf($url, $ticketId) */
120 const TICKET_ITEMS = self::HAMSALAM_BASE . '/tickets/%d/ticket-items';
121
122 /** POST upload ticket media */
123 const TICKET_MEDIA_UPLOAD = self::HAMSALAM_BASE . '/media?type=ticket_item&collection=IMAGE';
124
125 // App Store
126
127 /** POST app review */
128 const APP_REVIEW = self::APPS_BASE . '/v1/apps/13/reviews';
129
130 // Helpers
131
132 /** Build the SSO login URL */
133 public static function oauthLoginUrl(string $clientId, string $scopes, string $redirectUri, string $siteUrl): string
134 {
135 return self::BASALAM_ACCOUNTS
136 . '?client_id=' . $clientId
137 . '&scope=' . $scopes
138 . '&redirect_uri=' . $redirectUri
139 . '&state=' . $siteUrl;
140 }
141 }
142