starta.apiclient 1.112.12590 → 1.112.12591
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/services/organizations/orders.d.ts +1 -0
- package/lib/services/organizations/orders.js +9 -0
- package/lib/services/organizations/products.d.ts +6 -5
- package/lib/services/organizations/products.js +6 -4
- package/lib/services/organizations/public.d.ts +6 -3
- package/lib/services/organizations/public.js +8 -9
- package/lib/services/organizations/warehouses.d.ts +1 -0
- package/lib/services/organizations/warehouses.js +8 -0
- package/lib/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -46,4 +46,5 @@ export default class Orders {
|
|
|
46
46
|
setConfirmation(organizationOrCustomerLogin: string, orderId: string, { isConfirmed }: {
|
|
47
47
|
isConfirmed: boolean;
|
|
48
48
|
}): Promise<import("../../types").StartaResponse>;
|
|
49
|
+
addPromocode(organizationLogin: string, orderId: string, promocode: string): Promise<import("../../types").StartaResponse>;
|
|
49
50
|
}
|
|
@@ -117,5 +117,14 @@ class Orders {
|
|
|
117
117
|
},
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
addPromocode(organizationLogin, orderId, promocode) {
|
|
121
|
+
return this._requestRunner.performRequest({
|
|
122
|
+
url: `accounts/${organizationLogin}/orders/${orderId}/promocodes`,
|
|
123
|
+
method: 'POST',
|
|
124
|
+
body: {
|
|
125
|
+
promocode,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
120
129
|
}
|
|
121
130
|
exports.default = Orders;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Product, StartaRequestRunner } from '../../types';
|
|
1
|
+
import { Product, ProductAvailability, StartaRequestRunner } from '../../types';
|
|
2
2
|
export default class Products {
|
|
3
3
|
private _requestRunner;
|
|
4
4
|
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
-
index(organizationLogin: string, { categoryId, searchQuery, withTechcard,
|
|
5
|
+
index(organizationLogin: string, { categoryId, searchQuery, withTechcard, warehouseIds, availability, }?: {
|
|
6
6
|
categoryId?: string;
|
|
7
7
|
searchQuery?: string;
|
|
8
8
|
withTechcard?: boolean;
|
|
9
|
-
|
|
9
|
+
warehouseIds?: string[];
|
|
10
|
+
availability?: ProductAvailability[];
|
|
10
11
|
}): Promise<import("../../types").StartaResponse>;
|
|
11
|
-
add(organizationLogin: string, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, }: Product): Promise<import("../../types").StartaResponse>;
|
|
12
|
-
update(organizationLogin: string, productId: string, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, }: Product): Promise<import("../../types").StartaResponse>;
|
|
12
|
+
add(organizationLogin: string, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, barcode, }: Product): Promise<import("../../types").StartaResponse>;
|
|
13
|
+
update(organizationLogin: string, productId: string, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, barcode, }: Product): Promise<import("../../types").StartaResponse>;
|
|
13
14
|
delete(organizationLogin: string, productId: string): Promise<import("../../types").StartaResponse>;
|
|
14
15
|
get(organizationLogin: string, productId: string): Promise<import("../../types").StartaResponse>;
|
|
15
16
|
}
|
|
@@ -5,13 +5,13 @@ class Products {
|
|
|
5
5
|
constructor(requestRunner) {
|
|
6
6
|
this._requestRunner = requestRunner;
|
|
7
7
|
}
|
|
8
|
-
index(organizationLogin, { categoryId, searchQuery, withTechcard,
|
|
8
|
+
index(organizationLogin, { categoryId, searchQuery, withTechcard, warehouseIds, availability, } = {}) {
|
|
9
9
|
return this._requestRunner.performRequest({
|
|
10
|
-
url: `accounts/${organizationLogin}/products${(0, _helpers_1.buildQuery)({ categoryId, searchQuery, withTechcard,
|
|
10
|
+
url: `accounts/${organizationLogin}/products${(0, _helpers_1.buildQuery)({ categoryId, searchQuery, withTechcard, warehouseIds, availability })}`,
|
|
11
11
|
method: 'GET',
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
add(organizationLogin, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, }) {
|
|
14
|
+
add(organizationLogin, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, barcode, }) {
|
|
15
15
|
return this._requestRunner.performRequest({
|
|
16
16
|
url: `accounts/${organizationLogin}/products`,
|
|
17
17
|
method: 'POST',
|
|
@@ -34,10 +34,11 @@ class Products {
|
|
|
34
34
|
publicName,
|
|
35
35
|
image,
|
|
36
36
|
description,
|
|
37
|
+
barcode,
|
|
37
38
|
},
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
update(organizationLogin, productId, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, }) {
|
|
41
|
+
update(organizationLogin, productId, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, allowSell, allowPublicBooking, publicName, image, description, barcode, }) {
|
|
41
42
|
return this._requestRunner.performRequest({
|
|
42
43
|
url: `accounts/${organizationLogin}/products/${productId}`,
|
|
43
44
|
method: 'PUT',
|
|
@@ -60,6 +61,7 @@ class Products {
|
|
|
60
61
|
publicName,
|
|
61
62
|
image,
|
|
62
63
|
description,
|
|
64
|
+
barcode,
|
|
63
65
|
},
|
|
64
66
|
});
|
|
65
67
|
}
|
|
@@ -28,9 +28,8 @@ export default class Public {
|
|
|
28
28
|
skip: number;
|
|
29
29
|
limit: number;
|
|
30
30
|
}): Promise<import("../../types").StartaResponse>;
|
|
31
|
-
addPromocode(organizationLogin: string, promocode: string): Promise<import("../../types").StartaResponse>;
|
|
32
31
|
payForOrder(organizationLogin: string, orderId: string, certificateId: string): Promise<import("../../types").StartaResponse>;
|
|
33
|
-
createOrder(organizationLogin: any, { products, starttime, scheduleId, customerInfo, customerComment,
|
|
32
|
+
createOrder(organizationLogin: any, { products, starttime, scheduleId, customerInfo, customerComment, codes, comment, }: {
|
|
34
33
|
products: Array<{
|
|
35
34
|
type: 'service' | 'product';
|
|
36
35
|
id: string;
|
|
@@ -47,10 +46,14 @@ export default class Public {
|
|
|
47
46
|
phoneConfirmationCode: string;
|
|
48
47
|
};
|
|
49
48
|
customerComment?: string;
|
|
50
|
-
|
|
49
|
+
codes?: Array<{
|
|
50
|
+
code: string;
|
|
51
|
+
type: 'certificate' | 'promocode';
|
|
52
|
+
}>;
|
|
51
53
|
comment?: string;
|
|
52
54
|
}, referer?: string | null): Promise<import("../../types").StartaResponse>;
|
|
53
55
|
getOrder(organizationOrUserLogin: string, orderId: string): Promise<import("../../types").StartaResponse>;
|
|
54
56
|
getOrderPrepaymentDetails(organizationLogin: string, orderId: string): Promise<import("../../types").StartaResponse>;
|
|
57
|
+
findBonus(organizationLogin: string, code: string): Promise<import("../../types").StartaResponse>;
|
|
55
58
|
}
|
|
56
59
|
export {};
|
|
@@ -48,13 +48,6 @@ class Public {
|
|
|
48
48
|
method: 'GET',
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
addPromocode(organizationLogin, promocode) {
|
|
52
|
-
return this._requestRunner.performRequest({
|
|
53
|
-
url: `accounts/${organizationLogin}/public/promocodes`,
|
|
54
|
-
method: 'POST',
|
|
55
|
-
body: { promocode },
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
51
|
payForOrder(organizationLogin, orderId, certificateId) {
|
|
59
52
|
return this._requestRunner.performRequest({
|
|
60
53
|
url: `accounts/${organizationLogin}/public/orders/${orderId}/pay`,
|
|
@@ -62,7 +55,7 @@ class Public {
|
|
|
62
55
|
body: { certificateId },
|
|
63
56
|
});
|
|
64
57
|
}
|
|
65
|
-
createOrder(organizationLogin, { products, starttime, scheduleId, customerInfo, customerComment,
|
|
58
|
+
createOrder(organizationLogin, { products, starttime, scheduleId, customerInfo, customerComment, codes, comment, }, referer = null) {
|
|
66
59
|
return this._requestRunner.performRequest({
|
|
67
60
|
url: `accounts/${organizationLogin}/public/orders`,
|
|
68
61
|
method: 'POST',
|
|
@@ -72,7 +65,7 @@ class Public {
|
|
|
72
65
|
scheduleId,
|
|
73
66
|
customerInfo,
|
|
74
67
|
customerComment,
|
|
75
|
-
|
|
68
|
+
codes,
|
|
76
69
|
comment,
|
|
77
70
|
},
|
|
78
71
|
config: referer
|
|
@@ -94,5 +87,11 @@ class Public {
|
|
|
94
87
|
method: 'GET',
|
|
95
88
|
});
|
|
96
89
|
}
|
|
90
|
+
findBonus(organizationLogin, code) {
|
|
91
|
+
return this._requestRunner.performRequest({
|
|
92
|
+
url: `accounts/${organizationLogin}/public/bonuses/${code}`,
|
|
93
|
+
method: 'GET',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
97
96
|
}
|
|
98
97
|
exports.default = Public;
|
|
@@ -13,4 +13,5 @@ export default class Warehouses {
|
|
|
13
13
|
type: 'forServices' | 'forSales';
|
|
14
14
|
}): Promise<import("../../types").StartaResponse>;
|
|
15
15
|
delete(organizationLogin: string, warehouseId: string): Promise<import("../../types").StartaResponse>;
|
|
16
|
+
getPriceOfGoods(organizationLogin: string, branchId?: string): Promise<import("../../types").StartaResponse>;
|
|
16
17
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _helpers_1 = require("../_helpers");
|
|
3
4
|
class Warehouses {
|
|
4
5
|
constructor(requestRunner) {
|
|
5
6
|
this._requestRunner = requestRunner;
|
|
@@ -32,5 +33,12 @@ class Warehouses {
|
|
|
32
33
|
method: 'DELETE',
|
|
33
34
|
});
|
|
34
35
|
}
|
|
36
|
+
getPriceOfGoods(organizationLogin, branchId) {
|
|
37
|
+
const queryParams = branchId ? { branchId } : {};
|
|
38
|
+
return this._requestRunner.performRequest({
|
|
39
|
+
url: `accounts/${organizationLogin}/warehouses/price-of-goods${(0, _helpers_1.buildQuery)(queryParams)}`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
35
43
|
}
|
|
36
44
|
exports.default = Warehouses;
|
package/lib/types.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ export type Product = {
|
|
|
139
139
|
publicName?: LocalizedString;
|
|
140
140
|
description?: LocalizedString;
|
|
141
141
|
image?: string;
|
|
142
|
+
barcode?: string;
|
|
142
143
|
};
|
|
143
144
|
export type ProductOperation = {
|
|
144
145
|
organizationLogin: string;
|
|
@@ -276,6 +277,7 @@ export type TechcardSteps = Array<{
|
|
|
276
277
|
comment: string;
|
|
277
278
|
}>;
|
|
278
279
|
}>;
|
|
280
|
+
export type ProductAvailability = 'inStock' | 'outOfStock' | 'lowStock';
|
|
279
281
|
export type OrderData = {
|
|
280
282
|
products: Array<OrderItem>;
|
|
281
283
|
usedMaterials?: OrderUsedMaterials;
|