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.
- package/.eslint-report.json +1 -0
- package/.eslintignore +2 -0
- package/fetch-test.js +5 -6
- package/index.js +2 -2
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +51 -38
- package/lib/endpoints/accounts/agencies.js +34 -7
- package/lib/endpoints/accounts/journey-prices-settings.js +2 -2
- package/lib/endpoints/accounts/market-pricing-settings.js +3 -3
- package/lib/endpoints/accounts/multiproduct-sales-settings.js +6 -2
- package/lib/endpoints/accounts/operation-settings.js +3 -1
- package/lib/endpoints/btrzpay/referenced-payments.js +6 -2
- package/lib/endpoints/btrzpay/square.js +12 -3
- package/lib/endpoints/btrzpay/stripe-terminals.js +9 -3
- package/lib/endpoints/btrzpay/terminalPayments.js +14 -4
- package/lib/endpoints/inventory/document-types.js +2 -1
- package/lib/endpoints/inventory/fare-type-modifiers.js +167 -0
- package/lib/endpoints/inventory/products.js +1 -0
- package/lib/endpoints/notifications/notify.js +55 -19
- package/lib/endpoints/operations/movements.js +7 -2
- package/lib/endpoints/operations/pago-express.js +9 -3
- package/lib/endpoints/operations/parcels.js +3 -1
- package/lib/endpoints/sales/cancellations.js +31 -8
- package/package.json +6 -8
- package/src/client.js +1 -1
- package/src/endpoints/accounts/agencies.js +23 -1
- package/src/endpoints/accounts/journey-prices-settings.js +2 -2
- package/src/endpoints/accounts/market-pricing-settings.js +3 -3
- package/src/endpoints/accounts/multiproduct-sales-settings.js +6 -2
- package/src/endpoints/accounts/operation-settings.js +3 -1
- package/src/endpoints/btrzpay/referenced-payments.js +6 -2
- package/src/endpoints/btrzpay/square.js +12 -3
- package/src/endpoints/btrzpay/stripe-terminals.js +9 -3
- package/src/endpoints/btrzpay/terminalPayments.js +14 -4
- package/src/endpoints/inventory/document-types.js +2 -1
- package/src/endpoints/inventory/fare-type-modifiers.js +140 -0
- package/src/endpoints/inventory/products.js +1 -0
- package/src/endpoints/notifications/notify.js +28 -1
- package/src/endpoints/operations/movements.js +7 -2
- package/src/endpoints/operations/pago-express.js +9 -3
- package/src/endpoints/operations/parcels.js +3 -1
- package/src/endpoints/sales/cancellations.js +31 -8
- package/test/all.test.js +219 -0
- package/test/client.test.js +58 -44
- package/test/endpoints/accounts/agencies.test.js +28 -0
- package/test/endpoints/accounts/application-settings.test.js +2 -2
- package/test/endpoints/accounts/applications.test.js +2 -2
- package/test/endpoints/accounts/current-shifts.test.js +2 -2
- package/test/endpoints/accounts/customers.js +17 -17
- package/test/endpoints/accounts/domains.test.js +6 -8
- package/test/endpoints/accounts/exchange-rates.test.js +3 -3
- package/test/endpoints/accounts/exchange-receipts.test.js +3 -3
- package/test/endpoints/accounts/images.test.js +2 -2
- package/test/endpoints/accounts/interline.test.js +10 -12
- package/test/endpoints/accounts/network.test.js +3 -5
- package/test/endpoints/accounts/people-lookups.test.js +13 -13
- package/test/endpoints/accounts/print-templates.test.js +3 -3
- package/test/endpoints/accounts/printers.test.js +2 -2
- package/test/endpoints/accounts/tokens.js +2 -2
- package/test/endpoints/accounts/trusted-machines.test.js +2 -2
- package/test/endpoints/accounts/websales-config.test.js +47 -50
- package/test/endpoints/btrzpay/carpointe.tests.js +2 -2
- package/test/endpoints/btrzpay/datalogicPayments.tests.js +2 -2
- package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +2 -2
- package/test/endpoints/btrzpay/oxxoPayments.tests.js +2 -2
- package/test/endpoints/btrzpay/oxxoToken.tests.js +2 -2
- package/test/endpoints/btrzpay/payment-methods.test.js +3 -3
- package/test/endpoints/btrzpay/payments.tests.js +6 -6
- package/test/endpoints/btrzpay/reference-numbers.test.js +5 -5
- package/test/endpoints/btrzpay/referenced-payments.test.js +2 -2
- package/test/endpoints/btrzpay/square.tests.js +2 -2
- package/test/endpoints/btrzpay/terminalPayments.tests.js +2 -2
- package/test/endpoints/endpoints_helpers.test.js +28 -24
- package/test/endpoints/inventory/amenities.test.js +20 -20
- package/test/endpoints/inventory/amenity-groups.test.js +15 -15
- package/test/endpoints/inventory/bare-routes.test.js +2 -2
- package/test/endpoints/inventory/brands.test.js +9 -9
- package/test/endpoints/inventory/bundle-fares.test.js +10 -11
- package/test/endpoints/inventory/bundles.test.js +9 -9
- package/test/endpoints/inventory/companies.test.js +6 -6
- package/test/endpoints/inventory/custom-content.test.js +4 -4
- package/test/endpoints/inventory/custom-fields.test.js +2 -2
- package/test/endpoints/inventory/document-types.test.js +2 -2
- package/test/endpoints/inventory/fare-classes.test.js +10 -10
- package/test/endpoints/inventory/fare-type-modifiers.test.js +76 -0
- package/test/endpoints/inventory/fares.test.js +14 -16
- package/test/endpoints/inventory/fees.test.js +14 -15
- package/test/endpoints/inventory/filtered-trips-v2.test.js +5 -5
- package/test/endpoints/inventory/insurances.test.js +2 -2
- package/test/endpoints/inventory/insurancesCost.test.js +2 -2
- package/test/endpoints/inventory/journey-prices.test.js +13 -15
- package/test/endpoints/inventory/labels.test.js +2 -2
- package/test/endpoints/inventory/marital-status.test.js +2 -2
- package/test/endpoints/inventory/mit-terminal-settings.test.js +2 -2
- package/test/endpoints/inventory/mit-terminals.test.js +7 -7
- package/test/endpoints/inventory/operating-companies.test.js +14 -14
- package/test/endpoints/inventory/operation-messages.test.js +10 -10
- package/test/endpoints/inventory/parcel-zones.test.js +12 -13
- package/test/endpoints/inventory/payment-terminals.test.js +7 -7
- package/test/endpoints/inventory/prisma-terminals.test.js +2 -2
- package/test/endpoints/inventory/products.test.js +25 -20
- package/test/endpoints/inventory/promos.test.js +50 -50
- package/test/endpoints/inventory/seatclasses.test.js +2 -2
- package/test/endpoints/inventory/seatfees.test.js +6 -6
- package/test/endpoints/inventory/seatmaps.test.js +7 -7
- package/test/endpoints/inventory/segments-information.test.js +2 -2
- package/test/endpoints/inventory/service-numbers.test.js +6 -6
- package/test/endpoints/inventory/service-types.test.js +7 -7
- package/test/endpoints/inventory/shift-settings.test.js +2 -2
- package/test/endpoints/inventory/ssrs.test.js +10 -11
- package/test/endpoints/inventory/stations-zones.test.js +8 -9
- package/test/endpoints/inventory/stations.test.js +2 -2
- package/test/endpoints/inventory/travel-routes.test.js +2 -2
- package/test/endpoints/inventory/traveller-car-types.test.js +8 -8
- package/test/endpoints/inventory/traveller-card-providers-types.test.js +2 -2
- package/test/endpoints/inventory/traveller-card-providers.test.js +7 -7
- package/test/endpoints/inventory/vehicles.test.js +2 -2
- package/test/endpoints/inventory/zone-price-overages.test.js +2 -2
- package/test/endpoints/inventory/zone-prices.test.js +2 -2
- package/test/endpoints/invoices/dlink.test.js +2 -2
- package/test/endpoints/invoices/gti.test.js +2 -2
- package/test/endpoints/invoices/infile.test.js +2 -2
- package/test/endpoints/invoices/infileJson.test.js +2 -2
- package/test/endpoints/invoices/providers.test.js +4 -4
- package/test/endpoints/invoices/providersSequences.test.js +2 -2
- package/test/endpoints/invoices/system.test.js +2 -2
- package/test/endpoints/loyalty/movements.test.js +11 -11
- package/test/endpoints/loyalty/programs.test.js +21 -21
- package/test/endpoints/notifications/customers.test.js +6 -6
- package/test/endpoints/notifications/external-customers.test.js +10 -10
- package/test/endpoints/notifications/manifet-notifications.test.js +3 -3
- package/test/endpoints/notifications/notify.test.js +23 -5
- package/test/endpoints/notifications/orders-rules-validations.test.js +5 -6
- package/test/endpoints/notifications/pdfs.test.js +4 -4
- package/test/endpoints/notifications/printed-tickets.test.js +17 -18
- package/test/endpoints/notifications/short-urls.test.js +9 -9
- package/test/endpoints/operations/applied_insurance.test.js +10 -14
- package/test/endpoints/operations/calendar_entries.test.js +8 -9
- package/test/endpoints/operations/cancellation_settings.test.js +2 -2
- package/test/endpoints/operations/loans.test.js +2 -2
- package/test/endpoints/operations/manifest.test.js +11 -9
- package/test/endpoints/operations/operations.test.js +42 -25
- package/test/endpoints/operations/parcel_manifests.test.js +3 -3
- package/test/endpoints/operations/parcels.test.js +27 -22
- package/test/endpoints/operations/passenger_check_in_info.test.js +2 -2
- package/test/endpoints/operations/redemption.test.js +2 -2
- package/test/endpoints/operations/sold-items-fulfillment.test.js +2 -2
- package/test/endpoints/operations/sold_items.test.js +3 -3
- package/test/endpoints/operations/tickets.test.js +4 -4
- package/test/endpoints/operations/transaction.test.js +12 -15
- package/test/endpoints/operations/transactions.test.js +11 -11
- package/test/endpoints/operations/transport_regulations.js +2 -4
- package/test/endpoints/operations/trip_change_info.test.js +9 -10
- package/test/endpoints/operations/vehicle-assignments.test.js +5 -7
- package/test/endpoints/operations/waitlists.test.js +3 -3
- package/test/endpoints/ratality/auth.test.js +5 -5
- package/test/endpoints/ratality/client.test.js +4 -4
- package/test/endpoints/ratality/integrations.test.js +15 -9
- package/test/endpoints/reports/custom-reports.test.js +12 -12
- package/test/endpoints/reports/email.test.js +3 -3
- package/test/endpoints/reports/report-types.test.js +6 -6
- package/test/endpoints/reports/trip-manifests.test.js +5 -6
- package/test/endpoints/sales/bundles.test.js +9 -10
- package/test/endpoints/sales/cart-promo.test.js +15 -16
- package/test/endpoints/sales/cart.test.js +7 -7
- package/test/endpoints/sales/check-in-info.test.js +3 -3
- package/test/endpoints/sales/custom-fields.test.js +10 -13
- package/test/endpoints/sales/flexpasses.test.js +2 -2
- package/test/endpoints/sales/git-certificates.test.js +10 -13
- package/test/endpoints/sales/order.test.js +19 -21
- package/test/endpoints/sales/payment-providers.test.js +14 -15
- package/test/endpoints/sales/redeemable-items.test.js +14 -15
- package/test/endpoints/sales/sync-entry.test.js +9 -11
- package/test/endpoints/sales/voucher.test.js +19 -17
- package/test/endpoints/seatmaps/access-ticket.test.js +6 -6
- package/test/endpoints/seatmaps/seat.test.js +6 -6
- package/test/endpoints/uploads/files.test.js +8 -7
- package/test/endpoints/uploads/images.test.js +8 -7
- package/test/endpoints/webhooks/subscriptions.test.js +27 -27
- package/test/endpoints/webhooks/undelivered.test.js +22 -22
- package/test/endpoints/webhooks/webhooks.test.js +7 -7
- package/test/node-test-globals.js +19 -0
- package/test/test-helpers.js +4 -4
- package/test-integration/all.test.js +63 -0
- package/test-integration/endpoints/accounts/current-shifts.test.js +4 -4
- package/test-integration/endpoints/accounts/docs.test.js +6 -6
- package/test-integration/endpoints/accounts/lexicons.test.js +42 -37
- package/test-integration/endpoints/accounts/shifts.test.js +5 -8
- package/test-integration/endpoints/accounts/users.test.js +4 -4
- package/test-integration/endpoints/btrzpay/customerCards.test.js +24 -48
- package/test-integration/endpoints/btrzpay/customers.test.js +20 -34
- package/test-integration/endpoints/btrzpay/payment-methods.test.js +34 -34
- package/test-integration/endpoints/btrzpay/payments.test.js +21 -21
- package/test-integration/endpoints/btrzpay/reference-numbers.test.js +15 -15
- package/test-integration/endpoints/btrzpay/referenced-payments.test.js +5 -5
- package/test-integration/endpoints/client.test.js +6 -10
- package/test-integration/endpoints/inventory/amenities.test.js +34 -34
- package/test-integration/endpoints/inventory/amenity-groups.test.js +30 -31
- package/test-integration/endpoints/inventory/bundle-fares.test.js +10 -12
- package/test-integration/endpoints/inventory/companies.test.js +7 -8
- package/test-integration/endpoints/inventory/countries.test.js +10 -12
- package/test-integration/endpoints/inventory/custom-fields.test.js +2 -2
- package/test-integration/endpoints/inventory/docs.test.js +5 -7
- package/test-integration/endpoints/inventory/fare-classes.test.js +12 -13
- package/test-integration/endpoints/inventory/fares.test.js +7 -9
- package/test-integration/endpoints/inventory/fees.test.js +8 -10
- package/test-integration/endpoints/inventory/filtered-trips.test.js +15 -12
- package/test-integration/endpoints/inventory/gift-certificate-definitions.test.js +5 -5
- package/test-integration/endpoints/inventory/insurances.test.js +36 -34
- package/test-integration/endpoints/inventory/items.js +10 -12
- package/test-integration/endpoints/inventory/journey-prices.test.js +11 -11
- package/test-integration/endpoints/inventory/parcel-zones.test.js +15 -18
- package/test-integration/endpoints/inventory/products.test.js +12 -14
- package/test-integration/endpoints/inventory/promos.test.js +46 -42
- package/test-integration/endpoints/inventory/routes.test.js +13 -15
- package/test-integration/endpoints/inventory/schedule-groups.test.js +23 -23
- package/test-integration/endpoints/inventory/ssrs.test.js +16 -11
- package/test-integration/endpoints/inventory/stations-zones.test.js +5 -6
- package/test-integration/endpoints/inventory/stations.test.js +17 -20
- package/test-integration/endpoints/inventory/trips.test.js +30 -16
- package/test-integration/endpoints/notifications/printed-tickets.test.js +2 -2
- package/test-integration/endpoints/operations/applied_insurance.test.js +9 -11
- package/test-integration/endpoints/operations/manifest.test.js +32 -34
- package/test-integration/endpoints/operations/parcel.test.js +36 -38
- package/test-integration/endpoints/operations/redemption.test.js +9 -12
- package/test-integration/endpoints/operations/segments.js +8 -10
- package/test-integration/endpoints/operations/tickets.test.js +11 -11
- package/test-integration/endpoints/operations/transaction.test.js +1 -1
- package/test-integration/endpoints/operations/transactions.test.js +2 -2
- package/test-integration/endpoints/operations/trip_change_info.test.js +11 -13
- package/test-integration/endpoints/reports/custom-reports.test.js +21 -21
- package/test-integration/endpoints/reports/report-types.test.js +22 -22
- package/test-integration/endpoints/sales/bundles.test.js +5 -5
- package/test-integration/endpoints/sales/cart-promo.test.js +17 -32
- package/test-integration/endpoints/sales/cart.test.js +45 -51
- package/test-integration/endpoints/sales/check-in-info.test.js +2 -2
- package/test-integration/endpoints/sales/custom-fields.test.js +8 -10
- package/test-integration/endpoints/sales/flexpasses.test.js +2 -2
- package/test-integration/endpoints/sales/gift-certificates.test.js +14 -18
- package/test-integration/endpoints/sales/order.test.js +42 -50
- package/test-integration/endpoints/sales/payment-providers.test.js +7 -9
- package/test-integration/endpoints/sales/redeemable-items.test.js +17 -19
- package/test-integration/endpoints/sales/voucher.test.js +12 -14
- package/test-integration/endpoints/seatmaps/access-ticket.test.js +7 -9
- package/test-integration/endpoints/seatmaps/seat.test.js +7 -9
- package/test-integration/endpoints/uploads/files.test.js +14 -14
- package/test-integration/endpoints/uploads/images.test.js +3 -5
- package/test-integration/ports.js +4 -4
- package/test-integration/test-integration-helpers.js +13 -9
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const assert = require("node:assert/strict");
|
|
2
|
+
const port = process.env.BTRZPAY_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
|
+
btrzpay: (baseUrl) => { return `${baseUrl}/btrz-pay`; }
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
11
|
|
|
12
|
-
describe("btrz-pay/reference-numbers",
|
|
12
|
+
describe("btrz-pay/reference-numbers", () => {
|
|
13
13
|
it("should create a reference number", () => {
|
|
14
14
|
const referenceNumberRequest = {
|
|
15
15
|
"type": "pay_me_later",
|
|
@@ -28,9 +28,9 @@ describe("btrz-pay/reference-numbers", function() {
|
|
|
28
28
|
token,
|
|
29
29
|
referenceNumberRequest
|
|
30
30
|
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
.then(({status, data}) => {
|
|
32
|
+
assert.deepStrictEqual(status, 200);
|
|
33
|
+
assert.deepStrictEqual(data.referenceNumber.length, 8);
|
|
34
|
+
});
|
|
35
35
|
});
|
|
36
36
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const assert = require("node:assert/strict");
|
|
2
2
|
const port = process.env.BTRZPAY_API_PORT;
|
|
3
3
|
const token = process.env.API_TOKEN;
|
|
4
4
|
const jwtToken = process.env.JWT_TOKEN;
|
|
5
5
|
const transactionId = process.env.TRANSACTION_ID;
|
|
6
6
|
const referenceNumber = process.env.REFERENCE_NUMBER;
|
|
7
7
|
const externalType = process.env.EXTERNAL_TYPE;
|
|
8
|
-
const api = require("./../../../src/client").createApiClient({
|
|
8
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
9
9
|
baseURL: `http://localhost:${port}`,
|
|
10
10
|
baseURLOverride: {
|
|
11
11
|
btrzpay: (baseUrl) => {
|
|
@@ -23,8 +23,8 @@ describe("btrz-pay/referenced-payments", () => {
|
|
|
23
23
|
referenceNumber
|
|
24
24
|
})
|
|
25
25
|
.then(({status, data}) => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
assert.deepStrictEqual(status, 200);
|
|
27
|
+
assert.deepStrictEqual(data.paymentResult, null);
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -42,7 +42,7 @@ describe("btrz-pay/referenced-payments", () => {
|
|
|
42
42
|
}
|
|
43
43
|
})
|
|
44
44
|
.then(({status}) => {
|
|
45
|
-
|
|
45
|
+
assert.deepStrictEqual(status, 200);
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
});
|
|
@@ -1,17 +1,13 @@
|
|
|
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({baseURL: `http://localhost:${port}`});
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const {matchHeaders} = require("./../test-integration-helpers.js");
|
|
7
7
|
|
|
8
|
-
describe("clean client",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.then(matchHeaders('x-api-key'))
|
|
8
|
+
describe("clean client", () => {
|
|
9
|
+
it("should list products using clean client", () => {
|
|
10
|
+
return api._cleanClient({url: "/inventory/products", headers: {"x-api-key": token}, params: {isParcel: true}})
|
|
11
|
+
.then(matchHeaders("x-api-key"));
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
});
|
|
16
|
-
|
|
17
|
-
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
30
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
60
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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 {
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return api.inventory.bundleFares.all({
|
|
22
|
-
.then(matchHeaders(
|
|
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 {
|
|
11
|
+
const {matchHeaders, statusCode} = require("./../../test-integration-helpers.js");
|
|
12
12
|
|
|
13
|
-
describe("inventory/companies",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
11
|
+
const {matchHeaders, statusCode} = require("./../../test-integration-helpers.js");
|
|
12
12
|
|
|
13
|
-
describe("inventory/countries",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.then(
|
|
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
|
-
|
|
14
|
+
assert.deepStrictEqual(status, 200);
|
|
17
15
|
console.log(data);
|
|
18
|
-
|
|
16
|
+
assert.ok(data);
|
|
19
17
|
});
|
|
20
18
|
});
|
|
21
19
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
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({
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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 {
|
|
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({
|
|
17
|
-
.then(matchHeaders(
|
|
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({
|
|
24
|
-
.then(matchHeaders(
|
|
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 {
|
|
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({
|
|
18
|
-
.then(matchHeaders(
|
|
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",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
});
|