idosell 0.3.13 → 0.3.17
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/app.d.ts +1 -1
- package/dist/enums.d.ts +14 -4
- package/dist/enums.js +14 -4
- package/dist/gateways.d.ts +28 -15
- package/dist/helpers.js +21 -0
- package/dist/index.js +1 -1
- package/dist/methods/getOrdersAuctionDetails.js +3 -3
- package/dist/methods/getProductsAuctions.js +2 -2
- package/dist/methods/postEntries.js +1 -1
- package/dist/methods/postOrdersDocuments.js +3 -0
- package/dist/methods/putClients.js +1 -1
- package/dist/methods/putProductsOmnibusPrices.js +6 -0
- package/dist/methods/putProductsStrikethroughPrices.js +8 -1
- package/dist/methods/searchOrders.js +2 -2
- package/dist/methods/searchOrdersUnfinished.js +2 -2
- package/dist/methods/searchPackages.js +2 -1
- package/dist/methods/searchProducts.js +2 -2
- package/dist/methods/searchProductsDeliveryTime.js +1 -1
- package/dist/request.js +8 -6
- package/dist/responses.d.ts +576 -278
- package/package.json +1 -1
- package/tests/getClientsPayerAddress.test.js +2 -2
- package/tests/getClientsPricelistsProducts.test.js +2 -2
- package/tests/getCouriers.test.js +3 -2
- package/tests/getCouriersPickupPoints.test.js +4 -4
- package/tests/getMenu.test.js +4 -4
- package/tests/getMenuFilter.test.js +3 -3
- package/tests/getOrdersAuctionDetails.test.js +13 -3
- package/tests/getOrdersExportdocumentsEPP.test.js +6 -16
- package/tests/getOrdersExportdocumentsJPK.test.js +2 -2
- package/tests/getOrdersOpinionsRate.test.js +3 -3
- package/tests/getOrdersPackages.test.js +5 -5
- package/tests/getPayments.test.js +4 -9
- package/tests/getProductsAuctions.test.js +8 -2
- package/tests/getProductsBrandsFilter.test.js +4 -3
- package/tests/getProductsOpinionsRate.test.js +2 -2
- package/tests/getProductsProductsToFacebookCatalog.test.js +4 -3
- package/tests/getProductsSeriesFilter.test.js +3 -2
- package/tests/getReturns.test.js +2 -2
- package/tests/getWmsLocations.test.js +2 -2
- package/tests/getWmsStocksdocumentsDocuments.test.js +9 -9
- package/tests/getWmsStocksdocumentsProducts.test.js +2 -7
- package/tests/postEntries.test.js +5 -5
- package/tests/postOrdersDocuments.test.js +5 -0
- package/tests/postProducts.test.js +2 -2
- package/tests/putOrdersDevide.test.js +3 -3
- package/tests/putProductsOmnibusPrices.test.js +15 -0
- package/tests/putProductsStrikethroughPrices.test.js +16 -1
- package/tests/putSizes.test.js +2 -2
package/changelog.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.17] - 2025-08-02
|
|
9
|
+
### Changed
|
|
10
|
+
- Updated default version to v6
|
|
11
|
+
- Updated order status enums
|
|
12
|
+
- Modified response types to match reality instead of API specification
|
|
13
|
+
|
|
14
|
+
## [0.3.15] - 2025-07-21
|
|
15
|
+
### Fixed
|
|
16
|
+
- Added custom requirements
|
|
17
|
+
- Fixed requirements
|
|
18
|
+
- Updates tests
|
|
19
|
+
- Fixed several gates and tests
|
|
20
|
+
|
|
8
21
|
## [0.3.13] - 2025-07-19
|
|
9
22
|
### Fixed
|
|
10
23
|
- Fixed requirements
|
package/dist/app.d.ts
CHANGED
package/dist/enums.d.ts
CHANGED
|
@@ -114,6 +114,16 @@ export enum ORDER_STATUS {
|
|
|
114
114
|
WAIT_FOR_DISPATCH = 'wait_for_dispatch',
|
|
115
115
|
SUSPENDED = 'suspended',
|
|
116
116
|
FINISHED_EXT = 'finished_ext',
|
|
117
|
+
JOINED = 'joined',
|
|
118
|
+
FALSE = 'false',
|
|
119
|
+
CANCELED = 'canceled',
|
|
120
|
+
LOST = 'lost',
|
|
121
|
+
MISSING = 'missing',
|
|
122
|
+
WAIT_FOR_PACKAGING = 'wait_for_packaging',
|
|
123
|
+
WAIT_FOR_RECEIVE = 'wait_for_receive',
|
|
124
|
+
FINISHED = 'finished',
|
|
125
|
+
RETURNED = 'returned',
|
|
126
|
+
COMPLAINED = 'complained'
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
export enum STOCK_DOCUMENT_TYPE {
|
|
@@ -149,9 +159,9 @@ export enum RETURN_STATUS {
|
|
|
149
159
|
/** @description Zwrot rozpatrzony pozytywnie - Zwrot pieniędzy - wypłata zrealizowana */
|
|
150
160
|
ACCEPTED_REFUNDED = 11,
|
|
151
161
|
/** @description Zwrot anulowany przez klienta */
|
|
152
|
-
|
|
162
|
+
CANCELED_BY_CUSTOMER = 13,
|
|
153
163
|
/** @description Zwrot anulowany */
|
|
154
|
-
|
|
164
|
+
CANCELED = 14,
|
|
155
165
|
/** @description Ponowna wysyłka zamówienia */
|
|
156
166
|
RESEND = 15,
|
|
157
167
|
/** @description Zaniechanie ponownej wysyłki zamówienia */
|
|
@@ -192,9 +202,9 @@ export enum RMA_STATUS {
|
|
|
192
202
|
/** @description Reklamacja niepotwierdzona przez obsługę */
|
|
193
203
|
UNCONFIRMED = 15,
|
|
194
204
|
/** @description Reklamacja anulowana */
|
|
195
|
-
|
|
205
|
+
CANCELED = 17,
|
|
196
206
|
/** @description Reklamacja anulowana przez klienta */
|
|
197
|
-
|
|
207
|
+
CANCELED_BY_CUSTOMER = 18,
|
|
198
208
|
/** @description Reklamacja potwierdzona */
|
|
199
209
|
CONFIRMED = 19,
|
|
200
210
|
/** @description Reklamacja nieobsłużona */
|
package/dist/enums.js
CHANGED
|
@@ -115,6 +115,16 @@ var ORDER_STATUS;
|
|
|
115
115
|
ORDER_STATUS["WAIT_FOR_DISPATCH"] = "wait_for_dispatch";
|
|
116
116
|
ORDER_STATUS["SUSPENDED"] = "suspended";
|
|
117
117
|
ORDER_STATUS["FINISHED_EXT"] = "finished_ext";
|
|
118
|
+
ORDER_STATUS["JOINED"] = "joined";
|
|
119
|
+
ORDER_STATUS["FALSE"] = "false";
|
|
120
|
+
ORDER_STATUS["CANCELED"] = "canceled";
|
|
121
|
+
ORDER_STATUS["LOST"] = "lost";
|
|
122
|
+
ORDER_STATUS["MISSING"] = "missing";
|
|
123
|
+
ORDER_STATUS["WAIT_FOR_PACKAGING"] = "wait_for_packaging";
|
|
124
|
+
ORDER_STATUS["WAIT_FOR_RECEIVE"] = "wait_for_receive";
|
|
125
|
+
ORDER_STATUS["FINISHED"] = "finished";
|
|
126
|
+
ORDER_STATUS["RETURNED"] = "returned";
|
|
127
|
+
ORDER_STATUS["COMPLAINED"] = "complained";
|
|
118
128
|
})(ORDER_STATUS || (ORDER_STATUS = {}));
|
|
119
129
|
var STOCK_DOCUMENT_TYPE;
|
|
120
130
|
(function (STOCK_DOCUMENT_TYPE) {
|
|
@@ -150,9 +160,9 @@ var RETURN_STATUS;
|
|
|
150
160
|
/** @description Zwrot rozpatrzony pozytywnie - Zwrot pieniędzy - wypłata zrealizowana */
|
|
151
161
|
RETURN_STATUS[RETURN_STATUS["ACCEPTED_REFUNDED"] = 11] = "ACCEPTED_REFUNDED";
|
|
152
162
|
/** @description Zwrot anulowany przez klienta */
|
|
153
|
-
RETURN_STATUS[RETURN_STATUS["
|
|
163
|
+
RETURN_STATUS[RETURN_STATUS["CANCELED_BY_CUSTOMER"] = 13] = "CANCELED_BY_CUSTOMER";
|
|
154
164
|
/** @description Zwrot anulowany */
|
|
155
|
-
RETURN_STATUS[RETURN_STATUS["
|
|
165
|
+
RETURN_STATUS[RETURN_STATUS["CANCELED"] = 14] = "CANCELED";
|
|
156
166
|
/** @description Ponowna wysyłka zamówienia */
|
|
157
167
|
RETURN_STATUS[RETURN_STATUS["RESEND"] = 15] = "RESEND";
|
|
158
168
|
/** @description Zaniechanie ponownej wysyłki zamówienia */
|
|
@@ -193,9 +203,9 @@ var RMA_STATUS;
|
|
|
193
203
|
/** @description Reklamacja niepotwierdzona przez obsługę */
|
|
194
204
|
RMA_STATUS[RMA_STATUS["UNCONFIRMED"] = 15] = "UNCONFIRMED";
|
|
195
205
|
/** @description Reklamacja anulowana */
|
|
196
|
-
RMA_STATUS[RMA_STATUS["
|
|
206
|
+
RMA_STATUS[RMA_STATUS["CANCELED"] = 17] = "CANCELED";
|
|
197
207
|
/** @description Reklamacja anulowana przez klienta */
|
|
198
|
-
RMA_STATUS[RMA_STATUS["
|
|
208
|
+
RMA_STATUS[RMA_STATUS["CANCELED_BY_CUSTOMER"] = 18] = "CANCELED_BY_CUSTOMER";
|
|
199
209
|
/** @description Reklamacja potwierdzona */
|
|
200
210
|
RMA_STATUS[RMA_STATUS["CONFIRMED"] = 19] = "CONFIRMED";
|
|
201
211
|
/** @description Reklamacja nieobsłużona */
|
package/dist/gateways.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject } from "./app.d.ts"
|
|
2
|
-
import type { GetClientsResponse, SearchClientsCrmResponse, SearchGiftcardsResponse, SearchNewsletterEmailResponse, SearchNewsletterSmsResponse, SearchOpinionsResponse, SearchOrdersResponse, SearchPackagesResponse, SearchCategoriesIdosellResponse, SearchDeliveryTimeResponse, SearchProductsParametersResponse, SearchProductsResponse, GetReturnsResponse, GetRmaResponse, GetSizechartsResponse, GetConfigResponse, GetShopsDataResponse, GetWarrantiesResponse, GetLocationsResponse, GetStocksdocumentsDocumentsResponse, GetStocksdocumentsProductsResponse } from "./responses.d.ts"
|
|
2
|
+
import type { GetClientsResponse, SearchClientsCrmResponse, SearchGiftcardsResponse, SearchNewsletterEmailResponse, SearchNewsletterSmsResponse, GetMenuResponse, GetAuctionDetailsResponse, GetOrdersDocumentsResponse, SearchOpinionsResponse, SearchOrdersResponse, SearchPackagesResponse, GetCategoriesResponse, SearchCategoriesIdosellResponse, SearchDeliveryTimeResponse, SearchProductsParametersResponse, SearchProductsResponse, GetReturnsResponse, GetRmaResponse, GetSizechartsResponse, GetConfigResponse, GetShopsDataResponse, GetWarrantiesResponse, GetLocationsResponse, GetStocksdocumentsDocumentsResponse, GetStocksdocumentsProductsResponse } from "./responses.d.ts"
|
|
3
3
|
import * as ENUMS from "./enums";
|
|
4
4
|
|
|
5
5
|
export interface GetClientsBalanceRequest extends PagableGateway<GetClientsBalanceRequest> {
|
|
@@ -1290,7 +1290,7 @@ export interface DeleteMenuRequest extends AppendableGateway<DeleteMenuRequest>
|
|
|
1290
1290
|
item_textid: (item_textid: string) => this
|
|
1291
1291
|
}
|
|
1292
1292
|
|
|
1293
|
-
export interface GetMenuRequest extends Gateway {
|
|
1293
|
+
export interface GetMenuRequest extends Gateway<GetMenuResponse> {
|
|
1294
1294
|
/** Shop Id. */
|
|
1295
1295
|
shop_id: (value: number|string) => this;
|
|
1296
1296
|
/** Tree menu ID. */
|
|
@@ -1360,15 +1360,13 @@ export interface GetOrdersAnalyticsRequest extends Gateway {
|
|
|
1360
1360
|
orderSerialNumber: (value: number|string|number[]|string[]) => this;
|
|
1361
1361
|
}
|
|
1362
1362
|
|
|
1363
|
-
export interface GetOrdersAuctionDetailsRequest extends Gateway {
|
|
1363
|
+
export interface GetOrdersAuctionDetailsRequest extends Gateway<GetAuctionDetailsResponse> {
|
|
1364
1364
|
/** Identifier type. */
|
|
1365
1365
|
identType: (value: 'orders_id'|'orders_sn') => this;
|
|
1366
1366
|
/** Orders Id values. */
|
|
1367
1367
|
orders: (value: string|string[]) => this;
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
/** Define orders values by passing them as an array */
|
|
1371
|
-
serialNumbers: (values: number|string|number[]|string[]) => this;
|
|
1368
|
+
ids: (value: string|string[]) => this;
|
|
1369
|
+
serialNumbers: (value: number|string|number[]|string[]) => this;
|
|
1372
1370
|
}
|
|
1373
1371
|
|
|
1374
1372
|
export interface PutOrdersClientRequest extends Gateway {
|
|
@@ -1431,7 +1429,7 @@ export interface DeleteOrdersDocumentsRequest extends AppendableGateway<DeleteOr
|
|
|
1431
1429
|
id: (id: number|string) => this
|
|
1432
1430
|
}
|
|
1433
1431
|
|
|
1434
|
-
export interface GetOrdersDocumentsRequest extends Gateway {
|
|
1432
|
+
export interface GetOrdersDocumentsRequest extends Gateway<GetOrdersDocumentsResponse> {
|
|
1435
1433
|
/** Order serial number. */
|
|
1436
1434
|
orderSerialNumber: (value: string|string[]) => this;
|
|
1437
1435
|
/** Document type */
|
|
@@ -1455,6 +1453,8 @@ export interface PostOrdersDocumentsRequest extends AppendableGateway<PostOrders
|
|
|
1455
1453
|
returnedInOrderDetails: (returnedInOrderDetails: 'y'|'n') => this
|
|
1456
1454
|
/** Additional information. */
|
|
1457
1455
|
additionalData: (additionalData: JSObject) => this
|
|
1456
|
+
/** Set Issue date */
|
|
1457
|
+
date: (date: string) => this;
|
|
1458
1458
|
}
|
|
1459
1459
|
|
|
1460
1460
|
export interface GetOrdersExportdocumentsEPPRequest extends Gateway {
|
|
@@ -2167,8 +2167,7 @@ export interface GetProductsAuctionsRequest extends PagableGateway<GetProductsAu
|
|
|
2167
2167
|
resultsPage: (value: number|string) => this;
|
|
2168
2168
|
/** Number of results on page. Value from 1 to 100 */
|
|
2169
2169
|
resultsLimit: (value: number|string) => this;
|
|
2170
|
-
|
|
2171
|
-
ids: (values: number|string|number[]|string[]) => this;
|
|
2170
|
+
ids: (value: number|string|number[]|string[]) => this;
|
|
2172
2171
|
/** Get auction data on products */
|
|
2173
2172
|
fromAllegro: () => this;
|
|
2174
2173
|
}
|
|
@@ -2285,7 +2284,7 @@ export interface PutProductsBundlesRenewRequest extends AppendableGateway<PutPro
|
|
|
2285
2284
|
bundleIdent: (bundleIdent: JSObject) => this
|
|
2286
2285
|
}
|
|
2287
2286
|
|
|
2288
|
-
export interface GetProductsCategoriesRequest extends PagableGateway<GetProductsCategoriesRequest> {
|
|
2287
|
+
export interface GetProductsCategoriesRequest extends PagableGateway<GetProductsCategoriesRequest,GetCategoriesResponse> {
|
|
2289
2288
|
/** List of product category identifiers in the panel */
|
|
2290
2289
|
ids: (value: number|string|number[]|string[]) => this;
|
|
2291
2290
|
/** Array of languages categories names should be returned in. "Defaults" value returns categories names in store default language. Not using languages parameter causes a situation, that categories names are returned in all available languages. */
|
|
@@ -2422,7 +2421,7 @@ export interface PutProductsDescriptionsRequest extends AppendableGateway<PutPro
|
|
|
2422
2421
|
productAuctionDescriptionsData: (productAuctionDescriptionsData: Array<JSObject>) => this
|
|
2423
2422
|
productId: (value: number|string) => this;
|
|
2424
2423
|
/** Set various types of names or descriptions to the product */
|
|
2425
|
-
setText: (text: string, type
|
|
2424
|
+
setText: (text: string, type: "productName"|"productAuctionName"|"productPriceComparerName"|"productDescription"|"productLongDescription"|"productMetaTitle"|"productMetaDescription"|"productMetaKeywords" = 'productName', language?: string, shopId?: number|string) => this;
|
|
2426
2425
|
}
|
|
2427
2426
|
|
|
2428
2427
|
export interface PutProductsGroupsMainProductRequest extends AppendableGateway<PutProductsGroupsMainProductRequest> {
|
|
@@ -2612,6 +2611,12 @@ export interface PutProductsOmnibusPricesRequest extends AppendableGateway<PutPr
|
|
|
2612
2611
|
omnibusPrices: (omnibusPrices: JSObject) => this
|
|
2613
2612
|
/** Strikethrough price settings for the page. */
|
|
2614
2613
|
shops: (shops: Array<JSObject>) => this
|
|
2614
|
+
/** Set product identifiers */
|
|
2615
|
+
productId: (productId: number|string, type: 'id'|'index'|'codeExtern'|'codeProducer' = 'id') => this;
|
|
2616
|
+
/** Set retail or wholesale price */
|
|
2617
|
+
setPrice: (price: number, wholesale: boolean = false) => this;
|
|
2618
|
+
/** Set mode to automatic */
|
|
2619
|
+
mode: (automatic: boolean = false) => this;
|
|
2615
2620
|
}
|
|
2616
2621
|
|
|
2617
2622
|
export interface DeleteProductsOpinionsRequest extends Gateway {
|
|
@@ -2922,9 +2927,9 @@ export interface PostProductsRequest extends AppendableGateway<PostProductsReque
|
|
|
2922
2927
|
/** Responsible person code */
|
|
2923
2928
|
responsiblePersonCode: (responsiblePersonCode: string) => this
|
|
2924
2929
|
/** Set various types of names or descriptions to the product */
|
|
2925
|
-
setText: (text: string, type
|
|
2930
|
+
setText: (text: string, type: "productName"|"productParamDescriptions"|"productLongDescription"|"productMetaTitle"|"productMetaDescription"|"productMetaKeyword"|"productAuctionName"|"productAuctionDescription"|"productAuctionAdditionalName"|"productNameInPriceComparer" = 'productName', language?: string, shopId?: number|string) => this;
|
|
2926
2931
|
/** Sets product price by amount */
|
|
2927
|
-
setPrice: (value: number, type
|
|
2932
|
+
setPrice: (value: number, type: 'retail'|'wholesale'|'pos'|'minimal'|'strikethroughRetail'|'strikethroughWholesale'|'suggested'|'automaticCalculation' = 'retail') => this;
|
|
2928
2933
|
}
|
|
2929
2934
|
|
|
2930
2935
|
export interface PutProductsRequest extends AppendableGateway<PutProductsRequest> {
|
|
@@ -3199,7 +3204,7 @@ export interface PutProductsRequest extends AppendableGateway<PutProductsRequest
|
|
|
3199
3204
|
/** Responsible person code */
|
|
3200
3205
|
responsiblePersonCode: (responsiblePersonCode: string) => this
|
|
3201
3206
|
/** Set various types of names or descriptions to the product */
|
|
3202
|
-
setText: (text: string, type
|
|
3207
|
+
setText: (text: string, type: "productName"|"productParamDescriptions"|"productLongDescription"|"productMetaTitle"|"productMetaDescription"|"productMetaKeyword"|"productAuctionName"|"productAuctionDescription"|"productAuctionAdditionalName"|"productNameInPriceComparer" = 'productName', language?: string, shopId?: number|string) => this;
|
|
3203
3208
|
/** Set edit mode - disables adding new product */
|
|
3204
3209
|
editMode: () => this;
|
|
3205
3210
|
/** Set add mode - Api is allowed to create new products */
|
|
@@ -3603,6 +3608,14 @@ export interface PutProductsStrikethroughPricesRequest extends AppendableGateway
|
|
|
3603
3608
|
stp_settings: (stp_settings: JSObject) => this
|
|
3604
3609
|
/** Strikethrough price settings for the page. */
|
|
3605
3610
|
shops: (shops: Array<JSObject>) => this
|
|
3611
|
+
/** Set product identifiers */
|
|
3612
|
+
productId: (productId: number|string, type: 'id'|'index'|'codeExtern'|'codeProducer' = 'id') => this;
|
|
3613
|
+
/** Set precise price */
|
|
3614
|
+
setPrice: (price: number, wholesale: boolean = false) => this;
|
|
3615
|
+
/** Set price relative to current price */
|
|
3616
|
+
addPrice: (value: number, wholesale: boolean = false, base: 'price' | 'price_minimal' | 'price_pos' | 'price_srp' | 'price_crossed' = 'price') => this;
|
|
3617
|
+
/** Set price relative to current price by percent */
|
|
3618
|
+
addPricePercent: (value: number, wholesale: boolean = false, base: 'price' | 'price_minimal' | 'price_pos' | 'price_srp' | 'price_crossed' = 'price') => this;
|
|
3606
3619
|
}
|
|
3607
3620
|
|
|
3608
3621
|
export interface PutProductsSupplierCodeRequest extends AppendableGateway<PutProductsSupplierCodeRequest> {
|
package/dist/helpers.js
CHANGED
|
@@ -111,6 +111,8 @@ export const nest = (valueName, nodeName, obj = {}, forceArray = false) => (valu
|
|
|
111
111
|
value = [value];
|
|
112
112
|
const node = { ...obj }, params = {};
|
|
113
113
|
node[valueName] = value;
|
|
114
|
+
if (!nodeName.length)
|
|
115
|
+
return node;
|
|
114
116
|
params[nodeName] = node;
|
|
115
117
|
return params;
|
|
116
118
|
};
|
|
@@ -303,3 +305,22 @@ export const setProductDescription = (object) => (text, node = 'productName', la
|
|
|
303
305
|
langData[node] = text;
|
|
304
306
|
return product;
|
|
305
307
|
};
|
|
308
|
+
export const setStp = (object, value, wholesale = false, base = 'price', mode = 'amount_set') => {
|
|
309
|
+
const node = getAppendedNode(object);
|
|
310
|
+
const stp_settings = node.stp_settings ?? {};
|
|
311
|
+
stp_settings.price_change_mode = mode;
|
|
312
|
+
stp_settings.price_change_basevalue = base;
|
|
313
|
+
stp_settings[wholesale ? "wholesale_price_change_value" : "retail_price_change_value"] = value;
|
|
314
|
+
return { stp_settings };
|
|
315
|
+
};
|
|
316
|
+
export const setOmp = (object, value = false, wholesale = false, mode = false) => {
|
|
317
|
+
const node = getAppendedNode(object);
|
|
318
|
+
const omnibusPrices = node.omnibusPrices ?? {};
|
|
319
|
+
if (value) {
|
|
320
|
+
omnibusPrices[wholesale ? "omnibusPriceWholesale" : "omnibusPriceRetail"] = value;
|
|
321
|
+
}
|
|
322
|
+
else if (mode) {
|
|
323
|
+
omnibusPrices.omnibusPriceManagement = mode;
|
|
324
|
+
}
|
|
325
|
+
return { omnibusPrices };
|
|
326
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ENUMS from "./enums.js";
|
|
2
2
|
import { gateProxy } from "./gates.js";
|
|
3
|
-
const DEFAULT_VERSION =
|
|
3
|
+
const DEFAULT_VERSION = 6;
|
|
4
4
|
const idosell = (url, apiKey = "", version = DEFAULT_VERSION) => {
|
|
5
5
|
const auth = { url, apiKey, version, apikey: apiKey.slice(0, 6) + '*'.repeat(20) };
|
|
6
6
|
Object.defineProperty(auth, 'apiKey', { enumerable: false });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import {
|
|
2
|
+
import { nest } from "../helpers.js";
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/orders/auctionDetails' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
ids:
|
|
7
|
-
serialNumbers:
|
|
6
|
+
ids: nest("orders", "", { "identType": "order_id" }, true),
|
|
7
|
+
serialNumbers: nest("orders", "", { "identType": "orders_sn" }, true)
|
|
8
8
|
};
|
|
9
9
|
return new Proxy(object, paramsProxy);
|
|
10
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
-
import {
|
|
2
|
+
import { nest, page } from "../helpers.js";
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'get', node: '/products/auctions' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
ids:
|
|
6
|
+
ids: nest("products", "", { "identType": "id" }, true),
|
|
7
7
|
fromAllegro: () => { const auctionSites = ["allegro"]; return { auctionSites }; },
|
|
8
8
|
page
|
|
9
9
|
};
|
|
@@ -3,7 +3,7 @@ export default (object) => {
|
|
|
3
3
|
object.gate = { method: 'post', node: '/entries/entries' };
|
|
4
4
|
object.custom = {
|
|
5
5
|
blog: () => { const visibleOnSitesList = object.params.visibleOnSitesList ?? []; visibleOnSitesList.push({ siteId: "display_on_blog" }); return { root: { visibleOnSitesList } }; },
|
|
6
|
-
news: () => { const visibleOnSitesList = object.params.visibleOnSitesList ?? []; visibleOnSitesList.push({
|
|
6
|
+
news: () => { const visibleOnSitesList = object.params.visibleOnSitesList ?? []; visibleOnSitesList.push({ siteId: "display_on_news" }); return { root: { visibleOnSitesList } }; }
|
|
7
7
|
};
|
|
8
8
|
object.appendable = {
|
|
9
9
|
except: ["shopId", "date", "visible", "visibleOnSitesList", "products", "pictureData", "titleLinkType", "link"],
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
2
|
export default (object) => {
|
|
3
3
|
object.gate = { method: 'post', node: '/orders/documents' };
|
|
4
|
+
object.custom = {
|
|
5
|
+
date: (date) => ({ additionalData: { documentIssuedDate: date } })
|
|
6
|
+
};
|
|
4
7
|
object.appendable = {
|
|
5
8
|
except: [],
|
|
6
9
|
arrayNode: "documents",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
+
import { setOmp } from "../helpers.js";
|
|
2
3
|
export default (object) => {
|
|
3
4
|
object.gate = { method: 'put', node: '/products/omnibusPrices' };
|
|
5
|
+
object.custom = {
|
|
6
|
+
productId: (value, type = "id") => ({ ident: { type, value } }),
|
|
7
|
+
setPrice: (price, wholesale = false) => setOmp(object, price, wholesale),
|
|
8
|
+
mode: (manual = false) => setOmp(object, false, false, manual ? "manual" : "automatic")
|
|
9
|
+
};
|
|
4
10
|
object.appendable = {
|
|
5
11
|
except: [],
|
|
6
12
|
arrayNode: "products",
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { paramsProxy } from "../params.js";
|
|
2
|
+
import { setStp } from "../helpers.js";
|
|
2
3
|
export default (object) => {
|
|
3
4
|
object.gate = { method: 'put', node: '/products/strikethroughPrices' };
|
|
5
|
+
object.custom = {
|
|
6
|
+
productId: (value, type = "id") => ({ ident: { type, value } }),
|
|
7
|
+
setPrice: (value, wholesale = false) => setStp(object, value, wholesale),
|
|
8
|
+
addPrice: (value, wholesale = false, base = "price") => setStp(object, value, wholesale, base, "amount_diff"),
|
|
9
|
+
addPricePercent: (value, wholesale = false, base = "price") => setStp(object, value, wholesale, base, "percent_diff")
|
|
10
|
+
};
|
|
4
11
|
object.appendable = {
|
|
5
12
|
except: [],
|
|
6
13
|
arrayNode: "products",
|
|
7
14
|
index: 0
|
|
8
15
|
};
|
|
9
|
-
object.req = ["ident"
|
|
16
|
+
object.req = ["ident"];
|
|
10
17
|
object.arrays = ["products"];
|
|
11
18
|
return new Proxy(object, paramsProxy);
|
|
12
19
|
};
|
|
@@ -3,8 +3,8 @@ import { nest, dateRangeType, orderBy, arrayOfObjects, orderSource, page } from
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'post', node: '/orders/orders/search' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
shopIds: nest("shopsIds", "orderSource", {}),
|
|
7
|
-
byPackageNumbers: nest("packagesNumbers", "packages", { "orderHasPackageNumbers": "y" }),
|
|
6
|
+
shopIds: nest("shopsIds", "orderSource", {}, true),
|
|
7
|
+
byPackageNumbers: nest("packagesNumbers", "packages", { "orderHasPackageNumbers": "y" }, true),
|
|
8
8
|
dates: dateRangeType({ "nodeName": "ordersDateRange", "fromName": "ordersDateBegin", "toName": "ordersDateEnd", "typeName": "ordersDateType", "format": "YYYY-MM-DD HH:mm:ss", "nested": "ordersRange", "defaultType": "add" }),
|
|
9
9
|
orderBy,
|
|
10
10
|
logins: arrayOfObjects("clients", "clientLogin", { "type": "login" }),
|
|
@@ -3,8 +3,8 @@ import { nest, dateRangeType, orderBy, arrayOfObjects, orderSource, page } from
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'post', node: '/orders/unfinished/search' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
shopIds: nest("shopsIds", "orderSource", {}),
|
|
7
|
-
byPackageNumbers: nest("packagesNumbers", "packages", { "orderHasPackageNumbers": "y" }),
|
|
6
|
+
shopIds: nest("shopsIds", "orderSource", {}, true),
|
|
7
|
+
byPackageNumbers: nest("packagesNumbers", "packages", { "orderHasPackageNumbers": "y" }, true),
|
|
8
8
|
dates: dateRangeType({ "nodeName": "ordersDateRange", "fromName": "ordersDateBegin", "toName": "ordersDateEnd", "typeName": "ordersDateType", "format": "YYYY-MM-DD HH:mm:ss", "nested": "ordersRange", "defaultType": "add" }),
|
|
9
9
|
orderBy,
|
|
10
10
|
logins: arrayOfObjects("clients", "clientLogin", { "type": "login" }),
|
|
@@ -11,7 +11,8 @@ export default (object) => {
|
|
|
11
11
|
arrayNode: "events",
|
|
12
12
|
index: 0
|
|
13
13
|
};
|
|
14
|
-
object.req = [{
|
|
14
|
+
object.req = [(object) => { if (object.eventType || object.eventIds)
|
|
15
|
+
return false; return (object.events?.length || object.deliveryPackageNumbers?.length) ? false : 'events | deliveryPackageNumbers'; }];
|
|
15
16
|
object.arrays = ["deliveryPackageNumbers", "events"];
|
|
16
17
|
return new Proxy(object, paramsProxy);
|
|
17
18
|
};
|
|
@@ -3,8 +3,8 @@ import { nest, dateRangeType, orderBy, arrayOfObjects, page } from "../helpers.j
|
|
|
3
3
|
export default (object) => {
|
|
4
4
|
object.gate = { method: 'post', node: '/products/products/search' };
|
|
5
5
|
object.custom = {
|
|
6
|
-
byMenus: nest("menuItemsIds", "productMenuItems", {}),
|
|
7
|
-
byShops: nest("shopsIds", "searchByShops", {}),
|
|
6
|
+
byMenus: nest("menuItemsIds", "productMenuItems", {}, true),
|
|
7
|
+
byShops: nest("shopsIds", "searchByShops", {}, true),
|
|
8
8
|
dates: dateRangeType({ "nodeName": "productDate", "fromName": "productDateBegin", "toName": "productDateEnd", "typeName": "productDateMode", "defaultType": "added" }),
|
|
9
9
|
orderBy,
|
|
10
10
|
shops: arrayOfObjects("productShops", "shopId"),
|
|
@@ -6,7 +6,7 @@ export default (object) => {
|
|
|
6
6
|
arrayNode: "products",
|
|
7
7
|
index: 0
|
|
8
8
|
};
|
|
9
|
-
object.req = [
|
|
9
|
+
object.req = [(object) => ((object.productId && object.sizeId) || object.productIndex) ? false : 'productId + sizeId or productIndex'];
|
|
10
10
|
object.arrays = ["products"];
|
|
11
11
|
return new Proxy(object, paramsProxy);
|
|
12
12
|
};
|
package/dist/request.js
CHANGED
|
@@ -76,6 +76,9 @@ const isMissingRequirement = (obj, required) => {
|
|
|
76
76
|
else
|
|
77
77
|
return required;
|
|
78
78
|
}
|
|
79
|
+
else if (typeof required === 'function') {
|
|
80
|
+
return required(obj);
|
|
81
|
+
}
|
|
79
82
|
else if (required.any) {
|
|
80
83
|
if (required.any === true) {
|
|
81
84
|
const keys = Object.keys(obj).filter(field => !['results_page', 'results_limit', 'resultsLimit', 'resultsPage'].includes(field)).length;
|
|
@@ -110,12 +113,11 @@ const processRequired = (request) => {
|
|
|
110
113
|
if (typeof req === 'string') {
|
|
111
114
|
if (request.appendable.except.includes(req))
|
|
112
115
|
continue;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
116
|
+
}
|
|
117
|
+
for (const obj of request.params[request.appendable.arrayNode]) {
|
|
118
|
+
const missingField = isMissingRequirement(obj, req);
|
|
119
|
+
if (missingField)
|
|
120
|
+
missing.add(missingField);
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
}
|