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
@@ -48,7 +48,9 @@ function productsFactory(_ref) {
48
48
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
49
49
  * @param {ProductsListQuery} [opts.query] - Query params
50
50
  * @param {Object} [opts.headers] - Optional headers
51
- * @returns {Promise<import("axios").AxiosResponse>}
51
+ * @returns {Promise<import("axios").AxiosResponse<{ products: Array<object> }>>}
52
+ * Resolves with list of products; response.data has Products shape.
53
+ * @throws When the request fails (400 invalid channels, 401 unauthorized, 500). ErrorResponse body.
52
54
  */
53
55
  function all(_ref2) {
54
56
  var token = _ref2.token,
@@ -71,7 +73,9 @@ function productsFactory(_ref) {
71
73
  * @param {string} opts.productId - Product id
72
74
  * @param {ProductGetQuery} [opts.query] - Query params (providerIds, channels, enabled)
73
75
  * @param {Object} [opts.headers] - Optional headers
74
- * @returns {Promise<import("axios").AxiosResponse>}
76
+ * @returns {Promise<import("axios").AxiosResponse<{ product: object }>>}
77
+ * Resolves with single product; response.data.product is the Product.
78
+ * @throws When the request fails (400/401/404/500). Body: INVALID_PRODUCTID, WRONG_DATA, PRODUCT_NOTFOUND.
75
79
  */
76
80
  function get(_ref3) {
77
81
  var productId = _ref3.productId,
@@ -89,13 +93,16 @@ function productsFactory(_ref) {
89
93
  }
90
94
 
91
95
  /**
92
- * POST /products - create product. API does not accept query params.
96
+ * POST /products - create product. No query params. Requires BETTEREZ_APP JWT or API key.
93
97
  * @param {Object} opts
94
98
  * @param {string} [opts.token] - API key
95
99
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
96
- * @param {Object} opts.data - Product payload
100
+ * @param {Object} opts.data - Product payload (PostedProduct); must not include _id.
97
101
  * @param {Object} [opts.headers] - Optional headers
98
- * @returns {Promise<import("axios").AxiosResponse>}
102
+ * @returns {Promise<import("axios").AxiosResponse<{ product: object }>>}
103
+ * Resolves with the created product.
104
+ * @throws When the request fails (400/401/500). Body: DUPLICATE_PRODUCT, CANNOT_CREATE_PRODUCT_WITH_ID,
105
+ * INVALID_PAYMENT_METHODS, INVALID_PARENT_PRODUCT_ID, INVALID_JOURNEY_RESTRICTIONS, INVALID_PRODUCT_NAME, etc.
99
106
  */
100
107
  function create(_ref4) {
101
108
  var data = _ref4.data,
@@ -112,14 +119,17 @@ function productsFactory(_ref) {
112
119
  }
113
120
 
114
121
  /**
115
- * PUT /products/:productId - update product. API does not accept query params.
122
+ * PUT /products/:productId - update product. No query params. Requires BETTEREZ_APP JWT or API key.
116
123
  * @param {Object} opts
117
124
  * @param {string} [opts.token] - API key
118
125
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
119
126
  * @param {string} opts.productId - Product id
120
- * @param {Object} opts.data - Product payload
127
+ * @param {Object} opts.data - Product payload (PostedProduct).
121
128
  * @param {Object} [opts.headers] - Optional headers
122
- * @returns {Promise<import("axios").AxiosResponse>}
129
+ * @returns {Promise<import("axios").AxiosResponse<{ product: object }>>}
130
+ * Resolves with the updated product. Emits product.updated webhook.
131
+ * @throws When the request fails (400/401/404/500). Body: NOT_FOUND, INVALID_PAYMENT_METHODS,
132
+ * CANNOT_SET_PARENT_AS_CHILD, INVALID_JOURNEY_RESTRICTIONS, INVALID_PRODUCT_NAME, etc.
123
133
  */
124
134
  function update(_ref5) {
125
135
  var productId = _ref5.productId,
@@ -145,7 +155,8 @@ function productsFactory(_ref) {
145
155
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
146
156
  * @param {string} opts.domain - Domain
147
157
  * @param {Object} [opts.headers] - Optional headers
148
- * @returns {Promise<import("axios").AxiosResponse>}
158
+ * @returns {Promise<import("axios").AxiosResponse>} Resolves on success. May emit product.updated.
159
+ * @throws When the request fails (401, 404, 500).
149
160
  */
150
161
  remove: function remove(_ref6) {
151
162
  var token = _ref6.token,
@@ -169,7 +180,8 @@ function productsFactory(_ref) {
169
180
  * @param {string} [opts.token] - API key
170
181
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
171
182
  * @param {Object} [opts.headers] - Optional headers
172
- * @returns {Promise<import("axios").AxiosResponse>}
183
+ * @returns {Promise<import("axios").AxiosResponse>} Resolves with list of product families.
184
+ * @throws When the request fails (401, 500).
173
185
  */
174
186
  all: function all(_ref7) {
175
187
  var token = _ref7.token,
@@ -48,7 +48,9 @@ function promosFactory(_ref) {
48
48
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
49
49
  * @param {PromosListQuery} [opts.query] - Query params
50
50
  * @param {Object} [opts.headers] - Optional headers
51
- * @returns {Promise<import("axios").AxiosResponse>}
51
+ * @returns {Promise<import("axios").AxiosResponse<{ promos: Array<object>, total: number }>>}
52
+ * Resolves with paginated promos; response.data has Promos shape.
53
+ * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, PROMO_NOT_FOUND.
52
54
  */
53
55
  function all(_ref2) {
54
56
  var token = _ref2.token,
@@ -85,13 +87,15 @@ function promosFactory(_ref) {
85
87
  }
86
88
 
87
89
  /**
88
- * POST /promos - create promo. API does not accept query params.
90
+ * POST /promos - create promo. No query params. Requires BETTEREZ_APP JWT or API key. Emits promo.created.
89
91
  * @param {Object} opts
90
92
  * @param {string} [opts.token] - API key
91
93
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
92
- * @param {Object} opts.promo - Promo payload
94
+ * @param {Object} opts.promo - Promo payload (PromoUpdateRequest); must not include _id.
93
95
  * @param {Object} [opts.headers] - Optional headers
94
- * @returns {Promise<import("axios").AxiosResponse>}
96
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with created Promo.
97
+ * @throws When the request fails (400/401/500). Body: WRONG_DATA, INTERNALID_USED,
98
+ * CANNOT_CREATE_PROMO_WITH_ID, INVALID_PAYMENT_METHOD_TYPE, etc.
95
99
  */
96
100
  function create(_ref4) {
97
101
  var jwtToken = _ref4.jwtToken,
@@ -108,13 +112,14 @@ function promosFactory(_ref) {
108
112
  }
109
113
 
110
114
  /**
111
- * DELETE /promos/:promoId - remove promo. API does not accept query params.
115
+ * DELETE /promos/:promoId - disable promo (soft delete). No query params. Requires BETTEREZ_APP. Emits promo.deleted.
112
116
  * @param {Object} opts
113
117
  * @param {string} [opts.token] - API key
114
118
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
115
119
  * @param {string} opts.promoId - Promo id
116
120
  * @param {Object} [opts.headers] - Optional headers
117
- * @returns {Promise<import("axios").AxiosResponse>}
121
+ * @returns {Promise<import("axios").AxiosResponse>} Resolves with disabled promo.
122
+ * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PROMO_ID, PROMO_NOT_FOUND.
118
123
  */
119
124
  function remove(_ref5) {
120
125
  var jwtToken = _ref5.jwtToken,
@@ -130,14 +135,15 @@ function promosFactory(_ref) {
130
135
  }
131
136
 
132
137
  /**
133
- * PATCH /promos/:promoId - update promo. API does not accept query params.
138
+ * PATCH /promos/:promoId - update promo (partial). No query params. Requires BETTEREZ_APP. Emits promo.updated.
134
139
  * @param {Object} opts
135
140
  * @param {string} [opts.token] - API key
136
141
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
137
142
  * @param {string} opts.promoId - Promo id
138
- * @param {Object} opts.update - Update payload
143
+ * @param {Object} opts.update - Partial update (PromoUpdateRequest).
139
144
  * @param {Object} [opts.headers] - Optional headers
140
- * @returns {Promise<import("axios").AxiosResponse>}
145
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with updated Promo.
146
+ * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INTERNALID_USED, PROMO_NOT_FOUND, etc.
141
147
  */
142
148
  // eslint-disable-next-line no-shadow
143
149
  function update(_ref6) {
@@ -156,14 +162,15 @@ function promosFactory(_ref) {
156
162
  }
157
163
 
158
164
  /**
159
- * PATCH /promo/:promoId - patch promo with operations. API does not accept query params.
165
+ * PATCH /promo/:promoId - update rule availability (add/subtract). No query params. Emits promo.updated.
160
166
  * @param {Object} opts
161
167
  * @param {string} [opts.token] - API key
162
168
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
163
169
  * @param {string} opts.promoId - Promo id
164
- * @param {Object} opts.operations - Patch operations
170
+ * @param {Object} opts.operations - Array of PromoUpdateOperation (op, path, value).
165
171
  * @param {Object} [opts.headers] - Optional headers
166
- * @returns {Promise<import("axios").AxiosResponse>}
172
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with PatchedPromos.
173
+ * @throws When the request fails (400/401/404/500).
167
174
  */
168
175
  function patch(_ref7) {
169
176
  var jwtToken = _ref7.jwtToken,
@@ -181,14 +188,15 @@ function promosFactory(_ref) {
181
188
  }
182
189
 
183
190
  /**
184
- * POST /promos/:promoId/rules - add promo rule. API does not accept query params.
191
+ * POST /promos/:promoId/rules - add promo rule. No query params. Requires BETTEREZ_APP. May emit promo.updated.
185
192
  * @param {Object} opts
186
193
  * @param {string} [opts.token] - API key
187
194
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
188
195
  * @param {string} opts.promoId - Promo id
189
- * @param {Object} opts.rule - Rule payload
196
+ * @param {Object} opts.rule - Rule payload (PromoRule).
190
197
  * @param {Object} [opts.headers] - Optional headers
191
- * @returns {Promise<import("axios").AxiosResponse>}
198
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with Promo including new rule.
199
+ * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
192
200
  */
193
201
  function addRule(_ref8) {
194
202
  var jwtToken = _ref8.jwtToken,
@@ -206,15 +214,16 @@ function promosFactory(_ref) {
206
214
  }
207
215
 
208
216
  /**
209
- * PUT /promos/:promoId/rules/:ruleId - update promo rule. API does not accept query params.
217
+ * PUT /promos/:promoId/rules/:ruleId - update promo rule. No query params. Requires BETTEREZ_APP. Emits promo.updated.
210
218
  * @param {Object} opts
211
219
  * @param {string} [opts.token] - API key
212
220
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
213
221
  * @param {string} opts.promoId - Promo id
214
222
  * @param {string} opts.ruleId - Rule id
215
- * @param {Object} opts.rule - Rule payload
223
+ * @param {Object} opts.rule - Full rule payload (PromoRule).
216
224
  * @param {Object} [opts.headers] - Optional headers
217
- * @returns {Promise<import("axios").AxiosResponse>}
225
+ * @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with updated Promo.
226
+ * @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
218
227
  */
219
228
  function updateRule(_ref9) {
220
229
  var jwtToken = _ref9.jwtToken,
@@ -26,8 +26,7 @@ function stationGroupsFactory(_ref) {
26
26
  * GET /station-groups - list station groups.
27
27
  * @param {Object} opts
28
28
  * @param {string} [opts.token] - API key
29
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
30
- * @param {StationGroupsListQuery} [opts.query] - Query params
29
+ * @param {StationGroupsListQuery} [opts.query] - Query params (e.g. providerIds)
31
30
  * @param {Object} [opts.headers] - Optional headers
32
31
  * @returns {Promise<import("axios").AxiosResponse>}
33
32
  */
@@ -37,8 +36,7 @@ function stationGroupsFactory(_ref) {
37
36
  query = _ref2$query === undefined ? {} : _ref2$query,
38
37
  headers = _ref2.headers;
39
38
 
40
- return client({
41
- url: "/station-groups",
39
+ return client.get("/station-groups", {
42
40
  params: query,
43
41
  headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
44
42
  });
@@ -9,6 +9,15 @@ var _require = require("../endpoints_helpers.js"),
9
9
  * @property {string} [providerIds] - The id of the providers to get taxes for
10
10
  */
11
11
 
12
+ /**
13
+ * Query params for GET /taxes/exceptions (btrz-api-inventory). See get-tax-exceptions-handler getSpec().
14
+ * @typedef {Object} TaxExceptionsListQuery
15
+ * @property {string} [originId] - Origin station id (24 hex characters)
16
+ * @property {string} [destinationId] - Destination station id (24 hex characters)
17
+ * @property {number} [page] - Page to return
18
+ * @property {number} [recordsPerPage] - Records per page
19
+ */
20
+
12
21
  /**
13
22
  * Factory for taxes API (btrz-api-inventory).
14
23
  * @param {Object} deps
@@ -134,7 +143,7 @@ function taxesFactory(_ref) {
134
143
  url: "/taxes/exceptions",
135
144
  method: "post",
136
145
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
137
- data: taxException
146
+ data: { taxException: taxException }
138
147
  });
139
148
  },
140
149
 
@@ -159,7 +168,7 @@ function taxesFactory(_ref) {
159
168
  url: "/taxes/exceptions/" + taxExceptionId,
160
169
  method: "put",
161
170
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
162
- data: taxException
171
+ data: { taxException: taxException }
163
172
  });
164
173
  },
165
174
 
@@ -5,6 +5,7 @@ var _require = require("./../endpoints_helpers.js"),
5
5
 
6
6
  /**
7
7
  * Factory for traveller-card-providers types API (btrz-api-inventory).
8
+ * Returns the list of supported traveller card provider types (e.g. "custom", "caa").
8
9
  * @param {Object} deps
9
10
  * @param {import("axios").AxiosInstance} deps.client
10
11
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
@@ -17,21 +18,20 @@ function travellerCardProvidersTypesFactory(_ref) {
17
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
19
 
19
20
  /**
20
- * GET /traveller-card-providers/types - list traveller card provider types. API does not accept query params.
21
+ * GET /traveller-card-providers/types - list traveller card provider types (e.g. "custom", "caa"). No query or path params.
21
22
  * @param {Object} opts
22
23
  * @param {string} [opts.token] - API key
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
23
25
  * @param {Object} [opts.headers] - Optional headers
24
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ travellerCardProviderTypes: Array<{ type: string, properties: Object }> }>>}
25
27
  */
26
28
  function all(_ref2) {
27
29
  var token = _ref2.token,
28
- _ref2$query = _ref2.query,
29
- query = _ref2$query === undefined ? {} : _ref2$query,
30
+ jwtToken = _ref2.jwtToken,
30
31
  headers = _ref2.headers;
31
32
 
32
33
  return client.get("/traveller-card-providers/types", {
33
- params: query,
34
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
34
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
35
35
  });
36
36
  }
37
37
 
@@ -17,22 +17,19 @@ function vehicleTypesFactory(_ref) {
17
17
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
18
 
19
19
  /**
20
- * GET /vehicle-types - list vehicle types (e.g. Bus, Shuttle, Van, Train, Ferry, Tram).
20
+ * GET /vehicle-types - list vehicle types (e.g. Bus, Shuttle, Van, Train, Ferry, Tram). No query or path params.
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 {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
25
+ * @returns {Promise<import("axios").AxiosResponse<{ vehicleTypes: Array<{ _id: string, name: string }> }>>}
26
26
  */
27
27
  function all(_ref2) {
28
28
  var token = _ref2.token,
29
29
  jwtToken = _ref2.jwtToken,
30
- _ref2$query = _ref2.query,
31
- query = _ref2$query === undefined ? {} : _ref2$query,
32
30
  headers = _ref2.headers;
33
31
 
34
32
  return client.get("/vehicle-types", {
35
- params: query,
36
33
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
37
34
  });
38
35
  }
@@ -47,13 +47,14 @@ function vehiclesFactory(_ref) {
47
47
  */
48
48
  function all(_ref2) {
49
49
  var token = _ref2.token,
50
+ jwtToken = _ref2.jwtToken,
50
51
  _ref2$query = _ref2.query,
51
52
  query = _ref2$query === undefined ? {} : _ref2$query,
52
53
  headers = _ref2.headers;
53
54
 
54
55
  return client.get("/vehicles", {
55
56
  params: query,
56
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
57
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
57
58
  });
58
59
  }
59
60
 
@@ -69,10 +70,11 @@ function vehiclesFactory(_ref) {
69
70
  function get(_ref3) {
70
71
  var vehicleId = _ref3.vehicleId,
71
72
  token = _ref3.token,
73
+ jwtToken = _ref3.jwtToken,
72
74
  headers = _ref3.headers;
73
75
 
74
76
  return client.get("/vehicles/" + vehicleId, {
75
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
77
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
76
78
  });
77
79
  }
78
80
 
@@ -70,7 +70,7 @@ function customersFactory(_ref) {
70
70
  * @param {Object} opts
71
71
  * @param {string} [opts.token] - API key
72
72
  * @param {CustomersActivationPostQuery} [opts.query] - Query params (providerId required)
73
- * @param {Object} [opts.data] - Request body (CustomerForActivation)
73
+ * @param {Object} opts.data - Body: CustomerForActivation (firstName, lastName, email; optional activateCustomerEmailLoginToken)
74
74
  * @param {Object} [opts.headers] - Optional headers
75
75
  * @returns {Promise<import("axios").AxiosResponse>}
76
76
  */
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Request body for POST /external-customers/ado/registration (btrz-api-notifications).
8
+ * @typedef {Object} SaldoMaxRegistrationRequest
9
+ * @property {string} email - User email to register in Saldo Max (verification code is sent to this email).
10
+ */
11
+
12
+ /**
13
+ * Factory for external-customers API (btrz-api-notifications). Saldo Max (ADO) verification-code registration.
14
+ * @param {Object} deps
15
+ * @param {import("axios").AxiosInstance} deps.client
16
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
17
+ * @returns {{ requestSaldoMaxVerificationCode: function }}
18
+ */
19
+
20
+
21
+ function externalCustomersFactory(_ref) {
22
+ var client = _ref.client,
23
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
+
25
+ /**
26
+ * POST /external-customers/ado/registration – Request a Saldo Max (ADO) verification code for the given email.
27
+ * Requires BETTEREZ_APP JWT. Forwards to Saldo Max; sends verification code to the email.
28
+ * @param {Object} opts
29
+ * @param {string} [opts.token] - API key
30
+ * @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
31
+ * @param {SaldoMaxRegistrationRequest} opts.data - Body: { email } (or { body: { email } })
32
+ * @param {Object} [opts.headers] - Optional headers
33
+ * @returns {Promise<import("axios").AxiosResponse<{ code: string, message: string }>>}
34
+ */
35
+ function requestSaldoMaxVerificationCode(_ref2) {
36
+ var data = _ref2.data,
37
+ token = _ref2.token,
38
+ jwtToken = _ref2.jwtToken,
39
+ headers = _ref2.headers;
40
+
41
+ return client({
42
+ url: "/external-customers/ado/registration",
43
+ method: "post",
44
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
45
+ data: data
46
+ });
47
+ }
48
+
49
+ return {
50
+ requestSaldoMaxVerificationCode: requestSaldoMaxVerificationCode
51
+ };
52
+ }
53
+
54
+ module.exports = externalCustomersFactory;
@@ -82,9 +82,6 @@ function pdfFactory(_ref) {
82
82
  if (query.type === "transaction") {
83
83
  url = "/pdf-transactions/" + itemId;
84
84
  }
85
- if (query.type === "transaction") {
86
- url = "/pdf-transactions/" + itemId;
87
- }
88
85
  if (query.type === "ssr") {
89
86
  url = "/pdf-ssrs/" + itemId;
90
87
  }
@@ -30,12 +30,14 @@ function accountingItemsFactory(_ref) {
30
30
  * GET /accounting-items - list accounting items.
31
31
  * @param {Object} opts
32
32
  * @param {string} [opts.token] - API key
33
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
34
  * @param {AccountingItemsListQuery} [opts.query] - Query params (all optional)
34
35
  * @param {Object} [opts.headers] - Optional headers
35
36
  * @returns {Promise<import("axios").AxiosResponse>}
36
37
  */
37
38
  function all(_ref2) {
38
39
  var token = _ref2.token,
40
+ jwtToken = _ref2.jwtToken,
39
41
  _ref2$query = _ref2.query,
40
42
  query = _ref2$query === undefined ? {} : _ref2$query,
41
43
  headers = _ref2.headers;
@@ -44,6 +46,7 @@ function accountingItemsFactory(_ref) {
44
46
  params: query,
45
47
  headers: authorizationHeaders({
46
48
  token: token,
49
+ jwtToken: jwtToken,
47
50
  internalAuthTokenProvider: internalAuthTokenProvider,
48
51
  headers: headers
49
52
  })
@@ -54,18 +57,21 @@ function accountingItemsFactory(_ref) {
54
57
  * GET /accounting-items/:accountingItemId - get accounting item by id. API does not accept query params.
55
58
  * @param {Object} opts
56
59
  * @param {string} [opts.token] - API key
57
- * @param {string} opts.accountingItemId - Accounting item id
60
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
61
+ * @param {string} opts.accountingItemId - Accounting item id (ObjectId format)
58
62
  * @param {Object} [opts.headers] - Optional headers
59
63
  * @returns {Promise<import("axios").AxiosResponse>}
60
64
  */
61
65
  function get(_ref3) {
62
66
  var accountingItemId = _ref3.accountingItemId,
63
67
  token = _ref3.token,
68
+ jwtToken = _ref3.jwtToken,
64
69
  headers = _ref3.headers;
65
70
 
66
71
  return client.get("/accounting-items/" + accountingItemId, {
67
72
  headers: authorizationHeaders({
68
73
  token: token,
74
+ jwtToken: jwtToken,
69
75
  internalAuthTokenProvider: internalAuthTokenProvider,
70
76
  headers: headers
71
77
  })
@@ -17,14 +17,16 @@ function flexpassesFactory(_ref) {
17
17
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
18
 
19
19
  /**
20
- * DELETE /flexpasses/:flexpassId/scannings/:tripId - delete scan by trip id. API does not accept query params.
20
+ * DELETE /flexpasses/:flexpassId/scannings/:tripId - deletes one flexpass scanning for the given trip ID.
21
+ * Removes the scan matching tripId from the flexpass's scans; if multiple scans exist for the same tripId, only one is removed.
22
+ * Requires operations API base URL (e.g. .../operations). No query parameters.
21
23
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
- * @param {string} opts.flexpassId - Flexpass id
25
- * @param {string} opts.tripId - Trip id
26
- * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>}
24
+ * @param {string} [opts.token] - API key (X-API-KEY)
25
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
26
+ * @param {string} opts.flexpassId - Flexpass document ID (Mongo ObjectId string)
27
+ * @param {string} opts.tripId - Trip identifier of the scan to remove (e.g. routeId_scheduleName_date)
28
+ * @param {Object} [opts.headers] - Optional request headers
29
+ * @returns {Promise<import("axios").AxiosResponse<{ flexpassDeleted?: string }>>}
28
30
  */
29
31
  function deleteScanBytripId(_ref2) {
30
32
  var jwtToken = _ref2.jwtToken,
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Factory for gift-certificates API (btrz-api-operations).
8
+ * @param {Object} deps
9
+ * @param {import("axios").AxiosInstance} deps.client
10
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
+ * @returns {Object} gift-certificates API methods
12
+ */
13
+
14
+
15
+ function giftCertificatesFactory(_ref) {
16
+ var client = _ref.client,
17
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
+
19
+ /**
20
+ * GET /gift-certificates - list paid gift certificates for a customer. Paginated; requires customer JWT when used with JwtAuth.
21
+ * @param {Object} opts
22
+ * @param {string} [opts.token] - API key (X-API-KEY)
23
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer); when using customer JWT, must match customer param
24
+ * @param {string} opts.customer - Customer number to filter by (required)
25
+ * @param {number} [opts.page] - 1-based page number; page size is 20
26
+ * @param {Object} [opts.headers] - Optional request headers
27
+ * @returns {Promise<import("axios").AxiosResponse<{ giftCertificates: Array<object>, count: number, next?: string, previous?: string }>>}
28
+ */
29
+ function list(_ref2) {
30
+ var jwtToken = _ref2.jwtToken,
31
+ token = _ref2.token,
32
+ customer = _ref2.customer,
33
+ page = _ref2.page,
34
+ headers = _ref2.headers;
35
+
36
+ var params = { customer: customer };
37
+ if (page != null) {
38
+ params.page = page;
39
+ }
40
+ return client({
41
+ url: "/gift-certificates",
42
+ method: "get",
43
+ params: params,
44
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
45
+ });
46
+ }
47
+
48
+ return {
49
+ list: list
50
+ };
51
+ }
52
+
53
+ module.exports = giftCertificatesFactory;
@@ -28,15 +28,17 @@ function loansFactory(_ref) {
28
28
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
29
29
 
30
30
  /**
31
- * GET /loans - list loans.
31
+ * GET /loans - list loans for the account or provider. Paginated (20 per page). Requires operations API base URL.
32
32
  * @param {Object} opts
33
- * @param {string} [opts.token] - API key
34
- * @param {LoansListQuery} [opts.query] - Query params (all optional)
35
- * @param {Object} [opts.headers] - Optional headers
36
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @param {string} [opts.token] - API key (X-API-KEY)
34
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
35
+ * @param {LoansListQuery} [opts.query] - Query params (all optional): page, shiftId, type, trxId, status, providerId
36
+ * @param {Object} [opts.headers] - Optional request headers
37
+ * @returns {Promise<import("axios").AxiosResponse<{ loans: Array<object>, count: number, next?: string, previous?: string }>>}
37
38
  */
38
39
  function all(_ref2) {
39
40
  var token = _ref2.token,
41
+ jwtToken = _ref2.jwtToken,
40
42
  _ref2$query = _ref2.query,
41
43
  query = _ref2$query === undefined ? {} : _ref2$query,
42
44
  headers = _ref2.headers;
@@ -45,6 +47,7 @@ function loansFactory(_ref) {
45
47
  params: query,
46
48
  headers: authorizationHeaders({
47
49
  token: token,
50
+ jwtToken: jwtToken,
48
51
  internalAuthTokenProvider: internalAuthTokenProvider,
49
52
  headers: headers
50
53
  })
@@ -52,21 +55,24 @@ function loansFactory(_ref) {
52
55
  }
53
56
 
54
57
  /**
55
- * GET /loans/:loanId - get loan by id. API does not accept query params.
58
+ * GET /loans/:loanId - get a single loan by ID. Requires operations API base URL.
56
59
  * @param {Object} opts
57
- * @param {string} [opts.token] - API key
58
- * @param {string} opts.loanId - Loan id
59
- * @param {Object} [opts.headers] - Optional headers
60
- * @returns {Promise<import("axios").AxiosResponse>}
60
+ * @param {string} [opts.token] - API key (X-API-KEY)
61
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
62
+ * @param {string} opts.loanId - Loan document ID (24 hex characters)
63
+ * @param {Object} [opts.headers] - Optional request headers
64
+ * @returns {Promise<import("axios").AxiosResponse<{ loan: object }>>}
61
65
  */
62
66
  function get(_ref3) {
63
67
  var loanId = _ref3.loanId,
64
68
  token = _ref3.token,
69
+ jwtToken = _ref3.jwtToken,
65
70
  headers = _ref3.headers;
66
71
 
67
72
  return client.get("/loans/" + loanId, {
68
73
  headers: authorizationHeaders({
69
74
  token: token,
75
+ jwtToken: jwtToken,
70
76
  internalAuthTokenProvider: internalAuthTokenProvider,
71
77
  headers: headers
72
78
  })
@@ -3,6 +3,16 @@
3
3
  var _require = require("./../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
+ /**
7
+ * Request body for POST /movements (btrz-api-operations). See MovementPostData in movements models.
8
+ * @typedef {Object} MovementPostData
9
+ * @property {Array<{ _id: string, section?: string, sectionName?: string, seat?: string, row?: string, seatId?: string }>} tickets - Tickets to move (same transaction if more than one). Each must have _id; optional seat fields for destination seatmap.
10
+ * @property {{ routeId: string, scheduleId: string, date: string }} newManifest - Destination manifest: routeId (ObjectId), scheduleId (UUID), date (YYYY-MM-DD).
11
+ * @property {string} channel - Channel of the movement (e.g. backoffice). Must be a valid backoffice channel.
12
+ * @property {boolean} [allowsDifferentTrx] - If true, allows moving tickets from different transactions.
13
+ * @property {boolean} [newdesign] - If true, uses new seatmap design for accommodation.
14
+ */
15
+
6
16
  /**
7
17
  * Factory for movements API (btrz-api-operations).
8
18
  * @param {Object} deps
@@ -17,13 +27,14 @@ function movementsFactory(_ref) {
17
27
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
28
 
19
29
  /**
20
- * POST /movements - create movement. API does not accept query params.
30
+ * POST /movements - create a movement (move tickets to another manifest). No query params.
21
31
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
- * @param {Object} opts.movement - Movement payload
25
- * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
32
+ * @param {string} [opts.token] - API key (X-API-KEY)
33
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
34
+ * @param {MovementPostData} opts.movement - Request body: tickets, newManifest, channel; optional allowsDifferentTrx, newdesign
35
+ * @param {Object} [opts.query] - Optional query params (API accepts none)
36
+ * @param {Object} [opts.headers] - Optional request headers
37
+ * @returns {Promise<import("axios").AxiosResponse<{}>>}
27
38
  */
28
39
  function create(_ref2) {
29
40
  var token = _ref2.token,