Skip to content

Commit 2cd8207

Browse files
author
Leonid Vakulenko
committed
Shop-Script v.11.6.0
1 parent a8ad71c commit 2cd8207

File tree

108 files changed

+4317
-735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+4317
-735
lines changed

api/swagger/v1.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5437,6 +5437,34 @@ paths:
54375437
400:
54385438
description: Некорректное содержимое запроса.
54395439

5440+
/shop.settings.enableHeadless:
5441+
post:
5442+
summary: Включает Headless API на указанной витрине магазина
5443+
security:
5444+
- ApiKeyAuth: []
5445+
externalDocs:
5446+
description: shop.settings.enableHeadless
5447+
url: https://developers.webasyst.ru/api/explorer/shop/shop.settings.enableHeadless/
5448+
parameters:
5449+
- $ref: '#/components/parameters/requestFormat'
5450+
requestBody:
5451+
required: true
5452+
content:
5453+
application/x-www-form-urlencoded:
5454+
schema:
5455+
type: object
5456+
required:
5457+
- storefront_url
5458+
properties:
5459+
storefront_url:
5460+
type: string
5461+
description: URL витрины, как указан в shop.settings.get storefronts[].url
5462+
responses:
5463+
200:
5464+
description: Успешное выполнение запроса.
5465+
400:
5466+
description: Некорректное содержимое запроса.
5467+
54405468
#STOCK
54415469
/shop.stock.getInfo:
54425470
get:

api/v1/shop.ai.gpt.method.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function execute()
1717
$this->executeProduct();
1818
break;
1919
default:
20-
throw new waAPIException('entity_required', 'entity is unknown or missing', 400);
20+
throw new waAPIException('entity_required', sprintf_wp('Incorrect or empty “%s” parameter value.', 'entity'), 400);
2121
break;
2222
}
2323
}
@@ -40,7 +40,7 @@ protected function executeProduct()
4040
$product = new shopProduct($product_id);
4141
$description_request->loadFieldValuesFromProduct($product);
4242
} catch (waException $e) {
43-
throw new waAPIException('product_not_found', 'Bad product_id', 400);
43+
throw new waAPIException('product_not_found', sprintf_wp('Incorrect value of the “%s” parameter.', 'product_id'), 400);
4444
}
4545
}
4646

@@ -104,7 +104,7 @@ protected function executeProduct()
104104
break;
105105

106106
default:
107-
throw new waAPIException('field_required', 'field is unknown or missing', 400);
107+
throw new waAPIException('field_required', sprintf_wp('Incorrect or empty “%s” parameter value.', 'field'), 400);
108108
break;
109109
}
110110
}

api/v1/shop.category.add.method.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function execute()
2020
$category_model = new shopCategoryModel();
2121
$parent_id = waRequest::post('parent_id', 0, 'int');
2222
if ($parent_id && !$category_model->getById($parent_id)) {
23-
throw new waAPIException('invalid_request', 'Parent category not found', 404);
23+
throw new waAPIException('invalid_request', _w('Parent category not found.'), 404);
2424
}
2525
if (!isset($data['url']) || $data['url'] === '') {
2626
$data['url'] = shopHelper::transliterate($data['name']);

api/v1/shop.category.update.method.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function execute()
1919
}
2020
if (isset($data['parent_id']) && $category['parent_id'] != $data['parent_id']) {
2121
if (!$category_model->getById($data['parent_id'])) {
22-
throw new waAPIException('invalid_param', 'Parent category not found', 404);
22+
throw new waAPIException('invalid_param', _w('Parent category not found.'), 404);
2323
}
2424
if (!$category_model->move($id, null, $data['parent_id'])) {
2525
throw new waAPIException('server_error', 500);

api/v1/shop.coupon.getList.method.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public function execute()
2323
protected function validateRequest($offset, $limit, $search, $active_only)
2424
{
2525
if ($offset < 0) {
26-
throw new waAPIException('invalid_param', 'Param offset must be greater than or equal to zero');
26+
throw new waAPIException('invalid_param', _w('An “offset” parameter value must be greater than or equal to zero.'));
2727
}
2828
if ($limit < 0) {
29-
throw new waAPIException('invalid_param', 'Param limit must be greater than or equal to zero');
29+
throw new waAPIException('invalid_param', _w('A “limit” parameter value must be greater than or equal to zero.'));
3030
}
3131
}
3232

api/v1/shop.customer.search.method.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ protected function validateRequest()
7878
$offset = waRequest::request('offset', 0, 'int');
7979

8080
if ($offset < 0) {
81-
throw new waAPIException('invalid_param', 'Param offset must be greater than or equal to zero');
81+
throw new waAPIException('invalid_param', _w('An “offset” parameter value must be greater than or equal to zero.'));
8282
}
8383
$limit = waRequest::request('limit', 100, 'int');
8484
if ($limit < 0) {
85-
throw new waAPIException('invalid_param', 'Param limit must be greater than or equal to zero');
85+
throw new waAPIException('invalid_param', _w('A “limit” parameter value must be greater than or equal to zero.'));
8686
}
8787
}
8888

api/v1/shop.dashboard.customers.method.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public function execute()
88
{
99
$period = waRequest::get('period', 30*24*3600, 'int');
1010
if ($period <= 0) {
11-
throw new waAPIException('invalid_request', 'period must be a positive integer', 400);
11+
throw new waAPIException('invalid_request', sprintf_wp('The “%s” parameter value must be a positive integer.', 'period'), 400);
1212
}
1313
list($graph_data, $total) = self::getGraphData($period);
1414
$this->response = array(

api/v1/shop.dashboard.realtime.method.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public function execute()
1010

1111
$period = waRequest::get('period', $max_time, waRequest::TYPE_INT);
1212
if ($period <= 0) {
13-
throw new waAPIException('invalid_request', 'period must be a positive integer', 400);
13+
throw new waAPIException('invalid_request', sprintf_wp('The “%s” parameter value must be a positive integer.', 'period'), 400);
1414
} elseif ($period > $max_time) {
15-
throw new waAPIException('invalid_request', 'period cannot be more than 48 hours', 400);
15+
throw new waAPIException('invalid_request', _w('The “period” parameter value cannot be greater than 48 hours.'), 400);
1616
}
1717

1818
list($graph_data, $totals) = self::getGraphData($period);

api/v1/shop.dashboard.sales.method.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public function execute()
88
{
99
$period = waRequest::get('period', 30*24*3600, 'int');
1010
if ($period <= 0) {
11-
throw new waAPIException('invalid_request', 'period must be a positive integer', 400);
11+
throw new waAPIException('invalid_request', sprintf_wp('The “%s” parameter value must be a positive integer.', 'period'), 400);
1212
}
1313
list($graph_data, $totals) = self::getGraphData($period);
1414
$this->response = array(

api/v1/shop.feature.add.method.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function execute()
1515
$this->post('name', true);
1616
$feature_model = new shopFeatureModel();
1717
if ($feature_model->getByCode($code)) {
18-
throw new waAPIException('invalid_param', 'Code '.$code.' already exists');
18+
throw new waAPIException('invalid_param', sprintf_wp('Code %s already exists.', $code));
1919
}
2020

2121
$types = array(
@@ -27,7 +27,7 @@ public function execute()
2727
);
2828

2929
if (!in_array($type, $types)) {
30-
throw new waAPIException('invalid_param', 'Invalid type: '.$type);
30+
throw new waAPIException('invalid_param', sprintf_wp('Invalid type: %s.', $type));
3131
}
3232

3333
$data = waRequest::post();

0 commit comments

Comments
 (0)