btrz-api-client 8.64.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 (244) 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/notifications/pdf-data.js +3 -6
  18. package/lib/endpoints/operations/movements.js +7 -2
  19. package/lib/endpoints/operations/pago-express.js +9 -3
  20. package/lib/endpoints/operations/parcels.js +3 -1
  21. package/lib/endpoints/sales/cancellations.js +31 -8
  22. package/package.json +6 -8
  23. package/src/client.js +0 -1
  24. package/src/endpoints/accounts/journey-prices-settings.js +2 -2
  25. package/src/endpoints/accounts/market-pricing-settings.js +3 -3
  26. package/src/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  27. package/src/endpoints/accounts/operation-settings.js +3 -1
  28. package/src/endpoints/btrzpay/referenced-payments.js +6 -2
  29. package/src/endpoints/btrzpay/square.js +12 -3
  30. package/src/endpoints/btrzpay/stripe-terminals.js +9 -3
  31. package/src/endpoints/btrzpay/terminalPayments.js +14 -4
  32. package/src/endpoints/inventory/document-types.js +2 -1
  33. package/src/endpoints/inventory/products.js +1 -0
  34. package/src/endpoints/notifications/pdf-data.js +3 -6
  35. package/src/endpoints/operations/movements.js +7 -2
  36. package/src/endpoints/operations/pago-express.js +9 -3
  37. package/src/endpoints/operations/parcels.js +3 -1
  38. package/src/endpoints/sales/cancellations.js +31 -8
  39. package/test/all.test.js +218 -0
  40. package/test/client.test.js +58 -44
  41. package/test/endpoints/accounts/application-settings.test.js +2 -2
  42. package/test/endpoints/accounts/applications.test.js +2 -2
  43. package/test/endpoints/accounts/current-shifts.test.js +2 -2
  44. package/test/endpoints/accounts/customers.js +17 -17
  45. package/test/endpoints/accounts/domains.test.js +6 -8
  46. package/test/endpoints/accounts/exchange-rates.test.js +3 -3
  47. package/test/endpoints/accounts/exchange-receipts.test.js +3 -3
  48. package/test/endpoints/accounts/images.test.js +2 -2
  49. package/test/endpoints/accounts/interline.test.js +10 -12
  50. package/test/endpoints/accounts/network.test.js +3 -5
  51. package/test/endpoints/accounts/people-lookups.test.js +13 -13
  52. package/test/endpoints/accounts/print-templates.test.js +3 -3
  53. package/test/endpoints/accounts/printers.test.js +2 -2
  54. package/test/endpoints/accounts/tokens.js +2 -2
  55. package/test/endpoints/accounts/trusted-machines.test.js +2 -2
  56. package/test/endpoints/accounts/websales-config.test.js +47 -50
  57. package/test/endpoints/btrzpay/carpointe.tests.js +2 -2
  58. package/test/endpoints/btrzpay/datalogicPayments.tests.js +2 -2
  59. package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +2 -2
  60. package/test/endpoints/btrzpay/oxxoPayments.tests.js +2 -2
  61. package/test/endpoints/btrzpay/oxxoToken.tests.js +2 -2
  62. package/test/endpoints/btrzpay/payment-methods.test.js +3 -3
  63. package/test/endpoints/btrzpay/payments.tests.js +6 -6
  64. package/test/endpoints/btrzpay/reference-numbers.test.js +5 -5
  65. package/test/endpoints/btrzpay/referenced-payments.test.js +2 -2
  66. package/test/endpoints/btrzpay/square.tests.js +2 -2
  67. package/test/endpoints/btrzpay/terminalPayments.tests.js +2 -2
  68. package/test/endpoints/endpoints_helpers.test.js +28 -24
  69. package/test/endpoints/inventory/amenities.test.js +20 -20
  70. package/test/endpoints/inventory/amenity-groups.test.js +15 -15
  71. package/test/endpoints/inventory/bare-routes.test.js +2 -2
  72. package/test/endpoints/inventory/brands.test.js +9 -9
  73. package/test/endpoints/inventory/bundle-fares.test.js +10 -11
  74. package/test/endpoints/inventory/bundles.test.js +9 -9
  75. package/test/endpoints/inventory/companies.test.js +6 -6
  76. package/test/endpoints/inventory/custom-content.test.js +4 -4
  77. package/test/endpoints/inventory/custom-fields.test.js +2 -2
  78. package/test/endpoints/inventory/document-types.test.js +2 -2
  79. package/test/endpoints/inventory/fare-classes.test.js +10 -10
  80. package/test/endpoints/inventory/fares.test.js +14 -16
  81. package/test/endpoints/inventory/fees.test.js +14 -15
  82. package/test/endpoints/inventory/filtered-trips-v2.test.js +5 -5
  83. package/test/endpoints/inventory/insurances.test.js +2 -2
  84. package/test/endpoints/inventory/insurancesCost.test.js +2 -2
  85. package/test/endpoints/inventory/journey-prices.test.js +13 -15
  86. package/test/endpoints/inventory/labels.test.js +2 -2
  87. package/test/endpoints/inventory/marital-status.test.js +2 -2
  88. package/test/endpoints/inventory/mit-terminal-settings.test.js +2 -2
  89. package/test/endpoints/inventory/mit-terminals.test.js +7 -7
  90. package/test/endpoints/inventory/operating-companies.test.js +14 -14
  91. package/test/endpoints/inventory/operation-messages.test.js +10 -10
  92. package/test/endpoints/inventory/parcel-zones.test.js +12 -13
  93. package/test/endpoints/inventory/payment-terminals.test.js +7 -7
  94. package/test/endpoints/inventory/prisma-terminals.test.js +2 -2
  95. package/test/endpoints/inventory/products.test.js +25 -20
  96. package/test/endpoints/inventory/promos.test.js +50 -50
  97. package/test/endpoints/inventory/seatclasses.test.js +2 -2
  98. package/test/endpoints/inventory/seatfees.test.js +6 -6
  99. package/test/endpoints/inventory/seatmaps.test.js +7 -7
  100. package/test/endpoints/inventory/segments-information.test.js +2 -2
  101. package/test/endpoints/inventory/service-numbers.test.js +6 -6
  102. package/test/endpoints/inventory/service-types.test.js +7 -7
  103. package/test/endpoints/inventory/shift-settings.test.js +2 -2
  104. package/test/endpoints/inventory/ssrs.test.js +10 -11
  105. package/test/endpoints/inventory/stations-zones.test.js +8 -9
  106. package/test/endpoints/inventory/stations.test.js +2 -2
  107. package/test/endpoints/inventory/travel-routes.test.js +2 -2
  108. package/test/endpoints/inventory/traveller-car-types.test.js +8 -8
  109. package/test/endpoints/inventory/traveller-card-providers-types.test.js +2 -2
  110. package/test/endpoints/inventory/traveller-card-providers.test.js +7 -7
  111. package/test/endpoints/inventory/vehicles.test.js +2 -2
  112. package/test/endpoints/inventory/zone-price-overages.test.js +2 -2
  113. package/test/endpoints/inventory/zone-prices.test.js +2 -2
  114. package/test/endpoints/invoices/dlink.test.js +2 -2
  115. package/test/endpoints/invoices/gti.test.js +2 -2
  116. package/test/endpoints/invoices/infile.test.js +2 -2
  117. package/test/endpoints/invoices/infileJson.test.js +2 -2
  118. package/test/endpoints/invoices/providers.test.js +4 -4
  119. package/test/endpoints/invoices/providersSequences.test.js +2 -2
  120. package/test/endpoints/invoices/system.test.js +2 -2
  121. package/test/endpoints/loyalty/movements.test.js +11 -11
  122. package/test/endpoints/loyalty/programs.test.js +21 -21
  123. package/test/endpoints/notifications/customers.test.js +6 -6
  124. package/test/endpoints/notifications/external-customers.test.js +10 -10
  125. package/test/endpoints/notifications/manifet-notifications.test.js +3 -3
  126. package/test/endpoints/notifications/notify.test.js +5 -5
  127. package/test/endpoints/notifications/orders-rules-validations.test.js +5 -6
  128. package/test/endpoints/notifications/pdf-data.test.js +4 -4
  129. package/test/endpoints/notifications/pdfs.test.js +4 -4
  130. package/test/endpoints/notifications/printed-tickets.test.js +17 -18
  131. package/test/endpoints/notifications/short-urls.test.js +9 -9
  132. package/test/endpoints/operations/applied_insurance.test.js +10 -14
  133. package/test/endpoints/operations/calendar_entries.test.js +8 -9
  134. package/test/endpoints/operations/cancellation_settings.test.js +2 -2
  135. package/test/endpoints/operations/loans.test.js +2 -2
  136. package/test/endpoints/operations/manifest.test.js +11 -9
  137. package/test/endpoints/operations/operations.test.js +42 -25
  138. package/test/endpoints/operations/parcel_manifests.test.js +3 -3
  139. package/test/endpoints/operations/parcels.test.js +27 -22
  140. package/test/endpoints/operations/passenger_check_in_info.test.js +2 -2
  141. package/test/endpoints/operations/redemption.test.js +2 -2
  142. package/test/endpoints/operations/sold-items-fulfillment.test.js +2 -2
  143. package/test/endpoints/operations/sold_items.test.js +3 -3
  144. package/test/endpoints/operations/tickets.test.js +4 -4
  145. package/test/endpoints/operations/transaction.test.js +12 -15
  146. package/test/endpoints/operations/transactions.test.js +11 -11
  147. package/test/endpoints/operations/transport_regulations.js +2 -4
  148. package/test/endpoints/operations/trip_change_info.test.js +9 -10
  149. package/test/endpoints/operations/vehicle-assignments.test.js +5 -7
  150. package/test/endpoints/operations/waitlists.test.js +3 -3
  151. package/test/endpoints/ratality/auth.test.js +5 -5
  152. package/test/endpoints/ratality/client.test.js +4 -4
  153. package/test/endpoints/ratality/integrations.test.js +15 -9
  154. package/test/endpoints/reports/custom-reports.test.js +12 -12
  155. package/test/endpoints/reports/email.test.js +3 -3
  156. package/test/endpoints/reports/report-types.test.js +6 -6
  157. package/test/endpoints/reports/trip-manifests.test.js +5 -6
  158. package/test/endpoints/sales/bundles.test.js +9 -10
  159. package/test/endpoints/sales/cart-promo.test.js +15 -16
  160. package/test/endpoints/sales/cart.test.js +7 -7
  161. package/test/endpoints/sales/check-in-info.test.js +3 -3
  162. package/test/endpoints/sales/custom-fields.test.js +10 -13
  163. package/test/endpoints/sales/flexpasses.test.js +2 -2
  164. package/test/endpoints/sales/git-certificates.test.js +10 -13
  165. package/test/endpoints/sales/order.test.js +19 -21
  166. package/test/endpoints/sales/payment-providers.test.js +14 -15
  167. package/test/endpoints/sales/redeemable-items.test.js +14 -15
  168. package/test/endpoints/sales/sync-entry.test.js +9 -11
  169. package/test/endpoints/sales/voucher.test.js +19 -17
  170. package/test/endpoints/seatmaps/access-ticket.test.js +6 -6
  171. package/test/endpoints/seatmaps/seat.test.js +6 -6
  172. package/test/endpoints/uploads/files.test.js +8 -7
  173. package/test/endpoints/uploads/images.test.js +8 -7
  174. package/test/endpoints/webhooks/subscriptions.test.js +27 -27
  175. package/test/endpoints/webhooks/undelivered.test.js +22 -22
  176. package/test/endpoints/webhooks/webhooks.test.js +7 -7
  177. package/test/node-test-globals.js +19 -0
  178. package/test/test-helpers.js +4 -4
  179. package/test-integration/all.test.js +63 -0
  180. package/test-integration/endpoints/accounts/current-shifts.test.js +4 -4
  181. package/test-integration/endpoints/accounts/docs.test.js +6 -6
  182. package/test-integration/endpoints/accounts/lexicons.test.js +42 -37
  183. package/test-integration/endpoints/accounts/shifts.test.js +5 -8
  184. package/test-integration/endpoints/accounts/users.test.js +4 -4
  185. package/test-integration/endpoints/btrzpay/customerCards.test.js +24 -48
  186. package/test-integration/endpoints/btrzpay/customers.test.js +20 -34
  187. package/test-integration/endpoints/btrzpay/payment-methods.test.js +34 -34
  188. package/test-integration/endpoints/btrzpay/payments.test.js +21 -21
  189. package/test-integration/endpoints/btrzpay/reference-numbers.test.js +15 -15
  190. package/test-integration/endpoints/btrzpay/referenced-payments.test.js +5 -5
  191. package/test-integration/endpoints/client.test.js +6 -10
  192. package/test-integration/endpoints/inventory/amenities.test.js +34 -34
  193. package/test-integration/endpoints/inventory/amenity-groups.test.js +30 -31
  194. package/test-integration/endpoints/inventory/bundle-fares.test.js +10 -12
  195. package/test-integration/endpoints/inventory/companies.test.js +7 -8
  196. package/test-integration/endpoints/inventory/countries.test.js +10 -12
  197. package/test-integration/endpoints/inventory/custom-fields.test.js +2 -2
  198. package/test-integration/endpoints/inventory/docs.test.js +5 -7
  199. package/test-integration/endpoints/inventory/fare-classes.test.js +12 -13
  200. package/test-integration/endpoints/inventory/fares.test.js +7 -9
  201. package/test-integration/endpoints/inventory/fees.test.js +8 -10
  202. package/test-integration/endpoints/inventory/filtered-trips.test.js +15 -12
  203. package/test-integration/endpoints/inventory/gift-certificate-definitions.test.js +5 -5
  204. package/test-integration/endpoints/inventory/insurances.test.js +36 -34
  205. package/test-integration/endpoints/inventory/items.js +10 -12
  206. package/test-integration/endpoints/inventory/journey-prices.test.js +11 -11
  207. package/test-integration/endpoints/inventory/parcel-zones.test.js +15 -18
  208. package/test-integration/endpoints/inventory/products.test.js +12 -14
  209. package/test-integration/endpoints/inventory/promos.test.js +46 -42
  210. package/test-integration/endpoints/inventory/routes.test.js +13 -15
  211. package/test-integration/endpoints/inventory/schedule-groups.test.js +23 -23
  212. package/test-integration/endpoints/inventory/ssrs.test.js +16 -11
  213. package/test-integration/endpoints/inventory/stations-zones.test.js +5 -6
  214. package/test-integration/endpoints/inventory/stations.test.js +17 -20
  215. package/test-integration/endpoints/inventory/trips.test.js +30 -16
  216. package/test-integration/endpoints/notifications/printed-tickets.test.js +2 -2
  217. package/test-integration/endpoints/operations/applied_insurance.test.js +9 -11
  218. package/test-integration/endpoints/operations/manifest.test.js +32 -34
  219. package/test-integration/endpoints/operations/parcel.test.js +36 -38
  220. package/test-integration/endpoints/operations/redemption.test.js +9 -12
  221. package/test-integration/endpoints/operations/segments.js +8 -10
  222. package/test-integration/endpoints/operations/tickets.test.js +11 -11
  223. package/test-integration/endpoints/operations/transaction.test.js +1 -1
  224. package/test-integration/endpoints/operations/transactions.test.js +2 -2
  225. package/test-integration/endpoints/operations/trip_change_info.test.js +11 -13
  226. package/test-integration/endpoints/reports/custom-reports.test.js +21 -21
  227. package/test-integration/endpoints/reports/report-types.test.js +22 -22
  228. package/test-integration/endpoints/sales/bundles.test.js +5 -5
  229. package/test-integration/endpoints/sales/cart-promo.test.js +17 -32
  230. package/test-integration/endpoints/sales/cart.test.js +45 -51
  231. package/test-integration/endpoints/sales/check-in-info.test.js +2 -2
  232. package/test-integration/endpoints/sales/custom-fields.test.js +8 -10
  233. package/test-integration/endpoints/sales/flexpasses.test.js +2 -2
  234. package/test-integration/endpoints/sales/gift-certificates.test.js +14 -18
  235. package/test-integration/endpoints/sales/order.test.js +42 -50
  236. package/test-integration/endpoints/sales/payment-providers.test.js +7 -9
  237. package/test-integration/endpoints/sales/redeemable-items.test.js +17 -19
  238. package/test-integration/endpoints/sales/voucher.test.js +12 -14
  239. package/test-integration/endpoints/seatmaps/access-ticket.test.js +7 -9
  240. package/test-integration/endpoints/seatmaps/seat.test.js +7 -9
  241. package/test-integration/endpoints/uploads/files.test.js +14 -14
  242. package/test-integration/endpoints/uploads/images.test.js +3 -5
  243. package/test-integration/ports.js +4 -4
  244. package/test-integration/test-integration-helpers.js +13 -9
@@ -1,13 +1,13 @@
1
- const { expect } = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
  const port = process.env.INVENTORY_API_PORT;
3
3
  const token = process.env.API_TOKEN;
4
4
  const jwtToken = process.env.JWT_TOKEN;
5
5
  const amenityId = process.env.AMENITY_ID;
6
6
 
7
- const api = require("./../../../src/client").createApiClient({
7
+ const api = require("./../../../src/client.js").createApiClient({
8
8
  baseURL: `http://localhost:${port}`,
9
9
  baseURLOverride: {
10
- inventory: (baseUrl) => `${baseUrl}/inventory`
10
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
11
11
  }
12
12
  });
13
13
 
@@ -17,17 +17,17 @@ describe("inventory/amenities", () => {
17
17
  token,
18
18
  amenityId
19
19
  })
20
- .then(({status, data}) => {
21
- expect(status).to.equal(200);
22
- expect(data.amenity).to.exist;
23
- expect(data.amenity._id).to.eql(amenityId);
24
- });
20
+ .then(({status, data}) => {
21
+ assert.deepStrictEqual(status, 200);
22
+ assert.ok(data.amenity);
23
+ assert.deepStrictEqual(data.amenity._id, amenityId);
24
+ });
25
25
  });
26
26
 
27
27
  it("should create an Amenity", () => {
28
- const newName = "New Name 93",
29
- newIcon = "fa-train",
30
- newState = false;
28
+ const newName = "New Name 93";
29
+ const newIcon = "fa-train";
30
+ const newState = false;
31
31
  return api.inventory.amenities.create({
32
32
  jwtToken,
33
33
  token,
@@ -41,23 +41,23 @@ describe("inventory/amenities", () => {
41
41
  }
42
42
  }
43
43
  })
44
- .then(({status, data}) => {
45
- expect(status).to.equal(200);
46
- expect(data.amenity).to.exist;
47
- expect(data.amenity.name).to.eql(newName);
48
- expect(data.amenity.icon).to.eql(newIcon);
49
- expect(data.amenity.enabled).to.eql(newState);
50
- expect(data.amenity.createdAt).to.exist;
51
- expect(data.amenity.createdBy).to.exist;
52
- expect(data.amenity.updatedAt).to.exist;
53
- expect(data.amenity.updatedBy).to.exist;
54
- });
44
+ .then(({status, data}) => {
45
+ assert.deepStrictEqual(status, 200);
46
+ assert.ok(data.amenity);
47
+ assert.deepStrictEqual(data.amenity.name, newName);
48
+ assert.deepStrictEqual(data.amenity.icon, newIcon);
49
+ assert.deepStrictEqual(data.amenity.enabled, newState);
50
+ assert.ok(data.amenity.createdAt);
51
+ assert.ok(data.amenity.createdBy);
52
+ assert.ok(data.amenity.updatedAt);
53
+ assert.ok(data.amenity.updatedBy);
54
+ });
55
55
  });
56
56
 
57
57
  it("should update an Amenity", () => {
58
- const newName = "New Name 1234",
59
- newIcon = "fa-train",
60
- newState = false;
58
+ const newName = "New Name 1234";
59
+ const newIcon = "fa-train";
60
+ const newState = false;
61
61
 
62
62
  return api.inventory.amenities.update({
63
63
  jwtToken,
@@ -74,15 +74,15 @@ describe("inventory/amenities", () => {
74
74
  }
75
75
  })
76
76
  .then(({status, data}) => {
77
- expect(status).to.equal(200);
78
- expect(data.amenity).to.exist;
79
- expect(data.amenity.name).to.eql(newName);
80
- expect(data.amenity.icon).to.eql(newIcon);
81
- expect(data.amenity.enabled).to.eql(newState);
82
- expect(data.amenity.createdAt).to.exist;
83
- expect(data.amenity.createdBy).to.exist;
84
- expect(data.amenity.updatedAt).to.exist;
85
- expect(data.amenity.updatedBy).to.exist;
77
+ assert.deepStrictEqual(status, 200);
78
+ assert.ok(data.amenity);
79
+ assert.deepStrictEqual(data.amenity.name, newName);
80
+ assert.deepStrictEqual(data.amenity.icon, newIcon);
81
+ assert.deepStrictEqual(data.amenity.enabled, newState);
82
+ assert.ok(data.amenity.createdAt);
83
+ assert.ok(data.amenity.createdBy);
84
+ assert.ok(data.amenity.updatedAt);
85
+ assert.ok(data.amenity.updatedBy);
86
86
  });
87
87
  });
88
88
  });
@@ -1,13 +1,13 @@
1
- const { expect } = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
  const port = process.env.INVENTORY_API_PORT;
3
3
  const token = process.env.API_TOKEN;
4
4
  const jwtToken = process.env.JWT_TOKEN;
5
5
  const amenityGroupId = process.env.AMENITY_GROUP_ID;
6
6
 
7
- const api = require("./../../../src/client").createApiClient({
7
+ const api = require("./../../../src/client.js").createApiClient({
8
8
  baseURL: `http://localhost:${port}`,
9
9
  baseURLOverride: {
10
- inventory: (baseUrl) => `${baseUrl}/inventory`
10
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
11
11
  }
12
12
  });
13
13
 
@@ -17,17 +17,16 @@ describe("inventory/amenity-groups", () => {
17
17
  token,
18
18
  amenityGroupId
19
19
  })
20
- .then(({status, data}) => {
21
- expect(status).to.equal(200);
22
- expect(data.amenityGroup).to.exist;
23
- expect(data.amenityGroup._id).to.eql(amenityGroupId);
24
- });
20
+ .then(({status, data}) => {
21
+ assert.deepStrictEqual(status, 200);
22
+ assert.ok(data.amenityGroup);
23
+ assert.deepStrictEqual(data.amenityGroup._id, amenityGroupId);
24
+ });
25
25
  });
26
26
 
27
27
  it("should create an Amenity Group", () => {
28
- const newName = "New Name 97",
29
- newIcon = "fa-train",
30
- newState = false;
28
+ const newName = "New Name 97";
29
+ const newState = false;
31
30
  return api.inventory.amenityGroups.create({
32
31
  jwtToken,
33
32
  token,
@@ -38,21 +37,21 @@ describe("inventory/amenity-groups", () => {
38
37
  lexiconKeys: {}
39
38
  }
40
39
  })
41
- .then(({status, data}) => {
42
- expect(status).to.equal(200);
43
- expect(data.amenityGroup).to.exist;
44
- expect(data.amenityGroup.name).to.eql(newName);
45
- expect(data.amenityGroup.enabled).to.eql(newState);
46
- expect(data.amenityGroup.createdAt).to.exist;
47
- expect(data.amenityGroup.createdBy).to.exist;
48
- expect(data.amenityGroup.updatedAt).to.exist;
49
- expect(data.amenityGroup.updatedBy).to.exist;
50
- });
40
+ .then(({status, data}) => {
41
+ assert.deepStrictEqual(status, 200);
42
+ assert.ok(data.amenityGroup);
43
+ assert.deepStrictEqual(data.amenityGroup.name, newName);
44
+ assert.deepStrictEqual(data.amenityGroup.enabled, newState);
45
+ assert.ok(data.amenityGroup.createdAt);
46
+ assert.ok(data.amenityGroup.createdBy);
47
+ assert.ok(data.amenityGroup.updatedAt);
48
+ assert.ok(data.amenityGroup.updatedBy);
49
+ });
51
50
  });
52
51
 
53
52
  it("should update an Amenity Group", () => {
54
- const newName = "Amenity Group New Name",
55
- newState = false;
53
+ const newName = "Amenity Group New Name";
54
+ const newState = false;
56
55
 
57
56
  return api.inventory.amenityGroups.update({
58
57
  jwtToken,
@@ -66,14 +65,14 @@ describe("inventory/amenity-groups", () => {
66
65
  }
67
66
  })
68
67
  .then(({status, data}) => {
69
- expect(status).to.equal(200);
70
- expect(data.amenityGroup).to.exist;
71
- expect(data.amenityGroup.name).to.eql(newName);
72
- expect(data.amenityGroup.enabled).to.eql(newState);
73
- expect(data.amenityGroup.createdAt).to.exist;
74
- expect(data.amenityGroup.createdBy).to.exist;
75
- expect(data.amenityGroup.updatedAt).to.exist;
76
- expect(data.amenityGroup.updatedBy).to.exist;
68
+ assert.deepStrictEqual(status, 200);
69
+ assert.ok(data.amenityGroup);
70
+ assert.deepStrictEqual(data.amenityGroup.name, newName);
71
+ assert.deepStrictEqual(data.amenityGroup.enabled, newState);
72
+ assert.ok(data.amenityGroup.createdAt);
73
+ assert.ok(data.amenityGroup.createdBy);
74
+ assert.ok(data.amenityGroup.updatedAt);
75
+ assert.ok(data.amenityGroup.updatedBy);
77
76
  });
78
77
  });
79
78
  });
@@ -1,26 +1,24 @@
1
1
  const port = process.env.INVENTORY_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
- inventory: (baseUrl) => `${baseUrl}/inventory`
7
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
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("inventory/bundle-fares", () => {
14
-
15
14
  it("should list fares for a bundle", () => {
16
- const bundleId = "5b20472fd6d9c17d3b000007",
17
- productId = "595f9c7007ee12686d000033",
18
- query = {
19
- providerIds: "595f9c7007ee12686d000032"
20
- };
21
- return api.inventory.bundleFares.all({ token, bundleId, productId, query })
22
- .then(matchHeaders('x-api-key'))
15
+ const bundleId = "5b20472fd6d9c17d3b000007";
16
+ const productId = "595f9c7007ee12686d000033";
17
+ const query = {
18
+ providerIds: "595f9c7007ee12686d000032"
19
+ };
20
+ return api.inventory.bundleFares.all({token, bundleId, productId, query})
21
+ .then(matchHeaders("x-api-key"))
23
22
  .then(statusCode(200));
24
23
  });
25
-
26
24
  });
@@ -1,20 +1,19 @@
1
1
  const port = process.env.INVENTORY_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
- inventory: (baseUrl) => `${baseUrl}/inventory`
7
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
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
- describe("inventory/companies", function() {
14
-
15
- it("should list companies", function() {
16
- return api.inventory.companies.all({ token, query: { search: "sup" } })
17
- .then(matchHeaders('x-api-key'))
13
+ describe("inventory/companies", () => {
14
+ it("should list companies", () => {
15
+ return api.inventory.companies.all({token, query: {search: "sup"}})
16
+ .then(matchHeaders("x-api-key"))
18
17
  .then(statusCode(200))
19
18
  .then((res) => {
20
19
  console.log(res.data);
@@ -1,21 +1,19 @@
1
1
  const port = process.env.INVENTORY_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
 
4
- const api = require("./../../../src/client").createApiClient({
5
- baseURL: `http://localhost:${port}`,
4
+ const api = require("./../../../src/client.js").createApiClient({
5
+ baseURL: `http://localhost:${port}`,
6
6
  baseURLOverride: {
7
- inventory: (baseUrl) => `${baseUrl}/inventory`
7
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
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
- describe("inventory/countries", function() {
14
-
15
- it("should list countries", function() {
16
- return api.inventory.countries.all({ token, query: { isParcel: true } })
17
- .then(matchHeaders('x-api-key'))
18
- .then(statusCode(200))
13
+ describe("inventory/countries", () => {
14
+ it("should list countries", () => {
15
+ return api.inventory.countries.all({token, query: {isParcel: true}})
16
+ .then(matchHeaders("x-api-key"))
17
+ .then(statusCode(200));
19
18
  });
20
-
21
- });
19
+ });
@@ -1,7 +1,7 @@
1
1
  const port = process.env.INVENTORY_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
  // eslint-disable-next-line import/extensions
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
7
  inventory: (baseUrl) => {
@@ -10,7 +10,7 @@ const api = require("./../../../src/client").createApiClient({
10
10
  }
11
11
  });
12
12
 
13
- const {matchHeaders, statusCode} = require("./../../test-integration-helpers");
13
+ const {matchHeaders, statusCode} = require("./../../test-integration-helpers.js");
14
14
 
15
15
  describe("inventory/custom-fields", () => {
16
16
  it("should list custom fields", () => {
@@ -1,21 +1,19 @@
1
1
  describe("inventory/docs", () => {
2
- const {
3
- expect
4
- } = require("chai");
2
+ const assert = require("node:assert/strict");
5
3
  const port = process.env.INVENTORY_API_PORT;
6
4
 
7
- const api = require("./../../../src/client").createApiClient({
5
+ const api = require("./../../../src/client.js").createApiClient({
8
6
  baseURL: `http://localhost:${port}`,
9
7
  baseURLOverride: {
10
- inventory: (baseUrl) => `${baseUrl}/inventory`
8
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
11
9
  }
12
10
  });
13
11
  it("should get the docs", () => {
14
12
  return api.inventory.docs.get({})
15
13
  .then(({status, data}) => {
16
- expect(status).to.equal(200);
14
+ assert.deepStrictEqual(status, 200);
17
15
  console.log(data);
18
- expect(data).to.exist;
16
+ assert.ok(data);
19
17
  });
20
18
  });
21
19
  });
@@ -1,5 +1,5 @@
1
- const { expect } = require("chai");
2
- const uuid = require("uuid");
1
+ const assert = require("node:assert/strict");
2
+ const {randomUUID} = require("node:crypto");
3
3
 
4
4
  const port = process.env.INVENTORY_API_PORT;
5
5
  const token = process.env.API_TOKEN;
@@ -7,18 +7,17 @@ const jwtToken = process.env.JWT_TOKEN;
7
7
  const accountId = process.env.ACCOUNT_ID;
8
8
  const fareClassId = process.env.FARE_CLASS_ID;
9
9
 
10
- const api = require("./../../../src/client").createApiClient({
10
+ const api = require("./../../../src/client.js").createApiClient({
11
11
  baseURL: `http://localhost:${port}`,
12
12
  baseURLOverride: {
13
- inventory: (baseUrl) => `${baseUrl}/inventory`
13
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
14
14
  }
15
15
  });
16
16
 
17
17
 
18
18
  describe("inventory/fare-classes", () => {
19
-
20
19
  it("should create a fare class", () => {
21
- return api.inventory.products.all({ token }).then((res) => {
20
+ return api.inventory.products.all({token}).then((res) => {
22
21
  return api.inventory.fareClasses.create({
23
22
  jwtToken,
24
23
  token,
@@ -33,7 +32,7 @@ describe("inventory/fare-classes", () => {
33
32
  lexiconKeys: {
34
33
  name: "fare-class-name-97ba4o9al2837g0w9",
35
34
  description: "fare-class-description-97ba4o9al2837g0w9",
36
- terms: "fare-class-terms-97ba4o9al2837g0w9",
35
+ terms: "fare-class-terms-97ba4o9al2837g0w9"
37
36
  }
38
37
  }
39
38
  });
@@ -43,12 +42,12 @@ describe("inventory/fare-classes", () => {
43
42
  it("should get all fare classes", () => {
44
43
  return api.inventory.fareClasses.all({token, jwtToken, query: {providerId: accountId}})
45
44
  .then((response) => {
46
- expect(response.data.fareClasses).to.be.instanceOf(Array);
45
+ assert.ok(Array.isArray(response.data.fareClasses));
47
46
  });
48
47
  });
49
48
 
50
49
  it("should update a fare class", () => {
51
- const newName = uuid.v4();
50
+ const newName = randomUUID();
52
51
 
53
52
  return api.inventory.fareClasses.update({
54
53
  jwtToken,
@@ -59,9 +58,9 @@ describe("inventory/fare-classes", () => {
59
58
  }
60
59
  })
61
60
  .then(({status, data}) => {
62
- expect(status).to.equal(200);
63
- expect(data.fareClass).to.exist;
64
- expect(data.fareClass.name).to.eql(newName);
61
+ assert.deepStrictEqual(status, 200);
62
+ assert.ok(data.fareClass);
63
+ assert.deepStrictEqual(data.fareClass.name, newName);
65
64
  });
66
65
  });
67
- });
66
+ });
@@ -1,28 +1,26 @@
1
1
  const port = process.env.INVENTORY_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
- inventory: (baseUrl) => `${baseUrl}/inventory`
7
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
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("inventory/fares", () => {
14
-
15
14
  it("should list fares", () => {
16
- return api.inventory.fares.all({ token })
17
- .then(matchHeaders('x-api-key'))
15
+ return api.inventory.fares.all({token})
16
+ .then(matchHeaders("x-api-key"))
18
17
  .then(statusCode(200));
19
18
  });
20
19
 
21
20
  it("should get a fare by id", () => {
22
21
  const id = "595f9f62df9127b11d5e03bd";
23
- return api.inventory.fares.get({ token, id })
24
- .then(matchHeaders('x-api-key'))
22
+ return api.inventory.fares.get({token, id})
23
+ .then(matchHeaders("x-api-key"))
25
24
  .then(statusCode(200));
26
25
  });
27
-
28
26
  });
@@ -1,22 +1,20 @@
1
1
  const port = process.env.INVENTORY_API_PORT;
2
2
  const token = process.env.API_TOKEN;
3
3
 
4
- const api = require("./../../../src/client").createApiClient({
5
- baseURL: `http://localhost:${port}`,
4
+ const api = require("./../../../src/client.js").createApiClient({
5
+ baseURL: `http://localhost:${port}`,
6
6
  baseURLOverride: {
7
- inventory: (baseUrl) => `${baseUrl}/inventory`
7
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
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("inventory/fees", () => {
14
-
15
14
  it("should list fees", () => {
16
15
  const query = {rules: "manual"};
17
- return api.inventory.fees.all({ token, query })
18
- .then(matchHeaders('x-api-key'))
19
- .then(statusCode(200))
16
+ return api.inventory.fees.all({token, query})
17
+ .then(matchHeaders("x-api-key"))
18
+ .then(statusCode(200));
20
19
  });
21
-
22
- });
20
+ });
@@ -1,23 +1,26 @@
1
- const { expect } = require("chai");
2
1
 
3
2
  const port = process.env.INVENTORY_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
- inventory: (baseUrl) => `${baseUrl}/inventory`
9
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
11
10
  }
12
11
  });
13
12
 
14
- const { matchHeaders, statusCode } = require("./../../test-integration-helpers");
15
13
 
16
- describe("inventory/filtered-trips", function() {
17
-
18
- it("should filter a trip", function() {
19
- const tripSegmentsId = "eyJhY2NvdW50SWQiOiI0Zjc0YTIzNWIwZGZmYzAyMTAwMDAwMTUiLCJwcm9kdWN0SWQiOiI1YTNiZmIwYzhhYzQ1NTcwM2U5OWI1MjYiLCJvcmlnaW5JZCI6IjUxZWQyYWY3Y2YyYzgxOWQ1ZTAwMDAwNSIsImRlc3RpbmF0aW9uSWQiOiI1MWIwYjBmNzMxYzcyOWI3NWMwMDAxNjIiLCJzZWdtZW50cyI6W3sic2NoZWR1bGVJZCI6IjZmZmY5NjU0LTg5YWQtNDRkOS1hMmU1LTNmNWNhNmE3YmE0NiIsInNjaGVkdWxlRGlzcGxheU5hbWUiOiJNb3JuaW5nIiwib3JpZ2luIjoiRHVibGluIiwiZGVzdGluYXRpb24iOiJUb3JvbnRvIiwic3RvcHMiOlsiRHVibGluIiwiSW5kaWEiLCJCZW5kIiwiVG9yb250byJdfV0sIm9yaWdpbiI6IkR1YmxpbiIsImRlc3RpbmF0aW9uIjoiVG9yb250byJ9";
20
- return api.inventory.filteredTrips.create({ token, jwtToken, tripSegmentsId });
14
+ describe("inventory/filtered-trips", () => {
15
+ it("should filter a trip", () => {
16
+ const tripSegmentsId = "eyJhY2NvdW50SWQiOiI0Zjc0YTIzNWIwZGZmYzAyMTAwMDAwMTUi" +
17
+ "LCJwcm9kdWN0SWQiOiI1YTNiZmIwYzhhYzQ1NTcwM2U5OWI1MjYiLCJvcmlnaW5JZCI6IjUxZWQy" +
18
+ "YWY3Y2YyYzgxOWQ1ZTAwMDAwNSIsImRlc3RpbmF0aW9uSWQiOiI1MWIwYjBmNzMxYzcyOWI3NWMw" +
19
+ "MDAxNjIiLCJzZWdtZW50cyI6W3sic2NoZWR1bGVJZCI6IjZmZmY5NjU0LTg5YWQtNDRkOS1hMmU1" +
20
+ "LTNmNWNhNmE3YmE0NiIsInNjaGVkdWxlRGlzcGxheU5hbWUiOiJNb3JuaW5nIiwib3JpZ2luIjoi" +
21
+ "RHVibGluIiwiZGVzdGluYXRpb24iOiJUb3JvbnRvIiwic3RvcHMiOlsiRHVibGluIiwiSW5kaWEi" +
22
+ "LCJCZW5kIiwiVG9yb250byJdfV0sIm9yaWdpbiI6IkR1YmxpbiIsImRlc3RpbmF0aW9uIjoiVG9y" +
23
+ "b250byJ9";
24
+ return api.inventory.filteredTrips.create({token, jwtToken, tripSegmentsId});
21
25
  });
22
-
23
- });
26
+ });
@@ -4,14 +4,14 @@ const jwtToken = process.env.JWT_TOKEN;
4
4
  const providerId = process.env.PROVIDER_ID;
5
5
  const giftcertificateId = process.env.GIFT_CERTIFICATE_ID;
6
6
 
7
- const api = require("./../../../src/client").createApiClient({
7
+ const api = require("./../../../src/client.js").createApiClient({
8
8
  baseURL: `http://localhost:${port}`,
9
9
  baseURLOverride: {
10
- inventory: (baseUrl) => `${baseUrl}/inventory`
10
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
11
11
  }
12
12
  });
13
13
 
14
- const { matchHeaders, statusCode } = require("./../../test-integration-helpers");
14
+ const {matchHeaders, statusCode} = require("./../../test-integration-helpers.js");
15
15
 
16
16
  function randomText() {
17
17
  return (Math.random() + 1).toString(36).substring(7);
@@ -20,8 +20,8 @@ function randomText() {
20
20
  describe("inventory/gift-certificate-definitions", () => {
21
21
  it("should list gift certificate definitions for the given provider id", () => {
22
22
  const query = {providerId};
23
- return api.inventory.giftCertificateDefinitions.all({ token, query })
24
- .then(matchHeaders('x-api-key'))
23
+ return api.inventory.giftCertificateDefinitions.all({token, query})
24
+ .then(matchHeaders("x-api-key"))
25
25
  .then(statusCode(200));
26
26
  });
27
27
 
@@ -1,59 +1,61 @@
1
- const { expect } = require("chai");
2
1
 
3
2
  const port = process.env.INVENTORY_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
- inventory: (baseUrl) => `${baseUrl}/inventory`
9
+ inventory: (baseUrl) => { return `${baseUrl}/inventory`; }
11
10
  }
12
11
  });
13
12
 
14
- const { matchHeaders, statusCode } = require("./../../test-integration-helpers");
15
13
 
16
- describe("inventory/insurances", function() {
17
-
18
- it("should list insurances", function() {
19
- return api.inventory.insurances.all({ token })
14
+ describe("inventory/insurances", () => {
15
+ it("should list insurances", () => {
16
+ return api.inventory.insurances.all({token});
20
17
  });
21
18
 
22
- it("should list insurances by productId", function() {
23
- return api.inventory.products.all({ token, query: { isParcel: true } }).then((res) => {
19
+ it("should list insurances by productId", () => {
20
+ return api.inventory.products.all({token, query: {isParcel: true}}).then((res) => {
24
21
  const query = {
25
22
  productId: res.data.products[0]._id
26
23
  };
27
- return api.inventory.insurances.all({ token, query });
24
+ return api.inventory.insurances.all({token, query});
28
25
  });
29
26
  });
30
27
 
31
- it("should create insurances", function() {
32
- return api.inventory.products.all({ token, query: { isParcel: true } }).then((res) => {
33
- return api.inventory.insurances.create({ token, jwtToken, insurance: {
34
- productId: res.data.products[0]._id,
35
- cost: 1000,
36
- threshold: 1000,
37
- enabled: true
38
- }
39
- })
28
+ it("should create insurances", () => {
29
+ return api.inventory.products.all({token, query: {isParcel: true}}).then((res) => {
30
+ return api.inventory.insurances.create({
31
+ token,
32
+ jwtToken,
33
+ insurance: {
34
+ productId: res.data.products[0]._id,
35
+ cost: 1000,
36
+ threshold: 1000,
37
+ enabled: true
38
+ }
39
+ });
40
40
  });
41
41
  });
42
42
 
43
- it("should update insurance", function() {
44
- return api.inventory.products.all({ token, query: { isParcel: true } }).then((res) => {
45
- return api.inventory.insurances.create({ token, jwtToken, insurance: {
46
- productId: res.data.products[0]._id,
47
- cost: 1000,
48
- threshold: 1000,
49
- enabled: true
50
- }
51
- }).then(function(created) {
43
+ it("should update insurance", () => {
44
+ return api.inventory.products.all({token, query: {isParcel: true}}).then((res) => {
45
+ return api.inventory.insurances.create({
46
+ token,
47
+ jwtToken,
48
+ insurance: {
49
+ productId: res.data.products[0]._id,
50
+ cost: 1000,
51
+ threshold: 1000,
52
+ enabled: true
53
+ }
54
+ }).then((created) => {
52
55
  const insurance = created.data.insurance;
53
56
  insurance.enabled = false;
54
- return api.inventory.insurances.enabled({ token, insurance, jwtToken })
55
- })
57
+ return api.inventory.insurances.enabled({token, insurance, jwtToken});
58
+ });
56
59
  });
57
60
  });
58
-
59
- });
61
+ });