idosell 0.4.20 → 0.4.24

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/README.md CHANGED
@@ -4,6 +4,8 @@ This package wraps around the Idosell REST Api to make it easier to use by imple
4
4
 
5
5
  Visit [This page](https://idosell-converter.vercel.app/) for more detailed usage and examples.
6
6
 
7
+ [![npm version](https://img.shields.io/npm/v/idosell.svg)](https://www.npmjs.com/package/idosell)
8
+
7
9
  ## Basic use
8
10
 
9
11
  Package translates awkward gate names into more readable method names using REST verbs and gateways. Most of the possible methods are kept as is, only changed to camel case. For example:
@@ -15,7 +17,7 @@ const idosellRequest = idosell('SHOP_URL', 'API_KEY', API_VERSION)
15
17
 
16
18
  **API_KEY** can be obtained in your Idosell panel.
17
19
  **SHOP_URL** is the base URI of your shop.
18
- **API_VERSION** version of the API to call, current default version is **v6**
20
+ **API_VERSION** version of the API to call, current default version is **v7**
19
21
  Here are some examples:
20
22
  ```
21
23
  https://yourdomain.com
package/changelog.md CHANGED
@@ -5,12 +5,25 @@ 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.4.24] - 2025-03-21
9
+ ### Changed
10
+ - Updated to v7.13
11
+ - Fixed url format
12
+
13
+ ## [0.4.23] - 2025-03-11
14
+ ### Changed
15
+ - Added custom error class
16
+ - Fixed types for ids that can be integer instead of string
17
+ - Changed types of execution options, this allows custom logs
18
+
8
19
  ## [0.4.20] - 2025-12-18
20
+ ### Changed
9
21
  - Added indexing option for utils functions
10
22
  - Fixed typings and tests
11
23
  - Added descriptions
12
24
 
13
25
  ## [0.4.18] - 2025-12-18
26
+ ### Changed
14
27
  - Updated to v7.10
15
28
  - Updated utils
16
29
  - Fixed dates helper default value
package/dist/app.d.ts CHANGED
@@ -1,7 +1,13 @@
1
+ export interface ExecutableDumpParams {
2
+ url: string;
3
+ method: string;
4
+ params: Record<string,any>;
5
+ }
6
+
1
7
  export interface ExecutableOptions {
2
- log?: boolean,
3
- dump?: boolean,
4
- logPage?: boolean,
8
+ log?: boolean | ((obj: ExecutableDumpParams) => void),
9
+ dump?: boolean | ((obj: ExecutableDumpParams) => void),
10
+ logPage?: boolean | ((text: string) => void),
5
11
  skipCheck?: boolean
6
12
  }
7
13
 
@@ -32,12 +38,13 @@ export type GatewayRequestProxyObject = {
32
38
  arrayNode: string,
33
39
  except: string[]
34
40
  },
35
- custom?: Record<string,Function>,
41
+ custom?: Record<string,(..._: any) => false|Record<string,any>>,
36
42
  snakeCase?: boolean,
37
43
  next?: boolean,
38
44
  rootparams?: string|boolean,
39
45
  arrays?: string[],
40
46
  req?: RequirementType[],
47
+ n?: Record<string,number>,
41
48
  } & RequestProxyObject;
42
49
 
43
50
  export interface Gateway<R = JSObject, P = JSObject> {
@@ -91,4 +98,9 @@ export interface AppendableGateway<T,R = JSObject, P = JSObject> extends Gateway
91
98
  append: () => T
92
99
  }
93
100
 
94
- export {};
101
+ export interface IdosellErrorFaultStructure {
102
+ faultCode: number;
103
+ faultString: string;
104
+ }
105
+
106
+ export {};
package/dist/errors.js ADDED
@@ -0,0 +1,16 @@
1
+ export class IdosellFaultStringError extends Error {
2
+ cause;
3
+ constructor(message, cause) {
4
+ super(message);
5
+ this.name = 'IdosellFaultStringError';
6
+ this.cause = cause;
7
+ }
8
+ }
9
+ export function catchEmptyList(defaultValue) {
10
+ return (err) => {
11
+ if (err?.cause?.faultCode === 2) {
12
+ return defaultValue;
13
+ }
14
+ throw err;
15
+ };
16
+ }
@@ -1,10 +1,18 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-object-type */
2
- import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject } from "./app.d.ts"
2
+ import type { PagableGateway, AppendableGateway, Gateway, DateLike, JSObject, IdosellErrorFaultStructure } from "./app.d.ts"
3
3
  import type { GetClientsBalanceResponse, BooleanStatusResponse, GetClientsResponse, PostClientsResponse, PutClientsResponse, SearchClientsCrmResponse, GetClientsDeliveryAddressResponse, PostClientsDeliveryAddressResponse, PutClientsDeliveryAddressResponse, VouchersResponse, PutVouchersResponse, SearchClientsGiftcardsResponse, GetClientsGiftcardsTypesResponse, GetClientsMembershipCardsResponse, PutClientsMembershipCardsResponse, SearchClientsNewsletterEmailResponse, SearchClientsNewsletterSmsResponse, GetClientsPayerAddressResponse, PostClientsPayerAddressResponse, PutClientsPayerAddressResponse, GetClientsPricelistsClientsResponse, PutClientsPricelistsClientsResponse, GetClientsPricelistsResponse, PostClientsPricelistsResponse, GetClientsPricelistsProductsResponse, PutClientsPricelistsProductsResponse, GetClientsPricesActiveCardResponse, GetClientsPricesDiscountGroupsResponse, GetClientsPricesDiscountsResponse, PutClientsPricesDiscountsResponse, GetClientsProfitPointsResponse, GetClientsProvinceListResponse, GetClientsTagsResponse, PostClientsTagsResponse, PutClientsTagsResponse, GetConfigVariablesResponse, PutConfigVariablesResponse, GetCouriersAssignedToShippingProfilesResponse, GetCouriersResponse, GetCouriersPickupPointsResponse, PutCouriersPickupPointsResponse, GetCpaCampaignResponse, CmsCampaignResponse, CmsResponse, GetCpaResponse, GetDeliveriesProfilesResponse, GetDeliveriesRegionsResponse, PostDeliveriesRegionsResponse, GetDiscountsGroupsClientsResponse, GetDiscountsGroupsResponse, PostDiscountsGroupsResponse, GetEntriesResponse, PostEntriesResponse, GetEntriesPagesToDisplayResponse, GetEntriesSourcesResponse, GetMenuResponse, PostMenuResponse, PutMenuResponse, PutMenuSortResponse, GetOrdersAnalyticsResponse, GetOrdersAuctionDetailsResponse, PutOrdersCourierResponse, PostOrdersDocumentsCreateResponse, GetOrdersDocumentsResponse, PostOrdersDocumentsResponse, GetOrdersHandlerResponse, GetOrdersHistoryResponse, GetOrdersImagesResponse, PostOrdersImagesResponse, GetOrdersLabelsResponse, SearchOrdersOpinionsResponse, GetOrdersOpinionsRateResponse, SearchOrdersResponse, PostOrdersResponse, PutOrdersResponse, GetOrdersPackagesResponse, PutOrdersPackagesResponse, PutOrdersProductsSerialNumbersResponse, PutOrdersProfitMarginResponse, GetOrdersProfitabilityResponse, GetOrdersStatusesResponse, GetOrdersWarehouseResponse, PostPackagesLabelsResponse, PutPackagesResponse, SearchPackagesResponse, GetPaymentsFormsResponse, GetPaymentsResponse, PostPaymentsResponse, GetPaymentsProfilesResponse, PostPaymentsRepaymentResponse, GetProductsSKUbyBarcodeResponse, PutProductsAttachmentsResponse, GetProductsAuctionsResponse, GetProductsBrandsResponse, PutProductsBrandsResponse, GetProductsCategoriesResponse, PutProductsCategoriesResponse, SearchProductsCategoriesIdosellResponse, GetProductsCodeExistenceResponse, SearchProductsDeliveryTimeResponse, GetProductsDescriptionsResponse, ProductIdentResponse, PutProductsGroupsSettingsResponse, GetProductsIdBySizecodeResponse, PutProductsImagesResponse, GetProductsMarketingPromotionResponse, PostProductsMarketingPromotionResponse, PutProductsMarketingPromotionResponse, GetProductsMarketingZonesResponse, PutProductsMarketingZonesResponse, GetProductsOmnibusPricesResponse, GetProductsOpinionsResponse, PostProductsOpinionsResponse, GetProductsOpinionsRateResponse, PutProductsParametersResponse, SearchProductsParametersResponse, SearchProductsResponse, PostProductsResponse, PutProductsResponse, GetProductsQuestionsResponse, GetProductsReservationsResponse, GetProductsSeriesResponse, PutProductsSeriesResponse, GetProductsSizesResponse, PutProductsSizesResponse, PutProductsStockQuantityResponse, GetProductsStocksResponse, PutProductsStocksResponse, GetProductsStrikethroughPricesResponse, PutProductsSupplierCodeResponse, PutProductsSupplierProductDataResponse, GetResponsibilityEntitiesResponse, PutResponsibilityEntitiesResponse, GetReturnsResponse, PostReturnsResponse, PutReturnsResponse, PutReturnsSerialNumberResponse, GetRmaResponse, PutRmaResponse, GetRmaStatusesResponse, GetShopsCurrenciesResponse, GetShopsLanguagesResponse, GetSizechartsResponse, PutSizechartsResponse, GetSizesResponse, PutSizesResponse, GetSnippetsCampaignResponse, GetSnippetsCookiesResponse, GetSnippetsResponse, GetSystemConfigResponse, GetSystemCurrenciesResponse, PutSystemCurrenciesResponse, GetSystemProcessesAutomationResponse, GetSystemServerLoadResponse, GetSystemServerTimeResponse, GetSystemShopsDataResponse, GetSystemUnitsResponse, PutSystemUnitsResponse, GetSystemUsersResponse, GetVouchersTypesResponse, GetVouchersResponse, GetWarrantiesCountTotalResponse, PutWarrantiesLanguageDataResponse, GetWarrantiesResponse, PutWarrantiesResponse, GetWmsLocationsResponse, GetWmsStocksdocumentsDocumentsResponse, PostWmsStocksdocumentsDocumentsResponse, PutWmsStocksdocumentsDocumentsResponse, GetWmsStocksdocumentsOpenedDocumentsResponse, GetWmsStocksdocumentsProductsResponse, PutWmsStocksdocumentsProductsResponse, GetWmsSuppliersResponse, PutWmsSuppliersResponse } from "./responses.d.ts"
4
4
  import type * as RequestParams from "./reqparams.d.ts";
5
5
  import * as ENUMS from "./enums";
6
6
  import utils from "./utils";
7
7
 
8
+ export class IdosellFaultStringError extends Error {
9
+ cause: IdosellFaultStringError;
10
+ constructor(message: string, cause: IdosellErrorFaultStructure);
11
+ }
12
+
13
+ export function catchEmptyList(): (_err: IdosellFaultStringError) => undefined;
14
+ export function catchEmptyList<T>(_defaultValue: T): (_err: IdosellFaultStringError) => T;
15
+
8
16
  export interface GetClientsBalanceRequest extends PagableGateway<GetClientsBalanceRequest, GetClientsBalanceResponse> {
9
17
  /** Customer Id */
10
18
  clientNumbers: (value: number|string|number[]|string[]) => this;
@@ -67,7 +75,7 @@ export interface GetClientsRequest extends PagableGateway<GetClientsRequest, Get
67
75
  /** Client Registration Date */
68
76
  clientRegistrationDate: (value: JSObject) => this;
69
77
  /** The ID of the shop, that client is assigned to. */
70
- shopId: (value: string) => this;
78
+ shopId: (value: number|string) => this;
71
79
  /** Define range of dates */
72
80
  lastPurchased: (dateFrom: DateLike, dateTo: DateLike) => this;
73
81
  /** Define range of dates */
@@ -163,7 +171,7 @@ export interface PutClientsRequest extends AppendableGateway<PutClientsRequest,
163
171
  /** Country ID in accordance with ISO-3166. */
164
172
  clientCountryId: (clientCountryId: string) => this
165
173
  /** Administrative region code. */
166
- clientProvinceId: (clientProvinceId: string) => this
174
+ clientProvinceId: (clientProvinceId: number|string) => this
167
175
  /** Customer password (min. 8 characters). */
168
176
  clientPassword: (clientPassword: string) => this
169
177
  /** Date of birth. */
@@ -331,9 +339,9 @@ export interface PostClientsDeliveryAddressRequest extends AppendableGateway<Pos
331
339
  /** Recipient street and number. */
332
340
  clientDeliveryAddressStreet: (clientDeliveryAddressStreet: string) => this
333
341
  /** Administrative region code. */
334
- clientDeliveryAddressRegionId: (clientDeliveryAddressRegionId: string) => this
342
+ clientDeliveryAddressRegionId: (clientDeliveryAddressRegionId: number|string) => this
335
343
  /** Administrative region code. */
336
- clientDeliveryAddressProvinceId: (clientDeliveryAddressProvinceId: string) => this
344
+ clientDeliveryAddressProvinceId: (clientDeliveryAddressProvinceId: number|string) => this
337
345
  /** Recipient's postal code. */
338
346
  clientDeliveryAddressZipCode: (clientDeliveryAddressZipCode: string) => this
339
347
  /** Recipient's country. */
@@ -348,7 +356,7 @@ export interface PutClientsDeliveryAddressRequest extends AppendableGateway<PutC
348
356
  /** External system code. */
349
357
  clientCodeExternal: (clientCodeExternal: string) => this
350
358
  /** Delivery address ID. */
351
- clientDeliveryAddressId: (clientDeliveryAddressId: string) => this
359
+ clientDeliveryAddressId: (clientDeliveryAddressId: number|string) => this
352
360
  /** List of stores IDs When mask is determined, this parameter is omitted. */
353
361
  shopsIds: (shopsIds: number|string|number[]|string[]) => this
354
362
  /** Currency ID */
@@ -366,9 +374,9 @@ export interface PutClientsDeliveryAddressRequest extends AppendableGateway<PutC
366
374
  /** Recipient street and number. */
367
375
  clientDeliveryAddressStreet: (clientDeliveryAddressStreet: string) => this
368
376
  /** Administrative region code. */
369
- clientDeliveryAddressRegionId: (clientDeliveryAddressRegionId: string) => this
377
+ clientDeliveryAddressRegionId: (clientDeliveryAddressRegionId: number|string) => this
370
378
  /** Administrative region code. */
371
- clientDeliveryAddressProvinceId: (clientDeliveryAddressProvinceId: string) => this
379
+ clientDeliveryAddressProvinceId: (clientDeliveryAddressProvinceId: number|string) => this
372
380
  /** Recipient's postal code. */
373
381
  clientDeliveryAddressZipCode: (clientDeliveryAddressZipCode: string) => this
374
382
  /** Recipient's country. */
@@ -551,7 +559,7 @@ export interface DeleteClientsPayerAddressRequest extends AppendableGateway<Dele
551
559
 
552
560
  export interface GetClientsPayerAddressRequest extends PagableGateway<GetClientsPayerAddressRequest, GetClientsPayerAddressResponse> {
553
561
  /** Unique client's number. */
554
- clientId: (value: string) => this;
562
+ clientId: (value: number|string) => this;
555
563
  /** Page with results number. Numeration starts from 0 */
556
564
  resultsPage: (value: number|string) => this;
557
565
  /** Number of results on page. Value from 1 to 100 */
@@ -585,9 +593,9 @@ export interface PostClientsPayerAddressRequest extends AppendableGateway<PostCl
585
593
  export interface PutClientsPayerAddressRequest extends AppendableGateway<PutClientsPayerAddressRequest, PutClientsPayerAddressResponse, RequestParams.PutClientsPayerAddressParams> {
586
594
  payers: (value: RequestParams.PutClientsPayerAddressParams["payers"]) => this;
587
595
  /** Unique client's number. */
588
- clientId: (clientId: string) => this
596
+ clientId: (clientId: number|string) => this
589
597
  /** Buyer's address id. */
590
- payerAddressId: (payerAddressId: string) => this
598
+ payerAddressId: (payerAddressId: number|string) => this
591
599
  /** Buyer's first name. */
592
600
  payerAddressFirstName: (payerAddressFirstName: string) => this
593
601
  /** Buyer's last name. */
@@ -869,7 +877,7 @@ export interface GetCouriersRequest extends PagableGateway<GetCouriersRequest, G
869
877
  export interface DeleteCouriersPickupPointsRequest extends AppendableGateway<DeleteCouriersPickupPointsRequest> {
870
878
  pickupPointDeleteRequests: (value: Array<JSObject>) => this;
871
879
  /** Collection point ID. */
872
- pickupPointId: (pickupPointId: string) => this
880
+ pickupPointId: (pickupPointId: number|string) => this
873
881
  /** external system code. */
874
882
  pickupPointExternalId: (pickupPointExternalId: string) => this
875
883
  /** Courier ID. */
@@ -880,7 +888,7 @@ export interface GetCouriersPickupPointsRequest extends PagableGateway<GetCourie
880
888
  /** Courier ID. */
881
889
  courierId: (value: number|string) => this;
882
890
  /** Collection point ID. */
883
- pickupPointId: (value: string) => this;
891
+ pickupPointId: (value: number|string) => this;
884
892
  /** External system code. */
885
893
  pickupPointExternalId: (value: string) => this;
886
894
  /** Page with results number. Numeration starts from 0 */
@@ -912,7 +920,7 @@ export interface PostCouriersPickupPointsRequest extends AppendableGateway<PostC
912
920
  export interface PutCouriersPickupPointsRequest extends AppendableGateway<PutCouriersPickupPointsRequest, PutCouriersPickupPointsResponse, RequestParams.PutCouriersPickupPointsParams> {
913
921
  pickupPoints: (value: RequestParams.PutCouriersPickupPointsParams["pickupPoints"]) => this;
914
922
  /** Collection point ID. */
915
- pickupPointId: (pickupPointId: string) => this
923
+ pickupPointId: (pickupPointId: number|string) => this
916
924
  /** external system code. */
917
925
  pickupPointExternalId: (pickupPointExternalId: string) => this
918
926
  /** Courier ID. */
@@ -1272,7 +1280,7 @@ export interface PutMenuFilterRequest extends AppendableGateway<PutMenuFilterReq
1272
1280
  /** Active filters. */
1273
1281
  menuFiltersActive: (value: Array<JSObject>) => this;
1274
1282
  /** Menu filter ID. */
1275
- menuFilterId: (menuFilterId: string) => this
1283
+ menuFilterId: (menuFilterId: number|string) => this
1276
1284
  /** Filter name on page. */
1277
1285
  menuFilterName: (menuFilterName: string) => this
1278
1286
  /** Display as: "name" - text, "gfx" - graphics, "namegfx" - text and graphics. */
@@ -1321,7 +1329,7 @@ export interface PostMenuRequest extends AppendableGateway<PostMenuRequest, Post
1321
1329
  /** Menu ID. */
1322
1330
  menu_id: (menu_id: number|string) => this
1323
1331
  /** Parent menu element ID. */
1324
- parent_id: (parent_id: string) => this
1332
+ parent_id: (parent_id: number|string) => this
1325
1333
  /** Menu element text identifier. Example: "item1\item2". */
1326
1334
  parent_textid: (parent_textid: string) => this
1327
1335
  /** */
@@ -1337,7 +1345,7 @@ export interface PutMenuRequest extends AppendableGateway<PutMenuRequest, PutMen
1337
1345
  /** Menu ID. */
1338
1346
  menu_id: (menu_id: number|string) => this
1339
1347
  /** Menu element ID. */
1340
- item_id: (item_id: string) => this
1348
+ item_id: (item_id: number|string) => this
1341
1349
  /** Menu element text identifier. Example: "item1\item2\item3". */
1342
1350
  item_textid: (item_textid: string) => this
1343
1351
  /** */
@@ -1389,7 +1397,7 @@ export interface PutOrdersCourierRequest extends Gateway<PutOrdersCourierRespons
1389
1397
  /** Courier ID. */
1390
1398
  courierId: (value: number|string) => this;
1391
1399
  /** Collection point ID. */
1392
- pickupPointId: (value: string) => this;
1400
+ pickupPointId: (value: number|string) => this;
1393
1401
  }
1394
1402
 
1395
1403
  export interface PutOrdersDeliveryAddressRequest extends Gateway {
@@ -1436,7 +1444,7 @@ export interface DeleteOrdersDocumentsRequest extends AppendableGateway<DeleteOr
1436
1444
 
1437
1445
  export interface GetOrdersDocumentsRequest extends Gateway<GetOrdersDocumentsResponse> {
1438
1446
  /** Order serial number. */
1439
- orderSerialNumber: (value: string|string[]) => this;
1447
+ orderSerialNumber: (value: number|string|number[]|string[]) => this;
1440
1448
  /** Document type */
1441
1449
  documentType: (value: 'sales_confirmation'|'vat_invoice'|'corrective_vat_invoice'|'advance_vat_invoice'|'final_advance_vat_invoice'|'pro_forma_invoice'|'advance_pro_forma_invoice'|'final_advance_pro_forma_invoice'|'delivery_note'|'fiscal_receipt'|'fiscal_invoice'|'other') => this;
1442
1450
  /** Elements returned by api */
@@ -1629,7 +1637,7 @@ export interface PostOrdersRequest extends AppendableGateway<PostOrdersRequest,
1629
1637
  /** Courier ID. */
1630
1638
  courierId: (courierId: number|string) => this
1631
1639
  /** Collection point ID. */
1632
- pickupPointId: (pickupPointId: string) => this
1640
+ pickupPointId: (pickupPointId: number|string) => this
1633
1641
  /** Delivery cost. */
1634
1642
  deliveryCost: (deliveryCost: number) => this
1635
1643
  /** Delivery address data. */
@@ -1656,13 +1664,17 @@ export interface PostOrdersRequest extends AppendableGateway<PostOrdersRequest,
1656
1664
  billingCurrencyRate: (billingCurrencyRate: number) => this
1657
1665
  /** Sale date. ISO 8602 format. */
1658
1666
  purchaseDate: (purchaseDate: string) => this
1667
+ /** Planned date of packing */
1668
+ plannedDateOfPacking: (plannedDateOfPacking: string) => this
1669
+ /** Planned date of shipment */
1670
+ estimatedDeliveryDate: (estimatedDeliveryDate: string) => this
1659
1671
  }
1660
1672
 
1661
1673
  export interface PutOrdersRequest extends AppendableGateway<PutOrdersRequest, PutOrdersResponse, RequestParams.PutOrdersParams> {
1662
1674
  /** Orders. */
1663
1675
  orders: (value: RequestParams.PutOrdersParams["orders"]) => this;
1664
1676
  /** Order ID. */
1665
- orderId: (orderId: string) => this
1677
+ orderId: (orderId: number|string) => this
1666
1678
  /** Order serial number. */
1667
1679
  orderSerialNumber: (orderSerialNumber: number|string) => this
1668
1680
  /** Order status. Allowed values: "finished_ext" - order status: completed in FA application, "finished" - completed, "new" - not handled, "payment_waiting" - awaiting payment, "delivery_waiting" - awaiting delivery, "on_order" - in progress, "packed" - being picked, "packed_fulfillment" - being picked - fulfilment, "packed_ready" - packed, "ready" - ready, "wait_for_dispatch" - awaiting dispatch date, "suspended" - on hold, "joined" - merged, "missing" - missing, "lost" - lost, "false" - false, "canceled" - Customer canceled. */
@@ -1701,6 +1713,8 @@ export interface PutOrdersRequest extends AppendableGateway<PutOrdersRequest, Pu
1701
1713
  purchaseDate: (purchaseDate: string) => this
1702
1714
  /** Estimated date of shipment of the order in format Y-m-d H:i */
1703
1715
  estimatedDeliveryDate: (estimatedDeliveryDate: string) => this
1716
+ /** Planned date of packing */
1717
+ plannedDateOfPacking: (plannedDateOfPacking: string) => this
1704
1718
  }
1705
1719
 
1706
1720
  export interface SearchOrdersRequest extends PagableGateway<SearchOrdersRequest, SearchOrdersResponse, RequestParams.SearchOrdersParams> {
@@ -1722,7 +1736,7 @@ export interface SearchOrdersRequest extends PagableGateway<SearchOrdersRequest,
1722
1736
  orderType: (value: 'wholesale'|'retail'|'dropshipping'|'deliverer') => this;
1723
1737
  dropshippingOrderStatus: (value: 'all'|'finished'|'canceled'|'notCanceled') => this;
1724
1738
  /** Orders IDs. */
1725
- ordersIds: (value: string|string[]) => this;
1739
+ ordersIds: (value: number|string|number[]|string[]) => this;
1726
1740
  /** Order serial numbers. */
1727
1741
  ordersSerialNumbers: (value: number|string|number[]|string[]) => this;
1728
1742
  /** Customer data. */
@@ -1816,7 +1830,7 @@ export interface PostOrdersPackagesRequest extends AppendableGateway<PostOrdersP
1816
1830
  /** List of parcels assigned to the order Maximum default number: 100 parcels. */
1817
1831
  orderPackages: (value: RequestParams.PostOrdersPackagesParams["orderPackages"]) => this;
1818
1832
  /** Id. */
1819
- eventId: (eventId: string) => this
1833
+ eventId: (eventId: number|string) => this
1820
1834
  /** Type. */
1821
1835
  eventType: (eventType: 'order'|'rma'|'return') => this
1822
1836
  /** Information on consignments. */
@@ -1827,7 +1841,7 @@ export interface PutOrdersPackagesRequest extends AppendableGateway<PutOrdersPac
1827
1841
  /** List of parcels assigned to the order Maximum default number: 100 parcels. */
1828
1842
  orderPackages: (value: RequestParams.PutOrdersPackagesParams["orderPackages"]) => this;
1829
1843
  /** Id. */
1830
- eventId: (eventId: string) => this
1844
+ eventId: (eventId: number|string) => this
1831
1845
  /** Type. */
1832
1846
  eventType: (eventType: 'order'|'rma'|'return') => this
1833
1847
  /** Information on consignments. */
@@ -1838,7 +1852,7 @@ export interface PutOrdersPickupPointRequest extends Gateway<PutOrdersCourierRes
1838
1852
  /** Order serial number. */
1839
1853
  orderSerialNumber: (value: number|string) => this;
1840
1854
  /** Collection point ID. */
1841
- pickupPointId: (value: string) => this;
1855
+ pickupPointId: (value: number|string) => this;
1842
1856
  }
1843
1857
 
1844
1858
  export interface GetOrdersPrinterDocumentsRequest extends Gateway {
@@ -1904,7 +1918,7 @@ export interface SearchOrdersUnfinishedRequest extends PagableGateway<SearchOrde
1904
1918
  /** Dropshipping order status in the supplier's system. Allowed values: "all" - all, "finished" - sent, "canceled" - canceled, "notCanceled" - failed to cancel. */
1905
1919
  dropshippingOrderStatus: (value: 'all'|'finished'|'canceled'|'notCanceled') => this;
1906
1920
  /** Orders IDs. */
1907
- ordersIds: (value: string|string[]) => this;
1921
+ ordersIds: (value: number|string|number[]|string[]) => this;
1908
1922
  /** Order serial numbers. */
1909
1923
  ordersSerialNumbers: (value: number|string|number[]|string[]) => this;
1910
1924
  /** Customer data. */
@@ -2008,7 +2022,7 @@ export interface PostPackagesLabelsRequest extends AppendableGateway<PostPackage
2008
2022
  /** Shipment configuration options available for Inpost Smile courier */
2009
2023
  parcelParametersByPackages: (value: RequestParams.PostPackagesLabelsParams["parcelParametersByPackages"]) => this;
2010
2024
  /** Package ID in system. */
2011
- packageId: (packageId: string) => this
2025
+ packageId: (packageId: number|string) => this
2012
2026
  /** Set order serial number */
2013
2027
  orderSn: (orderSn: number |string) => this;
2014
2028
  /** Set default parcel size */
@@ -2220,7 +2234,7 @@ export interface PutProductsBrandsFilterRequest extends AppendableGateway<PutPro
2220
2234
  /** Active filters. */
2221
2235
  filtersActive: (value: Array<JSObject>) => this;
2222
2236
  /** Menu filter ID. */
2223
- filterId: (filterId: string) => this
2237
+ filterId: (filterId: number|string) => this
2224
2238
  /** Filter name on page. */
2225
2239
  filterName: (filterName: string) => this
2226
2240
  /** Display as: "name" - text, "gfx" - graphics, "namegfx" - text and graphics. */
@@ -2356,7 +2370,7 @@ export interface GetProductsCodeExistenceRequest extends Gateway<GetProductsCode
2356
2370
  identType: (value: 'id'|'index'|'codeExtern'|'codeProducer'|'codeDeliverer') => this;
2357
2371
  /** Products list. */
2358
2372
  products: (value: string|string[]) => this;
2359
- delivererId: (value: string) => this;
2373
+ delivererId: (value: number|string) => this;
2360
2374
  /** Set product identifiers */
2361
2375
  productId: (productId: number|string|number|string|number[]|string[], type?: 'id'|'index'|'codeExtern'|'codeProducer') => this;
2362
2376
  }
@@ -2413,7 +2427,7 @@ export interface SearchProductsDeliveryTimeRequest extends AppendableGateway<Sea
2413
2427
  /** Product Id */
2414
2428
  productId: (productId: number|string) => this
2415
2429
  /** Size identifier */
2416
- sizeId: (sizeId: string) => this
2430
+ sizeId: (sizeId: number|string) => this
2417
2431
  /** Size name */
2418
2432
  sizePanelName: (sizePanelName: string) => this
2419
2433
  /** Product IAI code */
@@ -2492,7 +2506,7 @@ export interface DeleteProductsImagesRequest extends AppendableGateway<DeletePro
2492
2506
  /** Shop Id */
2493
2507
  shopId: (shopId: number|string) => this
2494
2508
  /** */
2495
- productImagesId: (productImagesId: string|string[]) => this
2509
+ productImagesId: (productImagesId: number|string|number[]|string[]) => this
2496
2510
  }
2497
2511
 
2498
2512
  export interface PutProductsImagesRequest extends AppendableGateway<PutProductsImagesRequest, PutProductsImagesResponse, RequestParams.PutProductsImagesParams> {
@@ -2558,12 +2572,12 @@ export interface PostProductsMarketingPromotionRequest extends AppendableGateway
2558
2572
  /** */
2559
2573
  elementType: (elementType: 'product'|'series'|'producer'|'category'|'menu') => this
2560
2574
  /** Identifier of the element affected by the promotion (in the case of a menu in the format: storeId-menuId-itemId) */
2561
- elementId: (elementId: string) => this
2575
+ elementId: (elementId: number|string) => this
2562
2576
  }
2563
2577
 
2564
2578
  export interface PutProductsMarketingPromotionRequest extends AppendableGateway<PutProductsMarketingPromotionRequest, PutProductsMarketingPromotionResponse, RequestParams.PutProductsMarketingPromotionParams> {
2565
2579
  /** Promotion ID */
2566
- promotionId: (value: string) => this;
2580
+ promotionId: (value: number|string) => this;
2567
2581
  /** Promotion name */
2568
2582
  promotionName: (value: string) => this;
2569
2583
  /** List of stores IDs When mask is determined, this parameter is omitted. */
@@ -2593,7 +2607,7 @@ export interface PutProductsMarketingPromotionRequest extends AppendableGateway<
2593
2607
  /** */
2594
2608
  elementType: (elementType: 'product'|'series'|'producer'|'category'|'menu') => this
2595
2609
  /** Identifier of the element affected by the promotion (in the case of a menu in the format: storeId-menuId-itemId) */
2596
- elementId: (elementId: string) => this
2610
+ elementId: (elementId: number|string) => this
2597
2611
  }
2598
2612
 
2599
2613
  export interface GetProductsMarketingZonesRequest extends Gateway<GetProductsMarketingZonesResponse> {
@@ -2750,9 +2764,9 @@ export interface PutProductsParametersRequest extends AppendableGateway<PutProdu
2750
2764
  /** Icons of section, parameter or value to display on the list of products. */
2751
2765
  link_icons: (link_icons: RequestParams.PutProductsParametersParams["items"][number]["link_icons"]) => this
2752
2766
  /** Parameter's additional feature. 1. Status: context_id = "CONTEXT_STATE" Takes values context_value_id: - CONTEXT_STATE_NEW - New, - CONTEXT_STATE_USED - Used, - CONTEXT_STATE_USED_EXCELLENT - Used - excellent condition - CONTEXT_STATE_USED_VERYGOOD - Used - very good condition - CONTEXT_STATE_USED_CORRECT - Used - good condition - CONTEXT_STATE_USED_ACCEPTABLE - Used - acceptable condition - CONTEXT_STATE_REFURBISHED_EXCELLENT - Refurbished - excellent condition - CONTEXT_STATE_REFURBISHED_VERYGOOD - Refurbished - very good condition - CONTEXT_STATE_REFURBISHED_CORRECT - Refurbished - good condition - CONTEXT_STATE_NEW_OTHERS - New other (see details) - CONTEXT_STATE_NEW_WITH_DEFECTS - New with defects - CONTEXT_STATE_NEW_OEM - New - OEM - CONTEXT_STATE_NEW_OPEN_BOX - New - open box - CONTEXT_STATE_REFURBISHED_BY_PRODUCER - Renewed by a manufacturer, - CONTEXT_STATE_REFURBISHED_BY_SELLER - Renewed by a seller, - CONTEXT_STATE_FOR_PARTS_OR_BROKEN - In parts or damaged. 2. Product weight in grams: context_id = "CONTEXT_STD_UNIT_WEIGHT" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 3. A product's value in milliliters: context_id = "CONTEXT_STD_UNIT_VOLUME" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 4. Sex: context_id = "CONTEXT_SEX" Takes values context_value_id: - CONTEXT_SEX_MAN - Man, - CONTEXT_SEX_WOMAN - Woman, - CONTEXT_SEX_UNISEX - Unisex. 5. Age group: context_id = "CONTEXT_AGE_GROUP" Takes values context_value_id: - CONTEXT_AGE_GROUP_ADULT - Adults, - CONTEXT_AGE_GROUP_MINOR - Children. 6. Maximum number of products in an order: context_id = "CONTEXT_MAX_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 7. Maximum number of products in a wholesale order: context_id = "CONTEXT_MAX_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 8. Minimal number of products in an order: context_id = "CONTEXT_MIN_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 9. Minimum number of products in a wholesale order: context_id = "CONTEXT_MIN_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 10. Maximal number of a single size in an order: context_id = "CONTEXT_MAX_SIZE_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 11. Maximal number of a single size in a wholesale order: context_id = "CONTEXT_MAX_SIZE_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 12. Minimal number of a single size in an order: context_id = "CONTEXT_MIN_SIZE_QUANTITY_PER_RETAIL_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 13. Minimal number of a single size in a wholesale order: context_id = "CONTEXT_MIN_SIZE_QUANTITY_PER_WHOLESALE_ORDER" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 14. Net weight: context_id = "CONTEXT_WEIGHT_NET" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 15. Color: context_id = "CONTEXT_COLOR" Takes values context_value_id: - Value of additional feature is set automatically basing on the parameter's value. 16. #!TylkoDlaDoroslych!#: context_id = "CONTEXT_ONLY_ADULTS" Takes values context_value_id: - CONTEXT_ONLY_ADULTS_YES - yes, - CONTEXT_ONLY_ADULTS_NO - no. 17. Prescription drug: context_id = "CONTEXT_PRESCRIPTION_MEDICINE" Takes values context_value_id: - CONTEXT_PRESCRIPTION_MEDICINE_YES - yes, - CONTEXT_PRESCRIPTION_MEDICINE_NO - no. 18. Season Rate: context_id = "CONTEXT_SEASON" Takes values context_value_id: - CONTEXT_SEASON_SPRING - Spring, - CONTEXT_SEASON_SUMMER - Summer, - CONTEXT_SEASON_FALL - Autumn, - CONTEXT_SEASON_WINTER - Winter, - CONTEXT_SEASON_SPRING_SUMMER - Spring/Summer, - CONTEXT_SEASON_FALL_WINTER - Autumn/Winter 19. Risk - signal word: context_id = \"CONTEXT_HAZMAT_SIGNAL\" Takes values context_value_id: - CONTEXT_HAZMAT_SIGNAL_DANGER - danger, - CONTEXT_HAZMAT_SIGNAL_WARNING - warnging, - CONTEXT_HAZMAT_SIGNAL_CAUTION - caution, - CONTEXT_HAZMAT_SIGNAL_NOTICE - notice, 20. Risk - warning pictogram context_id = \"CONTEXT_HAZMAT_PICTOGRAM\" Takes values context_value_id: - GHS01, GHS02, GHS03, GHS04, GHS05, GHS06, GHS07, GHS08, GHS09 21. Risk - type of hazard: context_id = \"CONTEXT_HAZMAT_STATEMENT\" Takes values context_value_id: - H200, H201, H202, H203, H204, H205, H220, H221, H222, H223, H224, H225, H226, H228, H240, H241, H242, H250, H251, H252, H260, H261, H270, H271, H272, H280, H281, H290, H300, H301, H302, H304, H310, H311, H312, H314, H315, H317, H318, H319, H330, H331, H332, H334, H335, H336, H340, H341, H350, H351, H360, H361, H362, H370, H371, H372, H373, H400, H410, H411, H412, H413, EUH 001, EUH 014, EUH 018, EUH 019, EUH 044, EUH 029, EUH 031, EUH 032, EUH 066, EUH 070, EUH 071, EUH 201, EUH 201A, EUH 202, EUH 203, EUH 204, EUH 205, EUH 206, EUH 207, EUH 208, EUH 209, EUH 209A, EUH 210, EUH 401 22. Repair score: context_id = \"CONTEXT_REPAIR_SCORE\" Takes values context_value_id: - The value of the additional feature is set automatically based on the parameter's value 23. Safety - information pictogram: context_id = \"CONTEXT_SAFETY_PICTOGRAM\" Takes values context_value_id: - 1 (Not suitable for small children) - 2 (CE mark) 24. Safety - type of warning: context_id = \"CONTEXT_SAFETY_STATEMENT\" Takes values context_value_id: - 1 (Not suitable for children under 3 years) - 2 (Keep out of the reach of children) - 3 (Product contains a button cell or coin battery) - 4 (Use under the direct supervision of adults) - 5 (Required protective gear. Do not use in public traffic) - 6 (Contains toy. Adult supervision recommended) - 7 (To prevent possible injury from entanglement, remove this toy as soon as the child begins to crawl) - 8 (Use only in shallow water under adult supervision) - 9 (Only use under adult supervision) - 10 (This toy does not provide protection) - 11 (Contains fragrances that may cause allergies) - 12 (For household use only). */
2753
- context_id: (context_id: string) => this
2767
+ context_id: (context_id: number|string) => this
2754
2768
  /** value of additional feature - Values described in context_id. */
2755
- context_value_id: (context_value_id: string) => this
2769
+ context_value_id: (context_value_id: number|string) => this
2756
2770
  }
2757
2771
 
2758
2772
  export interface SearchProductsParametersRequest extends PagableGateway<SearchProductsParametersRequest, SearchProductsParametersResponse, RequestParams.SearchProductsParametersParams> {
@@ -2781,7 +2795,7 @@ export interface DeleteProductsRequest extends AppendableGateway<DeleteProductsR
2781
2795
 
2782
2796
  export interface GetProductsRequest extends Gateway<SearchProductsResponse> {
2783
2797
  /** List of the unique, indexed product codes (IAI code / External system code / Producer code). You can transfer a maximum of 100 products IDs in one request. */
2784
- productIds: (value: string|string[]) => this;
2798
+ productIds: (value: number|string|number[]|string[]) => this;
2785
2799
  }
2786
2800
 
2787
2801
  export interface PostProductsRequest extends AppendableGateway<PostProductsRequest, PostProductsResponse, RequestParams.PostProductsParams> {
@@ -3520,7 +3534,7 @@ export interface PutProductsSeriesFilterRequest extends AppendableGateway<PutPro
3520
3534
  /** Active filters. */
3521
3535
  filtersActive: (value: Array<JSObject>) => this;
3522
3536
  /** Menu filter ID. */
3523
- filterId: (filterId: string) => this
3537
+ filterId: (filterId: number|string) => this
3524
3538
  /** Filter name on page. */
3525
3539
  filterName: (filterName: string) => this
3526
3540
  /** Display as: "name" - text, "gfx" - graphics, "namegfx" - text and graphics. */
@@ -3963,7 +3977,7 @@ export interface GetRmaRequest extends PagableGateway<GetRmaRequest, GetRmaRespo
3963
3977
  /** Login of the user handling the complaint */
3964
3978
  operatorLogin: (value: string) => this;
3965
3979
  /** Unique client's number. */
3966
- clientId: (value: string) => this;
3980
+ clientId: (value: number|string) => this;
3967
3981
  /** Complaint creation date in the YYYY-MM-DD format */
3968
3982
  creationDate: (value: JSObject) => this;
3969
3983
  /** Complaint modification date in the YYYY-MM-DD format */
@@ -4044,7 +4058,7 @@ export interface PutSizesRequest extends AppendableGateway<PutSizesRequest, PutS
4044
4058
  /** Size group ID. */
4045
4059
  group_id: (group_id: number|string) => this
4046
4060
  /** Size identifier. */
4047
- id: (id: string) => this
4061
+ id: (id: number|string) => this
4048
4062
  /** Category plural name. */
4049
4063
  name: (name: string) => this
4050
4064
  /** Size description. */
@@ -4546,23 +4560,23 @@ export interface PutVouchersRequest extends AppendableGateway<PutVouchersRequest
4546
4560
  }
4547
4561
 
4548
4562
  export interface GetWarrantiesCountTotalRequest extends Gateway<GetWarrantiesCountTotalResponse> {
4549
- warranty_ids: (value: string|string[]) => this;
4563
+ warranty_ids: (value: number|string|number[]|string[]) => this;
4550
4564
  }
4551
4565
 
4552
4566
  export interface PutWarrantiesLanguageDataRequest extends AppendableGateway<PutWarrantiesLanguageDataRequest, PutWarrantiesLanguageDataResponse, RequestParams.PutWarrantiesLanguageDataParams> {
4553
4567
  lang_data: (value: RequestParams.PutWarrantiesLanguageDataParams["lang_data"]) => this;
4554
4568
  /** Warranty ID (numeric or text based). */
4555
- warranty_id: (warranty_id: string) => this
4569
+ warranty_id: (warranty_id: number|string) => this
4556
4570
  /** */
4557
4571
  lang: (lang: RequestParams.PutWarrantiesLanguageDataParams["lang_data"][number]["lang"]) => this
4558
4572
  }
4559
4573
 
4560
4574
  export interface DeleteWarrantiesRequest extends Gateway {
4561
- warranty_ids: (value: string|string[]) => this;
4575
+ warranty_ids: (value: number|string|number[]|string[]) => this;
4562
4576
  }
4563
4577
 
4564
4578
  export interface GetWarrantiesRequest extends PagableGateway<GetWarrantiesRequest, GetWarrantiesResponse> {
4565
- warranty_ids: (value: string|string[]) => this;
4579
+ warranty_ids: (value: number|string|number[]|string[]) => this;
4566
4580
  /** Number of results on page. */
4567
4581
  results_limit: (value: number|string) => this;
4568
4582
  /** Result page number. */
@@ -4587,7 +4601,7 @@ export interface PostWarrantiesRequest extends AppendableGateway<PostWarrantiesR
4587
4601
  export interface PutWarrantiesRequest extends AppendableGateway<PutWarrantiesRequest, PutWarrantiesResponse, RequestParams.PutWarrantiesParams> {
4588
4602
  warranties: (value: RequestParams.PutWarrantiesParams["warranties"]) => this;
4589
4603
  /** Warranty ID (numeric or text based). */
4590
- id: (id: string) => this
4604
+ id: (id: number|string) => this
4591
4605
  /** Name. */
4592
4606
  name: (name: string) => this
4593
4607
  /** */
package/dist/index.js CHANGED
@@ -1,12 +1,28 @@
1
1
  import ENUMS from "./enums.js";
2
2
  import utils from "./utils.js";
3
3
  import { gateProxy } from "./gates.js";
4
+ import { IdosellFaultStringError, catchEmptyList } from "./errors.js";
4
5
  export const DEFAULT_VERSION = 7;
6
+ function normalizeUrl(input) {
7
+ const trimmed = input.trim();
8
+ const withProtocol = trimmed
9
+ .replace(/^https?:\/\//i, "") // strip existing protocol
10
+ .replace(/^\/{2}/, ""); // strip bare // (protocol-relative)
11
+ const normalized = `https://${withProtocol}`;
12
+ let parsed;
13
+ try {
14
+ parsed = new URL(normalized);
15
+ }
16
+ catch {
17
+ throw new Error(`Invalid URL: "${input}"`);
18
+ }
19
+ return parsed.origin;
20
+ }
5
21
  const idosell = (url, apiKey, version = DEFAULT_VERSION) => {
6
- const auth = { url, apiKey, version, apikey: apiKey ? apiKey.slice(0, 6) + '*'.repeat(20) : "" };
22
+ const auth = { url: normalizeUrl(url), apiKey, version, apikey: apiKey ? apiKey.slice(0, 6) + '*'.repeat(20) : "" };
7
23
  Object.defineProperty(auth, 'apiKey', { enumerable: false });
8
24
  const element = { auth, params: {} };
9
25
  return new Proxy(element, gateProxy);
10
26
  };
11
27
  export default idosell;
12
- export { ENUMS, utils };
28
+ export { ENUMS, utils, IdosellFaultStringError, catchEmptyList };
@@ -6,7 +6,7 @@ export default (object) => {
6
6
  arrayNode: "products",
7
7
  index: 0
8
8
  };
9
- object.req = ["productSizeCodeExternal", "stockId"];
9
+ object.req = [{ "any": ["productSizeCodeExternal", "productIndex", "productSizeCodeProducer"] }, "stockId"];
10
10
  object.arrays = ["products"];
11
11
  return new Proxy(object, paramsProxy);
12
12
  };
package/dist/params.js CHANGED
@@ -32,10 +32,12 @@ export const paramsProxy = {
32
32
  }
33
33
  else if (object.custom && typeof object.custom[property] === 'function') {
34
34
  const param = object.custom[property](...values);
35
- if (param.root)
36
- Object.assign(object.params, param.root);
37
- else
38
- Object.assign(item, param);
35
+ if (param) {
36
+ if (param.root)
37
+ Object.assign(object.params, param.root);
38
+ else
39
+ Object.assign(item, param);
40
+ }
39
41
  }
40
42
  else {
41
43
  item[property] = values[0];
package/dist/request.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import axios from "axios";
2
2
  import { page } from "./helpers.js";
3
- import { inspect } from 'util';
3
+ import { IdosellFaultStringError } from "./errors.js";
4
4
  const DECODE_TABLE = [
5
5
  ['Å\x82', "ł"],
6
6
  ['Ä\x99', 'ę']
7
7
  ];
8
+ const DEFAULT_LOG_FUNCTION = console.log;
8
9
  const catchIdosellError = (err) => {
9
10
  if (!err.response) {
10
11
  if (err.cause)
@@ -29,21 +30,28 @@ const catchIdosellError = (err) => {
29
30
  throw new Error(`${err.response.status}: ${message}`, { cause: err.response.status });
30
31
  };
31
32
  const checkNext = (request, response, logPage) => {
33
+ if (logPage === true)
34
+ logPage = DEFAULT_LOG_FUNCTION;
32
35
  if (!response)
33
36
  return;
34
- if (response?.errors?.faultCode > 0)
35
- throw new Error(response.errors.faultString, { cause: response.errors });
37
+ if (response?.errors?.faultString) {
38
+ const faultStructure = {
39
+ faultCode: response?.errors?.faultCode ?? 999,
40
+ faultString: response.errors.faultString,
41
+ };
42
+ throw new IdosellFaultStringError(response.errors.faultString, faultStructure);
43
+ }
36
44
  if (response.resultsNumberPage) {
37
45
  request.next = response.resultsPage + 1 < response.resultsNumberPage;
38
46
  request.params.resultsPage = request.params.resultsPage ? request.params.resultsPage + 1 : 1;
39
47
  if (logPage)
40
- console.log('Page: ' + response.resultsPage + ' / ' + response.resultsNumberPage);
48
+ logPage('Page: ' + response.resultsPage + ' / ' + response.resultsNumberPage);
41
49
  }
42
50
  else if (response.results_number_page) {
43
51
  request.next = response.results_page + 1 < response.results_number_page;
44
52
  request.params.results_page = request.params.results_page ? request.params.results_page + 1 : 1;
45
53
  if (logPage)
46
- console.log('Page: ' + response.results_page + ' / ' + response.results_page);
54
+ logPage('Page: ' + response.results_page + ' / ' + response.results_page);
47
55
  }
48
56
  return response;
49
57
  };
@@ -141,10 +149,21 @@ export const sendRequest = async (request, options = {}) => {
141
149
  request.next = false;
142
150
  const { method, node } = request.gate;
143
151
  let url = `${request.auth.url}/api/admin/v${request.auth.version}${node}`;
144
- if (options.log || options.dump) {
145
- console.log(inspect({ params: request.params, method, url }, { showHidden: false, depth: null, colors: true }));
146
- if (options.dump)
152
+ if (options.dump || options.log) {
153
+ const dumpData = { params: request.params, method, url };
154
+ if (options.dump) {
155
+ if (options.dump === true)
156
+ DEFAULT_LOG_FUNCTION(dumpData);
157
+ else
158
+ options.dump(dumpData);
147
159
  return {};
160
+ }
161
+ else if (options.log) {
162
+ if (options.log === true)
163
+ DEFAULT_LOG_FUNCTION(dumpData);
164
+ else
165
+ options.log(dumpData);
166
+ }
148
167
  }
149
168
  if (method === 'get' || method === 'delete') {
150
169
  url += '?' + queryfy(request.params);
@@ -1758,6 +1758,10 @@ export type GetOrdersDocumentsResponse = {
1758
1758
  documentId?: string;
1759
1759
  /** @description Document name */
1760
1760
  documentName?: string;
1761
+ /** @description Internal document number in the KSeF system */
1762
+ ksefNumber: string;
1763
+ /** @description Document status in the IdoSell system */
1764
+ ksefDocumentStatus: "pending" | "processing" | "completed" | "failed" | "skipped";
1761
1765
  /** @description Base64 encoded PDF document. */
1762
1766
  pdfWithDocumentsInBase64?: string;
1763
1767
  /** @description Information on error that occurred during gate call. */
@@ -4962,6 +4966,8 @@ export type SearchProductsResponse = {
4962
4966
  responsibleProducerCode?: string | null;
4963
4967
  /** @description Responsible person code */
4964
4968
  responsiblePersonCode?: string | null;
4969
+ /** @description Minimum stock level */
4970
+ minStockLevel?: number;
4965
4971
  }[];
4966
4972
  } & PagedResponse;
4967
4973
 
@@ -8660,7 +8666,484 @@ export type GetProductsResponse = {
8660
8666
  depositProductId?: number;
8661
8667
  /** @description Product deposit count */
8662
8668
  depositCount?: number;
8669
+ /** @description Minimum stock level */
8670
+ minStockLevel?: number;
8663
8671
  }[];
8664
8672
  } & { resultsLimit: number; };
8665
8673
 
8674
+ export type GetOrdersResponse = {
8675
+ Results: {
8676
+ /** @description Order ID. */
8677
+ orderId: string;
8678
+ /** @description Order note supported by IAI Bridge. */
8679
+ orderBridgeNote: string;
8680
+ /** @description Order serial number. */
8681
+ orderSerialNumber: number;
8682
+ /** @description Order type. List of values: "p" - wholesale order placed in panel, "t" - wholesale order placed in shop, "n" - retail order placed in shop, "r" - retail order placed in panel. */
8683
+ orderType: "p" | "t" | "n" | "r";
8684
+ /** @description Customer data. */
8685
+ clientResult: {
8686
+ /** @description Client's billing address' data. */
8687
+ clientBillingAddress: {
8688
+ /** @description Customer's first name. */
8689
+ clientFirstName: string;
8690
+ /** @description Customer's last name. */
8691
+ clientLastName: string;
8692
+ /** @description Customer Tax no. */
8693
+ clientNip: string;
8694
+ /** @description Customer's company name. */
8695
+ clientFirm: string;
8696
+ /** @description Product suggestion. */
8697
+ clientAdditional: string;
8698
+ /** @description Street and number. */
8699
+ clientStreet: string;
8700
+ /** @description Customer's postal code. */
8701
+ clientZipCode: string;
8702
+ /** @description Customer's city. */
8703
+ clientCity: string;
8704
+ /** @description Region name takes priority over clientCountryId. */
8705
+ clientCountryName: string;
8706
+ /** @description Client NIP verification status */
8707
+ clientNipUeVerified: string;
8708
+ /** @description Country ID in accordance with ISO-3166. */
8709
+ clientCountryId: string;
8710
+ /** @description Cell phone. */
8711
+ clientPhone1: string;
8712
+ /** @description Land line. */
8713
+ clientPhone2: string;
8714
+ /** @description Administrative region code. */
8715
+ clientProvinceId: string;
8716
+ /** @description Administrative region. */
8717
+ clientProvince: string;
8718
+ };
8719
+ /** @description Delivery address data. */
8720
+ clientDeliveryAddress: {
8721
+ /** @description Delivery address ID. */
8722
+ clientDeliveryAddressId: string;
8723
+ /** @description Recipient's first name. */
8724
+ clientDeliveryAddressFirstName: string;
8725
+ /** @description Recipient's last name. */
8726
+ clientDeliveryAddressLastName: string;
8727
+ /** @description Company name. */
8728
+ clientDeliveryAddressFirm: string;
8729
+ /** @description Recipient street and number. */
8730
+ clientDeliveryAddressStreet: string;
8731
+ /** @description Recipient's postal code. */
8732
+ clientDeliveryAddressZipCode: string;
8733
+ /** @description Recipient's city. */
8734
+ clientDeliveryAddressCity: string;
8735
+ /** @description Recipient's country. */
8736
+ clientDeliveryAddressCountry: string;
8737
+ /** @description Country code in ISO 3166-1 standard. */
8738
+ clientDeliveryAddressCountryId: string;
8739
+ /** @description Cell phone. */
8740
+ clientDeliveryAddressPhone1: string;
8741
+ /** @description Land line. */
8742
+ clientDeliveryAddressPhone2: string;
8743
+ /** @description Administrative region code. */
8744
+ clientDeliveryAddressProvinceId: string;
8745
+ /** @description Administrative region. */
8746
+ clientDeliveryAddressProvince: string;
8747
+ /** @description Type of delivery address resulting from the type of delivery e.g. collection point. Available values: "client" - Address provided by customer to which he/she wishes to receive the shipment, "pickupPoint"- The address of the pickup point selected by the customer from which the customer wishes to pick up the order, "warehouse" - The address of the warehouse selected by the customer from which the customer wishes to pick up the order. */
8748
+ clientDeliveryAddressType: "client" | "pickupPoint" | "warehouse";
8749
+ /** @description Internal Receiving Point Identifier. */
8750
+ clientDeliveryAddressPickupPointInternalId: number;
8751
+ };
8752
+ clientPickupPointAddress: {
8753
+ /** @description Collection point ID. */
8754
+ pickupPointId: string;
8755
+ /** @description External service collection point ID. */
8756
+ externalPickupPointId: string;
8757
+ /** @description Town / City. */
8758
+ city: string;
8759
+ /** @description Address. */
8760
+ street: string;
8761
+ /** @description ZIP / Post code. */
8762
+ zipCode: string;
8763
+ /** @example description */
8764
+ description: string;
8765
+ /** @description Latitude. */
8766
+ latitude: number;
8767
+ /** @description Longitude. */
8768
+ longitude: number;
8769
+ /** @description Name. */
8770
+ name: string;
8771
+ };
8772
+ /** @description Buyer's address data. */
8773
+ payerAddress: {
8774
+ /** @description Buyer's address id. */
8775
+ payerAddressId: string;
8776
+ /** @description Buyer's first name. */
8777
+ payerAddressFirstName: string;
8778
+ /** @description Buyer's last name. */
8779
+ payerAddressLastName: string;
8780
+ /** @description Company name. */
8781
+ payerAddressFirm: string;
8782
+ /** @description Customer VAT ID. */
8783
+ payerAddressNip: string;
8784
+ /** @description Buyer's street name and house number. */
8785
+ payerAddressStreet: string;
8786
+ /** @description Buyer's postal code. */
8787
+ payerAddressZipCode: string;
8788
+ /** @description Buyer's city. */
8789
+ payerAddressCity: string;
8790
+ /** @description Buyer's country. */
8791
+ payerAddressCountry: string;
8792
+ /** @description Country code in the ISO 3166-1 A2 standard. */
8793
+ payerAddressCountryId: string;
8794
+ /** @description Buyer's telephone number. */
8795
+ payerAddressPhone: string;
8796
+ };
8797
+ /** @description Data of customer account in store. */
8798
+ clientAccount: {
8799
+ /** @description Unique client's number. */
8800
+ clientId: number;
8801
+ /** @description Customer's login. */
8802
+ clientLogin: string;
8803
+ /** @description E-mail address. */
8804
+ clientEmail: string;
8805
+ /** @description Cell phone. */
8806
+ clientPhone1: string;
8807
+ /** @description Land line. */
8808
+ clientPhone2: string;
8809
+ /** @description External system code. */
8810
+ clientCodeExternal: string;
8811
+ };
8812
+ /** @description End customer details. */
8813
+ endClientAccount: {
8814
+ /** @description Unique client's number. */
8815
+ clientId: number;
8816
+ /** @description Customer's login. */
8817
+ clientLogin: string;
8818
+ /** @description E-mail address. */
8819
+ clientEmail: string;
8820
+ /** @description Cell phone. */
8821
+ clientPhone1: string;
8822
+ /** @description Land line. */
8823
+ clientPhone2: string;
8824
+ /** @description External system code. */
8825
+ clientCodeExternal: string;
8826
+ };
8827
+ /** @description Is client on black list? */
8828
+ clientOnBlackList: boolean;
8829
+ };
8830
+ /** @description Order data. */
8831
+ orderDetails: {
8832
+ /** @description Flag informing on order registration or completion in external program through API. Allowed values. "none" - order was not registered in external program, "registered" - order was registered in external program, "realized" - order was completed in external program, "registered_pos" - order was registered in external program, "realized_pos" - order was completed in external program. */
8833
+ apiFlag: "none" | "registered" | "realized" | "registered_pos" | "realized_pos" | "registration_fault";
8834
+ /** @description Order status. Allowed values: "finished_ext" - order status: completed in FA application, "finished" - completed, "new" - not handled, "payment_waiting" - awaiting payment, "delivery_waiting" - awaiting delivery, "on_order" - in progress, "packed" - being picked, "packed_fulfillment" - being picked - fulfilment, "packed_ready" - packed, "ready" - ready, "wait_for_dispatch" - awaiting dispatch date, "suspended" - on hold, "joined" - merged, "missing" - missing, "lost" - lost, "false" - false, "canceled" - Customer canceled. */
8835
+ orderStatus: string;
8836
+ /** @description Order status id */
8837
+ orderStatusId: string;
8838
+ /** @description Date of change of status to the currently set status in YYYY-MM-DD HH:MM:SS format. */
8839
+ orderStatusChangeDate: string;
8840
+ /** @example dropshippingOrderStatus */
8841
+ dropshippingOrderStatus: string;
8842
+ /** @description Type of order confirmation. Confirmations listing: "none" - order unconfirmed , "email" - order confirmed by e-mail, "phone_client" - order confirmed by phone call made by client, "phone_service" - order confirmed by phone call made by staff, "postauction" - order confirmed by auction return page, "willingness" - confirmed by willingness to buy letter, "auctionfod" - confirmed by after-sales form Allegro. */
8843
+ orderConfirmation: string;
8844
+ /** @description Date of order placing in YYYY-MM-DD HH:MM:SS format. */
8845
+ orderAddDate: string;
8846
+ /** @description Date of order sending in YYYY-MM-DD HH:MM:SS format. */
8847
+ orderDispatchDate: string | null;
8848
+ /** @example receivedDate */
8849
+ receivedDate: string;
8850
+ /** @description Order handling time in seconds. */
8851
+ orderPrepareTime: string;
8852
+ /** @description Customer comments on order. */
8853
+ clientNoteToOrder: string;
8854
+ /** @description Customer remarks for courier. */
8855
+ clientNoteToCourier: string;
8856
+ /** @description Order payment data. */
8857
+ payments: {
8858
+ /** @description Order payment method. Allowed values. "cash_on_delivery" - cash on delivery, "prepaid" - prepayment, "tradecredit" - Trade credit. */
8859
+ orderPaymentType: string;
8860
+ /** @description Number of days. */
8861
+ orderPaymentDays: number;
8862
+ /** @description Accrued discount. */
8863
+ orderRebatePercent: number;
8864
+ /** @description Information on order value in currency of order adding. */
8865
+ orderCurrency: {
8866
+ /** @description Currency ID */
8867
+ currencyId: string;
8868
+ /** @description Currency average rate set for order (by default, an average rate of order adding date, if it wasn't manually changed). */
8869
+ orderCurrencyValue: number;
8870
+ /** @description Currency scaler. */
8871
+ orderCurrencyScale: number;
8872
+ /** @description Panel billing currency exchange rate in relation to billing currency in the shop . */
8873
+ billingCurrencyRate: number;
8874
+ /** @description Products cost. */
8875
+ orderProductsCost: number;
8876
+ /** @description Shipping costs. */
8877
+ orderDeliveryCost: number;
8878
+ /** @description Additional charge for selected payment method. */
8879
+ orderPayformCost: number;
8880
+ /** @description Additional fee for insurance. */
8881
+ orderInsuranceCost: number;
8882
+ };
8883
+ /** @description Information on order value in shop account currency. */
8884
+ orderBaseCurrency: {
8885
+ /** @example billingCurrency */
8886
+ billingCurrency: string;
8887
+ /** @description Products cost. */
8888
+ orderProductsCost: number;
8889
+ /** @description Shipping costs. */
8890
+ orderDeliveryCost: number;
8891
+ /** @description Delivery VAT. */
8892
+ orderDeliveryVat: number;
8893
+ /** @description Additional charge for selected payment method. */
8894
+ orderPayformCost: number;
8895
+ /** @description VAT for additional fee for the chosen form of payment. */
8896
+ orderPayformVat: number;
8897
+ /** @description Additional fee for insurance. */
8898
+ orderInsuranceCost: number;
8899
+ /** @description Insurance VAT rate (in percents). */
8900
+ orderInsuranceVat: number;
8901
+ };
8902
+ /** @description Order currency squaring method. "gross" - calculated in gross prices, "net" - squared in net prices. */
8903
+ orderWorthCalculateType: "gross" | "net";
8904
+ /** @description Information if the VAT for the current order was calculated: "y" - yes, "n" - no. */
8905
+ orderVatExists: string;
8906
+ };
8907
+ /** @description Information about prepayment for the order. */
8908
+ prepaids: {
8909
+ /** @description Order payment identifier. */
8910
+ prepaidId: number;
8911
+ /** @description Payment number for order. */
8912
+ paymentOrdinalNumber: number;
8913
+ /** @description Payment number - [order no.]-[payment no.], i.e. 1234-1. */
8914
+ paymentNumber: string;
8915
+ /** @description Date of payment addition. */
8916
+ paymentAddDate: string;
8917
+ /** @description Client's payment modification date. */
8918
+ paymentModifiedDateByClient: string;
8919
+ /** @description Payment modification date made by shop staff. */
8920
+ paymentModifiedDateByShop: string;
8921
+ /** @description Payment status. */
8922
+ paymentStatus: string;
8923
+ /** @description Transaction type: "payment" - payment, "advance" - advance payment, "repayment" - return, "fee" - handling fee. */
8924
+ paymentType: "payment" | "advance" | "repayment" | "fee";
8925
+ /** @description Form of payment ID. */
8926
+ payformId: number;
8927
+ /** @description Name of payment form. */
8928
+ payformName: string;
8929
+ /** @description Account. */
8930
+ payformAccount: string;
8931
+ /** @description Payment amount. */
8932
+ paymentValue: number;
8933
+ /** @description Currency ID */
8934
+ currencyId: string;
8935
+ /** @description Number of voucher used in a payment. */
8936
+ voucherNumber: string;
8937
+ /** @description Number of gift card used in a payment. */
8938
+ giftCardNumber: string;
8939
+ }[];
8940
+ /** @description Order source data. */
8941
+ orderSourceResults: {
8942
+ /** @description order source type - possible values:. "self_added" - Orders from panel, "shop" - Orders from shop, "search_engine" - Orders from search engines, "auction" - Orders from auctions, "advertisement_campaign" - Advertisement campaigns, "price_comparer" - Price comparison sites, "affiliate_program" - Affiliate programme, "api" - Order from API, "eletronic_offer" - Order from ODT price lst, "cpa" - Order from CPA program, "refferer_site" - Order from reference sites, "pos" - Orders from POS, "marketplace" - Order from the Marketplace, "iai_ads" - Orders from IAI Ads */
8943
+ orderSourceType: string;
8944
+ /** @description Shop Id */
8945
+ shopId: number;
8946
+ /** @description Auction site order comes from. Auction sites listing: "allegro" - Allegro.pl, "testwebapi" - Allegro.pl test site, "ebay" - eBay. */
8947
+ auctionsServiceName: string;
8948
+ /** @description Detailed information on order source. */
8949
+ orderSourceDetails: {
8950
+ /** @description order source type - possible values:. "self_added" - Orders from panel, "shop" - Orders from shop, "search_engine" - Orders from search engines, "auction" - Orders from auctions, "advertisement_campaign" - Advertisement campaigns, "price_comparer" - Price comparison sites, "affiliate_program" - Affiliate programme, "api" - Order from API, "eletronic_offer" - Order from ODT price lst, "cpa" - Order from CPA program, "refferer_site" - Order from reference sites, "pos" - Orders from POS, "marketplace" - Order from the Marketplace, "iai_ads" - Orders from IAI Ads */
8951
+ orderSourceType: string;
8952
+ /** @description Exact source name. */
8953
+ orderSourceName: string;
8954
+ /** @description Numerical ID of order source type. */
8955
+ orderSourceTypeId: number;
8956
+ /** @description Numerical ID of order source. */
8957
+ orderSourceId: number;
8958
+ /** @example 1 */
8959
+ entryProductIdBeforeOrder: number;
8960
+ /** @example sourcePageUrl */
8961
+ sourcePageUrl: string;
8962
+ /** @description The order ID of the external service */
8963
+ orderExternalId: string;
8964
+ /** @description Order from the InPost Fresh marketplace */
8965
+ fresh: "y" | "n";
8966
+ /** @description Order supported by InPost fulfillment */
8967
+ fulfillment: "y" | "n";
8968
+ };
8969
+ preorderSourcesDetails: {
8970
+ /** @description order source type - possible values:. "self_added" - Orders from panel, "shop" - Orders from shop, "search_engine" - Orders from search engines, "auction" - Orders from auctions, "advertisement_campaign" - Advertisement campaigns, "price_comparer" - Price comparison sites, "affiliate_program" - Affiliate programme, "api" - Order from API, "eletronic_offer" - Order from ODT price lst, "cpa" - Order from CPA program, "refferer_site" - Order from reference sites, "pos" - Orders from POS, "marketplace" - Order from the Marketplace, "iai_ads" - Orders from IAI Ads */
8971
+ orderSourceType: string;
8972
+ /** @description Exact source name. */
8973
+ orderSourceName: string;
8974
+ /** @description Numerical ID of order source type. */
8975
+ orderSourceTypeId: number;
8976
+ /** @description Numerical ID of order source. */
8977
+ orderSourceId: number;
8978
+ /** @example entryDate */
8979
+ entryDate: string;
8980
+ }[];
8981
+ };
8982
+ /** @description Data of auction, order comes from (only if it comes from auction). */
8983
+ auctionInfo: {
8984
+ /** @description Account ID on auction site. */
8985
+ auctionClientId: string;
8986
+ /** @description Account login on auction site. */
8987
+ auctionClientLogin: string;
8988
+ /** @description #!TablicaNumerowAukcjiDoZamowienia!#. */
8989
+ auctionItemsIds: {
8990
+ /** @description Auction number. */
8991
+ auctionItemId: string;
8992
+ }[];
8993
+ /** @description The customer's email address at the auction service. */
8994
+ auctionClientEmail: string;
8995
+ };
8996
+ /** @description Consignment data. */
8997
+ dispatch: {
8998
+ /** @description Courier ID. */
8999
+ courierId: number;
9000
+ /** @description Name of the supplier of the shipment. */
9001
+ courierName: string;
9002
+ /** @description Courier via webservice. */
9003
+ courierWebserviceOnly: boolean;
9004
+ /** @description Shipment ID. */
9005
+ deliveryPackageId: string;
9006
+ /** @description Selected delivery date. */
9007
+ deliveryDate: string;
9008
+ /** @description Additional information on delivery date. */
9009
+ deliveryDateAdditional: string;
9010
+ /** @description Estimated date of shipment of the order. */
9011
+ estimatedDeliveryDate: string;
9012
+ /** @description Parcel weight. */
9013
+ deliveryWeight: number;
9014
+ };
9015
+ /** @description The list of products returned due to a gate call */
9016
+ productsResults: {
9017
+ /** @description Product IAI code */
9018
+ productId: number;
9019
+ /** @description Product name. */
9020
+ productName: string;
9021
+ /** @description External product system code */
9022
+ productCode: string;
9023
+ /** @description Name of the parameter value, e.g. orange, green, red */
9024
+ versionName: string;
9025
+ /** @description Size identifier */
9026
+ sizeId: string;
9027
+ /** @description Size name */
9028
+ sizePanelName: string;
9029
+ /** @description External product system code for size. */
9030
+ productSizeCodeExternal: string;
9031
+ /** @description Stock ID */
9032
+ stockId: number;
9033
+ /** @description Serial number of the product. */
9034
+ productSerialNumber: string;
9035
+ /** @description Product quantity. */
9036
+ productQuantity: number;
9037
+ /** @description Weight. */
9038
+ productWeight: number;
9039
+ /** @description Value of VAT */
9040
+ productVat: number;
9041
+ /** @description Is product VAT free Allowed values "y" - yes, "n" - no. */
9042
+ productVatFree: string;
9043
+ /** @description Gross price of the product in the currency of the administration panel. */
9044
+ productPanelPrice: number;
9045
+ /** @description Net price of the product in the currency of the administration panel. */
9046
+ productPanelPriceNet: number;
9047
+ /** @description Product gross price of order in order currency. */
9048
+ productOrderPrice: number;
9049
+ /** @description Product net price of order in order currency. */
9050
+ productOrderPriceNet: number;
9051
+ /** @description Product gross price of order in shop account currency. */
9052
+ productOrderPriceBaseCurrency: number;
9053
+ /** @description Product net price of order in shop account currency. */
9054
+ productOrderPriceNetBaseCurrency: number;
9055
+ /** @description List of product suggestions . */
9056
+ orderAdditionalList: {
9057
+ /** @description Product suggestion. */
9058
+ orderAdditional: {
9059
+ /** @description Name of suggestion. */
9060
+ orderAdditionalName: string;
9061
+ /** @description Value of suggestion. */
9062
+ orderAdditionalValue: string;
9063
+ };
9064
+ };
9065
+ /** @description Client's remarks on product. */
9066
+ remarksToProduct: string;
9067
+ /** @description Label for grouping products. */
9068
+ label: string;
9069
+ /** @description Product selling mode. Available values: "money", "gift", "points". */
9070
+ orderSalesMode: "money" | "gift" | "points";
9071
+ /** @description A set's ID. */
9072
+ bundleId: number;
9073
+ /** @description Serial numbers. */
9074
+ productSerialNumbers: string;
9075
+ /** @description Additional information. */
9076
+ productOrderAdditional: string;
9077
+ /** @description Item in basket. */
9078
+ basketPosition: number;
9079
+ /** @description price information. */
9080
+ productPriceLog: string;
9081
+ /** @description Information about the selected parameters in the configurator. */
9082
+ priceFormulaParameters: {
9083
+ /** @description Parameter ID */
9084
+ parameterId: string;
9085
+ /** @description Parameter name. */
9086
+ parameterName: string;
9087
+ /** @description Parameter values */
9088
+ parameterValues: {
9089
+ /** @example valueId */
9090
+ valueId: string;
9091
+ /** @example valueName */
9092
+ valueName: string;
9093
+ }[];
9094
+ }[];
9095
+ /** @description Is product packed? */
9096
+ productPacked: boolean;
9097
+ }[];
9098
+ /** @description Parameter determines if product has been removed from stock. List of values: "y" - removed from stock, "n" - put in stock. */
9099
+ productRemovedInStock: "y" | "n";
9100
+ /** @description Stock ID */
9101
+ stockId: number;
9102
+ /** @description Customer asked for invoice. List of parameters: "y" - yes (paper invoicing ), "e" - yes (electronic invoicing ), "n" - no. */
9103
+ clientRequestInvoice: string;
9104
+ /** @description Delivery address ID. */
9105
+ clientDeliveryAddressId: number;
9106
+ /** @description Note to the order. */
9107
+ orderNote: string;
9108
+ /** @description Information on used discount code. */
9109
+ discountCode: {
9110
+ /** @description Campaign ID. */
9111
+ campaignId: string;
9112
+ /** @description Name of code. */
9113
+ discountCodeName: string;
9114
+ /** @description Accrued discount */
9115
+ discountCodeValue: string;
9116
+ };
9117
+ /** @description Discount card */
9118
+ discountCard: {
9119
+ /** @description Name of card */
9120
+ discountCardName: string;
9121
+ };
9122
+ /** @description Order handler. */
9123
+ orderOperatorLogin: string;
9124
+ /** @description Order picker. */
9125
+ orderPackingPersonLogin: string;
9126
+ /** @description Sale date. ISO 8602 format. */
9127
+ purchaseDate: string;
9128
+ /** @description Modification date in YYYY-MM-DD HH:MM:SS format . */
9129
+ orderChangeDate: string;
9130
+ /** @description Source subscription identifier. */
9131
+ subscriptionId: number;
9132
+ /** @description Are all products packed? */
9133
+ allProductPacked: boolean;
9134
+ /** @description Planned date of packing */
9135
+ plannedDateOfPacking: string | null;
9136
+ /** @description Is order verified? */
9137
+ verified: boolean;
9138
+ };
9139
+ /** @description Information on error that occurred during gate call. */
9140
+ errors: {
9141
+ /** @description Error code. */
9142
+ faultCode: number;
9143
+ /** @description Error description. */
9144
+ faultString: string;
9145
+ }[];
9146
+ }[];
9147
+ };
9148
+
8666
9149
  export { };
package/dist/utils.d.ts CHANGED
@@ -17,7 +17,7 @@ export type MapProductLocationsFunction = (product: IdosellProduct, stockId?: nu
17
17
 
18
18
  export type GetLangDataFunction = <T extends { langId: string}>(array: T[], langId?: string) => T|undefined;
19
19
 
20
- export type ClearParametersLangDataFunction = (products: SearchProductsResponse['results'], langId: string = 'pol') => SearchProductsResponse['results'];
20
+ export type ClearParametersLangDataFunction = (products: SearchProductsResponse['results'], langId?: string) => SearchProductsResponse['results'];
21
21
 
22
22
  declare namespace utils {
23
23
  /** @description The method allows you to build an IAI code from the product ID and size ID. */
package/dist/utils.js CHANGED
@@ -1,4 +1,3 @@
1
- import { PRODUCE_SIZE_INDEX } from "./enums.d.js";
2
1
  import ENUMS from "./enums.js";
3
2
  const getIaiCode = (productId, sizeId) => {
4
3
  if (sizeId === 'uniw')
@@ -136,9 +135,9 @@ const sumProductQuantities = (productStocksData, nodeName = ENUMS.PRODUCT_SIZE_C
136
135
  };
137
136
  const getProductIndexFunction = (type, product) => {
138
137
  switch (type) {
139
- case PRODUCE_SIZE_INDEX.ID: return (obj) => obj.sizeId;
140
- case PRODUCE_SIZE_INDEX.IAI_CODE: return (obj) => getIaiCode(product.productId, obj.sizeId);
141
- case PRODUCE_SIZE_INDEX.NAME: {
138
+ case ENUMS.PRODUCE_SIZE_INDEX.ID: return (obj) => obj.sizeId;
139
+ case ENUMS.PRODUCE_SIZE_INDEX.IAI_CODE: return (obj) => getIaiCode(product.productId, obj.sizeId);
140
+ case ENUMS.PRODUCE_SIZE_INDEX.NAME: {
142
141
  return (obj) => {
143
142
  if (obj.sizePanelName)
144
143
  return obj.sizePanelName;
@@ -263,6 +262,13 @@ const clearParametersLangData = (products, langId = 'pol') => {
263
262
  }
264
263
  return products;
265
264
  };
265
+ const removeRmaAttachments = (rmaResponse) => {
266
+ for (const rma of rmaResponse.rmas) {
267
+ for (const product of rma.products)
268
+ product.attachments = [];
269
+ }
270
+ return rmaResponse;
271
+ };
266
272
  export default {
267
273
  /** @description The method allows you to build an IAI code from the product ID and size ID. */
268
274
  getIaiCode,
@@ -279,5 +285,7 @@ export default {
279
285
  /** @description Get first item (description, series, parameter name or value) with the selected langId */
280
286
  getLangData,
281
287
  /** @description Modifies product response by removing all parameter names nad values that are not in selected langId */
282
- clearParametersLangData
288
+ clearParametersLangData,
289
+ /** @description Removes attachments to RMA that are returned by default, helps to reduce data if serialized or forwarded */
290
+ removeRmaAttachments
283
291
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idosell",
3
- "version": "0.4.20",
3
+ "version": "0.4.24",
4
4
  "description": "Idosell 3 REST connector",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/gateways.d.ts",