idosell 0.2.2 → 0.2.5
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/changelog.md +13 -0
- package/dist/gates.def.js +232 -133
- package/dist/gates.js +22 -0
- package/dist/index.js +3 -1
- package/dist/methods/getCpa.js +4 -0
- package/dist/methods/getCpaCampaign.js +4 -0
- package/dist/methods/getPackagesLabels.js +5 -0
- package/dist/methods/getResponsibilityEntities.js +4 -0
- package/dist/methods/getSnippets.js +4 -0
- package/dist/methods/getSnippetsCampaign.js +4 -0
- package/dist/methods/getSnippetsCookies.js +4 -0
- package/dist/methods/postSubscriptionsAddProduct.js +7 -0
- package/dist/methods/postSubscriptionsChangeDeliveryDates.js +7 -0
- package/dist/methods/postSubscriptionsChangePriceAutoUpdate.js +7 -0
- package/dist/methods/postSubscriptionsChangeStatus.js +7 -0
- package/dist/methods/postSubscriptionsDeleteProduct.js +7 -0
- package/dist/methods/postSubscriptionsEdit.js +7 -0
- package/dist/methods/postSubscriptionsEditProduct.js +7 -0
- package/dist/methods/postSubscriptionsItemsList.js +7 -0
- package/dist/methods/postSubscriptionsListViewFetchIds.js +7 -0
- package/dist/methods/postSubscriptionsListViewList.js +7 -0
- package/dist/methods/postSubscriptionsSetRebateCode.js +7 -0
- package/dist/methods/postSubscriptionsUnsetRebateCode.js +7 -0
- package/dist/methods/putProductsStrikethroughPrices.js +5 -0
- package/dist/params.js +7 -10
- package/dist/request.js +16 -4
- package/package.json +1 -1
- package/tests/getCpa.test.js +12 -0
- package/tests/getCpaCampaign.test.js +12 -0
- package/tests/getPackagesLabels.test.js +7 -0
- package/tests/getReturns.test.js +1 -1
- package/tests/putReturns.test.js +7 -0
- package/tests/searchClientsCrm.test.js +8 -8
- package/tests/searchClientsGiftcards.test.js +2 -2
- package/tests/searchClientsNewsletterEmail.test.js +4 -4
- package/tests/searchClientsNewsletterSms.test.js +6 -6
- package/tests/searchOrders.test.js +24 -24
- package/tests/searchOrdersUnfinished.test.js +12 -12
- package/tests/searchPackages.test.js +6 -6
- package/tests/searchProducts.test.js +32 -32
- package/tests/searchProductsCategoriesIdosell.test.js +2 -2
- package/tests/searchProductsDeliveryTime.test.js +6 -6
- package/tests/searchProductsParameters.test.js +6 -6
- package/tests/url.test.js +6 -0
- package/tests/getClientsCrm.test.js +0 -22
- package/tests/getClientsGiftcards.test.js +0 -7
- package/tests/getClientsNewsletterEmailSMS.test.js +0 -17
- package/tests/getClientsNewsletterEmailShops.test.js +0 -12
- package/tests/getOrdersOpinions.test.js +0 -32
- package/tests/getPackages.test.js +0 -17
- package/tests/getProductsCategoriesIdosell.test.js +0 -7
- package/tests/getProductsDeliveryTime.test.js +0 -17
- package/tests/getProductsParameters.test.js +0 -17
- package/tests/listOrders.test.js +0 -62
- package/tests/listOrdersUnfinished.test.js +0 -32
- package/tests/listProducts.test.js +0 -82
- package/tests/postResponsibilityEntities.test.js +0 -8
- package/tests/putResponsibilityEntities.test.js +0 -8
package/dist/gates.js
CHANGED
|
@@ -263,6 +263,17 @@ import getSnippets from "./methods/getSnippets.js";
|
|
|
263
263
|
import postSnippets from "./methods/postSnippets.js";
|
|
264
264
|
import putSnippets from "./methods/putSnippets.js";
|
|
265
265
|
import deleteSnippets from "./methods/deleteSnippets.js";
|
|
266
|
+
import postSubscriptionsChangeDeliveryDates from "./methods/postSubscriptionsChangeDeliveryDates.js";
|
|
267
|
+
import postSubscriptionsChangePriceAutoUpdate from "./methods/postSubscriptionsChangePriceAutoUpdate.js";
|
|
268
|
+
import postSubscriptionsChangeStatus from "./methods/postSubscriptionsChangeStatus.js";
|
|
269
|
+
import postSubscriptionsDeleteProduct from "./methods/postSubscriptionsDeleteProduct.js";
|
|
270
|
+
import postSubscriptionsEdit from "./methods/postSubscriptionsEdit.js";
|
|
271
|
+
import postSubscriptionsEditProduct from "./methods/postSubscriptionsEditProduct.js";
|
|
272
|
+
import postSubscriptionsItemsList from "./methods/postSubscriptionsItemsList.js";
|
|
273
|
+
import postSubscriptionsListViewFetchIds from "./methods/postSubscriptionsListViewFetchIds.js";
|
|
274
|
+
import postSubscriptionsListViewList from "./methods/postSubscriptionsListViewList.js";
|
|
275
|
+
import postSubscriptionsSetRebateCode from "./methods/postSubscriptionsSetRebateCode.js";
|
|
276
|
+
import postSubscriptionsUnsetRebateCode from "./methods/postSubscriptionsUnsetRebateCode.js";
|
|
266
277
|
import getSystemConfig from "./methods/getSystemConfig.js";
|
|
267
278
|
import putSystemConfig from "./methods/putSystemConfig.js";
|
|
268
279
|
import getSystemCurrencies from "./methods/getSystemCurrencies.js";
|
|
@@ -571,6 +582,17 @@ const gates = {
|
|
|
571
582
|
postSnippets,
|
|
572
583
|
putSnippets,
|
|
573
584
|
deleteSnippets,
|
|
585
|
+
postSubscriptionsChangeDeliveryDates,
|
|
586
|
+
postSubscriptionsChangePriceAutoUpdate,
|
|
587
|
+
postSubscriptionsChangeStatus,
|
|
588
|
+
postSubscriptionsDeleteProduct,
|
|
589
|
+
postSubscriptionsEdit,
|
|
590
|
+
postSubscriptionsEditProduct,
|
|
591
|
+
postSubscriptionsItemsList,
|
|
592
|
+
postSubscriptionsListViewFetchIds,
|
|
593
|
+
postSubscriptionsListViewList,
|
|
594
|
+
postSubscriptionsSetRebateCode,
|
|
595
|
+
postSubscriptionsUnsetRebateCode,
|
|
574
596
|
getSystemConfig,
|
|
575
597
|
putSystemConfig,
|
|
576
598
|
getSystemCurrencies,
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,9 @@ const DEFAULT_VERSION = 5;
|
|
|
10
10
|
* @returns {import('./gates.def.js').Gateways} Gateways Idosell connector - pick gate
|
|
11
11
|
*/
|
|
12
12
|
const idosell = (url, apiKey, version = DEFAULT_VERSION) => {
|
|
13
|
-
const
|
|
13
|
+
const auth = { url, apiKey, version, apikey: apiKey.slice(0,6) + '*'.repeat(20) };
|
|
14
|
+
Object.defineProperty(auth, 'apiKey', { enumerable: false });
|
|
15
|
+
const element = { auth, params: {}};
|
|
14
16
|
return new Proxy(element, gateProxy);
|
|
15
17
|
}
|
|
16
18
|
|
package/dist/methods/getCpa.js
CHANGED
|
@@ -2,5 +2,10 @@ import { paramsProxy } from "../params.js";
|
|
|
2
2
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/packages/labels' };
|
|
5
|
+
object.custom = {
|
|
6
|
+
order: (orderSerialNumber) => ({ eventType: "order", eventId: orderSerialNumber }),
|
|
7
|
+
rm: (rmaId) => ({ eventType: "rma", eventId: rmaId }),
|
|
8
|
+
return: (returnId) => ({ eventType: "return", eventId: returnId })
|
|
9
|
+
};
|
|
5
10
|
return new Proxy(object, paramsProxy);
|
|
6
11
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
+
import { page } from "../helpers.js";
|
|
2
3
|
|
|
3
4
|
export default (object) => {
|
|
4
5
|
object.gate = { method: 'get', node: '/responsibility/entities' };
|
|
6
|
+
object.custom = {
|
|
7
|
+
page
|
|
8
|
+
};
|
|
5
9
|
return new Proxy(object, paramsProxy);
|
|
6
10
|
}
|
|
@@ -2,5 +2,10 @@ import { paramsProxy } from "../params.js";
|
|
|
2
2
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'put', node: '/products/strikethroughPrices' };
|
|
5
|
+
object.appendable = {
|
|
6
|
+
except: [],
|
|
7
|
+
arrayNode: "products",
|
|
8
|
+
index: 0
|
|
9
|
+
}
|
|
5
10
|
return new Proxy(object, paramsProxy);
|
|
6
11
|
}
|
package/dist/params.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { sendRequest, countResults, getParams, hasNext, toString } from "./request.js";
|
|
2
2
|
|
|
3
|
-
const getAttributes = (obj) => Object.keys(obj).slice(3);
|
|
4
|
-
|
|
5
3
|
const requests = {
|
|
6
4
|
exec: sendRequest,
|
|
7
5
|
count: countResults,
|
|
8
6
|
getParams,
|
|
9
7
|
hasNext,
|
|
10
8
|
toString,
|
|
11
|
-
|
|
9
|
+
params: (object, value) => {
|
|
10
|
+
object.params = value;
|
|
11
|
+
return new Proxy(object, paramsProxy);
|
|
12
|
+
}
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export const paramsProxy = {
|
|
@@ -16,8 +17,7 @@ export const paramsProxy = {
|
|
|
16
17
|
return (...values) => {
|
|
17
18
|
if (requests[property]) {
|
|
18
19
|
return requests[property](object, values[0]);
|
|
19
|
-
}
|
|
20
|
-
else if (object.appendable && object.appendable.arrayNode !== property && !object.appendable.except.includes(property)) {
|
|
20
|
+
} else if (object.appendable && object.appendable.arrayNode !== property && !object.appendable.except.includes(property)) {
|
|
21
21
|
if (!object.params[object.appendable.arrayNode]) object.params[object.appendable.arrayNode] = [{}];
|
|
22
22
|
const item = object.params[object.appendable.arrayNode][object.appendable.index];
|
|
23
23
|
if (property === 'append') {
|
|
@@ -29,15 +29,12 @@ export const paramsProxy = {
|
|
|
29
29
|
} else {
|
|
30
30
|
item[property] = values[0];
|
|
31
31
|
}
|
|
32
|
-
}
|
|
33
|
-
else if (object.custom && typeof object.custom[property] === 'function') {
|
|
32
|
+
} else if (object.custom && typeof object.custom[property] === 'function') {
|
|
34
33
|
if (property === 'page') values.push(Boolean(object.snakeCase));
|
|
35
34
|
const param = object.custom[property](...values);
|
|
36
35
|
Object.assign(object.params, param);
|
|
37
36
|
}
|
|
38
|
-
else
|
|
39
|
-
object.params = values[0];
|
|
40
|
-
} else object.params[property] = values[0];
|
|
37
|
+
else object.params[property] = values[0];
|
|
41
38
|
return new Proxy(object, paramsProxy);
|
|
42
39
|
}
|
|
43
40
|
}
|
package/dist/request.js
CHANGED
|
@@ -12,16 +12,27 @@ const catchIdosellError = (err) => {
|
|
|
12
12
|
for (const [ search, replace ] of DECODE_TABLE) {
|
|
13
13
|
message = message.replaceAll(search, replace);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
if (err.response.status === 403) {
|
|
16
|
+
const match = message.match(/Scope: ([a-z]+), level: ([rw]{1,2})/)
|
|
17
|
+
if (match) {
|
|
18
|
+
const access = match[2] === 'rw' ? 'Odczyt i zapis' : 'Odczyt';
|
|
19
|
+
const mod = match[1].toUpperCase();
|
|
20
|
+
message = `Brak dostępu do modułu ${mod} (${access})`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
throw new Error(`${err.response.status}: ${message}`, { cause: err.response.status })
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
const checkNext = (request, response) => {
|
|
26
|
+
const checkNext = (request, response, logPage) => {
|
|
27
|
+
if (!response) return;
|
|
19
28
|
if (response.resultsNumberPage) {
|
|
20
29
|
request.next = response.resultsPage + 1 < response.resultsNumberPage;
|
|
21
30
|
request.params.resultsPage = request.params.resultsPage ? request.params.resultsPage + 1 : 1;
|
|
31
|
+
if (logPage) logger.gray('Page: ' + response.resultsPage + ' / ' + response.resultsNumberPage)
|
|
22
32
|
} else if (response.results_number_page) {
|
|
23
33
|
request.next = response.results_page + 1 < response.results_number_page;
|
|
24
34
|
request.params.results_page = request.params.results_page ? request.params.results_page + 1 : 1;
|
|
35
|
+
if (logPage) logger.gray('Page: ' + response.results_page + ' / ' + response.results_page)
|
|
25
36
|
}
|
|
26
37
|
return response;
|
|
27
38
|
}
|
|
@@ -63,17 +74,18 @@ export const sendRequest = async (request, options = {}) => {
|
|
|
63
74
|
const { method, node } = request.gate;
|
|
64
75
|
let url = `${request.auth.url}/api/admin/v${request.auth.version}${node}`;
|
|
65
76
|
if (options.log || options.dump) {
|
|
77
|
+
console.log(util.inspect({ params: request.params, method, url }, {showHidden: false, depth: null, colors: true}))
|
|
66
78
|
if (options.dump) return;
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
if (method === 'get' || method === 'delete') {
|
|
70
82
|
url += '?' + queryfy(request.params);
|
|
71
83
|
const response = await axios[method](url, { headers }).then(response => response.data).catch(catchIdosellError);
|
|
72
|
-
return checkNext(request, response);
|
|
84
|
+
return checkNext(request, response, options.logPage);
|
|
73
85
|
} else {
|
|
74
86
|
const params = request.rootparams ? request.params : { params: request.params };
|
|
75
87
|
const response = await axios[method](url, params, { headers }).then(response => response.data).catch(catchIdosellError);
|
|
76
|
-
return checkNext(request, response);
|
|
88
|
+
return checkNext(request, response, options.logPage);
|
|
77
89
|
}
|
|
78
90
|
}
|
|
79
91
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import idosell from "./dist/index.js"
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
|
+
|
|
4
|
+
test("getCpaId", () => {
|
|
5
|
+
const params = idosell().getCpa.id(2).getParams();
|
|
6
|
+
expect(params).toEqual({"id":2});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("getCpaPage", () => {
|
|
10
|
+
const params = idosell().getCpa.page(1,2).getParams();
|
|
11
|
+
expect(params).toEqual({"resultsPage":1,"resultsLimit":2});
|
|
12
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import idosell from "./dist/index.js"
|
|
2
|
+
import { expect, test } from "vitest"
|
|
3
|
+
|
|
4
|
+
test("getCpaCampaignId", () => {
|
|
5
|
+
const params = idosell().getCpaCampaign.campaign(2).getParams();
|
|
6
|
+
expect(params).toEqual({"campaign":2});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("getCpaCampaignPage", () => {
|
|
10
|
+
const params = idosell().getCpaCampaign.page(1,2).getParams();
|
|
11
|
+
expect(params).toEqual({"resultsPage":1,"resultsLimit":2});
|
|
12
|
+
})
|
package/tests/getReturns.test.js
CHANGED
|
@@ -18,7 +18,7 @@ test("getReturnsStatus", () => {
|
|
|
18
18
|
|
|
19
19
|
test("getReturnsDates", () => {
|
|
20
20
|
const params = idosell().getReturns.dates("2023-12-01", "2023-12-10", "date_add").getParams();
|
|
21
|
-
expect(params).toEqual({"range":{"date
|
|
21
|
+
expect(params).toEqual({"range":{"date][date_begin": "2023-12-01","date][date_end": "2023-12-10","date][dates_type": "date_add",}});
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
test("getReturnsPage", () => {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test("
|
|
5
|
-
const params = idosell().
|
|
4
|
+
test("searchClientsCrmClientLogin", () => {
|
|
5
|
+
const params = idosell().searchClientsCrm.clientLogin("abcdefg").getParams();
|
|
6
6
|
expect(params).toEqual({"clientLogin":"abcdefg"});
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
test("
|
|
10
|
-
const params = idosell().
|
|
9
|
+
test("searchClientsCrmClientIsWholesaler", () => {
|
|
10
|
+
const params = idosell().searchClientsCrm.clientIsWholesaler("yes").getParams();
|
|
11
11
|
expect(params).toEqual({"clientIsWholesaler":"yes"});
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
test("
|
|
15
|
-
const params = idosell().
|
|
14
|
+
test("searchClientsCrmRegistered", () => {
|
|
15
|
+
const params = idosell().searchClientsCrm.registered("2023-01-01", 1672704000000).getParams();
|
|
16
16
|
expect(params).toEqual({"clientRegistrationDate":{"clientRegistrationDateBegin":"2023-01-01","clientRegistrationDateEnd":"2023-01-03"}});
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
test("
|
|
20
|
-
const params = idosell().
|
|
19
|
+
test("searchClientsCrmPage", () => {
|
|
20
|
+
const params = idosell().searchClientsCrm.page(2,10).getParams();
|
|
21
21
|
expect(params).toEqual({"resultsPage":2,"resultsLimit":10});
|
|
22
22
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test("
|
|
5
|
-
const params = idosell().
|
|
4
|
+
test("searchClientsGiftcardsNumber", () => {
|
|
5
|
+
const params = idosell().searchClientsGiftcards.number([123,456,789]).getParams();
|
|
6
6
|
expect(params).toEqual({"giftCards":[{"number":123},{"number":456},{"number":789}]});
|
|
7
7
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test("
|
|
5
|
-
const params = idosell().
|
|
4
|
+
test("searchClientsNewsletterEmailLanguage", () => {
|
|
5
|
+
const params = idosell().searchClientsNewsletterEmail.language("pol").getParams();
|
|
6
6
|
expect(params).toEqual({"language":"pol"});
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
test("
|
|
10
|
-
const params = idosell().
|
|
9
|
+
test("searchClientsNewsletterEmailPage", () => {
|
|
10
|
+
const params = idosell().searchClientsNewsletterEmail.page(2,10).getParams();
|
|
11
11
|
expect(params).toEqual({"results_page":2,"results_limit":10});
|
|
12
12
|
})
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test("
|
|
5
|
-
const params = idosell().
|
|
4
|
+
test("searchClientsNewsletterSmsPage", () => {
|
|
5
|
+
const params = idosell().searchClientsNewsletterSms.page(2,10).getParams();
|
|
6
6
|
expect(params).toEqual({"results_page":2,"results_limit":10});
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
test("
|
|
10
|
-
const params = idosell().
|
|
9
|
+
test("searchClientsNewsletterSmsLanguage", () => {
|
|
10
|
+
const params = idosell().searchClientsNewsletterSms.language("pol").getParams();
|
|
11
11
|
expect(params).toEqual({"language":"pol"});
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
test("
|
|
15
|
-
const params = idosell().
|
|
14
|
+
test("searchClientsNewsletterSmsDates", () => {
|
|
15
|
+
const params = idosell().searchClientsNewsletterSms.dates("2023-01-01", 1672704000000).getParams();
|
|
16
16
|
expect(params).toEqual({"date":{"from":"2023-01-01","to":"2023-01-03"}});
|
|
17
17
|
})
|
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test("
|
|
5
|
-
const params = idosell().
|
|
4
|
+
test("searchOrdersOrdersStatuses", () => {
|
|
5
|
+
const params = idosell().searchOrders.ordersStatuses(["packed"]).getParams();
|
|
6
6
|
expect(params).toEqual({"ordersStatuses":["packed"]});
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
test("
|
|
10
|
-
const params = idosell().
|
|
9
|
+
test("searchOrdersOrderType", () => {
|
|
10
|
+
const params = idosell().searchOrders.orderType("wholesale").getParams();
|
|
11
11
|
expect(params).toEqual({"orderType":"wholesale"});
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
test("
|
|
15
|
-
const params = idosell().
|
|
14
|
+
test("searchOrdersOrderBy", () => {
|
|
15
|
+
const params = idosell().searchOrders.orderBy("sn", false).getParams();
|
|
16
16
|
expect(params).toEqual({"ordersBy":[{"elementName":"sn","sortDirection":"ASC"}]});
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
test("
|
|
20
|
-
const params = idosell().
|
|
19
|
+
test("searchOrdersLogins", () => {
|
|
20
|
+
const params = idosell().searchOrders.logins(["iai_demo"]).getParams();
|
|
21
21
|
expect(params).toEqual({"clients":[{"type":"login","clientLogin":"iai_demo"}]});
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
test("
|
|
25
|
-
const params = idosell().
|
|
24
|
+
test("searchOrdersPage", () => {
|
|
25
|
+
const params = idosell().searchOrders.page(2,10).getParams();
|
|
26
26
|
expect(params).toEqual({"resultsPage":2,"resultsLimit":10});
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
test("
|
|
30
|
-
const params = idosell().
|
|
29
|
+
test("searchOrdersStockIds", () => {
|
|
30
|
+
const params = idosell().searchOrders.stockIds(2).getParams();
|
|
31
31
|
expect(params).toEqual({"stocks":[{"stockId":2}]});
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
test("
|
|
35
|
-
const params = idosell().
|
|
34
|
+
test("searchOrdersHasProductAnySize", () => {
|
|
35
|
+
const params = idosell().searchOrders.hasProduct(13).getParams();
|
|
36
36
|
expect(params).toEqual({"products":[{"productId":13}]});
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
test("
|
|
40
|
-
const params = idosell().
|
|
39
|
+
test("searchOrdersHasProductWithSize", () => {
|
|
40
|
+
const params = idosell().searchOrders.hasProduct(13,4).getParams();
|
|
41
41
|
expect(params).toEqual({"products":[{"productId":13,"sizeId":4}]});
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
test("
|
|
45
|
-
const params = idosell().
|
|
44
|
+
test("searchOrdersByPackageNumbers", () => {
|
|
45
|
+
const params = idosell().searchOrders.byPackageNumbers([5003724016]).getParams();
|
|
46
46
|
expect(params).toEqual({"packages":{"orderHasPackageNumbers":"y","packagesNumbers":[5003724016]}});
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
-
test("
|
|
50
|
-
const params = idosell().
|
|
49
|
+
test("searchOrdersHasPackage", () => {
|
|
50
|
+
const params = idosell().searchOrders.hasPackage().getParams();
|
|
51
51
|
expect(params).toEqual({"packages":{"orderHasPackageNumbers":"y"}});
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
test("
|
|
55
|
-
const params = idosell().
|
|
54
|
+
test("searchOrdersShopIds", () => {
|
|
55
|
+
const params = idosell().searchOrders.shopIds([3]).getParams();
|
|
56
56
|
expect(params).toEqual({"orderSource":{"shopsIds":[3]}});
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
test("
|
|
60
|
-
const params = idosell().
|
|
59
|
+
test("searchOrdersFromAllegro", () => {
|
|
60
|
+
const params = idosell().searchOrders.fromAllegro().getParams();
|
|
61
61
|
expect(params).toEqual({"orderSource":{"auctionsParams":{"auctionsServicesNames":["allegro"]}}});
|
|
62
62
|
})
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import idosell from "./dist/index.js"
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
|
-
test("
|
|
5
|
-
const params = idosell().
|
|
4
|
+
test("searchOrdersUnfinishedOrdersStatuses", () => {
|
|
5
|
+
const params = idosell().searchOrdersUnfinished.ordersStatuses(["packed"]).getParams();
|
|
6
6
|
expect(params).toEqual({"ordersStatuses":["packed"]});
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
test("
|
|
10
|
-
const params = idosell().
|
|
9
|
+
test("searchOrdersUnfinishedOrderType", () => {
|
|
10
|
+
const params = idosell().searchOrdersUnfinished.orderType("wholesale").getParams();
|
|
11
11
|
expect(params).toEqual({"orderType":"wholesale"});
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
test("
|
|
15
|
-
const params = idosell().
|
|
14
|
+
test("searchOrdersUnfinishedOrderBy", () => {
|
|
15
|
+
const params = idosell().searchOrdersUnfinished.orderBy("sn", false).getParams();
|
|
16
16
|
expect(params).toEqual({"ordersBy":[{"elementName":"sn","sortDirection":"ASC"}]});
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
test("
|
|
20
|
-
const params = idosell().
|
|
19
|
+
test("searchOrdersUnfinishedLogins", () => {
|
|
20
|
+
const params = idosell().searchOrdersUnfinished.logins(["iai_demo"]).getParams();
|
|
21
21
|
expect(params).toEqual({"clients":[{"type":"login","clientLogin":"iai_demo"}]});
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
test("
|
|
25
|
-
const params = idosell().
|
|
24
|
+
test("searchOrdersUnfinishedPage", () => {
|
|
25
|
+
const params = idosell().searchOrdersUnfinished.page(2,10).getParams();
|
|
26
26
|
expect(params).toEqual({"resultsPage":2,"resultsLimit":10});
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
test("
|
|
30
|
-
const params = idosell().
|
|
29
|
+
test("searchOrdersUnfinishedStockIds", () => {
|
|
30
|
+
const params = idosell().searchOrdersUnfinished.stockIds(2).getParams();
|
|
31
31
|
expect(params).toEqual({"stocks":[{"stockId":2}]});
|
|
32
32
|
})
|