btrz-api-client 8.33.0 → 8.35.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 (160) hide show
  1. package/lib/client-standalone-min.js +3 -3
  2. package/lib/client.js +10 -2
  3. package/lib/endpoints/btrzpay/adyen.js +58 -0
  4. package/lib/endpoints/btrzpay/cardpointe.js +6 -3
  5. package/lib/endpoints/btrzpay/customerCards.js +19 -19
  6. package/lib/endpoints/btrzpay/customers.js +13 -13
  7. package/lib/endpoints/btrzpay/cybersource3ds.js +142 -0
  8. package/lib/endpoints/btrzpay/datalogic.js +64 -28
  9. package/lib/endpoints/btrzpay/oxxo.js +54 -28
  10. package/lib/endpoints/btrzpay/prismaTerminals.js +24 -15
  11. package/lib/endpoints/btrzpay/referenced-payments.js +4 -4
  12. package/lib/endpoints/btrzpay/square.js +8 -8
  13. package/lib/endpoints/btrzpay/stripe-terminals.js +16 -11
  14. package/lib/endpoints/btrzpay/stripe3ds.js +54 -0
  15. package/lib/endpoints/btrzpay/terminalPayments.js +19 -19
  16. package/lib/endpoints/inventory/banks.js +39 -21
  17. package/lib/endpoints/inventory/change-requests.js +59 -31
  18. package/lib/endpoints/inventory/control-classes.js +39 -20
  19. package/lib/endpoints/inventory/countries.js +25 -9
  20. package/lib/endpoints/inventory/custom-content.js +39 -21
  21. package/lib/endpoints/inventory/custom-fields.js +25 -17
  22. package/lib/endpoints/inventory/document-types.js +33 -42
  23. package/lib/endpoints/inventory/external-wallets.js +26 -20
  24. package/lib/endpoints/inventory/fees.js +19 -13
  25. package/lib/endpoints/inventory/filtered-trips.js +34 -8
  26. package/lib/endpoints/inventory/financing-costs.js +19 -14
  27. package/lib/endpoints/inventory/garages.js +19 -14
  28. package/lib/endpoints/inventory/getnet-terminals.js +20 -15
  29. package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
  30. package/lib/endpoints/inventory/holidays.js +158 -0
  31. package/lib/endpoints/inventory/insurances.js +17 -13
  32. package/lib/endpoints/inventory/items.js +13 -9
  33. package/lib/endpoints/inventory/labels.js +16 -11
  34. package/lib/endpoints/inventory/marital-status.js +16 -11
  35. package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
  36. package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
  37. package/lib/endpoints/inventory/mit-terminals.js +16 -11
  38. package/lib/endpoints/inventory/operation-messages.js +18 -12
  39. package/lib/endpoints/inventory/operation-reasons.js +15 -10
  40. package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
  41. package/lib/endpoints/inventory/payment-terminals.js +15 -10
  42. package/lib/endpoints/inventory/products.js +22 -10
  43. package/lib/endpoints/inventory/promos.js +27 -18
  44. package/lib/endpoints/inventory/segments-information-tables.js +13 -7
  45. package/lib/endpoints/inventory/station-groups.js +2 -4
  46. package/lib/endpoints/inventory/taxes.js +11 -2
  47. package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
  48. package/lib/endpoints/inventory/trip-ids.js +67 -0
  49. package/lib/endpoints/inventory/trips.js +60 -13
  50. package/lib/endpoints/inventory/vehicle-types.js +2 -5
  51. package/lib/endpoints/inventory/vehicles.js +4 -2
  52. package/lib/endpoints/invoices/emails.js +15 -5
  53. package/lib/endpoints/invoices/invoices.js +46 -25
  54. package/lib/endpoints/invoices/pdfs.js +15 -8
  55. package/lib/endpoints/invoices/providers.js +42 -25
  56. package/lib/endpoints/invoices/tax-ids.js +11 -7
  57. package/lib/endpoints/notifications/customers.js +1 -1
  58. package/lib/endpoints/notifications/external-customers.js +54 -0
  59. package/lib/endpoints/notifications/pdfs.js +0 -3
  60. package/lib/endpoints/operations/accounting_items.js +7 -1
  61. package/lib/endpoints/operations/flexpasses.js +9 -7
  62. package/lib/endpoints/operations/gift-certificates.js +53 -0
  63. package/lib/endpoints/operations/loans.js +16 -10
  64. package/lib/endpoints/operations/movements.js +17 -6
  65. package/lib/endpoints/operations/pago-express.js +96 -0
  66. package/lib/endpoints/operations/parcels.js +11 -11
  67. package/lib/endpoints/operations/parcels_manifests.js +7 -4
  68. package/lib/endpoints/sales/cancellations.js +43 -31
  69. package/lib/endpoints/sales/cart.js +21 -18
  70. package/lib/endpoints/sales/flexpasses.js +2 -5
  71. package/lib/endpoints/sales/order.js +41 -7
  72. package/lib/endpoints/sales/parcel-quotes.js +2 -2
  73. package/package.json +1 -1
  74. package/src/client.js +10 -2
  75. package/src/endpoints/btrzpay/adyen.js +44 -0
  76. package/src/endpoints/btrzpay/cardpointe.js +6 -4
  77. package/src/endpoints/btrzpay/customerCards.js +19 -19
  78. package/src/endpoints/btrzpay/customers.js +13 -13
  79. package/src/endpoints/btrzpay/cybersource3ds.js +114 -0
  80. package/src/endpoints/btrzpay/datalogic.js +63 -28
  81. package/src/endpoints/btrzpay/oxxo.js +53 -26
  82. package/src/endpoints/btrzpay/prismaTerminals.js +24 -15
  83. package/src/endpoints/btrzpay/referenced-payments.js +4 -4
  84. package/src/endpoints/btrzpay/square.js +8 -8
  85. package/src/endpoints/btrzpay/stripe-terminals.js +17 -10
  86. package/src/endpoints/btrzpay/stripe3ds.js +40 -0
  87. package/src/endpoints/btrzpay/terminalPayments.js +19 -19
  88. package/src/endpoints/inventory/banks.js +39 -21
  89. package/src/endpoints/inventory/change-requests.js +59 -31
  90. package/src/endpoints/inventory/control-classes.js +39 -20
  91. package/src/endpoints/inventory/countries.js +25 -10
  92. package/src/endpoints/inventory/custom-content.js +39 -22
  93. package/src/endpoints/inventory/custom-fields.js +25 -19
  94. package/src/endpoints/inventory/document-types.js +34 -33
  95. package/src/endpoints/inventory/external-wallets.js +25 -20
  96. package/src/endpoints/inventory/fees.js +19 -14
  97. package/src/endpoints/inventory/filtered-trips.js +29 -8
  98. package/src/endpoints/inventory/financing-costs.js +19 -14
  99. package/src/endpoints/inventory/garages.js +19 -14
  100. package/src/endpoints/inventory/getnet-terminals.js +20 -15
  101. package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
  102. package/src/endpoints/inventory/holidays.js +121 -0
  103. package/src/endpoints/inventory/insurances.js +17 -13
  104. package/src/endpoints/inventory/items.js +13 -9
  105. package/src/endpoints/inventory/labels.js +16 -11
  106. package/src/endpoints/inventory/marital-status.js +16 -11
  107. package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
  108. package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
  109. package/src/endpoints/inventory/mit-terminals.js +16 -11
  110. package/src/endpoints/inventory/operation-messages.js +18 -12
  111. package/src/endpoints/inventory/operation-reasons.js +15 -10
  112. package/src/endpoints/inventory/pay-on-accounts.js +5 -4
  113. package/src/endpoints/inventory/payment-terminals.js +15 -10
  114. package/src/endpoints/inventory/products.js +22 -10
  115. package/src/endpoints/inventory/promos.js +27 -18
  116. package/src/endpoints/inventory/segments-information-tables.js +13 -7
  117. package/src/endpoints/inventory/station-groups.js +2 -4
  118. package/src/endpoints/inventory/taxes.js +11 -2
  119. package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
  120. package/src/endpoints/inventory/trip-ids.js +54 -0
  121. package/src/endpoints/inventory/trips.js +52 -14
  122. package/src/endpoints/inventory/vehicle-types.js +3 -4
  123. package/src/endpoints/inventory/vehicles.js +4 -3
  124. package/src/endpoints/invoices/emails.js +15 -5
  125. package/src/endpoints/invoices/invoices.js +46 -25
  126. package/src/endpoints/invoices/pdfs.js +15 -8
  127. package/src/endpoints/invoices/providers.js +42 -25
  128. package/src/endpoints/invoices/tax-ids.js +11 -7
  129. package/src/endpoints/notifications/customers.js +1 -1
  130. package/src/endpoints/notifications/external-customers.js +41 -0
  131. package/src/endpoints/notifications/pdfs.js +0 -3
  132. package/src/endpoints/operations/accounting_items.js +7 -2
  133. package/src/endpoints/operations/flexpasses.js +9 -7
  134. package/src/endpoints/operations/gift-certificates.js +39 -0
  135. package/src/endpoints/operations/loans.js +16 -11
  136. package/src/endpoints/operations/movements.js +17 -6
  137. package/src/endpoints/operations/pago-express.js +73 -0
  138. package/src/endpoints/operations/parcels.js +11 -11
  139. package/src/endpoints/operations/parcels_manifests.js +7 -5
  140. package/src/endpoints/sales/cancellations.js +43 -31
  141. package/src/endpoints/sales/cart.js +20 -18
  142. package/src/endpoints/sales/flexpasses.js +3 -4
  143. package/src/endpoints/sales/order.js +34 -7
  144. package/src/endpoints/sales/parcel-quotes.js +2 -2
  145. package/test/endpoints/btrzpay/adyen.tests.js +27 -0
  146. package/test/endpoints/btrzpay/carpointe.tests.js +14 -0
  147. package/test/endpoints/btrzpay/customerCards.test.js +9 -6
  148. package/test/endpoints/btrzpay/cybersource3ds.tests.js +55 -0
  149. package/test/endpoints/btrzpay/stripe-terminals.tests.js +5 -6
  150. package/test/endpoints/btrzpay/stripe3ds.tests.js +31 -0
  151. package/test/endpoints/inventory/banks.test.js +8 -10
  152. package/test/endpoints/inventory/filtered-trips.test.js +6 -0
  153. package/test/endpoints/inventory/holidays.test.js +52 -0
  154. package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
  155. package/test/endpoints/inventory/trip-ids.test.js +27 -0
  156. package/test/endpoints/inventory/trips.test.js +19 -14
  157. package/test/endpoints/notifications/external-customers.test.js +30 -0
  158. package/test/endpoints/operations/gift_certificates.test.js +37 -0
  159. package/test/endpoints/operations/operations.test.js +30 -0
  160. package/test/endpoints/sales/order.test.js +7 -1
@@ -24,13 +24,15 @@ function customContentFactory(_ref) {
24
24
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
25
25
 
26
26
  /**
27
- * GET /custom-content - list custom content.
27
+ * GET /custom-content List custom content (paginated). Query: enabled, pageId.
28
28
  * @param {Object} opts
29
29
  * @param {string} [opts.token] - API key
30
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
30
+ * @param {string} [opts.jwtToken] - JWT or internal auth
31
31
  * @param {InventoryCustomContentQuery} [opts.query] - Query params (enabled, pageId)
32
32
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object[] }>>}
34
+ * @throws 401 Unauthorized
35
+ * @throws 500 Internal server error
34
36
  */
35
37
  function all(_ref2) {
36
38
  var token = _ref2.token,
@@ -45,32 +47,40 @@ function customContentFactory(_ref) {
45
47
  }
46
48
 
47
49
  /**
48
- * GET /custom-content/:customContentId - get custom content by id. API does not accept query params.
50
+ * GET /custom-content/:customContentId Get custom content by id.
49
51
  * @param {Object} opts
50
52
  * @param {string} [opts.token] - API key
51
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
- * @param {string} opts.customContentId - Custom content id
53
+ * @param {string} [opts.jwtToken] - JWT or internal auth
54
+ * @param {string} opts.customContentId - Custom content id (24 hex)
53
55
  * @param {Object} [opts.headers] - Optional headers
54
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
57
+ * @throws 400 INVALID_CUSTOMCONTENT_ID
58
+ * @throws 401 Unauthorized
59
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
60
+ * @throws 500 Internal server error
55
61
  */
56
62
  function get(_ref3) {
57
63
  var customContentId = _ref3.customContentId,
58
64
  token = _ref3.token,
65
+ jwtToken = _ref3.jwtToken,
59
66
  headers = _ref3.headers;
60
67
 
61
68
  return client.get("/custom-content/" + customContentId, {
62
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
69
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
63
70
  });
64
71
  }
65
72
 
66
73
  /**
67
- * POST /custom-content - create custom content. API does not accept query params.
74
+ * POST /custom-content Create custom content. Body: { customContent }. Emits customContent.created.
68
75
  * @param {Object} opts
69
76
  * @param {string} [opts.token] - API key
70
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
71
- * @param {Object} opts.customContent - Custom content payload
77
+ * @param {string} [opts.jwtToken] - JWT or internal auth
78
+ * @param {Object} opts.customContent - CustomContentPost (name, pageId, lang required; at least one of title, text, imgUrl, mainUrl)
72
79
  * @param {Object} [opts.headers] - Optional headers
73
- * @returns {Promise<import("axios").AxiosResponse>}
80
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
81
+ * @throws 400 WRONG_DATA, INVALID_CUSTOMCONTENT
82
+ * @throws 401 Unauthorized
83
+ * @throws 500 Internal server error
74
84
  */
75
85
  function create(_ref4) {
76
86
  var jwtToken = _ref4.jwtToken,
@@ -89,13 +99,17 @@ function customContentFactory(_ref) {
89
99
  }
90
100
 
91
101
  /**
92
- * DELETE /custom-content/:customContentId - remove custom content. API does not accept query params.
102
+ * DELETE /custom-content/:customContentId Delete custom content. Emits customContent.deleted.
93
103
  * @param {Object} opts
94
104
  * @param {string} [opts.token] - API key
95
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
96
- * @param {string} opts.customContentId - Custom content id
105
+ * @param {string} [opts.jwtToken] - JWT or internal auth
106
+ * @param {string} opts.customContentId - Custom content id (24 hex)
97
107
  * @param {Object} [opts.headers] - Optional headers
98
- * @returns {Promise<import("axios").AxiosResponse>}
108
+ * @returns {Promise<import("axios").AxiosResponse<{ customContentId: string }>>}
109
+ * @throws 400 CUSTOMCONTENT_TERMINAL_ID, WRONG_DATA
110
+ * @throws 401 Unauthorized
111
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
112
+ * @throws 500 Internal server error
99
113
  */
100
114
  function remove(_ref5) {
101
115
  var jwtToken = _ref5.jwtToken,
@@ -111,14 +125,18 @@ function customContentFactory(_ref) {
111
125
  }
112
126
 
113
127
  /**
114
- * PUT /custom-content/:customContentId - update custom content. API does not accept query params.
128
+ * PUT /custom-content/:customContentId Update custom content. Body: { customContent }. Emits customContent.updated.
115
129
  * @param {Object} opts
116
130
  * @param {string} [opts.token] - API key
117
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
118
- * @param {string} opts.customContentId - Custom content id
119
- * @param {Object} opts.customContent - Custom content payload
131
+ * @param {string} [opts.jwtToken] - JWT or internal auth
132
+ * @param {string} opts.customContentId - Custom content id (24 hex)
133
+ * @param {Object} opts.customContent - CustomContentPost (at least one of title, text, imgUrl for update)
120
134
  * @param {Object} [opts.headers] - Optional headers
121
- * @returns {Promise<import("axios").AxiosResponse>}
135
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
136
+ * @throws 400 WRONG_DATA, INVALID_CUSTOMCONTENT_UPDATE
137
+ * @throws 401 Unauthorized
138
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
139
+ * @throws 500 Internal server error
122
140
  */
123
141
  function update(_ref6) {
124
142
  var jwtToken = _ref6.jwtToken,
@@ -16,7 +16,7 @@ var _require = require("./../endpoints_helpers.js"),
16
16
  * @param {Object} deps
17
17
  * @param {import("axios").AxiosInstance} deps.client
18
18
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
19
- * @returns {{ all: function, get: function, create: function, update: function, types: object }}
19
+ * @returns {{ all: function, get: function, create: function, update: function, types: { all: function } }}
20
20
  */
21
21
 
22
22
 
@@ -25,16 +25,18 @@ function customFieldsFactory(_ref) {
25
25
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
26
26
 
27
27
  /**
28
- * GET /custom-fields - list custom fields.
28
+ * GET /custom-fields - list custom fields (btrz-api-inventory).
29
29
  * @param {Object} opts
30
30
  * @param {string} [opts.token] - API key
31
31
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
32
  * @param {InventoryCustomFieldsQuery} [opts.query] - Query params (enabled, required, modelName)
33
33
  * @param {Object} [opts.headers] - Optional headers
34
- * @returns {Promise<import("axios").AxiosResponse>}
34
+ * @returns {Promise<import("axios").AxiosResponse<{ customfields: Array }>>}
35
+ * @throws When response is 4xx/5xx (e.g. 400 INVALID_MODEL_NAME, 401 Unauthorized, 500)
35
36
  */
36
37
  function all(_ref2) {
37
38
  var token = _ref2.token,
39
+ jwtToken = _ref2.jwtToken,
38
40
  _ref2$query = _ref2.query,
39
41
  query = _ref2$query === undefined ? {} : _ref2$query,
40
42
  headers = _ref2.headers;
@@ -42,18 +44,19 @@ function customFieldsFactory(_ref) {
42
44
  return client({
43
45
  url: "/custom-fields",
44
46
  params: query,
45
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
47
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
46
48
  });
47
49
  }
48
50
 
49
51
  /**
50
- * GET /custom-fields/:fieldId - get custom field by id. API does not accept query params.
52
+ * GET /custom-fields/:customfieldId - get custom field by id (btrz-api-inventory). No query params.
51
53
  * @param {Object} opts
52
54
  * @param {string} [opts.token] - API key
53
55
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
54
- * @param {string} opts.fieldId - Field id
56
+ * @param {string} opts.fieldId - Custom field id (24 hex chars; must start with accountId)
55
57
  * @param {Object} [opts.headers] - Optional headers
56
- * @returns {Promise<import("axios").AxiosResponse>}
58
+ * @returns {Promise<import("axios").AxiosResponse<{ customfield: Object }>>}
59
+ * @throws When response is 4xx/5xx (400, 401, 404 CUSTOMFIELD_NOT_FOUND, 500)
57
60
  */
58
61
  function get(_ref3) {
59
62
  var fieldId = _ref3.fieldId,
@@ -71,13 +74,14 @@ function customFieldsFactory(_ref) {
71
74
  }
72
75
 
73
76
  /**
74
- * POST /custom-fields - create custom field. API does not accept query params.
77
+ * POST /custom-fields - create custom field (btrz-api-inventory). No query params.
75
78
  * @param {Object} opts
76
79
  * @param {string} [opts.token] - API key
77
80
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
78
- * @param {Object} opts.field - Field payload
81
+ * @param {Object} opts.field - Field payload (FieldPutData: text, type, required, disabled, options when type List)
79
82
  * @param {Object} [opts.headers] - Optional headers
80
- * @returns {Promise<import("axios").AxiosResponse>}
83
+ * @returns {Promise<import("axios").AxiosResponse<{ customfield: Object }>>}
84
+ * @throws When response is 4xx/5xx (400, 401, 404 CUSTOMFIELD_NOT_FOUND/FIELD_NOT_FOUND, 500)
81
85
  */
82
86
  function create(_ref4) {
83
87
  var token = _ref4.token,
@@ -94,14 +98,15 @@ function customFieldsFactory(_ref) {
94
98
  }
95
99
 
96
100
  /**
97
- * PUT /custom-fields/:fieldId - update custom field. API does not accept query params.
101
+ * PUT /custom-fields/:fieldId - update custom field (btrz-api-inventory). No query params.
98
102
  * @param {Object} opts
99
103
  * @param {string} [opts.token] - API key
100
104
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
101
- * @param {string} opts.fieldId - Field id
102
- * @param {Object} opts.field - Field payload
105
+ * @param {string} opts.fieldId - Field id (24 hex chars)
106
+ * @param {Object} opts.field - Field payload (FieldPutData)
103
107
  * @param {Object} [opts.headers] - Optional headers
104
- * @returns {Promise<import("axios").AxiosResponse>}
108
+ * @returns {Promise<import("axios").AxiosResponse<{ customfield: Object }>>}
109
+ * @throws When response is 4xx/5xx (400, 401, 404 CUSTOMFIELD_NOT_FOUND/FIELD_NOT_FOUND/WRONG_DATA_OPTIONS, 500)
105
110
  */
106
111
  function update(_ref5) {
107
112
  var token = _ref5.token,
@@ -121,19 +126,22 @@ function customFieldsFactory(_ref) {
121
126
  /** @type {{ all: function }} */
122
127
  var types = {
123
128
  /**
124
- * GET /custom-fields/types - list custom field types. API does not accept query params.
129
+ * GET /custom-fields/types - list custom field types (btrz-api-inventory). No query params.
125
130
  * @param {Object} opts
126
131
  * @param {string} [opts.token] - API key
132
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
127
133
  * @param {Object} [opts.headers] - Optional headers
128
- * @returns {Promise<import("axios").AxiosResponse>}
134
+ * @returns {Promise<import("axios").AxiosResponse<{ types: Array }>>}
135
+ * @throws When response is 4xx/5xx (e.g. 401 Unauthorized, 500)
129
136
  */
130
137
  all: function all(_ref6) {
131
138
  var token = _ref6.token,
139
+ jwtToken = _ref6.jwtToken,
132
140
  headers = _ref6.headers;
133
141
 
134
142
  return client({
135
143
  url: "/custom-fields/types",
136
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
144
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
137
145
  });
138
146
  }
139
147
  };
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4
-
5
3
  var _require = require("./../endpoints_helpers.js"),
6
4
  authorizationHeaders = _require.authorizationHeaders;
7
5
 
8
6
  /**
9
- * Query params for GET /document-types (btrz-api-inventory). See get-document-types getSpec().
7
+ * Query params for GET /document-types (btrz-api-inventory).
10
8
  * @typedef {Object} DocumentTypesListQuery
11
9
  * @property {string} [providerIds] - Comma-separated provider IDs to get document types for
12
10
  */
@@ -25,136 +23,129 @@ function documentTypesFactory(_ref) {
25
23
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
26
24
 
27
25
  /**
28
- * GET /document-types - list document types.
26
+ * GET /document-types - list document types (paginated).
29
27
  * @param {Object} opts
30
28
  * @param {string} [opts.token] - API key
31
29
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
- * @param {DocumentTypesListQuery} [opts.query] - Query params (providerIds); opts.providerId merged into query if set
33
- * @param {string} [opts.providerId] - Provider id (added to query if set)
30
+ * @param {DocumentTypesListQuery} [opts.query] - Query params (providerIds)
34
31
  * @param {Object} [opts.headers] - Optional headers
35
- * @returns {Promise<import("axios").AxiosResponse>}
32
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttypes: Array, next?: string, previous?: string, count: number }>>}
33
+ * @throws When response is 4xx/5xx (401 Unauthorized, 500)
36
34
  */
37
35
  function all(_ref2) {
38
36
  var token = _ref2.token,
39
37
  jwtToken = _ref2.jwtToken,
40
38
  _ref2$query = _ref2.query,
41
39
  query = _ref2$query === undefined ? {} : _ref2$query,
42
- headers = _ref2.headers,
43
- providerId = _ref2.providerId;
40
+ headers = _ref2.headers;
44
41
 
45
- var query_ = providerId ? _extends({}, query, { providerId: providerId }) : query;
46
42
  return client({
47
43
  url: "/document-types",
48
44
  method: "get",
49
45
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
50
- params: query_
46
+ params: query
51
47
  });
52
48
  }
53
49
 
54
50
  /**
55
- * GET /document-types/:id - get document type by id. API does not accept query params.
51
+ * GET /document-types/:documenttypeId - get document type by id.
56
52
  * @param {Object} opts
57
53
  * @param {string} [opts.token] - API key
58
54
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
59
- * @param {string} opts.id - Document type id
60
- * @param {string} [opts.providerId] - Provider id (added to query if set)
55
+ * @param {string} opts.id - Document type id (24 hex characters)
61
56
  * @param {Object} [opts.headers] - Optional headers
62
- * @returns {Promise<import("axios").AxiosResponse>}
57
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
58
+ * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)
63
59
  */
64
60
  function get(_ref3) {
65
61
  var token = _ref3.token,
66
62
  jwtToken = _ref3.jwtToken,
67
63
  id = _ref3.id,
68
- _ref3$query = _ref3.query,
69
- query = _ref3$query === undefined ? {} : _ref3$query,
70
- headers = _ref3.headers,
71
- providerId = _ref3.providerId;
64
+ headers = _ref3.headers;
72
65
 
73
- var query_ = providerId ? _extends({}, query, { providerId: providerId }) : query;
74
66
  return client({
75
67
  url: "/document-types/" + id,
76
68
  method: "get",
77
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
78
- params: query_
69
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
79
70
  });
80
71
  }
81
72
 
82
73
  /**
83
- * PUT /document-types/:id - update document type. API does not accept query params.
74
+ * PUT /document-types/:documenttypeId - update document type.
84
75
  * @param {Object} opts
85
76
  * @param {string} [opts.token] - API key
86
77
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
87
78
  * @param {string} opts.id - Document type id
88
- * @param {Object} opts.data - Document type payload
79
+ * @param {Object} [opts.documenttype] - Document type payload (DocumentTypePutData)
80
+ * @param {Object} [opts.data] - Alias for documenttype (deprecated, use documenttype)
89
81
  * @param {Object} [opts.headers] - Optional headers
90
- * @returns {Promise<import("axios").AxiosResponse>}
82
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
83
+ * @throws When response is 4xx/5xx (400, 401, 404, 409 CANNOT_UPDATE_LEXICON_ENTRIES, 500)
91
84
  */
92
85
  function update(_ref4) {
93
86
  var token = _ref4.token,
94
87
  jwtToken = _ref4.jwtToken,
95
88
  id = _ref4.id,
89
+ documenttype = _ref4.documenttype,
96
90
  data = _ref4.data,
97
- _ref4$query = _ref4.query,
98
- query = _ref4$query === undefined ? {} : _ref4$query,
99
91
  headers = _ref4.headers;
100
92
 
93
+ var payload = documenttype || data;
101
94
  return client({
102
95
  url: "/document-types/" + id,
103
96
  method: "put",
104
97
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
105
- params: query,
106
- data: data
98
+ data: { documenttype: payload }
107
99
  });
108
100
  }
109
101
 
110
102
  /**
111
- * DELETE /document-types/:id - remove document type. API does not accept query params.
103
+ * DELETE /document-types/:documenttypeId - remove document type.
112
104
  * @param {Object} opts
113
105
  * @param {string} [opts.token] - API key
114
106
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
115
107
  * @param {string} opts.id - Document type id
116
108
  * @param {Object} [opts.headers] - Optional headers
117
- * @returns {Promise<import("axios").AxiosResponse>}
109
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttypeId: string }>>}
110
+ * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)
118
111
  */
119
112
  function remove(_ref5) {
120
113
  var token = _ref5.token,
121
114
  jwtToken = _ref5.jwtToken,
122
115
  id = _ref5.id,
123
- _ref5$query = _ref5.query,
124
- query = _ref5$query === undefined ? {} : _ref5$query,
125
116
  headers = _ref5.headers;
126
117
 
127
118
  return client({
128
119
  url: "/document-types/" + id,
129
120
  method: "delete",
130
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
131
- params: query
121
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
132
122
  });
133
123
  }
134
124
 
135
125
  /**
136
- * POST /document-types - create document type. API does not accept query params.
126
+ * POST /document-types - create document type.
137
127
  * @param {Object} opts
138
128
  * @param {string} [opts.token] - API key
139
129
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
140
- * @param {Object} opts.data - Document type payload
130
+ * @param {Object} [opts.documenttype] - Document type payload (DocumentTypePostData)
131
+ * @param {Object} [opts.data] - Alias for documenttype (deprecated, use documenttype)
141
132
  * @param {Object} [opts.headers] - Optional headers
142
- * @returns {Promise<import("axios").AxiosResponse>}
133
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
134
+ * @throws When response is 4xx/5xx (400, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
143
135
  */
144
136
  function create(_ref6) {
145
137
  var token = _ref6.token,
146
138
  jwtToken = _ref6.jwtToken,
139
+ documenttype = _ref6.documenttype,
147
140
  data = _ref6.data,
148
- _ref6$query = _ref6.query,
149
- query = _ref6$query === undefined ? {} : _ref6$query,
150
141
  headers = _ref6.headers;
151
142
 
143
+ var payload = documenttype || data;
152
144
  return client({
153
145
  url: "/document-types",
154
146
  method: "post",
155
147
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
156
- params: query,
157
- data: data
148
+ data: { documenttype: payload }
158
149
  });
159
150
  }
160
151
 
@@ -4,11 +4,11 @@ var _require = require("../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
6
  /**
7
- * Factory for external-wallets API (btrz-api-inventory).
7
+ * Factory for external-wallets API (btrz-api-inventory). SaldoMax external wallets only.
8
8
  * @param {Object} deps
9
9
  * @param {import("axios").AxiosInstance} deps.client
10
10
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
- * @returns {{ saldoMax: object }}
11
+ * @returns {{ saldoMax: { all: function, get: function, create: function, update: function, movements: { create: function } } }}
12
12
  */
13
13
 
14
14
 
@@ -19,12 +19,14 @@ function externalWalletsFactory(_ref) {
19
19
  /** @type {{ all: function, create: function, get: function, update: function, movements: object }} */
20
20
  var saldoMax = {
21
21
  /**
22
- * GET /external-wallets/saldo-max - list saldo max wallets. API does not accept query params.
22
+ * GET /external-wallets/saldo-max - list SaldoMax external wallets (paginated).
23
23
  * @param {Object} opts
24
24
  * @param {string} [opts.token] - API key
25
25
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
26
+ * @param {Object} [opts.query] - Pagination query params
26
27
  * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>}
28
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallets: Array, next?: string, previous?: string, count: number }>>}
29
+ * @throws When response is 4xx/5xx (401, 500)
28
30
  */
29
31
  all: function all(_ref2) {
30
32
  var token = _ref2.token,
@@ -39,13 +41,14 @@ function externalWalletsFactory(_ref) {
39
41
  });
40
42
  },
41
43
  /**
42
- * POST /external-wallets/saldo-max - create saldo max wallet. API does not accept query params.
44
+ * POST /external-wallets/saldo-max - create SaldoMax external wallet.
43
45
  * @param {Object} opts
44
46
  * @param {string} [opts.token] - API key
45
47
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
46
- * @param {Object} opts.externalWallet - External wallet payload
48
+ * @param {Object} opts.externalWallet - External wallet payload (ExternalWalletData: firstName, lastName, email, tel, dob, nip)
47
49
  * @param {Object} [opts.headers] - Optional headers
48
- * @returns {Promise<import("axios").AxiosResponse>}
50
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
51
+ * @throws When response is 4xx/5xx (400, 401, 409 DUPLICATE_EXTERNAL_WALLET_EMAIL/TEL, 500)
49
52
  */
50
53
  create: function create(_ref3) {
51
54
  var token = _ref3.token,
@@ -61,13 +64,14 @@ function externalWalletsFactory(_ref) {
61
64
  });
62
65
  },
63
66
  /**
64
- * GET /external-wallets/saldo-max/:walletId - get saldo max wallet. API does not accept query params.
67
+ * GET /external-wallets/saldo-max/:walletId - get SaldoMax external wallet by id.
65
68
  * @param {Object} opts
66
69
  * @param {string} [opts.token] - API key
67
70
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
68
- * @param {string} opts.walletId - Wallet id
71
+ * @param {string} opts.walletId - Wallet id (24 hex characters)
69
72
  * @param {Object} [opts.headers] - Optional headers
70
- * @returns {Promise<import("axios").AxiosResponse>}
73
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
74
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
71
75
  */
72
76
  get: function get(_ref4) {
73
77
  var token = _ref4.token,
@@ -80,13 +84,14 @@ function externalWalletsFactory(_ref) {
80
84
  });
81
85
  },
82
86
  /**
83
- * PUT /external-wallets/saldo-max/:externalWallet._id - update saldo max wallet. API does not accept query params.
87
+ * PUT /external-wallets/saldo-max/:walletId - update SaldoMax external wallet.
84
88
  * @param {Object} opts
85
89
  * @param {string} [opts.token] - API key
86
90
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
87
91
  * @param {Object} opts.externalWallet - External wallet payload (must include _id)
88
92
  * @param {Object} [opts.headers] - Optional headers
89
- * @returns {Promise<import("axios").AxiosResponse>}
93
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
94
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
90
95
  */
91
96
  update: function update(_ref5) {
92
97
  var token = _ref5.token,
@@ -112,27 +117,28 @@ function externalWalletsFactory(_ref) {
112
117
  /** @type {{ create: function }} */
113
118
  movements: {
114
119
  /**
115
- * PUT /external-wallets/saldo-max/:walletId/movements - create movement. API does not accept query params.
120
+ * PUT /external-wallets/saldo-max/:walletId/movements - add movement to wallet.
116
121
  * @param {Object} opts
117
122
  * @param {string} [opts.token] - API key
118
123
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
119
124
  * @param {string} opts.walletId - Wallet id
120
- * @param {Object} opts.movement - Movement payload
121
- * @returns {Promise<import("axios").AxiosResponse>}
125
+ * @param {Object} opts.movement - Movement payload (amount, type: payment|refund|manual, reason, nip)
126
+ * @param {Object} [opts.headers] - Optional headers
127
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
128
+ * @throws When response is 4xx/5xx (400, 401, 403 INVALID_NIP/WALLET_BLOCKED/WALLET_NOT_ACTIVE, 404, 500)
122
129
  */
123
130
  create: function create(_ref6) {
124
131
  var token = _ref6.token,
125
132
  jwtToken = _ref6.jwtToken,
126
133
  walletId = _ref6.walletId,
127
- movement = _ref6.movement;
134
+ movement = _ref6.movement,
135
+ headers = _ref6.headers;
128
136
 
129
137
  return client({
130
138
  url: "/external-wallets/saldo-max/" + walletId + "/movements",
131
139
  method: "put",
132
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider }),
133
- data: {
134
- movement: movement
135
- }
140
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
141
+ data: { movement: movement }
136
142
  });
137
143
  }
138
144
  }
@@ -26,33 +26,37 @@ function feesFactory(_ref) {
26
26
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
27
27
 
28
28
  /**
29
- * GET /fees - list fees.
29
+ * GET /fees - list fees (paginated).
30
30
  * @param {Object} opts
31
31
  * @param {string} [opts.token] - API key
32
- * @param {InventoryFeesQuery} [opts.query] - Optional query params (forwarded to API)
32
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
+ * @param {InventoryFeesQuery} [opts.query] - Query params (providerIds, rules, productId, internalId)
33
34
  * @param {Object} [opts.headers] - Optional headers
34
- * @returns {Promise<import("axios").AxiosResponse>}
35
+ * @returns {Promise<import("axios").AxiosResponse<{ fees: Array, next?: string, previous?: string, count: number }>>}
36
+ * @throws When response is 4xx/5xx (401, 500)
35
37
  */
36
38
  function all(_ref2) {
37
39
  var token = _ref2.token,
40
+ jwtToken = _ref2.jwtToken,
38
41
  _ref2$query = _ref2.query,
39
42
  query = _ref2$query === undefined ? {} : _ref2$query,
40
43
  headers = _ref2.headers;
41
44
 
42
45
  return client.get("/fees", {
43
46
  params: query,
44
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
47
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
45
48
  });
46
49
  }
47
50
 
48
51
  /**
49
- * GET /fees/:feeId - get fee by id. API does not accept query params.
52
+ * GET /fees/:feeId - get fee by id.
50
53
  * @param {Object} opts
51
54
  * @param {string} [opts.token] - API key
52
55
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
53
- * @param {string} opts.feeId - Fee id
56
+ * @param {string} opts.feeId - Fee id (24 hex characters)
54
57
  * @param {Object} [opts.headers] - Optional headers
55
- * @returns {Promise<import("axios").AxiosResponse>}
58
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
59
+ * @throws When response is 4xx/5xx (400, 401, 404 FEE_NOT_FOUND, 500)
56
60
  */
57
61
  function get(_ref3) {
58
62
  var token = _ref3.token,
@@ -66,13 +70,14 @@ function feesFactory(_ref) {
66
70
  }
67
71
 
68
72
  /**
69
- * POST /fees - create fee. API does not accept query params.
73
+ * POST /fees - create fee.
70
74
  * @param {Object} opts
71
75
  * @param {string} [opts.token] - API key
72
76
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
73
- * @param {Object} opts.fee - Fee payload
77
+ * @param {Object} opts.fee - Fee payload (FeePostData: name, internalId, valueType, value, rules, products, lexiconKeys, etc.)
74
78
  * @param {Object} [opts.headers] - Optional headers
75
- * @returns {Promise<import("axios").AxiosResponse>}
79
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
80
+ * @throws When response is 4xx/5xx (400, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
76
81
  */
77
82
  function create(_ref4) {
78
83
  var token = _ref4.token,
@@ -89,14 +94,15 @@ function feesFactory(_ref) {
89
94
  }
90
95
 
91
96
  /**
92
- * PUT /fees/:feeId - update fee. API does not accept query params.
97
+ * PUT /fees/:feeId - update fee.
93
98
  * @param {Object} opts
94
99
  * @param {string} [opts.token] - API key
95
100
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
96
101
  * @param {string} opts.feeId - Fee id
97
- * @param {Object} opts.fee - Fee payload
102
+ * @param {Object} opts.fee - Fee payload (partial FeePostData)
98
103
  * @param {Object} [opts.headers] - Optional headers
99
- * @returns {Promise<import("axios").AxiosResponse>}
104
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
105
+ * @throws When response is 4xx/5xx (400, 401, 404 FEE_NOT_FOUND, 409 CANNOT_UPDATE_LEXICON_ENTRIES, 500)
100
106
  */
101
107
  function update(_ref5) {
102
108
  var token = _ref5.token,