idosell 0.1.2 → 0.1.4
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 +14 -11
- package/dist/helpers.js +6 -0
- package/dist/index.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/listOrders.js +4 -1
- package/dist/methods/listOrdersUnfinished.js +6 -1
- package/dist/methods/putClientsGiftcards.js +5 -0
- package/dist/methods/putProductsDescriptions.js +4 -0
- package/dist/request.js +5 -1
- package/package.json +27 -27
- package/readme.md +2 -2
- package/tests/getProductsCodeExistence.test.js +17 -0
- package/tests/getProductsReservations.test.js +17 -0
- package/tests/getProductsStocks.test.js +17 -0
- package/tests/listOrders.test.js +5 -0
- package/tests/putClientsGiftcards.test.js +13 -3
- package/tests/putProductsDescriptions.test.js +8 -3
package/dist/gates.def.js
CHANGED
|
@@ -290,6 +290,9 @@
|
|
|
290
290
|
* @property {(shops: Array<Integer>) => PutClientsGiftcardsRequest} shops List of shops the card is active in
|
|
291
291
|
* @property {(note: String) => PutClientsGiftcardsRequest} note
|
|
292
292
|
* @property {function} append Append current data to array and start modifying next row
|
|
293
|
+
* @property {(amount: Float, currency: String) => PutClientsGiftcardsRequest} add Adds balance to current gift card
|
|
294
|
+
* @property {(amount: Float, currency: String) => PutClientsGiftcardsRequest} subtract Subtract from balance to current gift card
|
|
295
|
+
* @property {(amount: Float, currency: String) => PutClientsGiftcardsRequest} set Set balance to current gift card
|
|
293
296
|
* @property {function} exec Excecute request
|
|
294
297
|
*/
|
|
295
298
|
|
|
@@ -1187,6 +1190,9 @@
|
|
|
1187
1190
|
* @property {(discountCodes: Array<String>) => ListOrdersRequest} discountCodes Define campaign by passing array of values
|
|
1188
1191
|
* @property {(productId: Integer, sizeId: String|null) => ListProductsRequest} hasProduct Filter by product ID and optionally product size
|
|
1189
1192
|
* @property {(orderHasPackage: Boolean) => ListProductsRequest} hasPackage Filter by orders that have any package number
|
|
1193
|
+
* @property {(accountName: String) => ListProductsRequest} fromAllegro Filter by orders from auction service Allegro
|
|
1194
|
+
* @property {(accountName: String) => ListProductsRequest} fromEbay Filter by orders from action service EBay
|
|
1195
|
+
* @property {(accountName: String) => ListProductsRequest} fromAmazon Filter by orders from action service Amazon
|
|
1190
1196
|
* @property {(page: Integer, limit: Integer) => ListOrdersRequest} page Define page number and maximum results per page
|
|
1191
1197
|
* @property {() => Integer} count Returns total numer of results
|
|
1192
1198
|
* @property {function} exec Excecute request
|
|
@@ -1377,6 +1383,11 @@
|
|
|
1377
1383
|
* @property {(stockIds: Array<Integer>) => ListOrdersUnfinishedRequest} stockIds Define stocks by passing array of values
|
|
1378
1384
|
* @property {(campaignIds: Array<Integer>) => ListOrdersUnfinishedRequest} campaignIds Define campaign by passing array of values
|
|
1379
1385
|
* @property {(discountCodes: Array<String>) => ListOrdersUnfinishedRequest} discountCodes Define campaign by passing array of values
|
|
1386
|
+
* @property {(productId: Integer, sizeId: String|null) => ListProductsRequest} hasProduct Filter by product ID and optionally product size
|
|
1387
|
+
* @property {(orderHasPackage: Boolean) => ListProductsRequest} hasPackage Filter by orders that have any package number
|
|
1388
|
+
* @property {(accountName: String) => ListProductsRequest} fromAllegro Filter by orders from auction service Allegro
|
|
1389
|
+
* @property {(accountName: String) => ListProductsRequest} fromEbay Filter by orders from action service EBay
|
|
1390
|
+
* @property {(accountName: String) => ListProductsRequest} fromAmazon Filter by orders from action service Amazon
|
|
1380
1391
|
* @property {(page: Integer, limit: Integer) => ListOrdersUnfinishedRequest} page Define page number and maximum results per page
|
|
1381
1392
|
* @property {() => Integer} count Returns total numer of results
|
|
1382
1393
|
* @property {function} exec Excecute request
|
|
@@ -1778,6 +1789,7 @@
|
|
|
1778
1789
|
* @property {(productDescriptionsLangData: Array<Object>) => PutProductsDescriptionsRequest} productDescriptionsLangData Array of language-dependent elements.
|
|
1779
1790
|
* @property {(productAuctionDescriptionsData: Array<Object>) => PutProductsDescriptionsRequest} productAuctionDescriptionsData Product data for auction services
|
|
1780
1791
|
* @property {function} append Append current data to array and start modifying next row
|
|
1792
|
+
* @property {(productId: Integer) => PutProductsDescriptionsRequest} productId Define identValue value nested inside productIdent
|
|
1781
1793
|
* @property {function} exec Excecute request
|
|
1782
1794
|
*/
|
|
1783
1795
|
|
|
@@ -1895,9 +1907,6 @@
|
|
|
1895
1907
|
/**
|
|
1896
1908
|
* @typedef {Object} GetProductsMarketingZonesRequest
|
|
1897
1909
|
* @property {(products: Array<Object>) => GetProductsMarketingZonesRequest} products Products list.
|
|
1898
|
-
* @property {(ids: Array<Integer>) => GetProductsMarketingZonesRequest} ids Define products by passing array of values
|
|
1899
|
-
* @property {(externalCodes: Array<String>) => GetProductsMarketingZonesRequest} externalCodes Define products by passing array of values
|
|
1900
|
-
* @property {(producerCodes: Array<String>) => GetProductsMarketingZonesRequest} producerCodes Define products by passing array of values
|
|
1901
1910
|
* @property {function} exec Excecute request
|
|
1902
1911
|
*/
|
|
1903
1912
|
|
|
@@ -1918,9 +1927,6 @@
|
|
|
1918
1927
|
/**
|
|
1919
1928
|
* @typedef {Object} GetProductsOmnibusPricesRequest
|
|
1920
1929
|
* @property {(products: Array<Object>) => GetProductsOmnibusPricesRequest} products Products list.
|
|
1921
|
-
* @property {(ids: Array<[object Object]>) => GetProductsOmnibusPricesRequest} ids Define products by passing array of values
|
|
1922
|
-
* @property {(externalCodes: Array<String>) => GetProductsOmnibusPricesRequest} externalCodes Define products by passing array of values
|
|
1923
|
-
* @property {(producerCodes: Array<String>) => GetProductsOmnibusPricesRequest} producerCodes Define products by passing array of values
|
|
1924
1930
|
* @property {function} exec Excecute request
|
|
1925
1931
|
*/
|
|
1926
1932
|
|
|
@@ -2419,7 +2425,7 @@
|
|
|
2419
2425
|
/**
|
|
2420
2426
|
* @typedef {Object} GetProductsReservationsRequest
|
|
2421
2427
|
* @property {(productsIdents: Array<Object>) => GetProductsReservationsRequest} productsIdents Products list.
|
|
2422
|
-
* @property {(ids: Array<
|
|
2428
|
+
* @property {(ids: Array<Integer>) => GetProductsReservationsRequest} ids Define productsIdents by passing array of values
|
|
2423
2429
|
* @property {(externalCodes: Array<String>) => GetProductsReservationsRequest} externalCodes Define productsIdents by passing array of values
|
|
2424
2430
|
* @property {(producerCodes: Array<String>) => GetProductsReservationsRequest} producerCodes Define productsIdents by passing array of values
|
|
2425
2431
|
* @property {function} exec Excecute request
|
|
@@ -2529,7 +2535,7 @@
|
|
|
2529
2535
|
/**
|
|
2530
2536
|
* @typedef {Object} GetProductsStocksRequest
|
|
2531
2537
|
* @property {(products: Array<Object>) => GetProductsStocksRequest} products Products list.
|
|
2532
|
-
* @property {(ids: Array<
|
|
2538
|
+
* @property {(ids: Array<Integer>) => GetProductsStocksRequest} ids Define products by passing array of values
|
|
2533
2539
|
* @property {(externalCodes: Array<String>) => GetProductsStocksRequest} externalCodes Define products by passing array of values
|
|
2534
2540
|
* @property {(producerCodes: Array<String>) => GetProductsStocksRequest} producerCodes Define products by passing array of values
|
|
2535
2541
|
* @property {function} exec Excecute request
|
|
@@ -2549,9 +2555,6 @@
|
|
|
2549
2555
|
/**
|
|
2550
2556
|
* @typedef {Object} GetProductsStrikethroughPricesRequest
|
|
2551
2557
|
* @property {(products: Array<Object>) => GetProductsStrikethroughPricesRequest} products Products list.
|
|
2552
|
-
* @property {(ids: Array<[object Object]>) => GetProductsStrikethroughPricesRequest} ids Define products by passing array of values
|
|
2553
|
-
* @property {(externalCodes: Array<String>) => GetProductsStrikethroughPricesRequest} externalCodes Define products by passing array of values
|
|
2554
|
-
* @property {(producerCodes: Array<String>) => GetProductsStrikethroughPricesRequest} producerCodes Define products by passing array of values
|
|
2555
2558
|
* @property {function} exec Excecute request
|
|
2556
2559
|
*/
|
|
2557
2560
|
|
package/dist/helpers.js
CHANGED
|
@@ -119,6 +119,12 @@ export const nest = (valueName, nodeName, obj = {}, forceArray = false) => (valu
|
|
|
119
119
|
return params;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
export const orderSource = (sourceName) => (accountName = null) => {
|
|
123
|
+
const params = { orderSource: { auctionsParams: { auctionsServicesNames: [ sourceName ]}}};
|
|
124
|
+
if (accountName) params.orderSource.auctionsParams.auctionsAccounts = [{auctionsAccountLogin: 'monk'}];
|
|
125
|
+
return params;
|
|
126
|
+
}
|
|
127
|
+
|
|
122
128
|
const TEXT_NODES = {
|
|
123
129
|
name: {
|
|
124
130
|
main: 'productNames',
|
package/dist/index.js
CHANGED
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import { nest, dateRangeType, orderBy, arrayOfObjects, page } from "../helpers.js";
|
|
2
|
+
import { nest, dateRangeType, orderBy, arrayOfObjects, orderSource, page } from "../helpers.js";
|
|
3
3
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'post', node: '/orders/orders/get' }
|
|
@@ -16,6 +16,9 @@ export default (object) => {
|
|
|
16
16
|
discountCodes: arrayOfObjects("campaign", "discountCodes"),
|
|
17
17
|
hasProduct: (productId, sizeId = null) => { const product = { productId }; if (sizeId) product.sizeId = sizeId; return { products: [ product ]}},
|
|
18
18
|
hasPackage: (orderHasPackage = true) => ({ packages: { orderHasPackageNumbers: orderHasPackage ? "y" : "n" }}),
|
|
19
|
+
fromAllegro: orderSource("allegro"),
|
|
20
|
+
fromEbay: orderSource("ebay"),
|
|
21
|
+
fromAmazon: orderSource("amazon"),
|
|
19
22
|
page
|
|
20
23
|
};
|
|
21
24
|
return new Proxy(object, paramsProxy);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import { nest, dateRangeType, orderBy, arrayOfObjects, page } from "../helpers.js";
|
|
2
|
+
import { nest, dateRangeType, orderBy, arrayOfObjects, orderSource, page } from "../helpers.js";
|
|
3
3
|
|
|
4
4
|
export default (object) => {
|
|
5
5
|
object.gate = { method: 'post', node: '/orders/unfinished/get' }
|
|
@@ -14,6 +14,11 @@ export default (object) => {
|
|
|
14
14
|
stockIds: arrayOfObjects("stocks", "stockId"),
|
|
15
15
|
campaignIds: arrayOfObjects("campaign", "campaignId"),
|
|
16
16
|
discountCodes: arrayOfObjects("campaign", "discountCodes"),
|
|
17
|
+
hasProduct: (productId, sizeId = null) => { const product = { productId }; if (sizeId) product.sizeId = sizeId; return { products: [ product ]}},
|
|
18
|
+
hasPackage: (orderHasPackage = true) => ({ packages: { orderHasPackageNumbers: orderHasPackage ? "y" : "n" }}),
|
|
19
|
+
fromAllegro: orderSource("allegro"),
|
|
20
|
+
fromEbay: orderSource("ebay"),
|
|
21
|
+
fromAmazon: orderSource("amazon"),
|
|
17
22
|
page
|
|
18
23
|
};
|
|
19
24
|
return new Proxy(object, paramsProxy);
|
|
@@ -2,6 +2,11 @@ import { paramsProxy } from "../params.js";
|
|
|
2
2
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'put', node: '/clients/giftcards' }
|
|
5
|
+
object.custom = {
|
|
6
|
+
add: (amount, currency = "PLN") => ({ balance: { amount, currency }, balanceOperationType: "add" }),
|
|
7
|
+
subtract: (amount, currency = "PLN") => ({ balance: { amount, currency }, balanceOperationType: "subtract" }),
|
|
8
|
+
set: (amount, currency = "PLN") => ({ balance: { amount, currency }, balanceOperationType: "set" })
|
|
9
|
+
};
|
|
5
10
|
object.appendable = {
|
|
6
11
|
except: [],
|
|
7
12
|
arrayNode: "giftCards",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
+
import { nest } from "../helpers.js";
|
|
2
3
|
|
|
3
4
|
export default (object) => {
|
|
4
5
|
object.gate = { method: 'put', node: '/products/descriptions' }
|
|
6
|
+
object.custom = {
|
|
7
|
+
productId: nest("identValue", "productIdent", {"productIdentType":"id"})
|
|
8
|
+
};
|
|
5
9
|
object.appendable = {
|
|
6
10
|
except: [],
|
|
7
11
|
arrayNode: "products",
|
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}&`;
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "idosell",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Idosell 3 REST connector",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/ltung7/idosell.git"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"idosell",
|
|
15
|
-
"rest"
|
|
16
|
-
],
|
|
17
|
-
"author": "Tung Le",
|
|
18
|
-
"license": "ISC",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/ltung7/idosell.git/issues"
|
|
21
|
-
},
|
|
22
|
-
"homepage": "https://github.com/ltung7/idosell.git",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"axios": "^1.6.2"
|
|
25
|
-
},
|
|
26
|
-
"type": "module"
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "idosell",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Idosell 3 REST connector",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/ltung7/idosell.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"idosell",
|
|
15
|
+
"rest"
|
|
16
|
+
],
|
|
17
|
+
"author": "Tung Le",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/ltung7/idosell.git/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/ltung7/idosell.git",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"axios": "^1.6.2"
|
|
25
|
+
},
|
|
26
|
+
"type": "module"
|
|
27
|
+
}
|
package/readme.md
CHANGED
|
@@ -315,6 +315,6 @@ const orderRequest = idosellRequest.getOrders.ordersSerialNumbers([123, 456, 789
|
|
|
315
315
|
// Will return Object: { ordersSerialNumbers: [ 123, 456, 789 ] }
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
##
|
|
318
|
+
## Examples
|
|
319
319
|
|
|
320
|
-
Read documentation and examples on [This page](https://idosell-converter.vercel.app/examples)
|
|
320
|
+
Read documentation from this package and more examples on [This page](https://idosell-converter.vercel.app/examples)
|
|
@@ -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
|
+
})
|
|
@@ -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
|
+
})
|
package/tests/listOrders.test.js
CHANGED
|
@@ -54,4 +54,9 @@ test("listOrdersHasPackage", () => {
|
|
|
54
54
|
test("listOrdersShopIds", () => {
|
|
55
55
|
const params = idosell().listOrders.shopIds([3]).getParams();
|
|
56
56
|
expect(params).toEqual({"orderSource":{"shopsIds":[3]}});
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test("listOrdersFromAllegro", () => {
|
|
60
|
+
const params = idosell().listOrders.fromAllegro().getParams();
|
|
61
|
+
expect(params).toEqual({"orderSource":{"auctionsParams":{"auctionsServicesNames":["allegro"]}}});
|
|
57
62
|
})
|
|
@@ -2,6 +2,16 @@ import idosell from "./dist/index.js"
|
|
|
2
2
|
import { expect, test } from "vitest"
|
|
3
3
|
|
|
4
4
|
test("putClientsGiftcardsName", () => {
|
|
5
|
-
const params = idosell().putClientsGiftcards.id(23).name("
|
|
6
|
-
expect(params).toEqual({"giftCards":[{"id":23,"name":"
|
|
7
|
-
})
|
|
5
|
+
const params = idosell().putClientsGiftcards.id(23).name("My Card").getParams();
|
|
6
|
+
expect(params).toEqual({"giftCards":[{"id":23,"name":"My Card"}]});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("putClientsGiftcardsAdd", () => {
|
|
10
|
+
const params = idosell().putClientsGiftcards.id(23).add(10, "PLN").getParams();
|
|
11
|
+
expect(params).toEqual({"giftCards":[{"id":23,"balance":{"amount":10,"currency":"PLN"},"balanceOperationType":"add"}]});
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test("putClientsGiftcardsMultiple", () => {
|
|
15
|
+
const params = idosell().putClientsGiftcards.id(23).set(100, "PLN").append().id(24).subtract(20).getParams();
|
|
16
|
+
expect(params).toEqual({"giftCards":[{"id":23,"balance":{"amount":100,"currency":"PLN"},"balanceOperationType":"set"},{"id":24,"balance":{"amount":20,"currency":"PLN"},"balanceOperationType":"subtract"}]});
|
|
17
|
+
})
|
|
@@ -1,7 +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().putProductsDescriptions.productIdent({"productIdentType":"id","identValue":"33"}).productDescriptionsLangData([{"langId":"pol","productName":"
|
|
6
|
-
expect(params).toEqual({"products":[{"productIdent":{"productIdentType":"id","identValue":"33"},"productDescriptionsLangData":[{"langId":"pol","productName":"
|
|
4
|
+
test("putProductsDescriptionsProductIdent", () => {
|
|
5
|
+
const params = idosell().putProductsDescriptions.productIdent({"productIdentType":"id","identValue":"33"}).productDescriptionsLangData([{"langId":"pol","productName":"Krzesło Pavon"}]).getParams();
|
|
6
|
+
expect(params).toEqual({"products":[{"productIdent":{"productIdentType":"id","identValue":"33"},"productDescriptionsLangData":[{"langId":"pol","productName":"Krzesło Pavon"}]}]});
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test("putProductsDescriptionsProductId", () => {
|
|
10
|
+
const params = idosell().putProductsDescriptions.productId(33).productDescriptionsLangData([{"langId": "pol","productName": "Krzesło Pavon"}]).getParams();
|
|
11
|
+
expect(params).toEqual({"products":[{"productIdent":{"productIdentType":"id","identValue":33},"productDescriptionsLangData":[{"langId":"pol","productName":"Krzesło Pavon"}]}]});
|
|
7
12
|
})
|