idosell 0.1.0 → 0.1.3
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/dist/gates.def.js +7 -13
- package/dist/gates.js +1 -1
- package/dist/index.js +1 -1
- package/dist/methods/getClients.js +1 -1
- package/dist/methods/getClientsBalance.js +1 -1
- package/dist/methods/getProductsMarketingZones.js +0 -6
- package/dist/methods/getProductsOmnibusPrices.js +0 -6
- package/dist/methods/getProductsReservations.js +3 -3
- package/dist/methods/getProductsStocks.js +3 -3
- package/dist/methods/getProductsStrikethroughPrices.js +0 -6
- package/dist/methods/listOrdersUnfinished.js +4 -1
- package/dist/request.js +5 -3
- package/package.json +1 -1
- package/readme.md +13 -7
- package/tests/getClientsBalance.test.js +5 -5
- package/tests/getProductsCodeExistence.test.js +17 -0
- package/tests/getProductsReservations.test.js +17 -0
- package/tests/getProductsSizes.test.js +6 -1
- package/tests/getProductsStocks.test.js +17 -0
- package/tests/putProducts.test.js +5 -0
- package/tests/rootparams.test.js +11 -11
- package/tests/url.test.js +1 -1
package/dist/gates.def.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @property {(return_elements: Array<String>) => GetClientsBalanceRequest} return_elements Elements to be returned by the endpoint. By default all elements are returned
|
|
9
9
|
* @property {(results_page: Integer) => GetClientsBalanceRequest} results_page Results page number. Numbering begins at 0. Default value: 0.
|
|
10
10
|
* @property {(results_limit: Integer) => GetClientsBalanceRequest} results_limit Maximum number of results on a single page. Default is 100.
|
|
11
|
-
* @property {(dateFrom: DateLike, dateTo: DateLike) => GetClientsBalanceRequest}
|
|
11
|
+
* @property {(dateFrom: DateLike, dateTo: DateLike) => GetClientsBalanceRequest} lastPurchased Type of date according to the index results
|
|
12
12
|
* @property {(page: Integer, limit: Integer) => GetClientsBalanceRequest} page Define page number and maximum results per page
|
|
13
13
|
* @property {() => Integer} count Returns total numer of results
|
|
14
14
|
* @property {function} exec Excecute request
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* @property {(returnElements: Array<String>) => GetClientsRequest} returnElements Elements to be returned by the endpoint. By default all elements are returned
|
|
40
40
|
* @property {(resultsPage: Integer) => GetClientsRequest} resultsPage Page with results number. Numeration starts from 0
|
|
41
41
|
* @property {(resultsLimit: Integer) => GetClientsRequest} resultsLimit Number of results on page. Value from 1 to 100
|
|
42
|
-
* @property {(dateFrom: DateLike, dateTo: DateLike) => GetClientsRequest}
|
|
42
|
+
* @property {(dateFrom: DateLike, dateTo: DateLike) => GetClientsRequest} lastPurchased Type of date according to the index results
|
|
43
43
|
* @property {(dateFrom: DateLike, dateTo: DateLike) => GetClientsRequest} lastModified Type of date according to the index results
|
|
44
44
|
* @property {(page: Integer, limit: Integer) => GetClientsRequest} page Define page number and maximum results per page
|
|
45
45
|
* @property {() => Integer} count Returns total numer of results
|
|
@@ -1367,6 +1367,9 @@
|
|
|
1367
1367
|
* @property {(ordersBy: Array<Object>) => ListOrdersUnfinishedRequest} ordersBy Possibility of sorting returned list
|
|
1368
1368
|
* @property {(searchingOperatorTypeMatch: 'no_assignment'|'no_empty'|'empty') => ListOrdersUnfinishedRequest} searchingOperatorTypeMatch Method of searching orders by handler.
|
|
1369
1369
|
* @property {(ordersDelayed: 'y'|'n') => ListOrdersUnfinishedRequest} ordersDelayed Orders with the exceeded date of shipment.
|
|
1370
|
+
* @property {(shopIds: Array<Integer>) => ListOrdersUnfinishedRequest} shopIds Define shopsIds value nested inside orderSource
|
|
1371
|
+
* @property {(byPackageNumbers: Array<String>) => ListOrdersUnfinishedRequest} byPackageNumbers Define packagesNumbers value nested inside packages
|
|
1372
|
+
* @property {(dateFrom: DateLike, dateTo: DateLike, dateType: "add"|"modified"|"dispatch"|"payment"|"last_payments_operation"|"declared_payments") => ListOrdersUnfinishedRequest} dates Type of date according to the index results. Possible type values: add, modified, dispatch, payment, last_payments_operation, declared_payments
|
|
1370
1373
|
* @property {(elementName: "id"|"sn"|"order_time"|"status"|"order_source"|"order_cost"|"discount_code"|"ready_to_send_date", descending: Boolean) => ListOrdersUnfinishedRequest} orderBy Define sorting by element and direction
|
|
1371
1374
|
* @property {(logins: Array<String>) => ListOrdersUnfinishedRequest} logins Define clients by passing array of values
|
|
1372
1375
|
* @property {(clientIds: Array<String>) => ListOrdersUnfinishedRequest} clientIds Define clients by passing array of values
|
|
@@ -1892,9 +1895,6 @@
|
|
|
1892
1895
|
/**
|
|
1893
1896
|
* @typedef {Object} GetProductsMarketingZonesRequest
|
|
1894
1897
|
* @property {(products: Array<Object>) => GetProductsMarketingZonesRequest} products Products list.
|
|
1895
|
-
* @property {(ids: Array<Integer>) => GetProductsMarketingZonesRequest} ids Define products by passing array of values
|
|
1896
|
-
* @property {(externalCodes: Array<String>) => GetProductsMarketingZonesRequest} externalCodes Define products by passing array of values
|
|
1897
|
-
* @property {(producerCodes: Array<String>) => GetProductsMarketingZonesRequest} producerCodes Define products by passing array of values
|
|
1898
1898
|
* @property {function} exec Excecute request
|
|
1899
1899
|
*/
|
|
1900
1900
|
|
|
@@ -1915,9 +1915,6 @@
|
|
|
1915
1915
|
/**
|
|
1916
1916
|
* @typedef {Object} GetProductsOmnibusPricesRequest
|
|
1917
1917
|
* @property {(products: Array<Object>) => GetProductsOmnibusPricesRequest} products Products list.
|
|
1918
|
-
* @property {(ids: Array<[object Object]>) => GetProductsOmnibusPricesRequest} ids Define products by passing array of values
|
|
1919
|
-
* @property {(externalCodes: Array<String>) => GetProductsOmnibusPricesRequest} externalCodes Define products by passing array of values
|
|
1920
|
-
* @property {(producerCodes: Array<String>) => GetProductsOmnibusPricesRequest} producerCodes Define products by passing array of values
|
|
1921
1918
|
* @property {function} exec Excecute request
|
|
1922
1919
|
*/
|
|
1923
1920
|
|
|
@@ -2416,7 +2413,7 @@
|
|
|
2416
2413
|
/**
|
|
2417
2414
|
* @typedef {Object} GetProductsReservationsRequest
|
|
2418
2415
|
* @property {(productsIdents: Array<Object>) => GetProductsReservationsRequest} productsIdents Products list.
|
|
2419
|
-
* @property {(ids: Array<
|
|
2416
|
+
* @property {(ids: Array<Integer>) => GetProductsReservationsRequest} ids Define productsIdents by passing array of values
|
|
2420
2417
|
* @property {(externalCodes: Array<String>) => GetProductsReservationsRequest} externalCodes Define productsIdents by passing array of values
|
|
2421
2418
|
* @property {(producerCodes: Array<String>) => GetProductsReservationsRequest} producerCodes Define productsIdents by passing array of values
|
|
2422
2419
|
* @property {function} exec Excecute request
|
|
@@ -2526,7 +2523,7 @@
|
|
|
2526
2523
|
/**
|
|
2527
2524
|
* @typedef {Object} GetProductsStocksRequest
|
|
2528
2525
|
* @property {(products: Array<Object>) => GetProductsStocksRequest} products Products list.
|
|
2529
|
-
* @property {(ids: Array<
|
|
2526
|
+
* @property {(ids: Array<Integer>) => GetProductsStocksRequest} ids Define products by passing array of values
|
|
2530
2527
|
* @property {(externalCodes: Array<String>) => GetProductsStocksRequest} externalCodes Define products by passing array of values
|
|
2531
2528
|
* @property {(producerCodes: Array<String>) => GetProductsStocksRequest} producerCodes Define products by passing array of values
|
|
2532
2529
|
* @property {function} exec Excecute request
|
|
@@ -2546,9 +2543,6 @@
|
|
|
2546
2543
|
/**
|
|
2547
2544
|
* @typedef {Object} GetProductsStrikethroughPricesRequest
|
|
2548
2545
|
* @property {(products: Array<Object>) => GetProductsStrikethroughPricesRequest} products Products list.
|
|
2549
|
-
* @property {(ids: Array<[object Object]>) => GetProductsStrikethroughPricesRequest} ids Define products by passing array of values
|
|
2550
|
-
* @property {(externalCodes: Array<String>) => GetProductsStrikethroughPricesRequest} externalCodes Define products by passing array of values
|
|
2551
|
-
* @property {(producerCodes: Array<String>) => GetProductsStrikethroughPricesRequest} producerCodes Define products by passing array of values
|
|
2552
2546
|
* @property {function} exec Excecute request
|
|
2553
2547
|
*/
|
|
2554
2548
|
|
package/dist/gates.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dateRange, page } from "../helpers.js";
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'get', node: '/clients/clients' }
|
|
6
6
|
object.custom = {
|
|
7
|
-
|
|
7
|
+
lastPurchased: dateRange({"nodeName":"clientLastPurchaseDate","fromName":"clientLastPurchaseDateBegin","toName":"clientLastPurchaseDateEnd"}),
|
|
8
8
|
lastModified: dateRange({"nodeName":"clientsLastModificationDate","fromName":"clientsLastModificationDateBegin","toName":"clientsLastModificationDateEnd"}),
|
|
9
9
|
page
|
|
10
10
|
};
|
|
@@ -4,7 +4,7 @@ import { dateRange, page } from "../helpers.js";
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'get', node: '/clients/balance' }
|
|
6
6
|
object.custom = {
|
|
7
|
-
|
|
7
|
+
lastPurchased: dateRange({"nodeName":"last_purchase_date","fromName":"from","toName":"to"}),
|
|
8
8
|
page
|
|
9
9
|
};
|
|
10
10
|
object.snakeCase = true;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import { arrayOfObjects } from "../helpers.js";
|
|
3
2
|
|
|
4
3
|
export default (object) => {
|
|
5
4
|
object.gate = { method: 'get', node: '/products/marketingZones' }
|
|
6
|
-
object.custom = {
|
|
7
|
-
ids: arrayOfObjects("products", "value", {"type":"id"}),
|
|
8
|
-
externalCodes: arrayOfObjects("products", "value", {"type":"codeExtern"}),
|
|
9
|
-
producerCodes: arrayOfObjects("products", "value", {"type":"codeProducer"})
|
|
10
|
-
};
|
|
11
5
|
return new Proxy(object, paramsProxy);
|
|
12
6
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import { arrayOfObjects } from "../helpers.js";
|
|
3
2
|
|
|
4
3
|
export default (object) => {
|
|
5
4
|
object.gate = { method: 'get', node: '/products/omnibusPrices' }
|
|
6
|
-
object.custom = {
|
|
7
|
-
ids: arrayOfObjects("products", "value"),
|
|
8
|
-
externalCodes: arrayOfObjects("products", "value", {"type":"codeExtern"}),
|
|
9
|
-
producerCodes: arrayOfObjects("products", "value", {"type":"codeProducer"})
|
|
10
|
-
};
|
|
11
5
|
return new Proxy(object, paramsProxy);
|
|
12
6
|
}
|
|
@@ -4,9 +4,9 @@ import { arrayOfObjects } from "../helpers.js";
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'get', node: '/products/reservations' }
|
|
6
6
|
object.custom = {
|
|
7
|
-
ids: arrayOfObjects("productsIdents", "
|
|
8
|
-
externalCodes: arrayOfObjects("productsIdents", "
|
|
9
|
-
producerCodes: arrayOfObjects("productsIdents", "
|
|
7
|
+
ids: arrayOfObjects("productsIdents", "identValue", {"identType":"id"}),
|
|
8
|
+
externalCodes: arrayOfObjects("productsIdents", "identValue", {"identType":"codeExtern"}),
|
|
9
|
+
producerCodes: arrayOfObjects("productsIdents", "identValue", {"identType":"codeProducer"})
|
|
10
10
|
};
|
|
11
11
|
return new Proxy(object, paramsProxy);
|
|
12
12
|
}
|
|
@@ -4,9 +4,9 @@ import { arrayOfObjects } from "../helpers.js";
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'get', node: '/products/stocks' }
|
|
6
6
|
object.custom = {
|
|
7
|
-
ids: arrayOfObjects("products", "
|
|
8
|
-
externalCodes: arrayOfObjects("products", "
|
|
9
|
-
producerCodes: arrayOfObjects("products", "
|
|
7
|
+
ids: arrayOfObjects("products", "identValue", {"identType":"id"}),
|
|
8
|
+
externalCodes: arrayOfObjects("products", "identValue", {"identType":"codeExtern"}),
|
|
9
|
+
producerCodes: arrayOfObjects("products", "identValue", {"identType":"codeProducer"})
|
|
10
10
|
};
|
|
11
11
|
return new Proxy(object, paramsProxy);
|
|
12
12
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import { arrayOfObjects } from "../helpers.js";
|
|
3
2
|
|
|
4
3
|
export default (object) => {
|
|
5
4
|
object.gate = { method: 'get', node: '/products/strikethroughPrices' }
|
|
6
|
-
object.custom = {
|
|
7
|
-
ids: arrayOfObjects("products", "value"),
|
|
8
|
-
externalCodes: arrayOfObjects("products", "value", {"type":"codeExtern"}),
|
|
9
|
-
producerCodes: arrayOfObjects("products", "value", {"type":"codeProducer"})
|
|
10
|
-
};
|
|
11
5
|
return new Proxy(object, paramsProxy);
|
|
12
6
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import { orderBy, arrayOfObjects, page } from "../helpers.js";
|
|
2
|
+
import { nest, dateRangeType, orderBy, arrayOfObjects, page } from "../helpers.js";
|
|
3
3
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'post', node: '/orders/unfinished/get' }
|
|
6
6
|
object.custom = {
|
|
7
|
+
shopIds: nest("shopsIds", "orderSource", {}, true),
|
|
8
|
+
byPackageNumbers: nest("packagesNumbers", "packages", {"orderHasPackageNumbers":"y"}, true),
|
|
9
|
+
dates: dateRangeType({"nodeName":"ordersDateRange","fromName":"ordersDateBegin","toName":"ordersDateEnd","typeName":"ordersDateType","format":"YYYY-MM-DD HH:mm:ss","nested":"ordersRange","defaultType":"add"}),
|
|
7
10
|
orderBy,
|
|
8
11
|
logins: arrayOfObjects("clients", "clientLogin", {"type":"login"}),
|
|
9
12
|
clientIds: arrayOfObjects("clients", "clientId", {"type":"id"}),
|
package/dist/request.js
CHANGED
|
@@ -31,7 +31,11 @@ export const queryfy = (params) => {
|
|
|
31
31
|
let output = '';
|
|
32
32
|
for (const [ key, value ] of Object.entries(params)) {
|
|
33
33
|
if (Array.isArray(value)) {
|
|
34
|
-
|
|
34
|
+
if (typeof value[0] === 'object') {
|
|
35
|
+
const newValue = value.map(obj => encodeURIComponent(JSON.stringify(obj)));
|
|
36
|
+
output += `${key}=${newValue.join('%2C')}&`;
|
|
37
|
+
}
|
|
38
|
+
else output += `${key}=${value.join('%2C')}&`;
|
|
35
39
|
} else if (typeof value === 'object') {
|
|
36
40
|
for (const [ subkey, subvalue ] of Object.entries(value)) {
|
|
37
41
|
output += `${key}%5B${subkey}%5D=${subvalue}&`;
|
|
@@ -58,9 +62,7 @@ export const sendRequest = async (request, options = {}) => {
|
|
|
58
62
|
if (options.dump) return;
|
|
59
63
|
|
|
60
64
|
if (method === 'get') {
|
|
61
|
-
// url += '?' + qs.stringify(request.params, { arrayFormat: 'comma' });
|
|
62
65
|
url += '?' + queryfy(request.params);
|
|
63
|
-
console.log({ url })
|
|
64
66
|
const response = await axios.get(url, { headers }).then(response => response.data).catch(catchIdosellError);
|
|
65
67
|
return checkNext(request, response);
|
|
66
68
|
} else {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -8,11 +8,13 @@ Package translates awkward gate names into more readable method names using REST
|
|
|
8
8
|
|
|
9
9
|
```javascript
|
|
10
10
|
import idosell from 'idosell';
|
|
11
|
-
const idosellRequest = idosell('SHOP_URL', 'API_KEY')
|
|
11
|
+
const idosellRequest = idosell('SHOP_URL', 'API_KEY', API_VERSION)
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
**API_KEY** can be obtained in your Idosell panel.
|
|
15
|
-
**SHOP_URL** is the base URI of your shop.
|
|
15
|
+
**SHOP_URL** is the base URI of your shop.
|
|
16
|
+
**API_VERSION** version of the API to call, current default version is **v3**
|
|
17
|
+
Here are some examples:
|
|
16
18
|
```
|
|
17
19
|
https://yourdomain.com
|
|
18
20
|
https://clientXXXX.idosell.com
|
|
@@ -48,14 +50,14 @@ idosellRequest.deleteProductsOpinions.exec() // Translates to POST on products/o
|
|
|
48
50
|
Alternatively to setting parameters in an object, you can chain several methods named after top-level parameters to set their value to your request. To execute the request after setting all the parameters, run the *exec()* method.
|
|
49
51
|
|
|
50
52
|
```javascript
|
|
51
|
-
const idosellRequest = idosell('
|
|
52
|
-
const categories = idosellRequest.ids([123, 456, 789]).languages(['pol', 'eng']).result_page(1).result_limit(10).
|
|
53
|
+
const idosellRequest = idosell('https://yourdomain.com', 'API_KEY');
|
|
54
|
+
const categories = idosellRequest.getProductsCategories.ids([123, 456, 789]).languages(['pol', 'eng']).result_page(1).result_limit(10).exec();
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
This example will generate the following GET request:
|
|
56
58
|
|
|
57
59
|
```
|
|
58
|
-
https://yourdomain.com/api/admin/
|
|
60
|
+
https://yourdomain.com/api/admin/v3/products/categories?ids=123,456,789&languages=pol,eng&result_page=1&result_limit=10
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
A POST request will generate a JSON body request.
|
|
@@ -241,7 +243,7 @@ This will translate to following request parameters:
|
|
|
241
243
|
This method is used specifically for updating and creating products and allows you to easily set multiple types of descriptions in different languages and different shops.
|
|
242
244
|
|
|
243
245
|
```javascript
|
|
244
|
-
setText(text, type, languageId, shopId)
|
|
246
|
+
idosellRequest.putProducts.setText(text, type, languageId, shopId)
|
|
245
247
|
```
|
|
246
248
|
|
|
247
249
|
| Field | Description | Default | Possible values |
|
|
@@ -311,4 +313,8 @@ You can use the *getParams()* function to retrieve request parameters as Javascr
|
|
|
311
313
|
```javascript
|
|
312
314
|
const orderRequest = idosellRequest.getOrders.ordersSerialNumbers([123, 456, 789]).getParams();
|
|
313
315
|
// Will return Object: { ordersSerialNumbers: [ 123, 456, 789 ] }
|
|
314
|
-
```
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## examples
|
|
319
|
+
|
|
320
|
+
Read documentation and examples on [This page](https://idosell-converter.vercel.app/examples)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
|
-
import { expect, test } from
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test(
|
|
5
|
-
const params = idosell().getClientsBalance.active(
|
|
4
|
+
test("getClientsBalanceActive", () => {
|
|
5
|
+
const params = idosell().getClientsBalance.active("yes").getParams();
|
|
6
6
|
expect(params).toEqual({ "active": "yes" });
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ test("getClientsBalanceClient_numbers", () => {
|
|
|
16
16
|
expect(params).toEqual({"client_numbers":[123,456,678]});
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
test("
|
|
20
|
-
const params = idosell().getClientsBalance.
|
|
19
|
+
test("getClientsBalanceLastPurchased", () => {
|
|
20
|
+
const params = idosell().getClientsBalance.lastPurchased("2023-01-01", 1672704000000).getParams();
|
|
21
21
|
expect(params).toEqual({"last_purchase_date":{"from":"2023-01-01","to":"2023-01-03"}});
|
|
22
22
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import idosell from "./dist/index.js"
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
|
+
|
|
4
|
+
test("getProductsCodeExistenceExternalCodes", () => {
|
|
5
|
+
const params = idosell().getProductsCodeExistence.externalCodes(["pav01"]).getParams();
|
|
6
|
+
expect(params).toEqual({"products":[{"productIdentType":"codeExtern","productId":"pav01"}]});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("getProductsCodeExistenceProducerCodes", () => {
|
|
10
|
+
const params = idosell().getProductsCodeExistence.producerCodes(99099099099).getParams();
|
|
11
|
+
expect(params).toEqual({"products":[{"productIdentType":"codeProducer","productId":99099099099}]});
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test("getProductsCodeExistenceIds", () => {
|
|
15
|
+
const params = idosell().getProductsCodeExistence.ids([30,33]).getParams();
|
|
16
|
+
expect(params).toEqual({"products":[{"productIdentType":"id","productId":30},{"productIdentType":"id","productId":33}]});
|
|
17
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import idosell from "./dist/index.js"
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
|
+
|
|
4
|
+
test("getProductsReservationsIds", () => {
|
|
5
|
+
const params = idosell().getProductsReservations.ids(33).getParams();
|
|
6
|
+
expect(params).toEqual({"productsIdents":[{"identType":"id","identValue":33}]});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("getProductsReservationsExternalCodes", () => {
|
|
10
|
+
const params = idosell().getProductsReservations.externalCodes(["pav01"]).getParams();
|
|
11
|
+
expect(params).toEqual({"productsIdents":[{"identType":"codeExtern","identValue":"pav01"}]});
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test("getProductsReservationsProducerCodes", () => {
|
|
15
|
+
const params = idosell().getProductsReservations.producerCodes([99099099099]).getParams();
|
|
16
|
+
expect(params).toEqual({"productsIdents":[{"identType":"codeProducer","identValue":99099099099}]});
|
|
17
|
+
})
|
|
@@ -2,6 +2,11 @@ import idosell from "./dist/index.js"
|
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
4
|
test("getProductsSizesResult::page", () => {
|
|
5
|
-
const params = idosell().getProductsSizes[
|
|
5
|
+
const params = idosell().getProductsSizes["result::page"](123).getParams();
|
|
6
6
|
expect(params).toEqual({"result::page":123});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("getProductsSizesPage", () => {
|
|
10
|
+
const params = idosell().getProductsSizes.page(0,100).getParams();
|
|
11
|
+
expect(params).toEqual({"result::page":0,"result::pageNumber":100});
|
|
7
12
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import idosell from "./dist/index.js"
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
|
+
|
|
4
|
+
test("getProductsStocksIds", () => {
|
|
5
|
+
const params = idosell().getProductsStocks.ids(33).getParams();
|
|
6
|
+
expect(params).toEqual({"products":[{"identType":"id","identValue":33}]});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("getProductsStocksExternalCodes", () => {
|
|
10
|
+
const params = idosell().getProductsStocks.externalCodes(["pav01"]).getParams();
|
|
11
|
+
expect(params).toEqual({"products":[{"identType":"codeExtern","identValue":"pav01"}]});
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test("getProductsStocksProducerCodes", () => {
|
|
15
|
+
const params = idosell().getProductsStocks.producerCodes(99099099099).getParams();
|
|
16
|
+
expect(params).toEqual({"products":[{"identType":"codeProducer","identValue":99099099099}]});
|
|
17
|
+
})
|
|
@@ -4,4 +4,9 @@ import { expect, test } from "vitest"
|
|
|
4
4
|
test("putProductsSetText", () => {
|
|
5
5
|
const params = idosell().putProducts.productId(33).setText("Krzesło Pavon", "name").getParams();
|
|
6
6
|
expect(params).toEqual({"products":[{"productId":33,"productNames":{"productNamesLangData":[{"langId":"pol","productName":"Krzesło Pavon"}]}}]});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("putProductsCountryOfOrigin", () => {
|
|
10
|
+
const params = idosell().putProducts.productId(33).countryOfOrigin("PL").getParams();
|
|
11
|
+
expect(params).toEqual({"products":[{"productId":33,"countryOfOrigin":"PL"}]});
|
|
7
12
|
})
|
package/tests/rootparams.test.js
CHANGED
|
@@ -3,18 +3,18 @@ import { expect, test } from "vitest"
|
|
|
3
3
|
|
|
4
4
|
// Only partial test
|
|
5
5
|
|
|
6
|
-
const ROOTPARAMS_NODE =
|
|
6
|
+
const ROOTPARAMS_NODE = "rootparams";
|
|
7
7
|
const routes = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
"postProductsCollectionsProducts",
|
|
9
|
+
"putProductsCollectionsProducts",
|
|
10
|
+
"putProductsCollectionsRenew",
|
|
11
|
+
"deleteProductsSizes",
|
|
12
|
+
"deleteClientsTags",
|
|
13
|
+
"deleteDiscountsRebatesCode",
|
|
14
|
+
"postDiscountsRebatesCard",
|
|
15
|
+
"putSystemCurrencies",
|
|
16
|
+
"putProductsParameters",
|
|
17
|
+
"postProductsRestore"
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
for (const route of routes) {
|
package/tests/url.test.js
CHANGED
|
@@ -7,5 +7,5 @@ import { expect, test } from "vitest"
|
|
|
7
7
|
test("putWmsSuppliersName", () => {
|
|
8
8
|
const params = idosell().getClients.clientsIds([123,456,789]).lastPurchase("2023-01-01", 1672704000000).getParams();
|
|
9
9
|
const search = queryfy(params);
|
|
10
|
-
expect(search).toEqual(
|
|
10
|
+
expect(search).toEqual("clientsIds=123%2C456%2C789&clientLastPurchaseDate%5BclientLastPurchaseDateBegin%5D=2023-01-01&clientLastPurchaseDate%5BclientLastPurchaseDateEnd%5D=2023-01-03")
|
|
11
11
|
})
|