btrz-api-client 8.34.0 → 8.36.0

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.
Files changed (99) hide show
  1. package/lib/client-standalone-min.js +3 -3
  2. package/lib/client.js +4 -0
  3. package/lib/endpoints/inventory/banks.js +39 -21
  4. package/lib/endpoints/inventory/change-requests.js +59 -31
  5. package/lib/endpoints/inventory/control-classes.js +39 -20
  6. package/lib/endpoints/inventory/countries.js +25 -9
  7. package/lib/endpoints/inventory/custom-content.js +38 -21
  8. package/lib/endpoints/inventory/custom-fields.js +25 -17
  9. package/lib/endpoints/inventory/document-types.js +33 -42
  10. package/lib/endpoints/inventory/external-wallets.js +26 -20
  11. package/lib/endpoints/inventory/fees.js +24 -17
  12. package/lib/endpoints/inventory/filtered-trips.js +34 -8
  13. package/lib/endpoints/inventory/financing-costs.js +19 -14
  14. package/lib/endpoints/inventory/garages.js +19 -14
  15. package/lib/endpoints/inventory/getnet-terminals.js +20 -15
  16. package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
  17. package/lib/endpoints/inventory/holidays.js +158 -0
  18. package/lib/endpoints/inventory/insurances.js +17 -13
  19. package/lib/endpoints/inventory/items.js +13 -9
  20. package/lib/endpoints/inventory/labels.js +16 -11
  21. package/lib/endpoints/inventory/marital-status.js +16 -11
  22. package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
  23. package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
  24. package/lib/endpoints/inventory/mit-terminals.js +16 -11
  25. package/lib/endpoints/inventory/operation-messages.js +18 -12
  26. package/lib/endpoints/inventory/operation-reasons.js +15 -10
  27. package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
  28. package/lib/endpoints/inventory/payment-terminals.js +15 -10
  29. package/lib/endpoints/inventory/products.js +22 -10
  30. package/lib/endpoints/inventory/promos.js +27 -18
  31. package/lib/endpoints/inventory/station-groups.js +2 -4
  32. package/lib/endpoints/inventory/taxes.js +11 -2
  33. package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
  34. package/lib/endpoints/inventory/vehicle-types.js +2 -5
  35. package/lib/endpoints/inventory/vehicles.js +4 -2
  36. package/lib/endpoints/notifications/customers.js +1 -1
  37. package/lib/endpoints/notifications/external-customers.js +54 -0
  38. package/lib/endpoints/notifications/pdfs.js +0 -3
  39. package/lib/endpoints/operations/accounting_items.js +7 -1
  40. package/lib/endpoints/operations/flexpasses.js +9 -7
  41. package/lib/endpoints/operations/gift-certificates.js +53 -0
  42. package/lib/endpoints/operations/loans.js +16 -10
  43. package/lib/endpoints/operations/movements.js +17 -6
  44. package/lib/endpoints/operations/pago-express.js +96 -0
  45. package/lib/endpoints/operations/parcels.js +11 -11
  46. package/lib/endpoints/operations/parcels_manifests.js +7 -4
  47. package/package.json +1 -1
  48. package/src/client.js +4 -0
  49. package/src/endpoints/inventory/banks.js +39 -21
  50. package/src/endpoints/inventory/change-requests.js +59 -31
  51. package/src/endpoints/inventory/control-classes.js +39 -20
  52. package/src/endpoints/inventory/countries.js +25 -10
  53. package/src/endpoints/inventory/custom-content.js +38 -22
  54. package/src/endpoints/inventory/custom-fields.js +25 -19
  55. package/src/endpoints/inventory/document-types.js +34 -33
  56. package/src/endpoints/inventory/external-wallets.js +25 -20
  57. package/src/endpoints/inventory/fees.js +24 -18
  58. package/src/endpoints/inventory/filtered-trips.js +29 -8
  59. package/src/endpoints/inventory/financing-costs.js +19 -14
  60. package/src/endpoints/inventory/garages.js +19 -14
  61. package/src/endpoints/inventory/getnet-terminals.js +20 -15
  62. package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
  63. package/src/endpoints/inventory/holidays.js +121 -0
  64. package/src/endpoints/inventory/insurances.js +17 -13
  65. package/src/endpoints/inventory/items.js +13 -9
  66. package/src/endpoints/inventory/labels.js +16 -11
  67. package/src/endpoints/inventory/marital-status.js +16 -11
  68. package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
  69. package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
  70. package/src/endpoints/inventory/mit-terminals.js +16 -11
  71. package/src/endpoints/inventory/operation-messages.js +18 -12
  72. package/src/endpoints/inventory/operation-reasons.js +15 -10
  73. package/src/endpoints/inventory/pay-on-accounts.js +5 -4
  74. package/src/endpoints/inventory/payment-terminals.js +15 -10
  75. package/src/endpoints/inventory/products.js +22 -10
  76. package/src/endpoints/inventory/promos.js +27 -18
  77. package/src/endpoints/inventory/station-groups.js +2 -4
  78. package/src/endpoints/inventory/taxes.js +11 -2
  79. package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
  80. package/src/endpoints/inventory/vehicle-types.js +3 -4
  81. package/src/endpoints/inventory/vehicles.js +4 -3
  82. package/src/endpoints/notifications/customers.js +1 -1
  83. package/src/endpoints/notifications/external-customers.js +41 -0
  84. package/src/endpoints/notifications/pdfs.js +0 -3
  85. package/src/endpoints/operations/accounting_items.js +7 -2
  86. package/src/endpoints/operations/flexpasses.js +9 -7
  87. package/src/endpoints/operations/gift-certificates.js +39 -0
  88. package/src/endpoints/operations/loans.js +16 -11
  89. package/src/endpoints/operations/movements.js +17 -6
  90. package/src/endpoints/operations/pago-express.js +73 -0
  91. package/src/endpoints/operations/parcels.js +11 -11
  92. package/src/endpoints/operations/parcels_manifests.js +7 -5
  93. package/test/endpoints/inventory/banks.test.js +8 -10
  94. package/test/endpoints/inventory/filtered-trips.test.js +6 -0
  95. package/test/endpoints/inventory/holidays.test.js +52 -0
  96. package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
  97. package/test/endpoints/notifications/external-customers.test.js +30 -0
  98. package/test/endpoints/operations/gift_certificates.test.js +37 -0
  99. package/test/endpoints/operations/operations.test.js +30 -0
@@ -3,7 +3,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
3
3
  /**
4
4
  * Query params for GET /countries (btrz-api-inventory). See get-countries getSpec().
5
5
  * @typedef {Object} CountriesListQuery
6
- * @property {string} [isoCode] - Country 2 or 3 letter ISO code
6
+ * @property {string} [isoCode] - Country 2- or 3-letter ISO code (must be 2 or 3 chars if provided)
7
+ */
8
+
9
+ /**
10
+ * Query params for GET /countries/:countryId (btrz-api-inventory). See getCountryById getSpec().
11
+ * @typedef {Object} CountryGetQuery
12
+ * @property {string} [include] - Address level to include: "provinces" (default), "counties", "cities", "neighborhoods"
13
+ * @property {string} [parentKey] - Parent address level to filter by when include is not provinces
7
14
  */
8
15
 
9
16
  /**
@@ -15,30 +22,38 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
15
22
  */
16
23
  function countriesFactory({client, internalAuthTokenProvider}) {
17
24
  /**
18
- * GET /countries - list countries.
25
+ * GET /countries List countries. Optional filter by isoCode (2 or 3 characters).
19
26
  * @param {Object} opts
20
27
  * @param {string} [opts.token] - API key
21
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
28
+ * @param {string} [opts.jwtToken] - JWT or internal auth
22
29
  * @param {CountriesListQuery} [opts.query] - Query params (isoCode)
23
30
  * @param {Object} [opts.headers] - Optional headers
24
- * @returns {Promise<import("axios").AxiosResponse>}
31
+ * @returns {Promise<import("axios").AxiosResponse<{ countries: Object[] }>>}
32
+ * @throws 400 Validation failure (e.g. invalid isoCode length)
33
+ * @throws 401 Unauthorized
34
+ * @throws 500 Internal server error
25
35
  */
26
- function all({token, query = {}, headers}) {
36
+ function all({token, jwtToken, query = {}, headers}) {
27
37
  return client({
28
38
  url: "/countries",
29
39
  params: query,
30
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
40
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
31
41
  });
32
42
  }
33
43
 
34
44
  /**
35
- * GET /countries/:id - get country by id. API does not accept query params.
45
+ * GET /countries/:id Get country by id. Optional include (provinces/counties/cities/neighborhoods) and parentKey.
36
46
  * @param {Object} opts
37
47
  * @param {string} [opts.token] - API key
38
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
39
- * @param {string} opts.id - Country id
48
+ * @param {string} [opts.jwtToken] - JWT or internal auth
49
+ * @param {string} opts.id - Country id (24 hex)
50
+ * @param {CountryGetQuery} [opts.query] - Query params (include, parentKey)
40
51
  * @param {Object} [opts.headers] - Optional headers
41
- * @returns {Promise<import("axios").AxiosResponse>}
52
+ * @returns {Promise<import("axios").AxiosResponse<{ country: Object }>>}
53
+ * @throws 400 INVALID_COUNTRY_ID
54
+ * @throws 401 Unauthorized
55
+ * @throws 404 COUNTRY_NOT_FOUND
56
+ * @throws 500 Internal server error
42
57
  */
43
58
  function get({token, jwtToken, id, query = {}, headers}) {
44
59
  return client({
@@ -18,13 +18,14 @@ const {
18
18
  */
19
19
  function customContentFactory({client, internalAuthTokenProvider}) {
20
20
  /**
21
- * GET /custom-content - list custom content.
21
+ * GET /custom-content List custom content (paginated). Query: enabled, pageId.
22
22
  * @param {Object} opts
23
23
  * @param {string} [opts.token] - API key
24
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
25
24
  * @param {InventoryCustomContentQuery} [opts.query] - Query params (enabled, pageId)
26
25
  * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object[] }>>}
27
+ * @throws 401 Unauthorized
28
+ * @throws 500 Internal server error
28
29
  */
29
30
  function all({
30
31
  token,
@@ -38,28 +39,35 @@ function customContentFactory({client, internalAuthTokenProvider}) {
38
39
  }
39
40
 
40
41
  /**
41
- * GET /custom-content/:customContentId - get custom content by id. API does not accept query params.
42
+ * GET /custom-content/:customContentId Get custom content by id.
42
43
  * @param {Object} opts
43
44
  * @param {string} [opts.token] - API key
44
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
- * @param {string} opts.customContentId - Custom content id
45
+ * @param {string} [opts.jwtToken] - JWT or internal auth
46
+ * @param {string} opts.customContentId - Custom content id (24 hex)
46
47
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
48
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
49
+ * @throws 400 INVALID_CUSTOMCONTENT_ID
50
+ * @throws 401 Unauthorized
51
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
52
+ * @throws 500 Internal server error
48
53
  */
49
- function get({customContentId, token, headers}) {
54
+ function get({customContentId, token, jwtToken, headers}) {
50
55
  return client.get(`/custom-content/${customContentId}`, {
51
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
56
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
52
57
  });
53
58
  }
54
59
 
55
60
  /**
56
- * POST /custom-content - create custom content. API does not accept query params.
61
+ * POST /custom-content Create custom content. Body: { customContent }. Emits customContent.created.
57
62
  * @param {Object} opts
58
63
  * @param {string} [opts.token] - API key
59
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
60
- * @param {Object} opts.customContent - Custom content payload
64
+ * @param {string} [opts.jwtToken] - JWT or internal auth
65
+ * @param {Object} opts.customContent - CustomContentPost (name, pageId, lang required; at least one of title, text, imgUrl, mainUrl)
61
66
  * @param {Object} [opts.headers] - Optional headers
62
- * @returns {Promise<import("axios").AxiosResponse>}
67
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
68
+ * @throws 400 WRONG_DATA, INVALID_CUSTOMCONTENT
69
+ * @throws 401 Unauthorized
70
+ * @throws 500 Internal server error
63
71
  */
64
72
  function create({jwtToken, token, customContent, headers}) {
65
73
  return client({
@@ -73,13 +81,17 @@ function customContentFactory({client, internalAuthTokenProvider}) {
73
81
  }
74
82
 
75
83
  /**
76
- * DELETE /custom-content/:customContentId - remove custom content. API does not accept query params.
84
+ * DELETE /custom-content/:customContentId Delete custom content. Emits customContent.deleted.
77
85
  * @param {Object} opts
78
86
  * @param {string} [opts.token] - API key
79
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
80
- * @param {string} opts.customContentId - Custom content id
87
+ * @param {string} [opts.jwtToken] - JWT or internal auth
88
+ * @param {string} opts.customContentId - Custom content id (24 hex)
81
89
  * @param {Object} [opts.headers] - Optional headers
82
- * @returns {Promise<import("axios").AxiosResponse>}
90
+ * @returns {Promise<import("axios").AxiosResponse<{ customContentId: string }>>}
91
+ * @throws 400 CUSTOMCONTENT_TERMINAL_ID, WRONG_DATA
92
+ * @throws 401 Unauthorized
93
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
94
+ * @throws 500 Internal server error
83
95
  */
84
96
  function remove({jwtToken, customContentId, token, headers}) {
85
97
  return client({
@@ -90,14 +102,18 @@ function customContentFactory({client, internalAuthTokenProvider}) {
90
102
  }
91
103
 
92
104
  /**
93
- * PUT /custom-content/:customContentId - update custom content. API does not accept query params.
105
+ * PUT /custom-content/:customContentId Update custom content. Body: { customContent }. Emits customContent.updated.
94
106
  * @param {Object} opts
95
107
  * @param {string} [opts.token] - API key
96
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
97
- * @param {string} opts.customContentId - Custom content id
98
- * @param {Object} opts.customContent - Custom content payload
108
+ * @param {string} [opts.jwtToken] - JWT or internal auth
109
+ * @param {string} opts.customContentId - Custom content id (24 hex)
110
+ * @param {Object} opts.customContent - CustomContentPost (at least one of title, text, imgUrl for update)
99
111
  * @param {Object} [opts.headers] - Optional headers
100
- * @returns {Promise<import("axios").AxiosResponse>}
112
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
113
+ * @throws 400 WRONG_DATA, INVALID_CUSTOMCONTENT_UPDATE
114
+ * @throws 401 Unauthorized
115
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
116
+ * @throws 500 Internal server error
101
117
  */
102
118
  function update({jwtToken, token, customContentId, customContent, headers}) {
103
119
  return client({
@@ -13,34 +13,36 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
13
13
  * @param {Object} deps
14
14
  * @param {import("axios").AxiosInstance} deps.client
15
15
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
16
- * @returns {{ all: function, get: function, create: function, update: function, types: object }}
16
+ * @returns {{ all: function, get: function, create: function, update: function, types: { all: function } }}
17
17
  */
18
18
  function customFieldsFactory({client, internalAuthTokenProvider}) {
19
19
  /**
20
- * GET /custom-fields - list custom fields.
20
+ * GET /custom-fields - list custom fields (btrz-api-inventory).
21
21
  * @param {Object} opts
22
22
  * @param {string} [opts.token] - API key
23
23
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
24
  * @param {InventoryCustomFieldsQuery} [opts.query] - Query params (enabled, required, modelName)
25
25
  * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ customfields: Array }>>}
27
+ * @throws When response is 4xx/5xx (e.g. 400 INVALID_MODEL_NAME, 401 Unauthorized, 500)
27
28
  */
28
- function all({token, query = {}, headers}) {
29
+ function all({token, jwtToken, query = {}, headers}) {
29
30
  return client({
30
31
  url: "/custom-fields",
31
32
  params: query,
32
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
33
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
33
34
  });
34
35
  }
35
36
 
36
37
  /**
37
- * GET /custom-fields/:fieldId - get custom field by id. API does not accept query params.
38
+ * GET /custom-fields/:customfieldId - get custom field by id (btrz-api-inventory). No query params.
38
39
  * @param {Object} opts
39
40
  * @param {string} [opts.token] - API key
40
41
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
41
- * @param {string} opts.fieldId - Field id
42
+ * @param {string} opts.fieldId - Custom field id (24 hex chars; must start with accountId)
42
43
  * @param {Object} [opts.headers] - Optional headers
43
- * @returns {Promise<import("axios").AxiosResponse>}
44
+ * @returns {Promise<import("axios").AxiosResponse<{ customfield: Object }>>}
45
+ * @throws When response is 4xx/5xx (400, 401, 404 CUSTOMFIELD_NOT_FOUND, 500)
44
46
  */
45
47
  function get({fieldId, token, jwtToken, query = {}, headers}) {
46
48
  return client({
@@ -51,13 +53,14 @@ function customFieldsFactory({client, internalAuthTokenProvider}) {
51
53
  }
52
54
 
53
55
  /**
54
- * POST /custom-fields - create custom field. API does not accept query params.
56
+ * POST /custom-fields - create custom field (btrz-api-inventory). No query params.
55
57
  * @param {Object} opts
56
58
  * @param {string} [opts.token] - API key
57
59
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
58
- * @param {Object} opts.field - Field payload
60
+ * @param {Object} opts.field - Field payload (FieldPutData: text, type, required, disabled, options when type List)
59
61
  * @param {Object} [opts.headers] - Optional headers
60
- * @returns {Promise<import("axios").AxiosResponse>}
62
+ * @returns {Promise<import("axios").AxiosResponse<{ customfield: Object }>>}
63
+ * @throws When response is 4xx/5xx (400, 401, 404 CUSTOMFIELD_NOT_FOUND/FIELD_NOT_FOUND, 500)
61
64
  */
62
65
  function create({token, jwtToken, field, headers}) {
63
66
  return client({
@@ -69,14 +72,15 @@ function customFieldsFactory({client, internalAuthTokenProvider}) {
69
72
  }
70
73
 
71
74
  /**
72
- * PUT /custom-fields/:fieldId - update custom field. API does not accept query params.
75
+ * PUT /custom-fields/:fieldId - update custom field (btrz-api-inventory). No query params.
73
76
  * @param {Object} opts
74
77
  * @param {string} [opts.token] - API key
75
78
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
76
- * @param {string} opts.fieldId - Field id
77
- * @param {Object} opts.field - Field payload
79
+ * @param {string} opts.fieldId - Field id (24 hex chars)
80
+ * @param {Object} opts.field - Field payload (FieldPutData)
78
81
  * @param {Object} [opts.headers] - Optional headers
79
- * @returns {Promise<import("axios").AxiosResponse>}
82
+ * @returns {Promise<import("axios").AxiosResponse<{ customfield: Object }>>}
83
+ * @throws When response is 4xx/5xx (400, 401, 404 CUSTOMFIELD_NOT_FOUND/FIELD_NOT_FOUND/WRONG_DATA_OPTIONS, 500)
80
84
  */
81
85
  function update({token, jwtToken, fieldId, field, headers}) {
82
86
  return client({
@@ -90,16 +94,18 @@ function customFieldsFactory({client, internalAuthTokenProvider}) {
90
94
  /** @type {{ all: function }} */
91
95
  const types = {
92
96
  /**
93
- * GET /custom-fields/types - list custom field types. API does not accept query params.
97
+ * GET /custom-fields/types - list custom field types (btrz-api-inventory). No query params.
94
98
  * @param {Object} opts
95
99
  * @param {string} [opts.token] - API key
100
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
96
101
  * @param {Object} [opts.headers] - Optional headers
97
- * @returns {Promise<import("axios").AxiosResponse>}
102
+ * @returns {Promise<import("axios").AxiosResponse<{ types: Array }>>}
103
+ * @throws When response is 4xx/5xx (e.g. 401 Unauthorized, 500)
98
104
  */
99
- all({token, headers}) {
105
+ all({token, jwtToken, headers}) {
100
106
  return client({
101
107
  url: "/custom-fields/types",
102
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
108
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
103
109
  });
104
110
  }
105
111
  };
@@ -1,7 +1,7 @@
1
1
  const {authorizationHeaders} = require("./../endpoints_helpers.js");
2
2
 
3
3
  /**
4
- * Query params for GET /document-types (btrz-api-inventory). See get-document-types getSpec().
4
+ * Query params for GET /document-types (btrz-api-inventory).
5
5
  * @typedef {Object} DocumentTypesListQuery
6
6
  * @property {string} [providerIds] - Comma-separated provider IDs to get document types for
7
7
  */
@@ -15,99 +15,100 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
15
15
  */
16
16
  function documentTypesFactory({client, internalAuthTokenProvider}) {
17
17
  /**
18
- * GET /document-types - list document types.
18
+ * GET /document-types - list document types (paginated).
19
19
  * @param {Object} opts
20
20
  * @param {string} [opts.token] - API key
21
21
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
- * @param {DocumentTypesListQuery} [opts.query] - Query params (providerIds); opts.providerId merged into query if set
23
- * @param {string} [opts.providerId] - Provider id (added to query if set)
22
+ * @param {DocumentTypesListQuery} [opts.query] - Query params (providerIds)
24
23
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
24
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttypes: Array, next?: string, previous?: string, count: number }>>}
25
+ * @throws When response is 4xx/5xx (401 Unauthorized, 500)
26
26
  */
27
- function all({token, jwtToken, query = {}, headers, providerId}) {
28
- const query_ = providerId ? {...query, providerId} : query;
27
+ function all({token, jwtToken, query = {}, headers}) {
29
28
  return client({
30
29
  url: "/document-types",
31
30
  method: "get",
32
31
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
33
- params: query_
32
+ params: query
34
33
  });
35
34
  }
36
35
 
37
36
  /**
38
- * GET /document-types/:id - get document type by id. API does not accept query params.
37
+ * GET /document-types/:documenttypeId - get document type by id.
39
38
  * @param {Object} opts
40
39
  * @param {string} [opts.token] - API key
41
40
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
42
- * @param {string} opts.id - Document type id
43
- * @param {string} [opts.providerId] - Provider id (added to query if set)
41
+ * @param {string} opts.id - Document type id (24 hex characters)
44
42
  * @param {Object} [opts.headers] - Optional headers
45
- * @returns {Promise<import("axios").AxiosResponse>}
43
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
44
+ * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)
46
45
  */
47
- function get({token, jwtToken, id, query = {}, headers, providerId}) {
48
- const query_ = providerId ? {...query, providerId} : query;
46
+ function get({token, jwtToken, id, headers}) {
49
47
  return client({
50
48
  url: `/document-types/${id}`,
51
49
  method: "get",
52
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
53
- params: query_
50
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
54
51
  });
55
52
  }
56
53
 
57
54
  /**
58
- * PUT /document-types/:id - update document type. API does not accept query params.
55
+ * PUT /document-types/:documenttypeId - update document type.
59
56
  * @param {Object} opts
60
57
  * @param {string} [opts.token] - API key
61
58
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
62
59
  * @param {string} opts.id - Document type id
63
- * @param {Object} opts.data - Document type payload
60
+ * @param {Object} [opts.documenttype] - Document type payload (DocumentTypePutData)
61
+ * @param {Object} [opts.data] - Alias for documenttype (deprecated, use documenttype)
64
62
  * @param {Object} [opts.headers] - Optional headers
65
- * @returns {Promise<import("axios").AxiosResponse>}
63
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
64
+ * @throws When response is 4xx/5xx (400, 401, 404, 409 CANNOT_UPDATE_LEXICON_ENTRIES, 500)
66
65
  */
67
- function update({token, jwtToken, id, data, query = {}, headers}) {
66
+ function update({token, jwtToken, id, documenttype, data, headers}) {
67
+ const payload = documenttype || data;
68
68
  return client({
69
69
  url: `/document-types/${id}`,
70
70
  method: "put",
71
71
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
72
- params: query,
73
- data
72
+ data: {documenttype: payload}
74
73
  });
75
74
  }
76
75
 
77
76
  /**
78
- * DELETE /document-types/:id - remove document type. API does not accept query params.
77
+ * DELETE /document-types/:documenttypeId - remove document type.
79
78
  * @param {Object} opts
80
79
  * @param {string} [opts.token] - API key
81
80
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
82
81
  * @param {string} opts.id - Document type id
83
82
  * @param {Object} [opts.headers] - Optional headers
84
- * @returns {Promise<import("axios").AxiosResponse>}
83
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttypeId: string }>>}
84
+ * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)
85
85
  */
86
- function remove({token, jwtToken, id, query = {}, headers}) {
86
+ function remove({token, jwtToken, id, headers}) {
87
87
  return client({
88
88
  url: `/document-types/${id}`,
89
89
  method: "delete",
90
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
91
- params: query
90
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
92
91
  });
93
92
  }
94
93
 
95
94
  /**
96
- * POST /document-types - create document type. API does not accept query params.
95
+ * POST /document-types - create document type.
97
96
  * @param {Object} opts
98
97
  * @param {string} [opts.token] - API key
99
98
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
100
- * @param {Object} opts.data - Document type payload
99
+ * @param {Object} [opts.documenttype] - Document type payload (DocumentTypePostData)
100
+ * @param {Object} [opts.data] - Alias for documenttype (deprecated, use documenttype)
101
101
  * @param {Object} [opts.headers] - Optional headers
102
- * @returns {Promise<import("axios").AxiosResponse>}
102
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
103
+ * @throws When response is 4xx/5xx (400, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
103
104
  */
104
- function create({token, jwtToken, data, query = {}, headers}) {
105
+ function create({token, jwtToken, documenttype, data, headers}) {
106
+ const payload = documenttype || data;
105
107
  return client({
106
108
  url: "/document-types",
107
109
  method: "post",
108
110
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
109
- params: query,
110
- data
111
+ data: {documenttype: payload}
111
112
  });
112
113
  }
113
114
 
@@ -3,22 +3,24 @@ const {
3
3
  } = require("../endpoints_helpers.js");
4
4
 
5
5
  /**
6
- * Factory for external-wallets API (btrz-api-inventory).
6
+ * Factory for external-wallets API (btrz-api-inventory). SaldoMax external wallets only.
7
7
  * @param {Object} deps
8
8
  * @param {import("axios").AxiosInstance} deps.client
9
9
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
10
- * @returns {{ saldoMax: object }}
10
+ * @returns {{ saldoMax: { all: function, get: function, create: function, update: function, movements: { create: function } } }}
11
11
  */
12
12
  function externalWalletsFactory({client, internalAuthTokenProvider}) {
13
13
  /** @type {{ all: function, create: function, get: function, update: function, movements: object }} */
14
14
  const saldoMax = {
15
15
  /**
16
- * GET /external-wallets/saldo-max - list saldo max wallets. API does not accept query params.
16
+ * GET /external-wallets/saldo-max - list SaldoMax external wallets (paginated).
17
17
  * @param {Object} opts
18
18
  * @param {string} [opts.token] - API key
19
19
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
20
+ * @param {Object} [opts.query] - Pagination query params
20
21
  * @param {Object} [opts.headers] - Optional headers
21
- * @returns {Promise<import("axios").AxiosResponse>}
22
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallets: Array, next?: string, previous?: string, count: number }>>}
23
+ * @throws When response is 4xx/5xx (401, 500)
22
24
  */
23
25
  all: ({token, jwtToken, query = {}, headers}) => {
24
26
  return client.get("/external-wallets/saldo-max", {
@@ -27,13 +29,14 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
27
29
  });
28
30
  },
29
31
  /**
30
- * POST /external-wallets/saldo-max - create saldo max wallet. API does not accept query params.
32
+ * POST /external-wallets/saldo-max - create SaldoMax external wallet.
31
33
  * @param {Object} opts
32
34
  * @param {string} [opts.token] - API key
33
35
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
- * @param {Object} opts.externalWallet - External wallet payload
36
+ * @param {Object} opts.externalWallet - External wallet payload (ExternalWalletData: firstName, lastName, email, tel, dob, nip)
35
37
  * @param {Object} [opts.headers] - Optional headers
36
- * @returns {Promise<import("axios").AxiosResponse>}
38
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
39
+ * @throws When response is 4xx/5xx (400, 401, 409 DUPLICATE_EXTERNAL_WALLET_EMAIL/TEL, 500)
37
40
  */
38
41
  create: ({token, jwtToken, externalWallet, headers}) => {
39
42
  return client({
@@ -44,13 +47,14 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
44
47
  });
45
48
  },
46
49
  /**
47
- * GET /external-wallets/saldo-max/:walletId - get saldo max wallet. API does not accept query params.
50
+ * GET /external-wallets/saldo-max/:walletId - get SaldoMax external wallet by id.
48
51
  * @param {Object} opts
49
52
  * @param {string} [opts.token] - API key
50
53
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
51
- * @param {string} opts.walletId - Wallet id
54
+ * @param {string} opts.walletId - Wallet id (24 hex characters)
52
55
  * @param {Object} [opts.headers] - Optional headers
53
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
57
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
54
58
  */
55
59
  get: ({token, jwtToken, walletId, headers}) => {
56
60
  return client.get(`/external-wallets/saldo-max/${walletId}`, {
@@ -58,13 +62,14 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
58
62
  });
59
63
  },
60
64
  /**
61
- * PUT /external-wallets/saldo-max/:externalWallet._id - update saldo max wallet. API does not accept query params.
65
+ * PUT /external-wallets/saldo-max/:walletId - update SaldoMax external wallet.
62
66
  * @param {Object} opts
63
67
  * @param {string} [opts.token] - API key
64
68
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
69
  * @param {Object} opts.externalWallet - External wallet payload (must include _id)
66
70
  * @param {Object} [opts.headers] - Optional headers
67
- * @returns {Promise<import("axios").AxiosResponse>}
71
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
72
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
68
73
  */
69
74
  update: ({token, jwtToken, externalWallet, headers}) => {
70
75
  const externalWalletFieldsToUpdate = {
@@ -85,22 +90,22 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
85
90
  /** @type {{ create: function }} */
86
91
  movements: {
87
92
  /**
88
- * PUT /external-wallets/saldo-max/:walletId/movements - create movement. API does not accept query params.
93
+ * PUT /external-wallets/saldo-max/:walletId/movements - add movement to wallet.
89
94
  * @param {Object} opts
90
95
  * @param {string} [opts.token] - API key
91
96
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
92
97
  * @param {string} opts.walletId - Wallet id
93
- * @param {Object} opts.movement - Movement payload
94
- * @returns {Promise<import("axios").AxiosResponse>}
98
+ * @param {Object} opts.movement - Movement payload (amount, type: payment|refund|manual, reason, nip)
99
+ * @param {Object} [opts.headers] - Optional headers
100
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
101
+ * @throws When response is 4xx/5xx (400, 401, 403 INVALID_NIP/WALLET_BLOCKED/WALLET_NOT_ACTIVE, 404, 500)
95
102
  */
96
- create: ({token, jwtToken, walletId, movement}) => {
103
+ create: ({token, jwtToken, walletId, movement, headers}) => {
97
104
  return client({
98
105
  url: `/external-wallets/saldo-max/${walletId}/movements`,
99
106
  method: "put",
100
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider}),
101
- data: {
102
- movement
103
- }
107
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
108
+ data: {movement}
104
109
  });
105
110
  }
106
111
  }
@@ -3,10 +3,11 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
3
3
  /**
4
4
  * Query params for GET /fees (btrz-api-inventory). See fees get-handler getSpec().
5
5
  * @typedef {Object} InventoryFeesQuery
6
- * @property {string} [providerIds] - Provider IDs to get fees for
7
- * @property {string} [rules] - Rules where the fees apply
8
- * @property {string} [productId] - Product ID for the fee
9
- * @property {string} [internalId] - Fee internal id
6
+ * @property {string} [providerIds] - Comma-separated provider (account) IDs to get fees for
7
+ * @property {string} [rules] - Comma-separated rules where the fees apply (e.g. cancel, ticket, transaction)
8
+ * @property {string} [productId] - Product ID to filter fees by
9
+ * @property {string} [internalId] - Fee internal id to filter by
10
+ * @property {string} [page] - Page number for pagination (1-based). Response includes next, previous, count
10
11
  */
11
12
 
12
13
  /**
@@ -18,28 +19,31 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
18
19
  */
19
20
  function feesFactory({client, internalAuthTokenProvider}) {
20
21
  /**
21
- * GET /fees - list fees.
22
+ * GET /fees - list fees (paginated).
22
23
  * @param {Object} opts
23
24
  * @param {string} [opts.token] - API key
24
- * @param {InventoryFeesQuery} [opts.query] - Optional query params (forwarded to API)
25
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
26
+ * @param {InventoryFeesQuery} [opts.query] - Query params (providerIds, rules, productId, internalId)
25
27
  * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
28
+ * @returns {Promise<import("axios").AxiosResponse<{ fees: Array, next: string, previous: string, count: number }>>}
29
+ * @throws When response is 4xx/5xx (401, 500)
27
30
  */
28
- function all({token, query = {}, headers}) {
31
+ function all({token, jwtToken, query = {}, headers}) {
29
32
  return client.get("/fees", {
30
33
  params: query,
31
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
34
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
32
35
  });
33
36
  }
34
37
 
35
38
  /**
36
- * GET /fees/:feeId - get fee by id. API does not accept query params.
39
+ * GET /fees/:feeId - get fee by id.
37
40
  * @param {Object} opts
38
41
  * @param {string} [opts.token] - API key
39
42
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
40
- * @param {string} opts.feeId - Fee id
43
+ * @param {string} opts.feeId - Fee id (24 hex characters)
41
44
  * @param {Object} [opts.headers] - Optional headers
42
- * @returns {Promise<import("axios").AxiosResponse>}
45
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
46
+ * @throws When response is 4xx/5xx (400, 401, 404 FEE_NOT_FOUND, 500)
43
47
  */
44
48
  function get({token, jwtToken, feeId, headers}) {
45
49
  return client.get(`/fees/${feeId}`, {
@@ -48,13 +52,14 @@ function feesFactory({client, internalAuthTokenProvider}) {
48
52
  }
49
53
 
50
54
  /**
51
- * POST /fees - create fee. API does not accept query params.
55
+ * POST /fees - create fee.
52
56
  * @param {Object} opts
53
57
  * @param {string} [opts.token] - API key
54
58
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
55
- * @param {Object} opts.fee - Fee payload
59
+ * @param {Object} opts.fee - Fee payload (FeePostData: name, internalId, valueType, value, rules, products, lexiconKeys, etc.)
56
60
  * @param {Object} [opts.headers] - Optional headers
57
- * @returns {Promise<import("axios").AxiosResponse>}
61
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
62
+ * @throws When response is 4xx/5xx (400, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
58
63
  */
59
64
  function create({token, jwtToken, fee, headers}) {
60
65
  return client({
@@ -66,14 +71,15 @@ function feesFactory({client, internalAuthTokenProvider}) {
66
71
  }
67
72
 
68
73
  /**
69
- * PUT /fees/:feeId - update fee. API does not accept query params.
74
+ * PUT /fees/:feeId - update fee.
70
75
  * @param {Object} opts
71
76
  * @param {string} [opts.token] - API key
72
77
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
73
78
  * @param {string} opts.feeId - Fee id
74
- * @param {Object} opts.fee - Fee payload
79
+ * @param {Object} opts.fee - Fee payload (partial FeePostData)
75
80
  * @param {Object} [opts.headers] - Optional headers
76
- * @returns {Promise<import("axios").AxiosResponse>}
81
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
82
+ * @throws When response is 4xx/5xx (400, 401, 404 FEE_NOT_FOUND, 409 CANNOT_UPDATE_LEXICON_ENTRIES, 500)
77
83
  */
78
84
  function update({token, jwtToken, feeId, fee, headers}) {
79
85
  return client({