idosell 0.1.3 → 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 +12 -0
- package/dist/helpers.js +6 -0
- 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/package.json +27 -27
- package/readme.md +2 -2
- 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
|
|
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',
|
|
@@ -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/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)
|
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
|
})
|