btrz-api-client 8.65.0 → 8.66.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 (241) 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 +50 -38
  7. package/lib/endpoints/accounts/journey-prices-settings.js +2 -2
  8. package/lib/endpoints/accounts/market-pricing-settings.js +3 -3
  9. package/lib/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  10. package/lib/endpoints/accounts/operation-settings.js +3 -1
  11. package/lib/endpoints/btrzpay/referenced-payments.js +6 -2
  12. package/lib/endpoints/btrzpay/square.js +12 -3
  13. package/lib/endpoints/btrzpay/stripe-terminals.js +9 -3
  14. package/lib/endpoints/btrzpay/terminalPayments.js +14 -4
  15. package/lib/endpoints/inventory/document-types.js +2 -1
  16. package/lib/endpoints/inventory/products.js +1 -0
  17. package/lib/endpoints/operations/movements.js +7 -2
  18. package/lib/endpoints/operations/pago-express.js +9 -3
  19. package/lib/endpoints/operations/parcels.js +3 -1
  20. package/lib/endpoints/sales/cancellations.js +31 -8
  21. package/package.json +6 -8
  22. package/src/client.js +0 -1
  23. package/src/endpoints/accounts/journey-prices-settings.js +2 -2
  24. package/src/endpoints/accounts/market-pricing-settings.js +3 -3
  25. package/src/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  26. package/src/endpoints/accounts/operation-settings.js +3 -1
  27. package/src/endpoints/btrzpay/referenced-payments.js +6 -2
  28. package/src/endpoints/btrzpay/square.js +12 -3
  29. package/src/endpoints/btrzpay/stripe-terminals.js +9 -3
  30. package/src/endpoints/btrzpay/terminalPayments.js +14 -4
  31. package/src/endpoints/inventory/document-types.js +2 -1
  32. package/src/endpoints/inventory/products.js +1 -0
  33. package/src/endpoints/operations/movements.js +7 -2
  34. package/src/endpoints/operations/pago-express.js +9 -3
  35. package/src/endpoints/operations/parcels.js +3 -1
  36. package/src/endpoints/sales/cancellations.js +31 -8
  37. package/test/all.test.js +218 -0
  38. package/test/client.test.js +58 -44
  39. package/test/endpoints/accounts/application-settings.test.js +2 -2
  40. package/test/endpoints/accounts/applications.test.js +2 -2
  41. package/test/endpoints/accounts/current-shifts.test.js +2 -2
  42. package/test/endpoints/accounts/customers.js +17 -17
  43. package/test/endpoints/accounts/domains.test.js +6 -8
  44. package/test/endpoints/accounts/exchange-rates.test.js +3 -3
  45. package/test/endpoints/accounts/exchange-receipts.test.js +3 -3
  46. package/test/endpoints/accounts/images.test.js +2 -2
  47. package/test/endpoints/accounts/interline.test.js +10 -12
  48. package/test/endpoints/accounts/network.test.js +3 -5
  49. package/test/endpoints/accounts/people-lookups.test.js +13 -13
  50. package/test/endpoints/accounts/print-templates.test.js +3 -3
  51. package/test/endpoints/accounts/printers.test.js +2 -2
  52. package/test/endpoints/accounts/tokens.js +2 -2
  53. package/test/endpoints/accounts/trusted-machines.test.js +2 -2
  54. package/test/endpoints/accounts/websales-config.test.js +47 -50
  55. package/test/endpoints/btrzpay/carpointe.tests.js +2 -2
  56. package/test/endpoints/btrzpay/datalogicPayments.tests.js +2 -2
  57. package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +2 -2
  58. package/test/endpoints/btrzpay/oxxoPayments.tests.js +2 -2
  59. package/test/endpoints/btrzpay/oxxoToken.tests.js +2 -2
  60. package/test/endpoints/btrzpay/payment-methods.test.js +3 -3
  61. package/test/endpoints/btrzpay/payments.tests.js +6 -6
  62. package/test/endpoints/btrzpay/reference-numbers.test.js +5 -5
  63. package/test/endpoints/btrzpay/referenced-payments.test.js +2 -2
  64. package/test/endpoints/btrzpay/square.tests.js +2 -2
  65. package/test/endpoints/btrzpay/terminalPayments.tests.js +2 -2
  66. package/test/endpoints/endpoints_helpers.test.js +28 -24
  67. package/test/endpoints/inventory/amenities.test.js +20 -20
  68. package/test/endpoints/inventory/amenity-groups.test.js +15 -15
  69. package/test/endpoints/inventory/bare-routes.test.js +2 -2
  70. package/test/endpoints/inventory/brands.test.js +9 -9
  71. package/test/endpoints/inventory/bundle-fares.test.js +10 -11
  72. package/test/endpoints/inventory/bundles.test.js +9 -9
  73. package/test/endpoints/inventory/companies.test.js +6 -6
  74. package/test/endpoints/inventory/custom-content.test.js +4 -4
  75. package/test/endpoints/inventory/custom-fields.test.js +2 -2
  76. package/test/endpoints/inventory/document-types.test.js +2 -2
  77. package/test/endpoints/inventory/fare-classes.test.js +10 -10
  78. package/test/endpoints/inventory/fares.test.js +14 -16
  79. package/test/endpoints/inventory/fees.test.js +14 -15
  80. package/test/endpoints/inventory/filtered-trips-v2.test.js +5 -5
  81. package/test/endpoints/inventory/insurances.test.js +2 -2
  82. package/test/endpoints/inventory/insurancesCost.test.js +2 -2
  83. package/test/endpoints/inventory/journey-prices.test.js +13 -15
  84. package/test/endpoints/inventory/labels.test.js +2 -2
  85. package/test/endpoints/inventory/marital-status.test.js +2 -2
  86. package/test/endpoints/inventory/mit-terminal-settings.test.js +2 -2
  87. package/test/endpoints/inventory/mit-terminals.test.js +7 -7
  88. package/test/endpoints/inventory/operating-companies.test.js +14 -14
  89. package/test/endpoints/inventory/operation-messages.test.js +10 -10
  90. package/test/endpoints/inventory/parcel-zones.test.js +12 -13
  91. package/test/endpoints/inventory/payment-terminals.test.js +7 -7
  92. package/test/endpoints/inventory/prisma-terminals.test.js +2 -2
  93. package/test/endpoints/inventory/products.test.js +25 -20
  94. package/test/endpoints/inventory/promos.test.js +50 -50
  95. package/test/endpoints/inventory/seatclasses.test.js +2 -2
  96. package/test/endpoints/inventory/seatfees.test.js +6 -6
  97. package/test/endpoints/inventory/seatmaps.test.js +7 -7
  98. package/test/endpoints/inventory/segments-information.test.js +2 -2
  99. package/test/endpoints/inventory/service-numbers.test.js +6 -6
  100. package/test/endpoints/inventory/service-types.test.js +7 -7
  101. package/test/endpoints/inventory/shift-settings.test.js +2 -2
  102. package/test/endpoints/inventory/ssrs.test.js +10 -11
  103. package/test/endpoints/inventory/stations-zones.test.js +8 -9
  104. package/test/endpoints/inventory/stations.test.js +2 -2
  105. package/test/endpoints/inventory/travel-routes.test.js +2 -2
  106. package/test/endpoints/inventory/traveller-car-types.test.js +8 -8
  107. package/test/endpoints/inventory/traveller-card-providers-types.test.js +2 -2
  108. package/test/endpoints/inventory/traveller-card-providers.test.js +7 -7
  109. package/test/endpoints/inventory/vehicles.test.js +2 -2
  110. package/test/endpoints/inventory/zone-price-overages.test.js +2 -2
  111. package/test/endpoints/inventory/zone-prices.test.js +2 -2
  112. package/test/endpoints/invoices/dlink.test.js +2 -2
  113. package/test/endpoints/invoices/gti.test.js +2 -2
  114. package/test/endpoints/invoices/infile.test.js +2 -2
  115. package/test/endpoints/invoices/infileJson.test.js +2 -2
  116. package/test/endpoints/invoices/providers.test.js +4 -4
  117. package/test/endpoints/invoices/providersSequences.test.js +2 -2
  118. package/test/endpoints/invoices/system.test.js +2 -2
  119. package/test/endpoints/loyalty/movements.test.js +11 -11
  120. package/test/endpoints/loyalty/programs.test.js +21 -21
  121. package/test/endpoints/notifications/customers.test.js +6 -6
  122. package/test/endpoints/notifications/external-customers.test.js +10 -10
  123. package/test/endpoints/notifications/manifet-notifications.test.js +3 -3
  124. package/test/endpoints/notifications/notify.test.js +5 -5
  125. package/test/endpoints/notifications/orders-rules-validations.test.js +5 -6
  126. package/test/endpoints/notifications/pdfs.test.js +4 -4
  127. package/test/endpoints/notifications/printed-tickets.test.js +17 -18
  128. package/test/endpoints/notifications/short-urls.test.js +9 -9
  129. package/test/endpoints/operations/applied_insurance.test.js +10 -14
  130. package/test/endpoints/operations/calendar_entries.test.js +8 -9
  131. package/test/endpoints/operations/cancellation_settings.test.js +2 -2
  132. package/test/endpoints/operations/loans.test.js +2 -2
  133. package/test/endpoints/operations/manifest.test.js +11 -9
  134. package/test/endpoints/operations/operations.test.js +42 -25
  135. package/test/endpoints/operations/parcel_manifests.test.js +3 -3
  136. package/test/endpoints/operations/parcels.test.js +27 -22
  137. package/test/endpoints/operations/passenger_check_in_info.test.js +2 -2
  138. package/test/endpoints/operations/redemption.test.js +2 -2
  139. package/test/endpoints/operations/sold-items-fulfillment.test.js +2 -2
  140. package/test/endpoints/operations/sold_items.test.js +3 -3
  141. package/test/endpoints/operations/tickets.test.js +4 -4
  142. package/test/endpoints/operations/transaction.test.js +12 -15
  143. package/test/endpoints/operations/transactions.test.js +11 -11
  144. package/test/endpoints/operations/transport_regulations.js +2 -4
  145. package/test/endpoints/operations/trip_change_info.test.js +9 -10
  146. package/test/endpoints/operations/vehicle-assignments.test.js +5 -7
  147. package/test/endpoints/operations/waitlists.test.js +3 -3
  148. package/test/endpoints/ratality/auth.test.js +5 -5
  149. package/test/endpoints/ratality/client.test.js +4 -4
  150. package/test/endpoints/ratality/integrations.test.js +15 -9
  151. package/test/endpoints/reports/custom-reports.test.js +12 -12
  152. package/test/endpoints/reports/email.test.js +3 -3
  153. package/test/endpoints/reports/report-types.test.js +6 -6
  154. package/test/endpoints/reports/trip-manifests.test.js +5 -6
  155. package/test/endpoints/sales/bundles.test.js +9 -10
  156. package/test/endpoints/sales/cart-promo.test.js +15 -16
  157. package/test/endpoints/sales/cart.test.js +7 -7
  158. package/test/endpoints/sales/check-in-info.test.js +3 -3
  159. package/test/endpoints/sales/custom-fields.test.js +10 -13
  160. package/test/endpoints/sales/flexpasses.test.js +2 -2
  161. package/test/endpoints/sales/git-certificates.test.js +10 -13
  162. package/test/endpoints/sales/order.test.js +19 -21
  163. package/test/endpoints/sales/payment-providers.test.js +14 -15
  164. package/test/endpoints/sales/redeemable-items.test.js +14 -15
  165. package/test/endpoints/sales/sync-entry.test.js +9 -11
  166. package/test/endpoints/sales/voucher.test.js +19 -17
  167. package/test/endpoints/seatmaps/access-ticket.test.js +6 -6
  168. package/test/endpoints/seatmaps/seat.test.js +6 -6
  169. package/test/endpoints/uploads/files.test.js +8 -7
  170. package/test/endpoints/uploads/images.test.js +8 -7
  171. package/test/endpoints/webhooks/subscriptions.test.js +27 -27
  172. package/test/endpoints/webhooks/undelivered.test.js +22 -22
  173. package/test/endpoints/webhooks/webhooks.test.js +7 -7
  174. package/test/node-test-globals.js +19 -0
  175. package/test/test-helpers.js +4 -4
  176. package/test-integration/all.test.js +63 -0
  177. package/test-integration/endpoints/accounts/current-shifts.test.js +4 -4
  178. package/test-integration/endpoints/accounts/docs.test.js +6 -6
  179. package/test-integration/endpoints/accounts/lexicons.test.js +42 -37
  180. package/test-integration/endpoints/accounts/shifts.test.js +5 -8
  181. package/test-integration/endpoints/accounts/users.test.js +4 -4
  182. package/test-integration/endpoints/btrzpay/customerCards.test.js +24 -48
  183. package/test-integration/endpoints/btrzpay/customers.test.js +20 -34
  184. package/test-integration/endpoints/btrzpay/payment-methods.test.js +34 -34
  185. package/test-integration/endpoints/btrzpay/payments.test.js +21 -21
  186. package/test-integration/endpoints/btrzpay/reference-numbers.test.js +15 -15
  187. package/test-integration/endpoints/btrzpay/referenced-payments.test.js +5 -5
  188. package/test-integration/endpoints/client.test.js +6 -10
  189. package/test-integration/endpoints/inventory/amenities.test.js +34 -34
  190. package/test-integration/endpoints/inventory/amenity-groups.test.js +30 -31
  191. package/test-integration/endpoints/inventory/bundle-fares.test.js +10 -12
  192. package/test-integration/endpoints/inventory/companies.test.js +7 -8
  193. package/test-integration/endpoints/inventory/countries.test.js +10 -12
  194. package/test-integration/endpoints/inventory/custom-fields.test.js +2 -2
  195. package/test-integration/endpoints/inventory/docs.test.js +5 -7
  196. package/test-integration/endpoints/inventory/fare-classes.test.js +12 -13
  197. package/test-integration/endpoints/inventory/fares.test.js +7 -9
  198. package/test-integration/endpoints/inventory/fees.test.js +8 -10
  199. package/test-integration/endpoints/inventory/filtered-trips.test.js +15 -12
  200. package/test-integration/endpoints/inventory/gift-certificate-definitions.test.js +5 -5
  201. package/test-integration/endpoints/inventory/insurances.test.js +36 -34
  202. package/test-integration/endpoints/inventory/items.js +10 -12
  203. package/test-integration/endpoints/inventory/journey-prices.test.js +11 -11
  204. package/test-integration/endpoints/inventory/parcel-zones.test.js +15 -18
  205. package/test-integration/endpoints/inventory/products.test.js +12 -14
  206. package/test-integration/endpoints/inventory/promos.test.js +46 -42
  207. package/test-integration/endpoints/inventory/routes.test.js +13 -15
  208. package/test-integration/endpoints/inventory/schedule-groups.test.js +23 -23
  209. package/test-integration/endpoints/inventory/ssrs.test.js +16 -11
  210. package/test-integration/endpoints/inventory/stations-zones.test.js +5 -6
  211. package/test-integration/endpoints/inventory/stations.test.js +17 -20
  212. package/test-integration/endpoints/inventory/trips.test.js +30 -16
  213. package/test-integration/endpoints/notifications/printed-tickets.test.js +2 -2
  214. package/test-integration/endpoints/operations/applied_insurance.test.js +9 -11
  215. package/test-integration/endpoints/operations/manifest.test.js +32 -34
  216. package/test-integration/endpoints/operations/parcel.test.js +36 -38
  217. package/test-integration/endpoints/operations/redemption.test.js +9 -12
  218. package/test-integration/endpoints/operations/segments.js +8 -10
  219. package/test-integration/endpoints/operations/tickets.test.js +11 -11
  220. package/test-integration/endpoints/operations/transaction.test.js +1 -1
  221. package/test-integration/endpoints/operations/transactions.test.js +2 -2
  222. package/test-integration/endpoints/operations/trip_change_info.test.js +11 -13
  223. package/test-integration/endpoints/reports/custom-reports.test.js +21 -21
  224. package/test-integration/endpoints/reports/report-types.test.js +22 -22
  225. package/test-integration/endpoints/sales/bundles.test.js +5 -5
  226. package/test-integration/endpoints/sales/cart-promo.test.js +17 -32
  227. package/test-integration/endpoints/sales/cart.test.js +45 -51
  228. package/test-integration/endpoints/sales/check-in-info.test.js +2 -2
  229. package/test-integration/endpoints/sales/custom-fields.test.js +8 -10
  230. package/test-integration/endpoints/sales/flexpasses.test.js +2 -2
  231. package/test-integration/endpoints/sales/gift-certificates.test.js +14 -18
  232. package/test-integration/endpoints/sales/order.test.js +42 -50
  233. package/test-integration/endpoints/sales/payment-providers.test.js +7 -9
  234. package/test-integration/endpoints/sales/redeemable-items.test.js +17 -19
  235. package/test-integration/endpoints/sales/voucher.test.js +12 -14
  236. package/test-integration/endpoints/seatmaps/access-ticket.test.js +7 -9
  237. package/test-integration/endpoints/seatmaps/seat.test.js +7 -9
  238. package/test-integration/endpoints/uploads/files.test.js +14 -14
  239. package/test-integration/endpoints/uploads/images.test.js +3 -5
  240. package/test-integration/ports.js +4 -4
  241. package/test-integration/test-integration-helpers.js +13 -9
@@ -2,10 +2,10 @@ const port = process.env.NOTIFICATIONS_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
  const jwtToken = process.env.JWT_TOKEN;
4
4
 
5
- const api = require("./../../../src/client").createApiClient({
5
+ const api = require("./../../../src/client.js").createApiClient({
6
6
  baseURL: `http://localhost:${port}`,
7
7
  baseURLOverride: {
8
- notifications: (baseUrl) => `${baseUrl}/notifications`
8
+ notifications: (baseUrl) => { return `${baseUrl}/notifications`; }
9
9
  }
10
10
  });
11
11
 
@@ -1,24 +1,22 @@
1
- const { expect } = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
 
3
3
  const port = process.env.OPERATIONS_API_PORT;
4
4
  const token = process.env.API_TOKEN;
5
5
  const jwtToken = process.env.JWT_TOKEN;
6
6
 
7
- const api = require("./../../../src/client").createApiClient({
8
- baseURL: `http://localhost:${port}`,
7
+ const api = require("./../../../src/client.js").createApiClient({
8
+ baseURL: `http://localhost:${port}`,
9
9
  baseURLOverride: {
10
- operations: (baseUrl) => `${baseUrl}/operations`
10
+ operations: (baseUrl) => { return `${baseUrl}/operations`; }
11
11
  }
12
12
  });
13
13
 
14
- describe("operations/appliedInsurances", function() {
15
-
16
- it("empty array for unexistent transaction", function() {
14
+ describe("operations/appliedInsurances", () => {
15
+ it("empty array for unexistent transaction", () => {
17
16
  const trxId = "NOT_EXISTING_TRX";
18
- return api.operations.appliedInsurance.all({ token, jwtToken, trxId })
17
+ return api.operations.appliedInsurance.all({token, jwtToken, trxId})
19
18
  .then((res) => {
20
- expect(res.data.appliedInsurances).to.have.lengthOf(0);
21
- })
19
+ assert.strictEqual(res.data.appliedInsurances.length, 0);
20
+ });
22
21
  });
23
-
24
22
  });
@@ -1,34 +1,33 @@
1
- const { expect } = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
 
3
3
  const port = process.env.OPERATIONS_API_PORT;
4
4
  const token = process.env.API_TOKEN;
5
5
  const jwtToken = process.env.JWT_TOKEN;
6
6
 
7
- const api = require("./../../../src/client").createApiClient({
8
- baseURL: `http://localhost:${port}`,
7
+ const api = require("./../../../src/client.js").createApiClient({
8
+ baseURL: `http://localhost:${port}`,
9
9
  baseURLOverride: {
10
- operations: (baseUrl) => `${baseUrl}/operations`
10
+ operations: (baseUrl) => { return `${baseUrl}/operations`; }
11
11
  }
12
12
  });
13
13
 
14
- describe("operations/manifest", function() {
15
-
16
- it("should not get a manifest that does not exist", function() {
14
+ describe("operations/manifest", () => {
15
+ it("should not get a manifest that does not exist", () => {
17
16
  const query = {routeId: "51ed2be3cf2c819d00000000", scheduleId: "Morning", date: "2017-08-21"};
18
- return api.operations.manifest.get({ token, jwtToken, query })
17
+ return api.operations.manifest.get({token, jwtToken, query})
19
18
  .catch((err) => {
20
- expect(err).to.exist;
21
- expect(err.response.status).to.be.eql(404);
22
- expect(err.response.data.code).to.be.eql('MANIFEST_NOT_FOUND');
23
- expect(err.response.data.message).to.be.eql('manifest not found');
19
+ assert.ok(err);
20
+ assert.deepStrictEqual(err.response.status, 404);
21
+ assert.deepStrictEqual(err.response.data.code, "MANIFEST_NOT_FOUND");
22
+ assert.deepStrictEqual(err.response.data.message, "manifest not found");
24
23
  });
25
24
  });
26
25
 
27
- it("should get the manifest", function() {
26
+ it("should get the manifest", () => {
28
27
  const query = {routeId: "51ed2be3cf2c819d5e000010", scheduleId: "Morning", date: "2017-08-21"};
29
- return api.operations.manifest.get({ token, jwtToken, query })
28
+ return api.operations.manifest.get({token, jwtToken, query})
30
29
  .then((res) => {
31
- expect(res.data.manifest._id).to.be.eql("5997315d8efff74052000005");
30
+ assert.deepStrictEqual(res.data.manifest._id, "5997315d8efff74052000005");
32
31
  });
33
32
  });
34
33
 
@@ -45,30 +44,29 @@ describe("operations/manifest", function() {
45
44
  date: "2020-01-14"
46
45
  }]
47
46
  };
48
- const {data: response} = await api.operations.manifest.getMany({ token, jwtToken, providerId, data: payload });
49
- expect(response).to.be.an.array;
50
- expect(response).to.have.length(2);
47
+ const {data: response} = await api.operations.manifest.getMany({token, jwtToken, providerId, data: payload});
48
+ assert.ok(Array.isArray(response));
49
+ assert.strictEqual(response.length, 2);
51
50
 
52
- //TODO: These expectations probably fail even on a successful response. Edit these once the POST /manifests endpoint is complete.
53
- expect(response[0].routeId).to.eql("5c50e32e62da38d275000001");
54
- expect(response[0].schedule).to.eql("ef83faaa-b58f-43bb-8c5c-92e2bfa476c0");
55
- //TODO: Particularly the date format is probably incorrect
56
- expect(response[0].date).to.eql("2019-02-27");
51
+ // Note: These expectations probably fail even on a successful response. Edit these once the POST /manifests endpoint is complete.
52
+ assert.deepStrictEqual(response[0].routeId, "5c50e32e62da38d275000001");
53
+ assert.deepStrictEqual(response[0].schedule, "ef83faaa-b58f-43bb-8c5c-92e2bfa476c0");
54
+ // Note: Particularly the date format is probably incorrect
55
+ assert.deepStrictEqual(response[0].date, "2019-02-27");
57
56
 
58
- expect(response[0].routeId).to.eql("528cdd9c61c78c2f2d000066");
59
- expect(response[0].schedule).to.eql("711-b58f-43bb-8c5c-92e2bfa476c0");
60
- expect(response[0].date).to.eql("2020-01-14");
57
+ assert.deepStrictEqual(response[0].routeId, "528cdd9c61c78c2f2d000066");
58
+ assert.deepStrictEqual(response[0].schedule, "711-b58f-43bb-8c5c-92e2bfa476c0");
59
+ assert.deepStrictEqual(response[0].date, "2020-01-14");
61
60
  });
62
61
 
63
- it("should patch a manifest with add_tickets operation", function() {
64
- const providerId = "5997315d8efff74052000005",
65
- operations = [{op: "add_tickets", tickets: ["576989208f86028739fef256"]}];
66
- return api.operations.manifest.patch({ token, jwtToken, query: {providerId}, operations })
62
+ it("should patch a manifest with add_tickets operation", () => {
63
+ const providerId = "5997315d8efff74052000005";
64
+ const operations = [{op: "add_tickets", tickets: ["576989208f86028739fef256"]}];
65
+ return api.operations.manifest.patch({token, jwtToken, query: {providerId}, operations})
67
66
  .then((res) => {
68
- expect(res.data.results).to.have.length(1);
69
- expect(res.data.results[0].op).to.be.eql("add_tickets");
70
- expect(res.data.results[0].status).to.be.eql("success");
67
+ assert.strictEqual(res.data.results.length, 1);
68
+ assert.deepStrictEqual(res.data.results[0].op, "add_tickets");
69
+ assert.deepStrictEqual(res.data.results[0].status, "success");
71
70
  });
72
71
  });
73
-
74
72
  });
@@ -1,62 +1,60 @@
1
- const { expect } = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
 
3
3
  const port = process.env.OPERATIONS_API_PORT;
4
4
  const token = process.env.API_TOKEN;
5
5
  const jwtToken = process.env.JWT_TOKEN;
6
6
 
7
- const api = require("./../../../src/client").createApiClient({
8
- baseURL: `http://localhost:${port}`,
7
+ const api = require("./../../../src/client.js").createApiClient({
8
+ baseURL: `http://localhost:${port}`,
9
9
  baseURLOverride: {
10
- operations: (baseUrl) => `${baseUrl}/operations`
10
+ operations: (baseUrl) => { return `${baseUrl}/operations`; }
11
11
  }
12
12
  });
13
13
 
14
- describe("operations/parcel", function() {
15
-
16
- it("should not get a parcel that does not exist", function() {
14
+ describe("operations/parcel", () => {
15
+ it("should not get a parcel that does not exist", () => {
17
16
  const parcelId = "5967e3da1b7dfb3047e5ac81";
18
- return api.operations.parcel.get({ token, jwtToken, id: parcelId })
17
+ return api.operations.parcel.get({token, jwtToken, id: parcelId})
19
18
  .catch((err) => {
20
- expect(err).to.exist;
21
- expect(err.response.status).to.be.eql(404);
22
- expect(err.response.data.code).to.be.eql('PARCEL_NOT_FOUND');
23
- expect(err.response.data.message).to.be.eql('Parcel not found');
24
- })
19
+ assert.ok(err);
20
+ assert.deepStrictEqual(err.response.status, 404);
21
+ assert.deepStrictEqual(err.response.data.code, "PARCEL_NOT_FOUND");
22
+ assert.deepStrictEqual(err.response.data.message, "Parcel not found");
23
+ });
25
24
  });
26
25
 
27
- it("should not get any parcel from a trx that does not exist", function() {
26
+ it("should not get any parcel from a trx that does not exist", () => {
28
27
  const trxId = "5967e3da1b7dfb3047e5ac81";
29
- return api.operations.parcel.all({ token, jwtToken, query: {trxId: trxId }})
28
+ return api.operations.parcel.all({token, jwtToken, query: {trxId}})
30
29
  .catch((err) => {
31
- expect(err).to.exist;
32
- expect(err.response.status).to.be.eql(401);
33
- expect(err.response.data.code).to.be.eql('PARCEL_NOT_FOUND');
34
- expect(err.response.data.message).to.be.eql('Parcel not found');
35
- })
30
+ assert.ok(err);
31
+ assert.deepStrictEqual(err.response.status, 401);
32
+ assert.deepStrictEqual(err.response.data.code, "PARCEL_NOT_FOUND");
33
+ assert.deepStrictEqual(err.response.data.message, "Parcel not found");
34
+ });
36
35
  });
37
36
 
38
- it("should not update parcel that not exists", function() {
39
- const parcelId = "596e33cea74c7dd74c2f8572",
40
- parcel = {_id: parcelId, status: "delivered"},
41
- locationData = {latitude: 9876, longitude: 0123};
42
- return api.operations.parcel.update({ token, jwtToken, id: parcelId, parcel, locationData })
37
+ it("should not update parcel that not exists", () => {
38
+ const parcelId = "596e33cea74c7dd74c2f8572";
39
+ const parcel = {_id: parcelId, status: "delivered"};
40
+ const locationData = {latitude: 9876, longitude: 123};
41
+ return api.operations.parcel.update({token, jwtToken, id: parcelId, parcel, locationData})
43
42
  .catch((err) => {
44
- expect(err).to.exist;
45
- expect(err.response.status).to.be.eql(404);
46
- expect(err.response.data.code).to.be.eql('TICKET_NOT_FOUND');
47
- expect(err.response.data.msg).to.be.eql('parcel not found for id: 596e33cea74c7dd74c2f8572');
48
- })
43
+ assert.ok(err);
44
+ assert.deepStrictEqual(err.response.status, 404);
45
+ assert.deepStrictEqual(err.response.data.code, "TICKET_NOT_FOUND");
46
+ assert.deepStrictEqual(err.response.data.msg, "parcel not found for id: 596e33cea74c7dd74c2f8572");
47
+ });
49
48
  });
50
49
 
51
- it("should not add a comment in a parcel that not exists", function() {
50
+ it("should not add a comment in a parcel that not exists", () => {
52
51
  const parcelId = "596e33cea74c7dd74c2f8552";
53
- return api.operations.parcel.addComment({ token, jwtToken, id: parcelId, comment: "A comment" })
52
+ return api.operations.parcel.addComment({token, jwtToken, id: parcelId, comment: "A comment"})
54
53
  .catch((err) => {
55
- expect(err).to.exist;
56
- expect(err.response.status).to.be.eql(404);
57
- expect(err.response.data.code).to.be.eql('PARCEL_NOT_FOUND');
58
- expect(err.response.data.msg).to.be.eql('We could not found a Parcel with the given ID');
59
- })
54
+ assert.ok(err);
55
+ assert.deepStrictEqual(err.response.status, 404);
56
+ assert.deepStrictEqual(err.response.data.code, "PARCEL_NOT_FOUND");
57
+ assert.deepStrictEqual(err.response.data.msg, "We could not found a Parcel with the given ID");
58
+ });
60
59
  });
61
-
62
60
  });
@@ -1,19 +1,17 @@
1
- const { expect } = require("chai");
2
1
 
3
2
  const port = process.env.OPERATIONS_API_PORT;
4
3
  const token = process.env.API_TOKEN;
5
4
  const jwtToken = process.env.JWT_TOKEN;
6
5
 
7
- const api = require("./../../../src/client").createApiClient({
8
- baseURL: `http://localhost:${port}`,
6
+ const api = require("./../../../src/client.js").createApiClient({
7
+ baseURL: `http://localhost:${port}`,
9
8
  baseURLOverride: {
10
- operations: (baseUrl) => `${baseUrl}/operations`
9
+ operations: (baseUrl) => { return `${baseUrl}/operations`; }
11
10
  }
12
11
  });
13
12
 
14
- describe("operations/redemptions", function() {
15
-
16
- it("should create a redemption for the parcel", function() {
13
+ describe("operations/redemptions", () => {
14
+ it("should create a redemption for the parcel", () => {
17
15
  const redemption = {
18
16
  "itemCode": "PA-59e60182bc6ef25a2cfd6b6f",
19
17
  "options": {
@@ -24,12 +22,11 @@ describe("operations/redemptions", function() {
24
22
  "operationType": "received"
25
23
  },
26
24
  "redemptions": {
27
- "items": [],
28
- "scannedPurchases": [],
29
- "externalPasses": []
25
+ "items": [],
26
+ "scannedPurchases": [],
27
+ "externalPasses": []
30
28
  }
31
29
  };
32
- return api.operations.redemption.create({ token, jwtToken, redemption });
30
+ return api.operations.redemption.create({token, jwtToken, redemption});
33
31
  });
34
-
35
32
  });
@@ -2,20 +2,18 @@ const port = process.env.OPERATIONS_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
  const jwtToken = process.env.JWT_TOKEN;
4
4
 
5
- const api = require("./../../../src/client").createApiClient({
5
+ const api = require("./../../../src/client.js").createApiClient({
6
6
  baseURL: `http://localhost:${port}`,
7
7
  baseURLOverride: {
8
- operations: (baseUrl) => `${baseUrl}/operations`
8
+ operations: (baseUrl) => { return `${baseUrl}/operations`; }
9
9
  }
10
10
  });
11
11
 
12
- describe("operations/segments", function() {
13
-
14
- it("should get segments for product and ticket", function() {
15
- const productId = "595f9c7007ee12686d000033",
16
- ticketId = "5bad3ef2b726b6716b9567df",
17
- providerId = "595f9c7007ee12686d000032";
18
- return api.operations.segments.all({ token, jwtToken, productId, ticketId, providerId });
12
+ describe("operations/segments", () => {
13
+ it("should get segments for product and ticket", () => {
14
+ const productId = "595f9c7007ee12686d000033";
15
+ const ticketId = "5bad3ef2b726b6716b9567df";
16
+ const providerId = "595f9c7007ee12686d000032";
17
+ return api.operations.segments.all({token, jwtToken, productId, ticketId, providerId});
19
18
  });
20
-
21
19
  });
@@ -2,13 +2,13 @@
2
2
  /* eslint-disable arrow-parens */
3
3
  /* eslint-disable prefer-arrow-callback */
4
4
 
5
- const {expect} = require("chai");
5
+ const assert = require("node:assert/strict");
6
6
 
7
7
  const port = process.env.OPERATIONS_API_PORT;
8
8
  const token = process.env.API_TOKEN;
9
9
  const jwtToken = process.env.JWT_TOKEN;
10
10
 
11
- const api = require("./../../../src/client").createApiClient({
11
+ const api = require("./../../../src/client.js").createApiClient({
12
12
  baseURL: `http://localhost:${port}`,
13
13
  baseURLOverride: {
14
14
  operations: (baseUrl) => {
@@ -43,9 +43,9 @@ describe("operations/tickets", function () {
43
43
 
44
44
  return api.operations.tickets.patch({token, jwtToken, id, operations: [op1], warningsEnabled})
45
45
  .then((res) => {
46
- expect(res.data.results).to.have.length(1);
47
- expect(res.data.results[0].op).to.be.eql("move");
48
- expect(res.data.results[0].status).to.be.eql("success");
46
+ assert.strictEqual(res.data.results.length, 1);
47
+ assert.deepStrictEqual(res.data.results[0].op, "move");
48
+ assert.deepStrictEqual(res.data.results[0].status, "success");
49
49
  });
50
50
  });
51
51
 
@@ -62,12 +62,12 @@ describe("operations/tickets", function () {
62
62
  return api.operations.tickets.patch({token, jwtToken, id, operations: [op1], warningsEnabled})
63
63
  .catch((err) => {
64
64
  /* eslint-disable-next-line no-unused-expressions */
65
- expect(err).to.exist;
66
- expect(err.response.status).to.be.eql(404);
67
- expect(err.response.data.results).to.have.length(1);
68
- expect(err.response.data.results[0].op).to.be.eql("move");
69
- expect(err.response.data.results[0].status).to.be.eql("error");
70
- expect(err.response.data.results[0].error.code).to.be.eql("TICKET_NOT_FOUND");
65
+ assert.ok(err);
66
+ assert.deepStrictEqual(err.response.status, 404);
67
+ assert.strictEqual(err.response.data.results.length, 1);
68
+ assert.deepStrictEqual(err.response.data.results[0].op, "move");
69
+ assert.deepStrictEqual(err.response.data.results[0].status, "error");
70
+ assert.deepStrictEqual(err.response.data.results[0].error.code, "TICKET_NOT_FOUND");
71
71
  });
72
72
  });
73
73
  });
@@ -2,7 +2,7 @@ const port = process.env.OPERATIONS_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
  const jwtToken = process.env.JWT_TOKEN;
4
4
 
5
- const api = require("./../../../src/client").createApiClient({
5
+ const api = require("./../../../src/client.js").createApiClient({
6
6
  baseURL: `http://localhost:${port}`,
7
7
  baseURLOverride: {
8
8
  operations: (baseUrl) => {
@@ -14,7 +14,7 @@ const api = require("./../../../src/client.js").createApiClient({
14
14
  }
15
15
  }
16
16
  });
17
- const {expect} = require("chai");
17
+ const assert = require("node:assert/strict");
18
18
 
19
19
  describe("operations/transactions", function () {
20
20
  describe("companion", function () {
@@ -34,7 +34,7 @@ describe("operations/transactions", function () {
34
34
  const transactionId = "5ce2d7d4c16f0e5827069f13";
35
35
  return api.operations.transactions.expireAll({jwtToken, transactionId})
36
36
  .then((res) => {
37
- expect(res.data.transactionIds).to.have.length(1);
37
+ assert.strictEqual(res.data.transactionIds.length, 1);
38
38
  });
39
39
  });
40
40
  });
@@ -2,23 +2,21 @@ const port = process.env.OPERATIONS_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
  const jwtToken = process.env.JWT_TOKEN;
4
4
 
5
- const api = require("./../../../src/client").createApiClient({
5
+ const api = require("./../../../src/client.js").createApiClient({
6
6
  baseURL: `http://localhost:${port}`,
7
7
  baseURLOverride: {
8
- operations: (baseUrl) => `${baseUrl}/operations`
8
+ operations: (baseUrl) => { return `${baseUrl}/operations`; }
9
9
  }
10
10
  });
11
11
 
12
- describe("operations/trip-change-info", function() {
13
-
14
- it("should get the trip to change info", function() {
15
- const productId = "5a61f76266d8da4c4200000b",
16
- params = {
17
- ticketNumber: "V6H6BH",
18
- lastName: "Ferraro",
19
- providerId: "595f9c7007ee12686d000032"
20
- };
21
- return api.operations.tripChangeInfo.get({ token, jwtToken, productId, params });
12
+ describe("operations/trip-change-info", () => {
13
+ it("should get the trip to change info", () => {
14
+ const productId = "5a61f76266d8da4c4200000b";
15
+ const params = {
16
+ ticketNumber: "V6H6BH",
17
+ lastName: "Ferraro",
18
+ providerId: "595f9c7007ee12686d000032"
19
+ };
20
+ return api.operations.tripChangeInfo.get({token, jwtToken, productId, params});
22
21
  });
23
-
24
22
  });
@@ -1,16 +1,16 @@
1
- const { expect } = require("chai"),
2
- port = process.env.REPORTS_API_PORT,
3
- token = process.env.API_TOKEN,
4
- jwtToken = process.env.JWT_TOKEN,
5
- api = require("./../../../src/client").createApiClient({
6
- baseURL: `http://localhost:${port}`,
7
- baseURLOverride: {
8
- reports: (baseUrl) => `${baseUrl}/reports`
9
- }
10
- });
1
+ const assert = require("node:assert/strict");
2
+ const port = process.env.REPORTS_API_PORT;
3
+ const token = process.env.API_TOKEN;
4
+ const jwtToken = process.env.JWT_TOKEN;
5
+ const api = require("./../../../src/client.js").createApiClient({
6
+ baseURL: `http://localhost:${port}`,
7
+ baseURLOverride: {
8
+ reports: (baseUrl) => { return `${baseUrl}/reports`; }
9
+ }
10
+ });
11
11
 
12
- describe("reports/custom-report", function() {
13
- it("should return 200", function() {
12
+ describe("reports/custom-report", () => {
13
+ it("should return 200", () => {
14
14
  const customReport = {
15
15
  name: "customReportName",
16
16
  reportTypeId: "5a99c3055c44c49c5a000001",
@@ -48,24 +48,24 @@ describe("reports/custom-report", function() {
48
48
  prefixForFile: "greatReport"
49
49
  }
50
50
  };
51
- return api.reports.customReports.create({ jwtToken, token, customReport })
52
- .catch((err) => {
53
- expect(err.response.status).to.be.eql(200);
54
- expect(err.response.data.customReport.name).to.be.eql(customReport.name);
55
- });
51
+ return api.reports.customReports.create({jwtToken, token, customReport})
52
+ .catch((err) => {
53
+ assert.deepStrictEqual(err.response.status, 200);
54
+ assert.deepStrictEqual(err.response.data.customReport.name, customReport.name);
55
+ });
56
56
  });
57
57
 
58
- it("should not get any custom reports", function() {
58
+ it("should not get any custom reports", () => {
59
59
  return api.reports.customReports.all({token, jwtToken, query: {}})
60
60
  .catch((err) => {
61
- expect(err.response.status).to.be.eql(401);
61
+ assert.deepStrictEqual(err.response.status, 401);
62
62
  });
63
63
  });
64
64
 
65
- it("should not delete a custom report", function() {
65
+ it("should not delete a custom report", () => {
66
66
  return api.reports.customReports.remove({token, jwtToken, customReportId: "5a959a4aa7114ffd7f000001"})
67
67
  .catch((err) => {
68
- expect(err.response.status).to.be.eql(401);
68
+ assert.deepStrictEqual(err.response.status, 401);
69
69
  });
70
70
  });
71
71
  });
@@ -1,31 +1,31 @@
1
- const { expect } = require("chai"),
2
- port = process.env.REPORTS_API_PORT,
3
- token = process.env.API_TOKEN,
4
- jwtToken = process.env.JWT_TOKEN,
5
- api = require("./../../../src/client").createApiClient({
6
- baseURL: `http://localhost:${port}`,
7
- baseURLOverride: {
8
- reports: (baseUrl) => `${baseUrl}/reports`
9
- }
10
- });
1
+ const assert = require("node:assert/strict");
2
+ const port = process.env.REPORTS_API_PORT;
3
+ const token = process.env.API_TOKEN;
4
+ const jwtToken = process.env.JWT_TOKEN;
5
+ const api = require("./../../../src/client.js").createApiClient({
6
+ baseURL: `http://localhost:${port}`,
7
+ baseURLOverride: {
8
+ reports: (baseUrl) => { return `${baseUrl}/reports`; }
9
+ }
10
+ });
11
11
 
12
- describe("reports/types", function() {
13
- it("should return 404 for a wrong id", function() {
12
+ describe("reports/types", () => {
13
+ it("should return 404 for a wrong id", () => {
14
14
  const reportTypeId = "reportTypeId";
15
- return api.reports.reportTypes.get({ token, jwtToken, id: reportTypeId })
16
- .catch((err) => {
17
- expect(err.response.status).to.be.eql(404);
18
- expect(err.response.data.code).to.be.eql("TYPE_NOT_FOUND");
19
- expect(err.response.data.message).to.be.eql("Report type not found");
20
- });
15
+ return api.reports.reportTypes.get({token, jwtToken, id: reportTypeId})
16
+ .catch((err) => {
17
+ assert.deepStrictEqual(err.response.status, 404);
18
+ assert.deepStrictEqual(err.response.data.code, "TYPE_NOT_FOUND");
19
+ assert.deepStrictEqual(err.response.data.message, "Report type not found");
20
+ });
21
21
  });
22
22
 
23
- it("should return empty success", function() {
23
+ it("should return empty success", () => {
24
24
  const reportTypeName = "reportTypeName";
25
- return api.reports.reportTypes.getByName({ token, jwtToken, name: reportTypeName })
25
+ return api.reports.reportTypes.getByName({token, jwtToken, name: reportTypeName})
26
26
  .then((result) => {
27
- expect(result.status).to.be.eql(200);
28
- expect(result.data).to.be.eql([]);
27
+ assert.deepStrictEqual(result.status, 200);
28
+ assert.deepStrictEqual(result.data, []);
29
29
  });
30
30
  });
31
31
  });
@@ -1,14 +1,14 @@
1
1
  const port = process.env.SALES_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
 
4
- const api = require("./../../../src/client").createApiClient({
4
+ const api = require("./../../../src/client.js").createApiClient({
5
5
  baseURL: `http://localhost:${port}`,
6
6
  baseURLOverride: {
7
- sales: (baseUrl) => `${baseUrl}/sales`
7
+ sales: (baseUrl) => { return `${baseUrl}/sales`; }
8
8
  }
9
9
  });
10
10
 
11
- const { matchHeaders, statusCode } = require("./../../test-integration-helpers");
11
+ const {matchHeaders, statusCode} = require("./../../test-integration-helpers.js");
12
12
 
13
13
  describe("sales/bundles", () => {
14
14
  it("should list bundles", () => {
@@ -16,8 +16,8 @@ describe("sales/bundles", () => {
16
16
  providerId: "595f9c7007ee12686d000032",
17
17
  type: "bundles"
18
18
  };
19
- return api.sales.bundles.all({ token, query })
20
- .then(matchHeaders('x-api-key'))
19
+ return api.sales.bundles.all({token, query})
20
+ .then(matchHeaders("x-api-key"))
21
21
  .then(statusCode(200));
22
22
  });
23
23
  });