btrz-api-client 8.65.0 → 8.68.1

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 (249) hide show
  1. package/.eslint-report.json +1 -0
  2. package/.eslintignore +2 -0
  3. package/fetch-test.js +5 -6
  4. package/index.js +2 -2
  5. package/lib/client-standalone-min.js +3 -3
  6. package/lib/client.js +51 -38
  7. package/lib/endpoints/accounts/agencies.js +34 -7
  8. package/lib/endpoints/accounts/journey-prices-settings.js +2 -2
  9. package/lib/endpoints/accounts/market-pricing-settings.js +3 -3
  10. package/lib/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  11. package/lib/endpoints/accounts/operation-settings.js +3 -1
  12. package/lib/endpoints/btrzpay/referenced-payments.js +6 -2
  13. package/lib/endpoints/btrzpay/square.js +12 -3
  14. package/lib/endpoints/btrzpay/stripe-terminals.js +9 -3
  15. package/lib/endpoints/btrzpay/terminalPayments.js +14 -4
  16. package/lib/endpoints/inventory/document-types.js +2 -1
  17. package/lib/endpoints/inventory/fare-type-modifiers.js +167 -0
  18. package/lib/endpoints/inventory/products.js +1 -0
  19. package/lib/endpoints/notifications/notify.js +55 -19
  20. package/lib/endpoints/operations/movements.js +7 -2
  21. package/lib/endpoints/operations/pago-express.js +9 -3
  22. package/lib/endpoints/operations/parcels.js +3 -1
  23. package/lib/endpoints/sales/cancellations.js +31 -8
  24. package/package.json +6 -8
  25. package/src/client.js +1 -1
  26. package/src/endpoints/accounts/agencies.js +23 -1
  27. package/src/endpoints/accounts/journey-prices-settings.js +2 -2
  28. package/src/endpoints/accounts/market-pricing-settings.js +3 -3
  29. package/src/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  30. package/src/endpoints/accounts/operation-settings.js +3 -1
  31. package/src/endpoints/btrzpay/referenced-payments.js +6 -2
  32. package/src/endpoints/btrzpay/square.js +12 -3
  33. package/src/endpoints/btrzpay/stripe-terminals.js +9 -3
  34. package/src/endpoints/btrzpay/terminalPayments.js +14 -4
  35. package/src/endpoints/inventory/document-types.js +2 -1
  36. package/src/endpoints/inventory/fare-type-modifiers.js +140 -0
  37. package/src/endpoints/inventory/products.js +1 -0
  38. package/src/endpoints/notifications/notify.js +28 -1
  39. package/src/endpoints/operations/movements.js +7 -2
  40. package/src/endpoints/operations/pago-express.js +9 -3
  41. package/src/endpoints/operations/parcels.js +3 -1
  42. package/src/endpoints/sales/cancellations.js +31 -8
  43. package/test/all.test.js +219 -0
  44. package/test/client.test.js +58 -44
  45. package/test/endpoints/accounts/agencies.test.js +28 -0
  46. package/test/endpoints/accounts/application-settings.test.js +2 -2
  47. package/test/endpoints/accounts/applications.test.js +2 -2
  48. package/test/endpoints/accounts/current-shifts.test.js +2 -2
  49. package/test/endpoints/accounts/customers.js +17 -17
  50. package/test/endpoints/accounts/domains.test.js +6 -8
  51. package/test/endpoints/accounts/exchange-rates.test.js +3 -3
  52. package/test/endpoints/accounts/exchange-receipts.test.js +3 -3
  53. package/test/endpoints/accounts/images.test.js +2 -2
  54. package/test/endpoints/accounts/interline.test.js +10 -12
  55. package/test/endpoints/accounts/network.test.js +3 -5
  56. package/test/endpoints/accounts/people-lookups.test.js +13 -13
  57. package/test/endpoints/accounts/print-templates.test.js +3 -3
  58. package/test/endpoints/accounts/printers.test.js +2 -2
  59. package/test/endpoints/accounts/tokens.js +2 -2
  60. package/test/endpoints/accounts/trusted-machines.test.js +2 -2
  61. package/test/endpoints/accounts/websales-config.test.js +47 -50
  62. package/test/endpoints/btrzpay/carpointe.tests.js +2 -2
  63. package/test/endpoints/btrzpay/datalogicPayments.tests.js +2 -2
  64. package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +2 -2
  65. package/test/endpoints/btrzpay/oxxoPayments.tests.js +2 -2
  66. package/test/endpoints/btrzpay/oxxoToken.tests.js +2 -2
  67. package/test/endpoints/btrzpay/payment-methods.test.js +3 -3
  68. package/test/endpoints/btrzpay/payments.tests.js +6 -6
  69. package/test/endpoints/btrzpay/reference-numbers.test.js +5 -5
  70. package/test/endpoints/btrzpay/referenced-payments.test.js +2 -2
  71. package/test/endpoints/btrzpay/square.tests.js +2 -2
  72. package/test/endpoints/btrzpay/terminalPayments.tests.js +2 -2
  73. package/test/endpoints/endpoints_helpers.test.js +28 -24
  74. package/test/endpoints/inventory/amenities.test.js +20 -20
  75. package/test/endpoints/inventory/amenity-groups.test.js +15 -15
  76. package/test/endpoints/inventory/bare-routes.test.js +2 -2
  77. package/test/endpoints/inventory/brands.test.js +9 -9
  78. package/test/endpoints/inventory/bundle-fares.test.js +10 -11
  79. package/test/endpoints/inventory/bundles.test.js +9 -9
  80. package/test/endpoints/inventory/companies.test.js +6 -6
  81. package/test/endpoints/inventory/custom-content.test.js +4 -4
  82. package/test/endpoints/inventory/custom-fields.test.js +2 -2
  83. package/test/endpoints/inventory/document-types.test.js +2 -2
  84. package/test/endpoints/inventory/fare-classes.test.js +10 -10
  85. package/test/endpoints/inventory/fare-type-modifiers.test.js +76 -0
  86. package/test/endpoints/inventory/fares.test.js +14 -16
  87. package/test/endpoints/inventory/fees.test.js +14 -15
  88. package/test/endpoints/inventory/filtered-trips-v2.test.js +5 -5
  89. package/test/endpoints/inventory/insurances.test.js +2 -2
  90. package/test/endpoints/inventory/insurancesCost.test.js +2 -2
  91. package/test/endpoints/inventory/journey-prices.test.js +13 -15
  92. package/test/endpoints/inventory/labels.test.js +2 -2
  93. package/test/endpoints/inventory/marital-status.test.js +2 -2
  94. package/test/endpoints/inventory/mit-terminal-settings.test.js +2 -2
  95. package/test/endpoints/inventory/mit-terminals.test.js +7 -7
  96. package/test/endpoints/inventory/operating-companies.test.js +14 -14
  97. package/test/endpoints/inventory/operation-messages.test.js +10 -10
  98. package/test/endpoints/inventory/parcel-zones.test.js +12 -13
  99. package/test/endpoints/inventory/payment-terminals.test.js +7 -7
  100. package/test/endpoints/inventory/prisma-terminals.test.js +2 -2
  101. package/test/endpoints/inventory/products.test.js +25 -20
  102. package/test/endpoints/inventory/promos.test.js +50 -50
  103. package/test/endpoints/inventory/seatclasses.test.js +2 -2
  104. package/test/endpoints/inventory/seatfees.test.js +6 -6
  105. package/test/endpoints/inventory/seatmaps.test.js +7 -7
  106. package/test/endpoints/inventory/segments-information.test.js +2 -2
  107. package/test/endpoints/inventory/service-numbers.test.js +6 -6
  108. package/test/endpoints/inventory/service-types.test.js +7 -7
  109. package/test/endpoints/inventory/shift-settings.test.js +2 -2
  110. package/test/endpoints/inventory/ssrs.test.js +10 -11
  111. package/test/endpoints/inventory/stations-zones.test.js +8 -9
  112. package/test/endpoints/inventory/stations.test.js +2 -2
  113. package/test/endpoints/inventory/travel-routes.test.js +2 -2
  114. package/test/endpoints/inventory/traveller-car-types.test.js +8 -8
  115. package/test/endpoints/inventory/traveller-card-providers-types.test.js +2 -2
  116. package/test/endpoints/inventory/traveller-card-providers.test.js +7 -7
  117. package/test/endpoints/inventory/vehicles.test.js +2 -2
  118. package/test/endpoints/inventory/zone-price-overages.test.js +2 -2
  119. package/test/endpoints/inventory/zone-prices.test.js +2 -2
  120. package/test/endpoints/invoices/dlink.test.js +2 -2
  121. package/test/endpoints/invoices/gti.test.js +2 -2
  122. package/test/endpoints/invoices/infile.test.js +2 -2
  123. package/test/endpoints/invoices/infileJson.test.js +2 -2
  124. package/test/endpoints/invoices/providers.test.js +4 -4
  125. package/test/endpoints/invoices/providersSequences.test.js +2 -2
  126. package/test/endpoints/invoices/system.test.js +2 -2
  127. package/test/endpoints/loyalty/movements.test.js +11 -11
  128. package/test/endpoints/loyalty/programs.test.js +21 -21
  129. package/test/endpoints/notifications/customers.test.js +6 -6
  130. package/test/endpoints/notifications/external-customers.test.js +10 -10
  131. package/test/endpoints/notifications/manifet-notifications.test.js +3 -3
  132. package/test/endpoints/notifications/notify.test.js +23 -5
  133. package/test/endpoints/notifications/orders-rules-validations.test.js +5 -6
  134. package/test/endpoints/notifications/pdfs.test.js +4 -4
  135. package/test/endpoints/notifications/printed-tickets.test.js +17 -18
  136. package/test/endpoints/notifications/short-urls.test.js +9 -9
  137. package/test/endpoints/operations/applied_insurance.test.js +10 -14
  138. package/test/endpoints/operations/calendar_entries.test.js +8 -9
  139. package/test/endpoints/operations/cancellation_settings.test.js +2 -2
  140. package/test/endpoints/operations/loans.test.js +2 -2
  141. package/test/endpoints/operations/manifest.test.js +11 -9
  142. package/test/endpoints/operations/operations.test.js +42 -25
  143. package/test/endpoints/operations/parcel_manifests.test.js +3 -3
  144. package/test/endpoints/operations/parcels.test.js +27 -22
  145. package/test/endpoints/operations/passenger_check_in_info.test.js +2 -2
  146. package/test/endpoints/operations/redemption.test.js +2 -2
  147. package/test/endpoints/operations/sold-items-fulfillment.test.js +2 -2
  148. package/test/endpoints/operations/sold_items.test.js +3 -3
  149. package/test/endpoints/operations/tickets.test.js +4 -4
  150. package/test/endpoints/operations/transaction.test.js +12 -15
  151. package/test/endpoints/operations/transactions.test.js +11 -11
  152. package/test/endpoints/operations/transport_regulations.js +2 -4
  153. package/test/endpoints/operations/trip_change_info.test.js +9 -10
  154. package/test/endpoints/operations/vehicle-assignments.test.js +5 -7
  155. package/test/endpoints/operations/waitlists.test.js +3 -3
  156. package/test/endpoints/ratality/auth.test.js +5 -5
  157. package/test/endpoints/ratality/client.test.js +4 -4
  158. package/test/endpoints/ratality/integrations.test.js +15 -9
  159. package/test/endpoints/reports/custom-reports.test.js +12 -12
  160. package/test/endpoints/reports/email.test.js +3 -3
  161. package/test/endpoints/reports/report-types.test.js +6 -6
  162. package/test/endpoints/reports/trip-manifests.test.js +5 -6
  163. package/test/endpoints/sales/bundles.test.js +9 -10
  164. package/test/endpoints/sales/cart-promo.test.js +15 -16
  165. package/test/endpoints/sales/cart.test.js +7 -7
  166. package/test/endpoints/sales/check-in-info.test.js +3 -3
  167. package/test/endpoints/sales/custom-fields.test.js +10 -13
  168. package/test/endpoints/sales/flexpasses.test.js +2 -2
  169. package/test/endpoints/sales/git-certificates.test.js +10 -13
  170. package/test/endpoints/sales/order.test.js +19 -21
  171. package/test/endpoints/sales/payment-providers.test.js +14 -15
  172. package/test/endpoints/sales/redeemable-items.test.js +14 -15
  173. package/test/endpoints/sales/sync-entry.test.js +9 -11
  174. package/test/endpoints/sales/voucher.test.js +19 -17
  175. package/test/endpoints/seatmaps/access-ticket.test.js +6 -6
  176. package/test/endpoints/seatmaps/seat.test.js +6 -6
  177. package/test/endpoints/uploads/files.test.js +8 -7
  178. package/test/endpoints/uploads/images.test.js +8 -7
  179. package/test/endpoints/webhooks/subscriptions.test.js +27 -27
  180. package/test/endpoints/webhooks/undelivered.test.js +22 -22
  181. package/test/endpoints/webhooks/webhooks.test.js +7 -7
  182. package/test/node-test-globals.js +19 -0
  183. package/test/test-helpers.js +4 -4
  184. package/test-integration/all.test.js +63 -0
  185. package/test-integration/endpoints/accounts/current-shifts.test.js +4 -4
  186. package/test-integration/endpoints/accounts/docs.test.js +6 -6
  187. package/test-integration/endpoints/accounts/lexicons.test.js +42 -37
  188. package/test-integration/endpoints/accounts/shifts.test.js +5 -8
  189. package/test-integration/endpoints/accounts/users.test.js +4 -4
  190. package/test-integration/endpoints/btrzpay/customerCards.test.js +24 -48
  191. package/test-integration/endpoints/btrzpay/customers.test.js +20 -34
  192. package/test-integration/endpoints/btrzpay/payment-methods.test.js +34 -34
  193. package/test-integration/endpoints/btrzpay/payments.test.js +21 -21
  194. package/test-integration/endpoints/btrzpay/reference-numbers.test.js +15 -15
  195. package/test-integration/endpoints/btrzpay/referenced-payments.test.js +5 -5
  196. package/test-integration/endpoints/client.test.js +6 -10
  197. package/test-integration/endpoints/inventory/amenities.test.js +34 -34
  198. package/test-integration/endpoints/inventory/amenity-groups.test.js +30 -31
  199. package/test-integration/endpoints/inventory/bundle-fares.test.js +10 -12
  200. package/test-integration/endpoints/inventory/companies.test.js +7 -8
  201. package/test-integration/endpoints/inventory/countries.test.js +10 -12
  202. package/test-integration/endpoints/inventory/custom-fields.test.js +2 -2
  203. package/test-integration/endpoints/inventory/docs.test.js +5 -7
  204. package/test-integration/endpoints/inventory/fare-classes.test.js +12 -13
  205. package/test-integration/endpoints/inventory/fares.test.js +7 -9
  206. package/test-integration/endpoints/inventory/fees.test.js +8 -10
  207. package/test-integration/endpoints/inventory/filtered-trips.test.js +15 -12
  208. package/test-integration/endpoints/inventory/gift-certificate-definitions.test.js +5 -5
  209. package/test-integration/endpoints/inventory/insurances.test.js +36 -34
  210. package/test-integration/endpoints/inventory/items.js +10 -12
  211. package/test-integration/endpoints/inventory/journey-prices.test.js +11 -11
  212. package/test-integration/endpoints/inventory/parcel-zones.test.js +15 -18
  213. package/test-integration/endpoints/inventory/products.test.js +12 -14
  214. package/test-integration/endpoints/inventory/promos.test.js +46 -42
  215. package/test-integration/endpoints/inventory/routes.test.js +13 -15
  216. package/test-integration/endpoints/inventory/schedule-groups.test.js +23 -23
  217. package/test-integration/endpoints/inventory/ssrs.test.js +16 -11
  218. package/test-integration/endpoints/inventory/stations-zones.test.js +5 -6
  219. package/test-integration/endpoints/inventory/stations.test.js +17 -20
  220. package/test-integration/endpoints/inventory/trips.test.js +30 -16
  221. package/test-integration/endpoints/notifications/printed-tickets.test.js +2 -2
  222. package/test-integration/endpoints/operations/applied_insurance.test.js +9 -11
  223. package/test-integration/endpoints/operations/manifest.test.js +32 -34
  224. package/test-integration/endpoints/operations/parcel.test.js +36 -38
  225. package/test-integration/endpoints/operations/redemption.test.js +9 -12
  226. package/test-integration/endpoints/operations/segments.js +8 -10
  227. package/test-integration/endpoints/operations/tickets.test.js +11 -11
  228. package/test-integration/endpoints/operations/transaction.test.js +1 -1
  229. package/test-integration/endpoints/operations/transactions.test.js +2 -2
  230. package/test-integration/endpoints/operations/trip_change_info.test.js +11 -13
  231. package/test-integration/endpoints/reports/custom-reports.test.js +21 -21
  232. package/test-integration/endpoints/reports/report-types.test.js +22 -22
  233. package/test-integration/endpoints/sales/bundles.test.js +5 -5
  234. package/test-integration/endpoints/sales/cart-promo.test.js +17 -32
  235. package/test-integration/endpoints/sales/cart.test.js +45 -51
  236. package/test-integration/endpoints/sales/check-in-info.test.js +2 -2
  237. package/test-integration/endpoints/sales/custom-fields.test.js +8 -10
  238. package/test-integration/endpoints/sales/flexpasses.test.js +2 -2
  239. package/test-integration/endpoints/sales/gift-certificates.test.js +14 -18
  240. package/test-integration/endpoints/sales/order.test.js +42 -50
  241. package/test-integration/endpoints/sales/payment-providers.test.js +7 -9
  242. package/test-integration/endpoints/sales/redeemable-items.test.js +17 -19
  243. package/test-integration/endpoints/sales/voucher.test.js +12 -14
  244. package/test-integration/endpoints/seatmaps/access-ticket.test.js +7 -9
  245. package/test-integration/endpoints/seatmaps/seat.test.js +7 -9
  246. package/test-integration/endpoints/uploads/files.test.js +14 -14
  247. package/test-integration/endpoints/uploads/images.test.js +3 -5
  248. package/test-integration/ports.js +4 -4
  249. package/test-integration/test-integration-helpers.js +13 -9
@@ -128,6 +128,7 @@ function notifyTicketFactory(_ref) {
128
128
  jwtToken = _ref4.jwtToken,
129
129
  email = _ref4.email,
130
130
  lang = _ref4.lang,
131
+ accountId = _ref4.accountId,
131
132
  headers = _ref4.headers;
132
133
 
133
134
  return client({
@@ -135,6 +136,41 @@ function notifyTicketFactory(_ref) {
135
136
  method: "post",
136
137
  data: {
137
138
  email: email,
139
+ lang: lang,
140
+ accountId: accountId
141
+ },
142
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
143
+ });
144
+ }
145
+ },
146
+ newSeller: {
147
+ /**
148
+ * POST /notify-new-seller - welcome email for a new agency (seller).
149
+ * @param {Object} opts
150
+ * @param {string} [opts.token] - API key (provider)
151
+ * @param {string} [opts.jwtToken] - Internal service JWT
152
+ * @param {string} opts.sellerEmail - Agency admin email
153
+ * @param {string} opts.sellerDomain - Agency subdomain
154
+ * @param {string} [opts.providerAdminEmail] - Support contact in the email
155
+ * @param {string} [opts.lang] - Template lexicon language (e.g. en-us)
156
+ * @param {Object} [opts.headers] - Optional headers
157
+ */
158
+ create: function create(_ref5) {
159
+ var token = _ref5.token,
160
+ jwtToken = _ref5.jwtToken,
161
+ sellerEmail = _ref5.sellerEmail,
162
+ sellerDomain = _ref5.sellerDomain,
163
+ providerAdminEmail = _ref5.providerAdminEmail,
164
+ lang = _ref5.lang,
165
+ headers = _ref5.headers;
166
+
167
+ return client({
168
+ url: "/notify-new-seller",
169
+ method: "post",
170
+ data: {
171
+ sellerEmail: sellerEmail,
172
+ sellerDomain: sellerDomain,
173
+ providerAdminEmail: providerAdminEmail,
138
174
  lang: lang
139
175
  },
140
176
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
@@ -154,14 +190,14 @@ function notifyTicketFactory(_ref) {
154
190
  * @param {Object} [opts.headers] - Optional headers
155
191
  * @returns {Promise<import("axios").AxiosResponse>}
156
192
  */
157
- create: function create(_ref5) {
158
- var token = _ref5.token,
159
- jwtToken = _ref5.jwtToken,
160
- query = _ref5.query,
161
- operation = _ref5.operation,
162
- to = _ref5.to,
163
- ticketId = _ref5.ticketId,
164
- headers = _ref5.headers;
193
+ create: function create(_ref6) {
194
+ var token = _ref6.token,
195
+ jwtToken = _ref6.jwtToken,
196
+ query = _ref6.query,
197
+ operation = _ref6.operation,
198
+ to = _ref6.to,
199
+ ticketId = _ref6.ticketId,
200
+ headers = _ref6.headers;
165
201
 
166
202
  return client({
167
203
  url: "/notify-tickets/" + ticketId,
@@ -186,12 +222,12 @@ function notifyTicketFactory(_ref) {
186
222
  * @param {Object} [opts.headers] - Optional headers
187
223
  * @returns {Promise<import("axios").AxiosResponse>}
188
224
  */
189
- create: function create(_ref6) {
190
- var token = _ref6.token,
191
- jwtToken = _ref6.jwtToken,
192
- query = _ref6.query,
193
- data = _ref6.data,
194
- headers = _ref6.headers;
225
+ create: function create(_ref7) {
226
+ var token = _ref7.token,
227
+ jwtToken = _ref7.jwtToken,
228
+ query = _ref7.query,
229
+ data = _ref7.data,
230
+ headers = _ref7.headers;
195
231
 
196
232
  return client({
197
233
  url: "/notify-vouchers",
@@ -212,11 +248,11 @@ function notifyTicketFactory(_ref) {
212
248
  * @param {Object} [opts.headers] - Optional headers
213
249
  * @returns {Promise<import("axios").AxiosResponse>}
214
250
  */
215
- create: function create(_ref7) {
216
- var token = _ref7.token,
217
- jwtToken = _ref7.jwtToken,
218
- data = _ref7.data,
219
- headers = _ref7.headers;
251
+ create: function create(_ref8) {
252
+ var token = _ref8.token,
253
+ jwtToken = _ref8.jwtToken,
254
+ data = _ref8.data,
255
+ headers = _ref8.headers;
220
256
 
221
257
  return client({
222
258
  url: "/notify-manifest",
@@ -6,8 +6,13 @@ var _require = require("./../endpoints_helpers.js"),
6
6
  /**
7
7
  * Request body for POST /movements (btrz-api-operations). See MovementPostData in movements models.
8
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).
9
+ * @property {Array<{ _id: string, section?: string, sectionName?: string,
10
+ * seat?: string, row?: string, seatId?: string }>} tickets - Tickets to move
11
+ * (same transaction if more than one). Each must have _id; optional seat fields
12
+ * for destination seatmap.
13
+ * @property {{ routeId: string, scheduleId: string, date: string }} newManifest
14
+ * - Destination manifest: routeId (ObjectId), scheduleId (UUID), date
15
+ * (YYYY-MM-DD).
11
16
  * @property {string} channel - Channel of the movement (e.g. backoffice). Must be a valid backoffice channel.
12
17
  * @property {boolean} [allowsDifferentTrx] - If true, allows moving tickets from different transactions.
13
18
  * @property {boolean} [newdesign] - If true, uses new seatmap design for accommodation.
@@ -22,9 +22,13 @@ function pagoExpressFactory(_ref) {
22
22
  * @param {Object} opts
23
23
  * @param {string} [opts.token] - API key (x-api-key)
24
24
  * @param {string} [opts.jwtToken] - JWT or internal auth
25
- * @param {Object} opts.payment - Request body: folio (20-digit string), id_terminal (number), local_date (string DD/MM/YYYY HH:mm:ss), trx_no (number)
25
+ * @param {Object} opts.payment - Request body: folio (20-digit string),
26
+ * id_terminal (number), local_date (string DD/MM/YYYY HH:mm:ss),
27
+ * trx_no (number)
26
28
  * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>} 200 PostInfoResponse (code, message, result with folio, id_terminal, local_date, saldo, trx_no, responsecode, descriptioncode)
29
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostInfoResponse
30
+ * (code, message, result with folio, id_terminal, local_date, saldo,
31
+ * trx_no, responsecode, descriptioncode)
28
32
  */
29
33
  function info(_ref2) {
30
34
  var token = _ref2.token,
@@ -47,7 +51,9 @@ function pagoExpressFactory(_ref) {
47
51
  * @param {string} [opts.jwtToken] - JWT or internal auth
48
52
  * @param {Object} opts.payment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
49
53
  * @param {Object} [opts.headers] - Optional headers
50
- * @returns {Promise<import("axios").AxiosResponse>} 200 PostPayResponse (code, message, result with folio, id_terminal, local_date, trx_no, noauto, amount, responsecode, descriptioncode)
54
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostPayResponse
55
+ * (code, message, result with folio, id_terminal, local_date, trx_no,
56
+ * noauto, amount, responsecode, descriptioncode)
51
57
  */
52
58
  function pay(_ref3) {
53
59
  var token = _ref3.token,
@@ -144,7 +144,9 @@ function parcelFactory(_ref) {
144
144
  * @param {string} opts.id - Parcel id (path parcelId)
145
145
  * @param {string} opts.commentId - Comment id (path)
146
146
  * @param {Object} [opts.headers] - Optional headers
147
- * @returns {Promise<import("axios").AxiosResponse>} 200 deleted ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND, COMMENT_NOT_FOUND; 409
147
+ * @returns {Promise<import("axios").AxiosResponse>} 200 deleted
148
+ * ParcelUserComment; 400 MISSING_*; 401; 403;
149
+ * 404 PARCEL_NOT_FOUND, COMMENT_NOT_FOUND; 409
148
150
  */
149
151
  function deleteComment(_ref6) {
150
152
  var token = _ref6.token,
@@ -4,7 +4,8 @@ var _require = require("./../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
6
  /**
7
- * Request body for POST /cancellations (btrz-api-sales). CancelPostData. Item IDs grouped by family; trxId required.
7
+ * Request body for POST /cancellations (btrz-api-sales).
8
+ * CancelPostData. Item IDs grouped by family; trxId required.
8
9
  * @typedef {{
9
10
  * trxId: string,
10
11
  * fees: number[],
@@ -26,7 +27,9 @@ var _require = require("./../endpoints_helpers.js"),
26
27
  */
27
28
 
28
29
  /**
29
- * Request body for PUT /cancellations (btrz-api-sales). CancelPutData. Unmodified cancel set from POST response (must include _id and signature).
30
+ * Request body for PUT /cancellations (btrz-api-sales). CancelPutData.
31
+ * Unmodified cancel set from POST response
32
+ * (must include _id and signature).
30
33
  * @typedef {{ _id: string, cancellation: Object, signature: string }} CancelPutData
31
34
  */
32
35
 
@@ -50,13 +53,20 @@ function cancellationEndpointsFactory(_ref) {
50
53
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
51
54
 
52
55
  /**
53
- * POST /cancellations - creates a cancel set (preview) with calculated refunds and signature. Does not execute refunds. API does not accept query params.
56
+ * POST /cancellations - creates a cancel set (preview) with calculated
57
+ * refunds and signature. Does not execute refunds.
58
+ * API does not accept query params.
54
59
  * @param {Object} opts
55
60
  * @param {string} [opts.token] - API key
56
61
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
57
62
  * @param {CancelPostData} opts.cancelData - Refundable item IDs by family, trxId, channel, penalty (optional), etc.
58
63
  * @param {Object} [opts.headers] - Optional headers
59
- * @returns {Promise<import("axios").AxiosResponse<{ _id: string, cancellation: Object, signature: string }>>} Cancel set (signed). Rejects with 400 (e.g. MISSING_CANCELLABLE_IDS, INVALID_CANCEL_SET, [itemType]_NOT_REFUNDABLE), 401, 403 (NOT_ALLOWED_FOR_ONLINE, FEE_OVERRIDE_NOT_ALLOWED), 404 ([itemType]_NOT_FOUND), 409 (CURRENCY_EXCHANGE_MISMATCH, AGENCY_CURRENCY_MISMATCH), 500.
64
+ * @returns {Promise<import("axios").AxiosResponse<{ _id: string,
65
+ * cancellation: Object, signature: string }>>} Cancel set (signed).
66
+ * Rejects with 400 (e.g. MISSING_CANCELLABLE_IDS, INVALID_CANCEL_SET,
67
+ * [itemType]_NOT_REFUNDABLE), 401, 403 (NOT_ALLOWED_FOR_ONLINE,
68
+ * FEE_OVERRIDE_NOT_ALLOWED), 404 ([itemType]_NOT_FOUND),
69
+ * 409 (CURRENCY_EXCHANGE_MISMATCH, AGENCY_CURRENCY_MISMATCH), 500.
60
70
  */
61
71
  function createCancelSet(_ref2) {
62
72
  var token = _ref2.token,
@@ -75,13 +85,20 @@ function cancellationEndpointsFactory(_ref) {
75
85
  }
76
86
 
77
87
  /**
78
- * PUT /cancellations - executes the refund using the signed cancel set from POST. Body is cancelSet (or object with cancelSet key). API does not accept query params. Duplicate submission (same dupKey within 30s) returns 409.
88
+ * PUT /cancellations - executes the refund using the signed cancel set from
89
+ * POST. Body is cancelSet (or object with cancelSet key).
90
+ * API does not accept query params. Duplicate submission
91
+ * (same dupKey within 30s) returns 409.
79
92
  * @param {Object} opts
80
93
  * @param {string} [opts.token] - API key
81
94
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
82
95
  * @param {CancelPutData} opts.cancelSet - Unmodified cancel set from createCancelSet response
83
96
  * @param {Object} [opts.headers] - Optional headers
84
- * @returns {Promise<import("axios").AxiosResponse<{ transaction: Object }>>} RefundResponse. Rejects with 400 (e.g. INVALID_SIGNATURE, MISSING_TERMINAL_PAYLOAD, REFUNDED_ITEM), 401, 409 (NOT_FOUND_FOR_REFUND, REFUND_EXECUTION_ERROR, PAYMENT_ROLLBACK_FAILED, CONFLICT duplicate), 500.
97
+ * @returns {Promise<import("axios").AxiosResponse<{ transaction: Object }>>}
98
+ * RefundResponse. Rejects with 400 (e.g. INVALID_SIGNATURE,
99
+ * MISSING_TERMINAL_PAYLOAD, REFUNDED_ITEM), 401,
100
+ * 409 (NOT_FOUND_FOR_REFUND, REFUND_EXECUTION_ERROR,
101
+ * PAYMENT_ROLLBACK_FAILED, CONFLICT duplicate), 500.
85
102
  */
86
103
  function createRefund(_ref3) {
87
104
  var token = _ref3.token,
@@ -98,14 +115,20 @@ function cancellationEndpointsFactory(_ref) {
98
115
  }
99
116
 
100
117
  /**
101
- * PUT /cancellations/:pendingTransactionId - completes a pending payment for a cancellation transaction (e.g. terminal refund). API does not accept query params.
118
+ * PUT /cancellations/:pendingTransactionId - completes a pending payment
119
+ * for a cancellation transaction (e.g. terminal refund).
120
+ * API does not accept query params.
102
121
  * @param {Object} opts
103
122
  * @param {string} [opts.token] - API key
104
123
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
105
124
  * @param {string} opts.pendingTransactionId - Negative (pending) transaction ID (ObjectId)
106
125
  * @param {CompletePaymentCancellationData} opts.paymentResult - Payment result from terminal/provider
107
126
  * @param {Object} [opts.headers] - Optional headers
108
- * @returns {Promise<import("axios").AxiosResponse<{ transaction?: Object, paymentResult?: Object }>>} GetCompletePaymentCancellationResponse. Rejects with 400 (INVALID_PENDING_TRANSACTION_ID, INVALID_TRANSACTION_STATUS, PAYMENT_NOT_PENDING, etc.), 401, 404 (TRANSACTION_NOT_FOUND, PAYMENT_NOT_FOUND, etc.), 500.
127
+ * @returns {Promise<import("axios").AxiosResponse<{ transaction?: Object,
128
+ * paymentResult?: Object }>>} GetCompletePaymentCancellationResponse.
129
+ * Rejects with 400 (INVALID_PENDING_TRANSACTION_ID,
130
+ * INVALID_TRANSACTION_STATUS, PAYMENT_NOT_PENDING, etc.), 401,
131
+ * 404 (TRANSACTION_NOT_FOUND, PAYMENT_NOT_FOUND, etc.), 500.
109
132
  */
110
133
  function updateCompletePayment(_ref4) {
111
134
  var token = _ref4.token,
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.65.0",
3
+ "version": "8.68.1",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "tdd": "mocha --recursive test/ -w",
8
- "test": "mocha --recursive test/",
9
- "test:integration": "mocha --recursive -r test-integration/ports.js test-integration/",
7
+ "tdd": "node --watch --require ./test/node-test-globals.js --test test/all.test.js",
8
+ "test": "node --require ./test/node-test-globals.js --test test/all.test.js",
9
+ "test:only": "node --require ./test/node-test-globals.js --test test/all.test.js --test-only",
10
+ "test:integration": "node --require ./test/node-test-globals.js --require ./test-integration/ports.js --test test-integration/all.test.js",
10
11
  "browserify": "browserify lib/client.js --standalone BtrzApiClient -p tinyify -o lib/client-standalone-min.js",
11
12
  "commit-transpile": "git add lib/ && (git diff-index --quiet HEAD || git commit -m \"transpiled src\")",
12
13
  "pretranspile": "rm -rf lib/",
@@ -31,21 +32,18 @@
31
32
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
32
33
  "babel-preset-es2015": "^6.24.1",
33
34
  "browserify": "^17.0.1",
34
- "chai": "^4.3.8",
35
35
  "confusing-browser-globals": "^1.0.11",
36
36
  "eslint": "7.32.0",
37
37
  "eslint-config-btrz-base": "^1.0.0",
38
38
  "eslint-plugin-chai-friendly": "^0.4.1",
39
39
  "eslint-plugin-import": "^2.20.1",
40
- "eslint-plugin-mocha": "^5.3.0",
41
40
  "form-data": "^3.0.0",
42
- "mocha": "11.7.5",
43
41
  "tinyify": "4.0.0",
44
42
  "uuid": "14.0.0"
45
43
  },
46
44
  "dependencies": {
47
45
  "axios": "^0.27.2",
48
46
  "base-64": "^1.0.0",
49
- "undici": "^8.1.0"
47
+ "undici": "8.2.0"
50
48
  }
51
49
  }
package/src/client.js CHANGED
@@ -74,6 +74,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
74
74
  documentTypes: require("./endpoints/inventory/document-types.js")({client, internalAuthTokenProvider}),
75
75
  externalPasses: require("./endpoints/inventory/external-passes.js")({client, internalAuthTokenProvider}),
76
76
  externalWallets: require("./endpoints/inventory/external-wallets.js")({client, internalAuthTokenProvider}),
77
+ fareTypeModifiers: require("./endpoints/inventory/fare-type-modifiers.js")({client, internalAuthTokenProvider}),
77
78
  fallbackCodes: require("./endpoints/inventory/fallback-codes.js")({client, internalAuthTokenProvider}),
78
79
  fareClasses: require("./endpoints/inventory/fare-classes.js")({client, internalAuthTokenProvider}),
79
80
  fares: require("./endpoints/inventory/fares.js")({client, internalAuthTokenProvider}),
@@ -455,7 +456,6 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
455
456
  adyen: require("./endpoints/btrzpay/adyen.js")({client, internalAuthTokenProvider}),
456
457
  cybersource3ds: require("./endpoints/btrzpay/cybersource3ds.js")({client, internalAuthTokenProvider}),
457
458
  docs: require("./endpoints/btrzpay/docs.js")({client}),
458
- adyen: require("./endpoints/btrzpay/adyen.js")({client, internalAuthTokenProvider}),
459
459
  cardpointeTerminals: require("./endpoints/btrzpay/cardpointe.js").cardpointeTerminalsFactory({client, internalAuthTokenProvider}),
460
460
  paymentMethods: require("./endpoints/btrzpay/payment-methods.js")({client, internalAuthTokenProvider}),
461
461
  referenceNumbers: require("./endpoints/btrzpay/reference-numbers.js")({client, internalAuthTokenProvider}),
@@ -8,9 +8,30 @@ const {
8
8
  * @param {Object} deps
9
9
  * @param {import("axios").AxiosInstance} deps.client
10
10
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
- * @returns {{ putCreditLimit: function }}
11
+ * @returns {{ create: function, putCreditLimit: function }}
12
12
  */
13
13
  function agenciesFactory({client, internalAuthTokenProvider}) {
14
+ /**
15
+ * POST /agencies - create an agency (seller account) and link it to the provider network.
16
+ * Requires X-API-KEY and Authorization (JWT).
17
+ * @param {Object} opts
18
+ * @param {string} opts.token - API key
19
+ * @param {string} opts.jwtToken - JWT
20
+ * @param {Object} opts.agency - agencyData payload ({ seller, network })
21
+ * @param {Object} [opts.headers] - Optional headers
22
+ * @returns {Promise<import("axios").AxiosResponse>}
23
+ */
24
+ function create({token, jwtToken, agency, headers}) {
25
+ return client({
26
+ url: "/agencies",
27
+ method: "post",
28
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
29
+ data: {
30
+ agency
31
+ }
32
+ });
33
+ }
34
+
14
35
  /**
15
36
  * PUT /agencies/:agencyId/credit-limit - update credit limit for an agency (seller) in the provider's network.
16
37
  * Requires BETTEREZ_APP audience. Request body can be { limitAmount, unlimited } or { creditLimit: { limitAmount, unlimited } }.
@@ -33,6 +54,7 @@ function agenciesFactory({client, internalAuthTokenProvider}) {
33
54
  }
34
55
 
35
56
  return {
57
+ create,
36
58
  putCreditLimit
37
59
  };
38
60
  }
@@ -28,11 +28,11 @@ function journeyPricesSettingsFactory({client, internalAuthTokenProvider}) {
28
28
 
29
29
  /**
30
30
  * PUT /journey-prices-settings – Update journey prices settings. Body: JourneyPricesSettings at root.
31
- * Required: recordProtectionRules. Optional: pricingParameters, allowEachTripSegmentToBePricedIndividually.
31
+ * Required: recordProtectionRules. Optional: pricingParameters, allowEachTripSegmentToBePricedIndividually, displayExpiredSchedulesInUI.
32
32
  * @param {Object} opts
33
33
  * @param {string} [opts.token] - API key
34
34
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
35
- * @param {Object} opts.journeyPricesSettings - { recordProtectionRules, pricingParameters?, allowEachTripSegmentToBePricedIndividually? }
35
+ * @param {Object} opts.journeyPricesSettings - { recordProtectionRules, pricingParameters?, allowEachTripSegmentToBePricedIndividually?, displayExpiredSchedulesInUI? }
36
36
  * @param {Object} [opts.headers] - Optional headers
37
37
  * @returns {Promise<import("axios").AxiosResponse<{ journeyPricesSettings: object }>>}
38
38
  */
@@ -17,7 +17,7 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
17
17
  * @param {string} [opts.token] - API key
18
18
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
19
19
  * @param {Object} [opts.headers] - Optional headers
20
- * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean } }>>}
20
+ * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: { useOnlySpecificFareTable: boolean, displayExpiredSchedulesInUI: boolean } }>>}
21
21
  */
22
22
  function get({token, jwtToken, headers}) {
23
23
  return client({
@@ -27,11 +27,11 @@ function marketPricingSettingsFactory({client, internalAuthTokenProvider}) {
27
27
  }
28
28
 
29
29
  /**
30
- * PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable required).
30
+ * PUT /market-pricing-settings – Update market pricing settings. Body: MarketPricingSettings at root (useOnlySpecificFareTable and displayExpiredSchedulesInUI required).
31
31
  * @param {Object} opts
32
32
  * @param {string} [opts.token] - API key
33
33
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
- * @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean }
34
+ * @param {Object} opts.marketPricingSettings - { useOnlySpecificFareTable: boolean, displayExpiredSchedulesInUI: boolean }
35
35
  * @param {Object} [opts.headers] - Optional headers
36
36
  * @returns {Promise<import("axios").AxiosResponse<{ marketPricingSettings: object }>>}
37
37
  */
@@ -27,11 +27,15 @@ function multiproductSalesSettingsFactory({client, internalAuthTokenProvider}) {
27
27
  }
28
28
 
29
29
  /**
30
- * PUT /multiproduct-sales-settings – Create or update multi-product sales settings (upsert). Body: MultiProductSettingsPayload (productsMapping, stationsMapping, faresMapping, fareClassesMapping). Emits networks.created or networks.updated.
30
+ * PUT /multiproduct-sales-settings – Create or update multi-product sales settings
31
+ * (upsert). Body: MultiProductSettingsPayload (productsMapping, stationsMapping,
32
+ * faresMapping, fareClassesMapping). Emits networks.created or networks.updated.
31
33
  * @param {Object} opts
32
34
  * @param {string} [opts.token] - API key
33
35
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
- * @param {Object} opts.data - multiProductSettings payload (productsMapping, stationsMapping, faresMapping, fareClassesMapping; each key ObjectId, each value array of ObjectIds)
36
+ * @param {Object} opts.data - multiProductSettings payload. Includes
37
+ * productsMapping, stationsMapping, faresMapping, and fareClassesMapping; each
38
+ * key is an ObjectId and each value is an array of ObjectIds.
35
39
  * @param {Object} [opts.headers] - Optional headers
36
40
  * @returns {Promise<import("axios").AxiosResponse<{ multiProductSettings: object }>>}
37
41
  */
@@ -29,7 +29,9 @@ function operationSettingsFactory({client, internalAuthTokenProvider}) {
29
29
  }
30
30
 
31
31
  /**
32
- * PUT /operation-settings – Update operation settings. Body: { operationSettings } (OperationSettingsPutData). Emits operationsettings.updated.
32
+ * PUT /operation-settings – Update operation settings. Body:
33
+ * { operationSettings } (OperationSettingsPutData). Emits
34
+ * operationsettings.updated.
33
35
  * @param {Object} opts
34
36
  * @param {string} [opts.token] - API key
35
37
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
@@ -15,14 +15,18 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
15
15
  */
16
16
  function referencedPaymentsFactory({client, internalAuthTokenProvider}) {
17
17
  /**
18
- * GET /referenced-payments/:transactionId/:referenceNumber/status - get referenced payment status. Requires backoffice auth. Response body: { paymentResult: { status, result } | null }.
18
+ * GET /referenced-payments/:transactionId/:referenceNumber/status - get
19
+ * referenced payment status. Requires backoffice auth. Response body:
20
+ * { paymentResult: { status, result } | null }.
19
21
  * @param {Object} opts
20
22
  * @param {string} [opts.token] - API key
21
23
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
24
  * @param {string} opts.transactionId - Transaction ID
23
25
  * @param {string} opts.referenceNumber - Reference number of the payment
24
26
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse<{ paymentResult: { status: "error"|"pending"|"success"|"review", result: object } | null }>>}
27
+ * @returns {Promise<import("axios").AxiosResponse<{
28
+ * paymentResult: { status: "error"|"pending"|"success"|"review", result: object } | null
29
+ * }>>}
26
30
  */
27
31
  function getStatus({token, jwtToken, transactionId, referenceNumber, headers}) {
28
32
  return client.get(`/referenced-payments/${transactionId}/${referenceNumber}/status`, {
@@ -11,7 +11,9 @@ const {
11
11
  */
12
12
  function squareWebhooksFactory({client, internalAuthTokenProvider}) {
13
13
  /**
14
- * POST /square-webhooks/:providerId - send Square webhook payload to the Payments API. API verifies x-square-signature when present. Body must include type and data (Square webhook format).
14
+ * POST /square-webhooks/:providerId - send Square webhook payload to the
15
+ * Payments API. API verifies x-square-signature when present. Body must
16
+ * include type and data (Square webhook format).
15
17
  * @param {Object} opts
16
18
  * @param {string} [opts.token] - API key
17
19
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
@@ -43,12 +45,19 @@ function squareWebhooksFactory({client, internalAuthTokenProvider}) {
43
45
  */
44
46
  function squareTerminalsFactory({client, internalAuthTokenProvider}) {
45
47
  /**
46
- * GET /square-terminals - list Square terminals for the account. Requires JWT (BETTEREZ_APP or MOBILE_SCANNER). Response body: { terminals } with terminal objects (id, name, code, deviceId, productType, locationId, status, pairBy, createdAt, statusChangedAt).
48
+ * GET /square-terminals - list Square terminals for the account. Requires
49
+ * JWT (BETTEREZ_APP or MOBILE_SCANNER). Response body: { terminals } with
50
+ * terminal objects (id, name, code, deviceId, productType, locationId,
51
+ * status, pairBy, createdAt, statusChangedAt).
47
52
  * @param {Object} opts
48
53
  * @param {string} [opts.token] - API key
49
54
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
50
55
  * @param {Object} [opts.headers] - Optional headers
51
- * @returns {Promise<import("axios").AxiosResponse<{ terminals: Array<{ id: string, name: string, code: string, deviceId?: string, productType?: string, locationId: string, status?: string, pairBy?: string, createdAt?: string, statusChangedAt?: string }> }>>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ terminals: Array<{
57
+ * id: string, name: string, code: string, deviceId?: string, productType?: string,
58
+ * locationId: string, status?: string, pairBy?: string,
59
+ * createdAt?: string, statusChangedAt?: string
60
+ * }> }>>}
52
61
  */
53
62
  function get({token, jwtToken, headers}) {
54
63
  return client.get("/square-terminals", {
@@ -5,7 +5,8 @@ const {
5
5
  /**
6
6
  * Query params for GET /stripe-terminals (btrz-api-payments). See get-handler getSpec().
7
7
  * @typedef {Object} StripeTerminalsListQuery
8
- * @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers; when omitted, authenticated account ID is used
8
+ * @property {string} [providerId] - Account provider (operator) ID used by
9
+ * agencies/sellers; when omitted, authenticated account ID is used
9
10
  */
10
11
 
11
12
  /**
@@ -31,7 +32,9 @@ function stripeTerminalsFactory({client, internalAuthTokenProvider}) {
31
32
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
33
  * @param {StripeTerminalsListQuery} [opts.query] - Optional providerId
33
34
  * @param {Object} [opts.headers] - Optional headers
34
- * @returns {Promise<import("axios").AxiosResponse<GetStripeTerminalsResponse>>} Rejects with 400 (STRIPE_SECRET_KEY_INVALID), 401, 404 (PAYMENT_METHOD_NOT_FOUND), 500.
35
+ * @returns {Promise<import("axios").AxiosResponse<GetStripeTerminalsResponse>>}
36
+ * Rejects with 400 (STRIPE_SECRET_KEY_INVALID), 401,
37
+ * 404 (PAYMENT_METHOD_NOT_FOUND), 500.
35
38
  */
36
39
  function all({token, jwtToken, headers, query = {}}) {
37
40
  return client.get("/stripe-terminals", {
@@ -50,7 +53,10 @@ function stripeTerminalsFactory({client, internalAuthTokenProvider}) {
50
53
  * @param {string} opts.id - Terminal ID (Stripe reader id, e.g. tmr_xxx)
51
54
  * @param {{ ccNumber: string }} opts.stripePayment - Payment to simulate; ccNumber required
52
55
  * @param {Object} [opts.headers] - Optional headers
53
- * @returns {Promise<import("axios").AxiosResponse<{ stripeTerminalPayment: Object }>>} Rejects with 400 (WRONG_DATA), 401, 404 (PAYMENT_METHOD_NOT_FOUND, TRANSACTION_NOT_FOUND), 409 (errorCode/errorMessage), 500.
56
+ * @returns {Promise<import("axios").AxiosResponse<{ stripeTerminalPayment: Object }>>}
57
+ * Rejects with 400 (WRONG_DATA), 401,
58
+ * 404 (PAYMENT_METHOD_NOT_FOUND, TRANSACTION_NOT_FOUND),
59
+ * 409 (errorCode/errorMessage), 500.
54
60
  */
55
61
  function simulate({token, jwtToken, id, stripePayment, headers}) {
56
62
  return client({
@@ -32,10 +32,14 @@ function terminalPaymentsFactory({client, internalAuthTokenProvider}) {
32
32
  * @param {string} [opts.token] - API key
33
33
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
34
  * @param {string} opts.id - Terminal payment ID (UUID)
35
- * @param {{ result?: Object, paymentRequest: Object, orderId: string }} opts.terminalPayment - Terminal payment data (result, paymentRequest, orderId)
35
+ * @param {{ result?: Object, paymentRequest: Object, orderId: string }} opts.terminalPayment
36
+ * - Terminal payment data (result, paymentRequest, orderId)
36
37
  * @param {TerminalPaymentsMitPutQuery} [opts.query] - Optional providerId
37
38
  * @param {Object} [opts.headers] - Optional headers
38
- * @returns {Promise<import("axios").AxiosResponse<{ terminalPayment: Object }>>} Rejects with 400 (WRONG_DATA, INVALID_TERMINALPAYMENT_ID, INVALID_RESULT_OBJECT, MIT_*), 401, 404 (TERMINALPAYMENT_NOT_FOUND, MIT_PAYMENT_NOT_FOUND), 409 (CANT_UPDATE_ORDER), 500.
39
+ * @returns {Promise<import("axios").AxiosResponse<{ terminalPayment: Object }>>}
40
+ * Rejects with 400 (WRONG_DATA, INVALID_TERMINALPAYMENT_ID,
41
+ * INVALID_RESULT_OBJECT, MIT_*), 401, 404 (TERMINALPAYMENT_NOT_FOUND,
42
+ * MIT_PAYMENT_NOT_FOUND), 409 (CANT_UPDATE_ORDER), 500.
39
43
  */
40
44
  update({token, jwtToken, id, terminalPayment, query = {}, headers}) {
41
45
  return client({
@@ -54,7 +58,10 @@ function terminalPaymentsFactory({client, internalAuthTokenProvider}) {
54
58
  * @param {string} opts.id - Terminal payment ID (UUID)
55
59
  * @param {TerminalPaymentsMitGetQuery} opts.query - branchId, companyId, date (required); optional providerId
56
60
  * @param {Object} [opts.headers] - Optional headers
57
- * @returns {Promise<import("axios").AxiosResponse<{ terminalPayment: Object }>>} Rejects with 400 (WRONG_DATA, INVALID_TERMINALPAYMENT_ID, INVALID_DATE, MIT_*), 401, 404 (TERMINALPAYMENT_NOT_FOUND, MIT_PAYMENT_NOT_FOUND), 500.
61
+ * @returns {Promise<import("axios").AxiosResponse<{ terminalPayment: Object }>>}
62
+ * Rejects with 400 (WRONG_DATA, INVALID_TERMINALPAYMENT_ID,
63
+ * INVALID_DATE, MIT_*), 401, 404 (TERMINALPAYMENT_NOT_FOUND,
64
+ * MIT_PAYMENT_NOT_FOUND), 500.
58
65
  */
59
66
  get({token, jwtToken, id, query = {}, headers}) {
60
67
  return client.get(`/terminal-payments/mit/${id}`, {
@@ -73,7 +80,10 @@ function terminalPaymentsFactory({client, internalAuthTokenProvider}) {
73
80
  * @param {Object} [opts.headers] - Optional headers
74
81
  * @param {string} [opts.token] - API key (optional when no userId in payload)
75
82
  * @param {string} [opts.jwtToken] - JWT or internal auth (required when userId is in payload)
76
- * @returns {Promise<import("axios").AxiosResponse<{ status: string }>>} Rejects with 400 (INVALID_WEBHOOK_PAYLOAD), 401 (when userId present but not authenticated), 404 (PAYMENT_NOT_FOUND_FOR_WEBHOOK_EVENT, PAYMENT_METHOD_NOT_FOUND, USER_NOT_FOUND), 409 (CANT_UPDATE_ORDER), 500.
83
+ * @returns {Promise<import("axios").AxiosResponse<{ status: string }>>}
84
+ * Rejects with 400 (INVALID_WEBHOOK_PAYLOAD), 401 (when userId present but
85
+ * not authenticated), 404 (PAYMENT_NOT_FOUND_FOR_WEBHOOK_EVENT,
86
+ * PAYMENT_METHOD_NOT_FOUND, USER_NOT_FOUND), 409 (CANT_UPDATE_ORDER), 500.
77
87
  */
78
88
  getnet({data, providerId, headers = {}, token, jwtToken}) {
79
89
  const _headers = token && jwtToken ?
@@ -46,7 +46,8 @@ function documentTypesFactory({client, internalAuthTokenProvider}) {
46
46
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
47
47
  * @param {string} opts.id - Document type id (24 hex characters)
48
48
  * @param {DocumentTypeGetByIdQuery} [opts.query] - Optional query params (merged with providerId when opts.providerId is set)
49
- * @param {string} [opts.providerId] - Provider id (ObjectId); merged into query for provider context (same as peopleLookups.getById / dynamicForms.get)
49
+ * @param {string} [opts.providerId] - Provider id (ObjectId); merged into
50
+ * query for provider context (same as peopleLookups.getById / dynamicForms.get)
50
51
  * @param {Object} [opts.headers] - Optional headers
51
52
  * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
52
53
  * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)