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
@@ -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,
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-len */
3
4
  var _require = require("./../endpoints_helpers.js"),
4
5
  authorizationHeaders = _require.authorizationHeaders;
5
6
 
6
7
  /**
7
8
  * Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
8
9
  * @typedef {Object} SegmentsInformationTablesQuery
9
- * @property {string} [providerId] - Provider id of the route if not the same as the user making the request (ObjectId format)
10
+ * @property {string} [providerId] - Provider/account id of the route when different from the authenticated user (24-char hex ObjectId)
10
11
  */
11
12
 
12
13
  /**
@@ -23,14 +24,18 @@ function segmentInformationTableFactory(_ref) {
23
24
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
25
 
25
26
  /**
26
- * GET /segments-information-tables/:routeId - get segments information table by route id.
27
+ * GET /segments-information-tables/:routeId Returns segment information tables for the route (distances, durations, durationsHHMM between stops). Requires BETTEREZ_APP audience.
27
28
  * @param {Object} opts
28
- * @param {string} [opts.token] - API key
29
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
30
- * @param {string} opts.routeId - Route id (ObjectId format)
31
- * @param {SegmentsInformationTablesQuery} [opts.query] - Query params (providerId)
29
+ * @param {string} [opts.token] - API key (X-API-KEY)
30
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
31
+ * @param {string} opts.routeId - Route id (24-char hex ObjectId)
32
+ * @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
32
33
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
34
+ * @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
35
+ * @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
36
+ * @throws 401 Unauthorized
37
+ * @throws 404 ROUTE_NOT_FOUND
38
+ * @throws 500 Internal server error
34
39
  */
35
40
  function get(_ref2) {
36
41
  var token = _ref2.token,
@@ -42,6 +47,7 @@ function segmentInformationTableFactory(_ref) {
42
47
 
43
48
  return client({
44
49
  url: "/segments-information-tables/" + routeId,
50
+ method: "get",
45
51
  params: query,
46
52
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
47
53
  });
@@ -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
 
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable max-len */
4
+ var _require = require("./../endpoints_helpers.js"),
5
+ authorizationHeaders = _require.authorizationHeaders;
6
+
7
+ /**
8
+ * Body for POST /direct-trip-ids (btrz-api-inventory-trips). See TripIdPostData in post-handler getSpec().
9
+ * @typedef {Object} TripIdPostData
10
+ * @property {string} providerId - Provider id (24-char hex ObjectId)
11
+ * @property {string} routeId - Route id (24-char hex ObjectId)
12
+ * @property {string} scheduleId - Schedule id
13
+ * @property {string} departureDate - Departure date (yyyy-mm-dd)
14
+ * @property {string} fareIds - Fare ids and quantities (e.g. fareId:qty)
15
+ * @property {string} channel - One of: backoffice, agency-backoffice, websales, agency-websales
16
+ * @property {string} productId - Product id (24-char hex ObjectId)
17
+ * @property {string} originId - Origin station id (24-char hex ObjectId)
18
+ * @property {string} destinationId - Destination station id (24-char hex ObjectId)
19
+ * @property {string} [currency] - ISO currency code (optional, for multicurrency)
20
+ */
21
+
22
+ /**
23
+ * Factory for trip-ids API (btrz-api-inventory-trips).
24
+ * @param {Object} deps
25
+ * @param {import("axios").AxiosInstance} deps.client
26
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
27
+ * @returns {{ create: function }}
28
+ */
29
+
30
+
31
+ function tripIdsFactory(_ref) {
32
+ var client = _ref.client,
33
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
34
+
35
+ /**
36
+ * POST /direct-trip-ids — Resolve trip parameters to a trip id. Runs trip search internally and returns the matching trip's base64 id (or null). Body can be TripIdPostData or { tripId: TripIdPostData }.
37
+ * @param {Object} opts
38
+ * @param {string} [opts.token] - API key (X-API-KEY)
39
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
40
+ * @param {TripIdPostData|{ tripId: TripIdPostData }} opts.data - Trip parameters (or wrapped in tripId key)
41
+ * @param {Object} [opts.headers] - Optional headers
42
+ * @returns {Promise<import("axios").AxiosResponse<{ tripId: { tripId: string|null } }>>}
43
+ * @throws 400 WRONG_DATA — tripId required or required fields missing
44
+ * @throws 401 Unauthorized
45
+ * @throws 404 TRIP_IDS_NOT_FOUND
46
+ * @throws 500 Internal server error
47
+ */
48
+ function create(_ref2) {
49
+ var token = _ref2.token,
50
+ jwtToken = _ref2.jwtToken,
51
+ data = _ref2.data,
52
+ headers = _ref2.headers;
53
+
54
+ return client({
55
+ url: "/direct-trip-ids",
56
+ method: "post",
57
+ data: data,
58
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
59
+ });
60
+ }
61
+
62
+ return {
63
+ create: create
64
+ };
65
+ }
66
+
67
+ module.exports = tripIdsFactory;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-len */
3
4
  var _require = require("./../endpoints_helpers.js"),
4
5
  authorizationHeaders = _require.authorizationHeaders;
5
6
 
6
7
  /**
7
- * Factory for trips API (btrz-api-inventory).
8
+ * Factory for trips API (btrz-api-inventory-trips).
8
9
  * @param {Object} deps
9
10
  * @param {import("axios").AxiosInstance} deps.client
10
11
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
- * @returns {{ all: function, get: function }}
12
+ * @returns {{ all: function, get: function, getPricingSimulation: function }}
12
13
  */
13
14
 
14
15
 
@@ -17,12 +18,17 @@ function tripsFactory(_ref) {
17
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
19
 
19
20
  /**
20
- * GET /trips - list trips. API source of truth in btrz-api-inventory-trips; query not documented here.
21
+ * GET /trips Search for available trips by date, origin, destination, fare, product, channel, and price. Rate limited (e.g. 8000 req/10 min). See get-trips getSpec() for full query params (productId, originId, destinationId, fareIds, departureDate, returnDate, channel, currency, etc.).
21
22
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
23
+ * @param {string} [opts.token] - API key (X-API-KEY)
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
25
+ * @param {Object} [opts.query] - Query params (productId, originId, destinationId, fareIds, departureDate, returnDate, etc.)
24
26
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
27
+ * @returns {Promise<import("axios").AxiosResponse<{ trips: { departures: Object[], returns: Object[] } }>>}
28
+ * @throws 400 INVALID_DATE, INVALID_DATE_FORMAT, INVALID_PRODUCTID, INVALID_ORIGIN, INVALID_DESTINATION, INVALID_CHANNEL, INVALID_FARE, INVALID_FAREID, INVALID_MANIFEST_STATUS, WRONG_DATA
29
+ * @throws 401 Unauthorized
30
+ * @throws 409 NO_HIGHER_OR_EQL_PRICE
31
+ * @throws 500 Internal server error
26
32
  */
27
33
  function all(_ref2) {
28
34
  var token = _ref2.token,
@@ -33,32 +39,73 @@ function tripsFactory(_ref) {
33
39
 
34
40
  return client({
35
41
  url: "/trips",
42
+ method: "get",
36
43
  params: query,
37
44
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
38
45
  });
39
46
  }
40
47
 
41
48
  /**
42
- * GET /trip/:id - get trip by id. API does not accept query params.
49
+ * GET /trip/:id — Get up-to-date information for a trip by its ID (base64-encoded trip summary from a search). Optional query: extraCapacityImpact, ignoreCutoffs, currency, ignoreOmitByAvailability, includeMoveToTrips.
43
50
  * @param {Object} opts
44
- * @param {string} [opts.token] - API key
45
- * @param {string} opts.id - Trip id
51
+ * @param {string} [opts.token] - API key (X-API-KEY)
52
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
53
+ * @param {string} opts.id - Trip id (base64-encoded)
54
+ * @param {Object} [opts.query] - Optional: extraCapacityImpact, ignoreCutoffs, currency, ignoreOmitByAvailability, includeMoveToTrips
46
55
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ trip: Object }>>}
57
+ * @throws 400 INVALID_TRIP — tripId is invalid
58
+ * @throws 401 Unauthorized
59
+ * @throws 500 Internal server error
48
60
  */
49
61
  function get(_ref3) {
50
62
  var token = _ref3.token,
63
+ jwtToken = _ref3.jwtToken,
51
64
  id = _ref3.id,
65
+ _ref3$query = _ref3.query,
66
+ query = _ref3$query === undefined ? {} : _ref3$query,
52
67
  headers = _ref3.headers;
53
68
 
54
- return client.get("/trip/" + id, {
55
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
69
+ return client({
70
+ url: "/trip/" + id,
71
+ method: "get",
72
+ params: query,
73
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
74
+ });
75
+ }
76
+
77
+ /**
78
+ * GET /trips/pricing-simulation — Get pricing simulation for all purchase combinations for a schedule. Query: scheduleId, productId (required); purchaseDate, travelDate, includeReadable, includeMetadata, minimize (optional).
79
+ * @param {Object} opts
80
+ * @param {string} [opts.token] - API key (X-API-KEY)
81
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
82
+ * @param {Object} [opts.query] - scheduleId, productId (required); purchaseDate, travelDate, includeReadable, includeMetadata, minimize
83
+ * @param {Object} [opts.headers] - Optional headers
84
+ * @returns {Promise<import("axios").AxiosResponse<Object>>} Response shape per PricingSimulationResult definition
85
+ * @throws 400 INVALID_SCHEDULE_ID, INVALID_PRODUCT_ID, INVALID_PRODUCT, ROUTE_NOT_FOUND, ONLY_JP_SUPPORTED, INVALID_DATE
86
+ * @throws 401 Unauthorized, PRICING_SIMULATOR_DISABLED, PROVIDER_UNAUTHORIZED
87
+ * @throws 404 SCHEDULE_NOT_FOUND, NO_MANIFEST
88
+ * @throws 500 Internal server error
89
+ */
90
+ function getPricingSimulation(_ref4) {
91
+ var token = _ref4.token,
92
+ jwtToken = _ref4.jwtToken,
93
+ _ref4$query = _ref4.query,
94
+ query = _ref4$query === undefined ? {} : _ref4$query,
95
+ headers = _ref4.headers;
96
+
97
+ return client({
98
+ url: "/trips/pricing-simulation",
99
+ method: "get",
100
+ params: query,
101
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
56
102
  });
57
103
  }
58
104
 
59
105
  return {
60
106
  all: all,
61
- get: get
107
+ get: get,
108
+ getPricingSimulation: getPricingSimulation
62
109
  };
63
110
  }
64
111
 
@@ -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
 
@@ -18,13 +18,23 @@ function emailsFactory(_ref) {
18
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
19
 
20
20
  /**
21
- * POST /emails - create/send invoice email. API does not accept query params.
21
+ * POST /emails Send invoice by email to the given addresses.
22
+ * Request body may be sent as root object or under key "email". On success the API emits webhook invoiceemail.created.
23
+ *
22
24
  * @param {Object} opts
23
- * @param {string} [opts.token] - API key
24
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
25
- * @param {Object} opts.data - Request body
25
+ * @param {string} [opts.token] - API key (X-API-KEY)
26
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol (Authorization: Bearer)
27
+ * @param {Object} opts.data - Request body (EmailPostData)
28
+ * @param {string} opts.data.invoiceId - Invoice ID (required, 24-char hex ObjectId)
29
+ * @param {string[]} opts.data.emails - Recipient email addresses (required)
30
+ * @param {string} [opts.data.language] - Language code for template (e.g. "en-us")
31
+ * @param {Object} [opts.query] - Query params (none used by this endpoint)
26
32
  * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ status: "OK" }>>} Resolves with { status: "OK" } on success
34
+ * @throws 400 WRONG_DATA, ACCOUNT_CANT_SEND_EMAILS, NO_VERIFIED_OR_ACTIVE_EMAIL, INVALID_EMAIL_TO_SEND
35
+ * @throws 401 Unauthorized (missing/invalid X-API-KEY or Authorization)
36
+ * @throws 404 INVOICE_NOT_FOUND
37
+ * @throws 500 Internal server error
28
38
  */
29
39
  function create(_ref2) {
30
40
  var token = _ref2.token,