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.
- 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 +50 -38
- 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/products.js +1 -0
- 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 +0 -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/products.js +1 -0
- 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 +218 -0
- package/test/client.test.js +58 -44
- 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/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 +5 -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,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.ACCOUNTS_API_PORT;
|
|
5
5
|
const token = process.env.API_TOKEN;
|
|
@@ -7,56 +7,61 @@ const jwtToken = process.env.JWT_TOKEN;
|
|
|
7
7
|
const accountId = process.env.ACCOUNT_ID;
|
|
8
8
|
const existingLexiconKey = process.env.EXISTING_LEXICON_KEY;
|
|
9
9
|
|
|
10
|
-
const api = require("./../../../src/client").createApiClient({
|
|
11
|
-
baseURL: `http://localhost:${port}`,
|
|
10
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
11
|
+
baseURL: `http://localhost:${port}`,
|
|
12
12
|
baseURLOverride: {
|
|
13
|
-
accounts: (baseUrl) => `${baseUrl}/accounts
|
|
13
|
+
accounts: (baseUrl) => { return `${baseUrl}/accounts`; }
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
const {
|
|
17
|
+
const {matchHeaders, statusCode} = require("./../../test-integration-helpers.js");
|
|
18
18
|
|
|
19
|
-
describe("accounts/lexicons",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.then(
|
|
24
|
-
.then(statusCode(200))
|
|
19
|
+
describe("accounts/lexicons", () => {
|
|
20
|
+
it("should list lexicons", () => {
|
|
21
|
+
return api.accounts.lexicons.all({token, context: "vue"})
|
|
22
|
+
.then(matchHeaders("x-api-key"))
|
|
23
|
+
.then(statusCode(200));
|
|
25
24
|
});
|
|
26
25
|
|
|
27
|
-
it("should create lexicon entries",
|
|
28
|
-
return api.accounts.lexicons.create({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
it("should create lexicon entries", () => {
|
|
27
|
+
return api.accounts.lexicons.create({
|
|
28
|
+
token,
|
|
29
|
+
jwtToken,
|
|
30
|
+
lexiconEntries: [{
|
|
31
|
+
accountId,
|
|
32
|
+
name: "test-lexicon-entry-1",
|
|
33
|
+
context: ["app", "websales", "vue"],
|
|
34
|
+
values: {
|
|
35
|
+
"en-us": "Test lexicon entry",
|
|
36
|
+
"fr-fr": "Test lexicon entry french"
|
|
37
|
+
}
|
|
38
|
+
}]
|
|
39
|
+
})
|
|
38
40
|
.then(({status, data}) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
assert.deepStrictEqual(status, 200);
|
|
42
|
+
assert.strictEqual(data.successes.length, 1);
|
|
43
|
+
assert.strictEqual(data.failures.length, 0);
|
|
42
44
|
});
|
|
43
45
|
});
|
|
44
46
|
|
|
45
|
-
it("should update lexicon entries",
|
|
46
|
-
const newTranslation =
|
|
47
|
+
it("should update lexicon entries", () => {
|
|
48
|
+
const newTranslation = randomUUID();
|
|
47
49
|
|
|
48
|
-
return api.accounts.lexicons.updateMany({
|
|
50
|
+
return api.accounts.lexicons.updateMany({
|
|
51
|
+
token,
|
|
52
|
+
jwtToken,
|
|
53
|
+
updates: [{
|
|
49
54
|
accountId,
|
|
50
55
|
key: existingLexiconKey,
|
|
51
56
|
values: {
|
|
52
57
|
"en-us": newTranslation
|
|
53
58
|
}
|
|
54
|
-
}]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
}]
|
|
60
|
+
})
|
|
61
|
+
.then(({status, data}) => {
|
|
62
|
+
assert.deepStrictEqual(status, 200);
|
|
63
|
+
assert.strictEqual(data.entries.length, 1);
|
|
64
|
+
assert.deepStrictEqual(data.entries[0].values["en-us"], newTranslation);
|
|
65
|
+
});
|
|
60
66
|
});
|
|
61
|
-
|
|
62
|
-
});
|
|
67
|
+
});
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
const port = process.env.ACCOUNTS_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
|
-
accounts: (baseUrl) => `${baseUrl}/accounts
|
|
7
|
+
accounts: (baseUrl) => { return `${baseUrl}/accounts`; }
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const { matchHeaders, statusCode } = require("./../../test-integration-helpers");
|
|
12
11
|
|
|
13
12
|
describe("accounts/shift/user", () => {
|
|
14
|
-
|
|
15
13
|
it.skip("should get the shift of the user specified", () => {
|
|
16
14
|
const userId = "5818b94537e32ee60c000005";
|
|
17
|
-
return api.accounts.shifts.get({
|
|
15
|
+
return api.accounts.shifts.get({token, userId});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
|
-
});
|
|
17
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const assert = require("node:assert/strict");
|
|
2
2
|
const port = process.env.ACCOUNTS_API_PORT;
|
|
3
3
|
const token = process.env.API_TOKEN;
|
|
4
4
|
const id = "5818b94537e32ee60c000005";
|
|
5
5
|
|
|
6
|
-
const api = require("./../../../src/client").createApiClient({
|
|
6
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
7
7
|
baseURL: `http://localhost:${port}`,
|
|
8
8
|
baseURLOverride: {
|
|
9
|
-
accounts: (baseUrl) => `${baseUrl}/accounts
|
|
9
|
+
accounts: (baseUrl) => { return `${baseUrl}/accounts`; }
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ describe("accounts/user/{id}", () => {
|
|
|
14
14
|
it("should return user", () => {
|
|
15
15
|
return api.accounts.users.get({token, id})
|
|
16
16
|
.then((res) => {
|
|
17
|
-
|
|
17
|
+
assert.deepStrictEqual(res.status, 200);
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
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;
|
|
@@ -6,15 +6,15 @@ const customerId = process.env.CUSTOMER_ID;
|
|
|
6
6
|
const customerCardId = process.env.CUSTOMER_CARD_ID;
|
|
7
7
|
const paymentMethodId = process.env.PAYMENT_METHOD_ID;
|
|
8
8
|
const providerPaymentProfileId = process.env.PROVIDER_PAYMENT_PROFILE_ID;
|
|
9
|
-
const api = require("../../../src/client").createApiClient({
|
|
9
|
+
const api = require("../../../src/client.js").createApiClient({
|
|
10
10
|
baseURL: `http://localhost:${port}`,
|
|
11
11
|
baseURLOverride: {
|
|
12
|
-
btrzpay: (baseUrl) => `${baseUrl}/btrz-pay
|
|
12
|
+
btrzpay: (baseUrl) => { return `${baseUrl}/btrz-pay`; }
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
describe(
|
|
17
|
-
it("should create a customer card", (
|
|
16
|
+
describe(`btrz-pay/payment-methods/${paymentMethodId}/customers/${customerId}/customerCards`, () => {
|
|
17
|
+
it("should create a customer card", async () => {
|
|
18
18
|
const customerCard = {
|
|
19
19
|
customerId,
|
|
20
20
|
providerPaymentProfileId,
|
|
@@ -25,77 +25,53 @@ describe("btrz-pay/payment-methods/${paymentMethodId}/customers/${customerId}/cu
|
|
|
25
25
|
isDefault: true
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const {status, data} = await api.btrzpay.customerCards.create({
|
|
29
29
|
jwtToken,
|
|
30
30
|
token,
|
|
31
31
|
paymentMethodId,
|
|
32
32
|
customerId,
|
|
33
33
|
customerCard
|
|
34
|
-
})
|
|
35
|
-
.then(({status, data}) => {
|
|
36
|
-
expect(status).to.equal(200);
|
|
37
|
-
expect(data.customerId).to.eql(customerCard.customerId);
|
|
38
|
-
expect(data.paymentMethodId).to.eql(paymentMethodId);
|
|
39
|
-
expect(data.id).to.exist;
|
|
40
|
-
done();
|
|
41
|
-
})
|
|
42
|
-
.catch((err)=> {
|
|
43
|
-
done(err);
|
|
44
34
|
});
|
|
35
|
+
assert.deepStrictEqual(status, 200);
|
|
36
|
+
assert.deepStrictEqual(data.customerId, customerCard.customerId);
|
|
37
|
+
assert.deepStrictEqual(data.paymentMethodId, paymentMethodId);
|
|
38
|
+
assert.ok(data.id);
|
|
45
39
|
});
|
|
46
40
|
|
|
47
|
-
it("should get a customer card", (
|
|
48
|
-
|
|
41
|
+
it("should get a customer card", async () => {
|
|
42
|
+
const {status, data} = await api.btrzpay.customerCards.get({
|
|
49
43
|
jwtToken,
|
|
50
44
|
token,
|
|
51
45
|
paymentMethodId,
|
|
52
46
|
customerId,
|
|
53
47
|
customerCardId
|
|
54
|
-
})
|
|
55
|
-
.then(({status, data}) => {
|
|
56
|
-
expect(status).to.equal(200);
|
|
57
|
-
expect(data.customerCard.id).to.eql(customerCardId);
|
|
58
|
-
expect(data.customerCard.providerPaymentProfileId).to.eql(providerPaymentProfileId);
|
|
59
|
-
expect(data.customerCard.id).to.exist;
|
|
60
|
-
done();
|
|
61
|
-
})
|
|
62
|
-
.catch((err) => {
|
|
63
|
-
done(err);
|
|
64
48
|
});
|
|
49
|
+
assert.deepStrictEqual(status, 200);
|
|
50
|
+
assert.deepStrictEqual(data.customerCard.id, customerCardId);
|
|
51
|
+
assert.deepStrictEqual(data.customerCard.providerPaymentProfileId, providerPaymentProfileId);
|
|
52
|
+
assert.ok(data.customerCard.id);
|
|
65
53
|
});
|
|
66
54
|
|
|
67
|
-
it("should get all customer cards", (
|
|
68
|
-
|
|
55
|
+
it("should get all customer cards", async () => {
|
|
56
|
+
const {status, data} = await api.btrzpay.customerCards.all({
|
|
69
57
|
jwtToken,
|
|
70
58
|
token,
|
|
71
59
|
paymentMethodId,
|
|
72
60
|
customerId
|
|
73
|
-
})
|
|
74
|
-
.then(({status, data}) => {
|
|
75
|
-
expect(status).to.equal(200);
|
|
76
|
-
expect(data.customerCards.length).to.eql(2);
|
|
77
|
-
done();
|
|
78
|
-
})
|
|
79
|
-
.catch((err) => {
|
|
80
|
-
done(err);
|
|
81
61
|
});
|
|
62
|
+
assert.deepStrictEqual(status, 200);
|
|
63
|
+
assert.deepStrictEqual(data.customerCards.length, 2);
|
|
82
64
|
});
|
|
83
65
|
|
|
84
|
-
it("should delete a customer card", (
|
|
85
|
-
|
|
66
|
+
it("should delete a customer card", async () => {
|
|
67
|
+
const {status, data} = await api.btrzpay.customerCards.remove({
|
|
86
68
|
jwtToken,
|
|
87
69
|
token,
|
|
88
70
|
paymentMethodId,
|
|
89
71
|
customerId,
|
|
90
72
|
customerCardId
|
|
91
|
-
})
|
|
92
|
-
.then(({status, data}) => {
|
|
93
|
-
expect(status).to.equal(200);
|
|
94
|
-
expect(data.result).to.eql(1);
|
|
95
|
-
done();
|
|
96
|
-
})
|
|
97
|
-
.catch((err)=> {
|
|
98
|
-
done(err);
|
|
99
73
|
});
|
|
74
|
+
assert.deepStrictEqual(status, 200);
|
|
75
|
+
assert.deepStrictEqual(data.result, 1);
|
|
100
76
|
});
|
|
101
77
|
});
|
|
@@ -1,72 +1,58 @@
|
|
|
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 customerId = process.env.CUSTOMER_ID;
|
|
6
6
|
const paymentMethodId = process.env.PAYMENT_METHOD_ID;
|
|
7
7
|
const providerCustomerProfileId = process.env.PROVIDER_CUSTOMER_PROFILE_ID;
|
|
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
|
-
btrzpay: (baseUrl) =>
|
|
11
|
+
btrzpay: (baseUrl) => {
|
|
12
|
+
return `${baseUrl}/btrz-pay`;
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
15
|
});
|
|
14
16
|
|
|
17
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
15
18
|
describe("btrz-pay/payment-methods/${paymentMethodId}/customers", () => {
|
|
16
|
-
it("should create a customer", (
|
|
19
|
+
it("should create a customer", async () => {
|
|
17
20
|
const customer = {
|
|
18
21
|
customerId,
|
|
19
22
|
providerCustomerProfileId
|
|
20
23
|
};
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
const {status, data} = await api.btrzpay.customers.create({
|
|
23
26
|
jwtToken,
|
|
24
27
|
token,
|
|
25
28
|
paymentMethodId,
|
|
26
29
|
customer
|
|
27
|
-
})
|
|
28
|
-
.then(({status, data}) => {
|
|
29
|
-
expect(status).to.equal(200);
|
|
30
|
-
expect(data.customerId).to.eql(customer.customerId);
|
|
31
|
-
expect(data.paymentMethodId).to.eql(paymentMethodId);
|
|
32
|
-
expect(data.providerCustomerProfileId).to.exist;
|
|
33
|
-
done();
|
|
34
|
-
})
|
|
35
|
-
.catch((err)=> {
|
|
36
|
-
done(err);
|
|
37
30
|
});
|
|
31
|
+
assert.deepStrictEqual(status, 200);
|
|
32
|
+
assert.deepStrictEqual(data.customerId, customer.customerId);
|
|
33
|
+
assert.deepStrictEqual(data.paymentMethodId, paymentMethodId);
|
|
34
|
+
assert.ok(data.providerCustomerProfileId);
|
|
38
35
|
});
|
|
39
36
|
|
|
40
|
-
it("should get a customer", () => {
|
|
41
|
-
|
|
37
|
+
it("should get a customer", async () => {
|
|
38
|
+
const {status, data} = await api.btrzpay.customers.get({
|
|
42
39
|
jwtToken,
|
|
43
40
|
token,
|
|
44
41
|
paymentMethodId,
|
|
45
42
|
customerId
|
|
46
|
-
})
|
|
47
|
-
.then(({status, data}) => {
|
|
48
|
-
expect(status).to.equal(200);
|
|
49
|
-
expect(data.customer.customerId).to.eql(customerId);
|
|
50
|
-
done();
|
|
51
|
-
})
|
|
52
|
-
.catch((err)=> {
|
|
53
|
-
done(err);
|
|
54
43
|
});
|
|
44
|
+
assert.deepStrictEqual(status, 200);
|
|
45
|
+
assert.deepStrictEqual(data.customer.customerId, customerId);
|
|
55
46
|
});
|
|
56
47
|
|
|
57
|
-
it("should delete a customer", () => {
|
|
58
|
-
|
|
48
|
+
it("should delete a customer", async () => {
|
|
49
|
+
const {status, data} = await api.btrzpay.customers.remove({
|
|
59
50
|
jwtToken,
|
|
60
51
|
token,
|
|
61
52
|
paymentMethodId,
|
|
62
53
|
customerId
|
|
63
|
-
})
|
|
64
|
-
.then(({status, data}) => {
|
|
65
|
-
expect(status).to.equal(200);
|
|
66
|
-
expect(data.result).to.eql(1);
|
|
67
|
-
})
|
|
68
|
-
.catch((err)=> {
|
|
69
|
-
done(err);
|
|
70
54
|
});
|
|
55
|
+
assert.deepStrictEqual(status, 200);
|
|
56
|
+
assert.deepStrictEqual(data.result, 1);
|
|
71
57
|
});
|
|
72
58
|
});
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 paymentMethodId = process.env.PAYMENT_METHOD_ID;
|
|
6
|
+
const providerAccountId = process.env.PROVIDER_ACCOUNT_ID;
|
|
7
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
8
|
+
baseURL: `http://localhost:${port}`,
|
|
9
|
+
baseURLOverride: {
|
|
10
|
+
btrzpay: (baseUrl) => { return `${baseUrl}/btrz-pay`; }
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
13
|
|
|
14
|
-
describe("btrz-pay/payment-methods",
|
|
15
|
-
it("should return empty success",
|
|
14
|
+
describe("btrz-pay/payment-methods", () => {
|
|
15
|
+
it("should return empty success", () => {
|
|
16
16
|
const providerName = "anyName";
|
|
17
|
-
return api.btrzpay.paymentMethods.getByProviderName({
|
|
17
|
+
return api.btrzpay.paymentMethods.getByProviderName({token, jwtToken, providerName})
|
|
18
18
|
.then((result) => {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
assert.deepStrictEqual(result.status, 200);
|
|
20
|
+
assert.deepStrictEqual(result.data.paymentMethods, []);
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -34,13 +34,13 @@ describe("btrz-pay/payment-methods", function() {
|
|
|
34
34
|
token,
|
|
35
35
|
paymentMethod
|
|
36
36
|
})
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
.then(({status, data}) => {
|
|
38
|
+
assert.deepStrictEqual(status, 200);
|
|
39
|
+
assert.deepStrictEqual(data.paymentMethod.method, paymentMethod.method);
|
|
40
|
+
assert.deepStrictEqual(data.paymentMethod.displayName, paymentMethod.displayName);
|
|
41
|
+
assert.deepStrictEqual(data.paymentMethod.ord, paymentMethod.ord);
|
|
42
|
+
assert.deepStrictEqual(data.paymentMethod.provider, paymentMethod.providerName);
|
|
43
|
+
});
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it("should get a payment method", () => {
|
|
@@ -49,10 +49,10 @@ describe("btrz-pay/payment-methods", function() {
|
|
|
49
49
|
token,
|
|
50
50
|
paymentMethodId
|
|
51
51
|
})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
.then(({status, data}) => {
|
|
53
|
+
assert.deepStrictEqual(status, 200);
|
|
54
|
+
assert.deepStrictEqual(data.paymentMethod._id, paymentMethodId);
|
|
55
|
+
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it("should get a payment method with providerId in query (Agency)", () => {
|
|
@@ -62,10 +62,10 @@ describe("btrz-pay/payment-methods", function() {
|
|
|
62
62
|
paymentMethodId,
|
|
63
63
|
query: {providerId: providerAccountId}
|
|
64
64
|
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
.then(({status, data}) => {
|
|
66
|
+
assert.deepStrictEqual(status, 200);
|
|
67
|
+
assert.deepStrictEqual(data.paymentMethod._id, paymentMethodId);
|
|
68
|
+
});
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it("should update a payment method", () => {
|
|
@@ -80,8 +80,8 @@ describe("btrz-pay/payment-methods", function() {
|
|
|
80
80
|
}
|
|
81
81
|
})
|
|
82
82
|
.then(({status, data}) => {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
assert.deepStrictEqual(status, 200);
|
|
84
|
+
assert.deepStrictEqual(data.updated, true);
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 transactionId = process.env.TRANSACTION_ID;
|
|
6
|
+
const api = require("./../../../src/client.js").createApiClient({
|
|
7
|
+
baseURL: `http://localhost:${port}`,
|
|
8
|
+
baseURLOverride: {
|
|
9
|
+
btrzpay: (baseUrl) => { return `${baseUrl}/btrz-pay`; }
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
12
|
|
|
13
13
|
describe("btrz-pay/payments", () => {
|
|
14
14
|
it("should create a payment method", () => {
|
|
@@ -27,12 +27,12 @@ describe("btrz-pay/payments", () => {
|
|
|
27
27
|
token,
|
|
28
28
|
payments
|
|
29
29
|
})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
.then(({status, data}) => {
|
|
31
|
+
assert.deepStrictEqual(status, 200);
|
|
32
|
+
assert.deepStrictEqual(data.payments[0].transactionId, payments.items[0].transactionId);
|
|
33
|
+
assert.deepStrictEqual(data.payments[0].status, "pending");
|
|
34
|
+
assert.deepStrictEqual(data.payments[0].result, "{}");
|
|
35
|
+
});
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it("should get the payments for the transaction Id", () => {
|
|
@@ -41,9 +41,9 @@ describe("btrz-pay/payments", () => {
|
|
|
41
41
|
token,
|
|
42
42
|
transactionId
|
|
43
43
|
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
.then(({status, data}) => {
|
|
45
|
+
assert.deepStrictEqual(status, 200);
|
|
46
|
+
assert.deepStrictEqual(data.payments[0].transactionId, transactionId);
|
|
47
|
+
});
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -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
|
-
|