btrz-api-client 8.33.0 → 8.35.0
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/lib/client-standalone-min.js +3 -3
- package/lib/client.js +10 -2
- package/lib/endpoints/btrzpay/adyen.js +58 -0
- package/lib/endpoints/btrzpay/cardpointe.js +6 -3
- package/lib/endpoints/btrzpay/customerCards.js +19 -19
- package/lib/endpoints/btrzpay/customers.js +13 -13
- package/lib/endpoints/btrzpay/cybersource3ds.js +142 -0
- package/lib/endpoints/btrzpay/datalogic.js +64 -28
- package/lib/endpoints/btrzpay/oxxo.js +54 -28
- package/lib/endpoints/btrzpay/prismaTerminals.js +24 -15
- package/lib/endpoints/btrzpay/referenced-payments.js +4 -4
- package/lib/endpoints/btrzpay/square.js +8 -8
- package/lib/endpoints/btrzpay/stripe-terminals.js +16 -11
- package/lib/endpoints/btrzpay/stripe3ds.js +54 -0
- package/lib/endpoints/btrzpay/terminalPayments.js +19 -19
- package/lib/endpoints/inventory/banks.js +39 -21
- package/lib/endpoints/inventory/change-requests.js +59 -31
- package/lib/endpoints/inventory/control-classes.js +39 -20
- package/lib/endpoints/inventory/countries.js +25 -9
- package/lib/endpoints/inventory/custom-content.js +39 -21
- package/lib/endpoints/inventory/custom-fields.js +25 -17
- package/lib/endpoints/inventory/document-types.js +33 -42
- package/lib/endpoints/inventory/external-wallets.js +26 -20
- package/lib/endpoints/inventory/fees.js +19 -13
- package/lib/endpoints/inventory/filtered-trips.js +34 -8
- package/lib/endpoints/inventory/financing-costs.js +19 -14
- package/lib/endpoints/inventory/garages.js +19 -14
- package/lib/endpoints/inventory/getnet-terminals.js +20 -15
- package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
- package/lib/endpoints/inventory/holidays.js +158 -0
- package/lib/endpoints/inventory/insurances.js +17 -13
- package/lib/endpoints/inventory/items.js +13 -9
- package/lib/endpoints/inventory/labels.js +16 -11
- package/lib/endpoints/inventory/marital-status.js +16 -11
- package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
- package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
- package/lib/endpoints/inventory/mit-terminals.js +16 -11
- package/lib/endpoints/inventory/operation-messages.js +18 -12
- package/lib/endpoints/inventory/operation-reasons.js +15 -10
- package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
- package/lib/endpoints/inventory/payment-terminals.js +15 -10
- package/lib/endpoints/inventory/products.js +22 -10
- package/lib/endpoints/inventory/promos.js +27 -18
- package/lib/endpoints/inventory/segments-information-tables.js +13 -7
- package/lib/endpoints/inventory/station-groups.js +2 -4
- package/lib/endpoints/inventory/taxes.js +11 -2
- package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
- package/lib/endpoints/inventory/trip-ids.js +67 -0
- package/lib/endpoints/inventory/trips.js +60 -13
- package/lib/endpoints/inventory/vehicle-types.js +2 -5
- package/lib/endpoints/inventory/vehicles.js +4 -2
- package/lib/endpoints/invoices/emails.js +15 -5
- package/lib/endpoints/invoices/invoices.js +46 -25
- package/lib/endpoints/invoices/pdfs.js +15 -8
- package/lib/endpoints/invoices/providers.js +42 -25
- package/lib/endpoints/invoices/tax-ids.js +11 -7
- package/lib/endpoints/notifications/customers.js +1 -1
- package/lib/endpoints/notifications/external-customers.js +54 -0
- package/lib/endpoints/notifications/pdfs.js +0 -3
- package/lib/endpoints/operations/accounting_items.js +7 -1
- package/lib/endpoints/operations/flexpasses.js +9 -7
- package/lib/endpoints/operations/gift-certificates.js +53 -0
- package/lib/endpoints/operations/loans.js +16 -10
- package/lib/endpoints/operations/movements.js +17 -6
- package/lib/endpoints/operations/pago-express.js +96 -0
- package/lib/endpoints/operations/parcels.js +11 -11
- package/lib/endpoints/operations/parcels_manifests.js +7 -4
- package/lib/endpoints/sales/cancellations.js +43 -31
- package/lib/endpoints/sales/cart.js +21 -18
- package/lib/endpoints/sales/flexpasses.js +2 -5
- package/lib/endpoints/sales/order.js +41 -7
- package/lib/endpoints/sales/parcel-quotes.js +2 -2
- package/package.json +1 -1
- package/src/client.js +10 -2
- package/src/endpoints/btrzpay/adyen.js +44 -0
- package/src/endpoints/btrzpay/cardpointe.js +6 -4
- package/src/endpoints/btrzpay/customerCards.js +19 -19
- package/src/endpoints/btrzpay/customers.js +13 -13
- package/src/endpoints/btrzpay/cybersource3ds.js +114 -0
- package/src/endpoints/btrzpay/datalogic.js +63 -28
- package/src/endpoints/btrzpay/oxxo.js +53 -26
- package/src/endpoints/btrzpay/prismaTerminals.js +24 -15
- package/src/endpoints/btrzpay/referenced-payments.js +4 -4
- package/src/endpoints/btrzpay/square.js +8 -8
- package/src/endpoints/btrzpay/stripe-terminals.js +17 -10
- package/src/endpoints/btrzpay/stripe3ds.js +40 -0
- package/src/endpoints/btrzpay/terminalPayments.js +19 -19
- package/src/endpoints/inventory/banks.js +39 -21
- package/src/endpoints/inventory/change-requests.js +59 -31
- package/src/endpoints/inventory/control-classes.js +39 -20
- package/src/endpoints/inventory/countries.js +25 -10
- package/src/endpoints/inventory/custom-content.js +39 -22
- package/src/endpoints/inventory/custom-fields.js +25 -19
- package/src/endpoints/inventory/document-types.js +34 -33
- package/src/endpoints/inventory/external-wallets.js +25 -20
- package/src/endpoints/inventory/fees.js +19 -14
- package/src/endpoints/inventory/filtered-trips.js +29 -8
- package/src/endpoints/inventory/financing-costs.js +19 -14
- package/src/endpoints/inventory/garages.js +19 -14
- package/src/endpoints/inventory/getnet-terminals.js +20 -15
- package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
- package/src/endpoints/inventory/holidays.js +121 -0
- package/src/endpoints/inventory/insurances.js +17 -13
- package/src/endpoints/inventory/items.js +13 -9
- package/src/endpoints/inventory/labels.js +16 -11
- package/src/endpoints/inventory/marital-status.js +16 -11
- package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
- package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
- package/src/endpoints/inventory/mit-terminals.js +16 -11
- package/src/endpoints/inventory/operation-messages.js +18 -12
- package/src/endpoints/inventory/operation-reasons.js +15 -10
- package/src/endpoints/inventory/pay-on-accounts.js +5 -4
- package/src/endpoints/inventory/payment-terminals.js +15 -10
- package/src/endpoints/inventory/products.js +22 -10
- package/src/endpoints/inventory/promos.js +27 -18
- package/src/endpoints/inventory/segments-information-tables.js +13 -7
- package/src/endpoints/inventory/station-groups.js +2 -4
- package/src/endpoints/inventory/taxes.js +11 -2
- package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
- package/src/endpoints/inventory/trip-ids.js +54 -0
- package/src/endpoints/inventory/trips.js +52 -14
- package/src/endpoints/inventory/vehicle-types.js +3 -4
- package/src/endpoints/inventory/vehicles.js +4 -3
- package/src/endpoints/invoices/emails.js +15 -5
- package/src/endpoints/invoices/invoices.js +46 -25
- package/src/endpoints/invoices/pdfs.js +15 -8
- package/src/endpoints/invoices/providers.js +42 -25
- package/src/endpoints/invoices/tax-ids.js +11 -7
- package/src/endpoints/notifications/customers.js +1 -1
- package/src/endpoints/notifications/external-customers.js +41 -0
- package/src/endpoints/notifications/pdfs.js +0 -3
- package/src/endpoints/operations/accounting_items.js +7 -2
- package/src/endpoints/operations/flexpasses.js +9 -7
- package/src/endpoints/operations/gift-certificates.js +39 -0
- package/src/endpoints/operations/loans.js +16 -11
- package/src/endpoints/operations/movements.js +17 -6
- package/src/endpoints/operations/pago-express.js +73 -0
- package/src/endpoints/operations/parcels.js +11 -11
- package/src/endpoints/operations/parcels_manifests.js +7 -5
- package/src/endpoints/sales/cancellations.js +43 -31
- package/src/endpoints/sales/cart.js +20 -18
- package/src/endpoints/sales/flexpasses.js +3 -4
- package/src/endpoints/sales/order.js +34 -7
- package/src/endpoints/sales/parcel-quotes.js +2 -2
- package/test/endpoints/btrzpay/adyen.tests.js +27 -0
- package/test/endpoints/btrzpay/carpointe.tests.js +14 -0
- package/test/endpoints/btrzpay/customerCards.test.js +9 -6
- package/test/endpoints/btrzpay/cybersource3ds.tests.js +55 -0
- package/test/endpoints/btrzpay/stripe-terminals.tests.js +5 -6
- package/test/endpoints/btrzpay/stripe3ds.tests.js +31 -0
- package/test/endpoints/inventory/banks.test.js +8 -10
- package/test/endpoints/inventory/filtered-trips.test.js +6 -0
- package/test/endpoints/inventory/holidays.test.js +52 -0
- package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
- package/test/endpoints/inventory/trip-ids.test.js +27 -0
- package/test/endpoints/inventory/trips.test.js +19 -14
- package/test/endpoints/notifications/external-customers.test.js +30 -0
- package/test/endpoints/operations/gift_certificates.test.js +37 -0
- package/test/endpoints/operations/operations.test.js +30 -0
- package/test/endpoints/sales/order.test.js +7 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const {authorizationHeaders} = require("../endpoints_helpers.js");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request body for POST /external-customers/ado/registration (btrz-api-notifications).
|
|
5
|
+
* @typedef {Object} SaldoMaxRegistrationRequest
|
|
6
|
+
* @property {string} email - User email to register in Saldo Max (verification code is sent to this email).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Factory for external-customers API (btrz-api-notifications). Saldo Max (ADO) verification-code registration.
|
|
11
|
+
* @param {Object} deps
|
|
12
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
13
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
14
|
+
* @returns {{ requestSaldoMaxVerificationCode: function }}
|
|
15
|
+
*/
|
|
16
|
+
function externalCustomersFactory({client, internalAuthTokenProvider}) {
|
|
17
|
+
/**
|
|
18
|
+
* POST /external-customers/ado/registration – Request a Saldo Max (ADO) verification code for the given email.
|
|
19
|
+
* Requires BETTEREZ_APP JWT. Forwards to Saldo Max; sends verification code to the email.
|
|
20
|
+
* @param {Object} opts
|
|
21
|
+
* @param {string} [opts.token] - API key
|
|
22
|
+
* @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
|
|
23
|
+
* @param {SaldoMaxRegistrationRequest} opts.data - Body: { email } (or { body: { email } })
|
|
24
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
25
|
+
* @returns {Promise<import("axios").AxiosResponse<{ code: string, message: string }>>}
|
|
26
|
+
*/
|
|
27
|
+
function requestSaldoMaxVerificationCode({data, token, jwtToken, headers}) {
|
|
28
|
+
return client({
|
|
29
|
+
url: "/external-customers/ado/registration",
|
|
30
|
+
method: "post",
|
|
31
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
32
|
+
data
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
requestSaldoMaxVerificationCode
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = externalCustomersFactory;
|
|
@@ -26,12 +26,14 @@ function accountingItemsFactory({
|
|
|
26
26
|
* GET /accounting-items - list accounting items.
|
|
27
27
|
* @param {Object} opts
|
|
28
28
|
* @param {string} [opts.token] - API key
|
|
29
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
29
30
|
* @param {AccountingItemsListQuery} [opts.query] - Query params (all optional)
|
|
30
31
|
* @param {Object} [opts.headers] - Optional headers
|
|
31
32
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
32
33
|
*/
|
|
33
34
|
function all({
|
|
34
35
|
token,
|
|
36
|
+
jwtToken,
|
|
35
37
|
query = {},
|
|
36
38
|
headers
|
|
37
39
|
}) {
|
|
@@ -39,6 +41,7 @@ function accountingItemsFactory({
|
|
|
39
41
|
params: query,
|
|
40
42
|
headers: authorizationHeaders({
|
|
41
43
|
token,
|
|
44
|
+
jwtToken,
|
|
42
45
|
internalAuthTokenProvider,
|
|
43
46
|
headers
|
|
44
47
|
})
|
|
@@ -49,16 +52,18 @@ function accountingItemsFactory({
|
|
|
49
52
|
* GET /accounting-items/:accountingItemId - get accounting item by id. API does not accept query params.
|
|
50
53
|
* @param {Object} opts
|
|
51
54
|
* @param {string} [opts.token] - API key
|
|
52
|
-
* @param {string} opts.
|
|
55
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
56
|
+
* @param {string} opts.accountingItemId - Accounting item id (ObjectId format)
|
|
53
57
|
* @param {Object} [opts.headers] - Optional headers
|
|
54
58
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
55
59
|
*/
|
|
56
60
|
function get({
|
|
57
|
-
accountingItemId, token, headers
|
|
61
|
+
accountingItemId, token, jwtToken, headers
|
|
58
62
|
}) {
|
|
59
63
|
return client.get(`/accounting-items/${accountingItemId}`, {
|
|
60
64
|
headers: authorizationHeaders({
|
|
61
65
|
token,
|
|
66
|
+
jwtToken,
|
|
62
67
|
internalAuthTokenProvider,
|
|
63
68
|
headers
|
|
64
69
|
})
|
|
@@ -9,14 +9,16 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
9
9
|
*/
|
|
10
10
|
function flexpassesFactory({client, internalAuthTokenProvider}) {
|
|
11
11
|
/**
|
|
12
|
-
* DELETE /flexpasses/:flexpassId/scannings/:tripId -
|
|
12
|
+
* DELETE /flexpasses/:flexpassId/scannings/:tripId - deletes one flexpass scanning for the given trip ID.
|
|
13
|
+
* Removes the scan matching tripId from the flexpass's scans; if multiple scans exist for the same tripId, only one is removed.
|
|
14
|
+
* Requires operations API base URL (e.g. .../operations). No query parameters.
|
|
13
15
|
* @param {Object} opts
|
|
14
|
-
* @param {string} [opts.token] - API key
|
|
15
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
16
|
-
* @param {string} opts.flexpassId - Flexpass
|
|
17
|
-
* @param {string} opts.tripId - Trip
|
|
18
|
-
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
16
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
17
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
|
|
18
|
+
* @param {string} opts.flexpassId - Flexpass document ID (Mongo ObjectId string)
|
|
19
|
+
* @param {string} opts.tripId - Trip identifier of the scan to remove (e.g. routeId_scheduleName_date)
|
|
20
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
21
|
+
* @returns {Promise<import("axios").AxiosResponse<{ flexpassDeleted?: string }>>}
|
|
20
22
|
*/
|
|
21
23
|
function deleteScanBytripId({jwtToken, token, flexpassId, tripId, headers}) {
|
|
22
24
|
return client({
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const {authorizationHeaders} = require("../endpoints_helpers.js");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Factory for gift-certificates API (btrz-api-operations).
|
|
5
|
+
* @param {Object} deps
|
|
6
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
7
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
8
|
+
* @returns {Object} gift-certificates API methods
|
|
9
|
+
*/
|
|
10
|
+
function giftCertificatesFactory({client, internalAuthTokenProvider}) {
|
|
11
|
+
/**
|
|
12
|
+
* GET /gift-certificates - list paid gift certificates for a customer. Paginated; requires customer JWT when used with JwtAuth.
|
|
13
|
+
* @param {Object} opts
|
|
14
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
15
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer); when using customer JWT, must match customer param
|
|
16
|
+
* @param {string} opts.customer - Customer number to filter by (required)
|
|
17
|
+
* @param {number} [opts.page] - 1-based page number; page size is 20
|
|
18
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ giftCertificates: Array<object>, count: number, next?: string, previous?: string }>>}
|
|
20
|
+
*/
|
|
21
|
+
function list({jwtToken, token, customer, page, headers}) {
|
|
22
|
+
const params = {customer};
|
|
23
|
+
if (page != null) {
|
|
24
|
+
params.page = page;
|
|
25
|
+
}
|
|
26
|
+
return client({
|
|
27
|
+
url: "/gift-certificates",
|
|
28
|
+
method: "get",
|
|
29
|
+
params,
|
|
30
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
list
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = giftCertificatesFactory;
|
|
@@ -24,15 +24,17 @@ function loansFactory({
|
|
|
24
24
|
client, internalAuthTokenProvider
|
|
25
25
|
}) {
|
|
26
26
|
/**
|
|
27
|
-
* GET /loans - list loans.
|
|
27
|
+
* GET /loans - list loans for the account or provider. Paginated (20 per page). Requires operations API base URL.
|
|
28
28
|
* @param {Object} opts
|
|
29
|
-
* @param {string} [opts.token] - API key
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
32
|
-
* @
|
|
29
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
30
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
|
|
31
|
+
* @param {LoansListQuery} [opts.query] - Query params (all optional): page, shiftId, type, trxId, status, providerId
|
|
32
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
33
|
+
* @returns {Promise<import("axios").AxiosResponse<{ loans: Array<object>, count: number, next?: string, previous?: string }>>}
|
|
33
34
|
*/
|
|
34
35
|
function all({
|
|
35
36
|
token,
|
|
37
|
+
jwtToken,
|
|
36
38
|
query = {},
|
|
37
39
|
headers
|
|
38
40
|
}) {
|
|
@@ -40,6 +42,7 @@ function loansFactory({
|
|
|
40
42
|
params: query,
|
|
41
43
|
headers: authorizationHeaders({
|
|
42
44
|
token,
|
|
45
|
+
jwtToken,
|
|
43
46
|
internalAuthTokenProvider,
|
|
44
47
|
headers
|
|
45
48
|
})
|
|
@@ -47,19 +50,21 @@ function loansFactory({
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
50
|
-
* GET /loans/:loanId - get loan by
|
|
53
|
+
* GET /loans/:loanId - get a single loan by ID. Requires operations API base URL.
|
|
51
54
|
* @param {Object} opts
|
|
52
|
-
* @param {string} [opts.token] - API key
|
|
53
|
-
* @param {string} opts.
|
|
54
|
-
* @param {
|
|
55
|
-
* @
|
|
55
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
56
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
|
|
57
|
+
* @param {string} opts.loanId - Loan document ID (24 hex characters)
|
|
58
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
59
|
+
* @returns {Promise<import("axios").AxiosResponse<{ loan: object }>>}
|
|
56
60
|
*/
|
|
57
61
|
function get({
|
|
58
|
-
loanId, token, headers
|
|
62
|
+
loanId, token, jwtToken, headers
|
|
59
63
|
}) {
|
|
60
64
|
return client.get(`/loans/${loanId}`, {
|
|
61
65
|
headers: authorizationHeaders({
|
|
62
66
|
token,
|
|
67
|
+
jwtToken,
|
|
63
68
|
internalAuthTokenProvider,
|
|
64
69
|
headers
|
|
65
70
|
})
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Request body for POST /movements (btrz-api-operations). See MovementPostData in movements models.
|
|
5
|
+
* @typedef {Object} MovementPostData
|
|
6
|
+
* @property {Array<{ _id: string, section?: string, sectionName?: string, seat?: string, row?: string, seatId?: string }>} tickets - Tickets to move (same transaction if more than one). Each must have _id; optional seat fields for destination seatmap.
|
|
7
|
+
* @property {{ routeId: string, scheduleId: string, date: string }} newManifest - Destination manifest: routeId (ObjectId), scheduleId (UUID), date (YYYY-MM-DD).
|
|
8
|
+
* @property {string} channel - Channel of the movement (e.g. backoffice). Must be a valid backoffice channel.
|
|
9
|
+
* @property {boolean} [allowsDifferentTrx] - If true, allows moving tickets from different transactions.
|
|
10
|
+
* @property {boolean} [newdesign] - If true, uses new seatmap design for accommodation.
|
|
11
|
+
*/
|
|
12
|
+
|
|
3
13
|
/**
|
|
4
14
|
* Factory for movements API (btrz-api-operations).
|
|
5
15
|
* @param {Object} deps
|
|
@@ -9,13 +19,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
9
19
|
*/
|
|
10
20
|
function movementsFactory({client, internalAuthTokenProvider}) {
|
|
11
21
|
/**
|
|
12
|
-
* POST /movements - create movement
|
|
22
|
+
* POST /movements - create a movement (move tickets to another manifest). No query params.
|
|
13
23
|
* @param {Object} opts
|
|
14
|
-
* @param {string} [opts.token] - API key
|
|
15
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {Object} [opts.
|
|
18
|
-
* @
|
|
24
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
25
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
|
|
26
|
+
* @param {MovementPostData} opts.movement - Request body: tickets, newManifest, channel; optional allowsDifferentTrx, newdesign
|
|
27
|
+
* @param {Object} [opts.query] - Optional query params (API accepts none)
|
|
28
|
+
* @param {Object} [opts.headers] - Optional request headers
|
|
29
|
+
* @returns {Promise<import("axios").AxiosResponse<{}>>}
|
|
19
30
|
*/
|
|
20
31
|
function create({token, jwtToken, movement, query = {}, headers}) {
|
|
21
32
|
return client({
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const {authorizationHeaders} = require("../endpoints_helpers.js");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pago Express (Datalogic) endpoints for the Operations API.
|
|
5
|
+
* Used to get info, pay, and reverse reference payments.
|
|
6
|
+
* @param {Object} deps
|
|
7
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
8
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
9
|
+
* @returns {Object} pagoExpress API methods
|
|
10
|
+
*/
|
|
11
|
+
function pagoExpressFactory({client, internalAuthTokenProvider}) {
|
|
12
|
+
/**
|
|
13
|
+
* POST /pago-express/info - get transaction information for a Pago Express reference.
|
|
14
|
+
* @param {Object} opts
|
|
15
|
+
* @param {string} [opts.token] - API key (x-api-key)
|
|
16
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
17
|
+
* @param {Object} opts.payment - Request body: folio (20-digit string), id_terminal (number), local_date (string DD/MM/YYYY HH:mm:ss), trx_no (number)
|
|
18
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 PostInfoResponse (code, message, result with folio, id_terminal, local_date, saldo, trx_no, responsecode, descriptioncode)
|
|
20
|
+
*/
|
|
21
|
+
function info({token, jwtToken, payment, headers}) {
|
|
22
|
+
return client({
|
|
23
|
+
method: "post",
|
|
24
|
+
url: "/pago-express/info",
|
|
25
|
+
data: {payment},
|
|
26
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* POST /pago-express/pay - pay a Pago Express reference payment.
|
|
32
|
+
* @param {Object} opts
|
|
33
|
+
* @param {string} [opts.token] - API key (x-api-key)
|
|
34
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
35
|
+
* @param {Object} opts.payment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
|
|
36
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
37
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 PostPayResponse (code, message, result with folio, id_terminal, local_date, trx_no, noauto, amount, responsecode, descriptioncode)
|
|
38
|
+
*/
|
|
39
|
+
function pay({token, jwtToken, payment, headers}) {
|
|
40
|
+
return client({
|
|
41
|
+
method: "post",
|
|
42
|
+
url: "/pago-express/pay",
|
|
43
|
+
data: {payment},
|
|
44
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* POST /pago-express/reverse - reverse (cancel) a Pago Express reference payment. Emits transaction.reversed webhook.
|
|
50
|
+
* @param {Object} opts
|
|
51
|
+
* @param {string} [opts.token] - API key (x-api-key)
|
|
52
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
53
|
+
* @param {Object} opts.reversePayment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
|
|
54
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
55
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 PostReverseResponse (code, message, result)
|
|
56
|
+
*/
|
|
57
|
+
function reverse({token, jwtToken, reversePayment, headers}) {
|
|
58
|
+
return client({
|
|
59
|
+
method: "post",
|
|
60
|
+
url: "/pago-express/reverse",
|
|
61
|
+
data: {reversePayment},
|
|
62
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
info,
|
|
68
|
+
pay,
|
|
69
|
+
reverse
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = pagoExpressFactory;
|
|
@@ -28,13 +28,13 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
28
28
|
*/
|
|
29
29
|
function parcelFactory({client, internalAuthTokenProvider}) {
|
|
30
30
|
/**
|
|
31
|
-
* GET /parcels
|
|
31
|
+
* GET /parcels/{parcelId} - get parcel by id. Requires JwtAuth. No query params.
|
|
32
32
|
* @param {Object} opts
|
|
33
33
|
* @param {string} [opts.token] - API key
|
|
34
34
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
35
|
-
* @param {string} opts.id - Parcel id
|
|
35
|
+
* @param {string} opts.id - Parcel id (24 hex characters)
|
|
36
36
|
* @param {Object} [opts.headers] - Optional headers
|
|
37
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
37
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 { parcel }; 400 INVALID_PARCEL_ID; 401 Unauthorized; 404 PARCEL_NOT_FOUND; 500
|
|
38
38
|
*/
|
|
39
39
|
function get({token, jwtToken, id, headers}) {
|
|
40
40
|
return client({
|
|
@@ -83,14 +83,14 @@ function parcelFactory({client, internalAuthTokenProvider}) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* POST /parcels
|
|
86
|
+
* POST /parcels/{parcelId}/user-comments - add user comment to parcel. Requires JwtAuth. Body: { comment } (string).
|
|
87
87
|
* @param {Object} opts
|
|
88
88
|
* @param {string} [opts.token] - API key
|
|
89
89
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
90
|
-
* @param {string} opts.id - Parcel id
|
|
91
|
-
* @param {
|
|
90
|
+
* @param {string} opts.id - Parcel id (path parcelId)
|
|
91
|
+
* @param {string} opts.comment - Comment text (sent as body.comment)
|
|
92
92
|
* @param {Object} [opts.headers] - Optional headers
|
|
93
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
93
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND; 409
|
|
94
94
|
*/
|
|
95
95
|
function addComment({token, jwtToken, headers, id, comment}) {
|
|
96
96
|
return client({
|
|
@@ -102,14 +102,14 @@ function parcelFactory({client, internalAuthTokenProvider}) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* DELETE /parcels
|
|
105
|
+
* DELETE /parcels/{parcelId}/user-comments/{commentId} - delete user comment from parcel. Requires JwtAuth.
|
|
106
106
|
* @param {Object} opts
|
|
107
107
|
* @param {string} [opts.token] - API key
|
|
108
108
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
109
|
-
* @param {string} opts.id - Parcel id
|
|
110
|
-
* @param {string} opts.commentId - Comment id
|
|
109
|
+
* @param {string} opts.id - Parcel id (path parcelId)
|
|
110
|
+
* @param {string} opts.commentId - Comment id (path)
|
|
111
111
|
* @param {Object} [opts.headers] - Optional headers
|
|
112
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
112
|
+
* @returns {Promise<import("axios").AxiosResponse>} 200 deleted ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND, COMMENT_NOT_FOUND; 409
|
|
113
113
|
*/
|
|
114
114
|
function deleteComment({token, jwtToken, headers, id, commentId}) {
|
|
115
115
|
return client({
|
|
@@ -40,19 +40,21 @@ function parcelsManifestsFactory({client, internalAuthTokenProvider}) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* GET /parcels-manifests/:id - get parcels manifest by id.
|
|
43
|
+
* GET /parcels-manifests/:id - get parcels manifest by id.
|
|
44
44
|
* @param {Object} opts
|
|
45
45
|
* @param {string} [opts.token] - API key
|
|
46
46
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
47
|
-
* @param {string} opts.id - Parcel manifest id (ObjectId)
|
|
47
|
+
* @param {string} opts.id - Parcel manifest id (ObjectId, 24 hex chars)
|
|
48
|
+
* @param {"standard"|"webhook"} [opts.format="standard"] - Response format (standard | webhook)
|
|
48
49
|
* @param {Object} [opts.headers] - Optional request headers
|
|
49
|
-
* @returns {Promise<import("axios").AxiosResponse>} response.data parcel manifest; 404 PARCELMANIFEST_NOT_FOUND
|
|
50
|
+
* @returns {Promise<import("axios").AxiosResponse>} response.data parcel manifest; 400 WRONG_DATA; 404 MANIFEST_NOT_FOUND, PARCELMANIFEST_NOT_FOUND
|
|
50
51
|
*/
|
|
51
|
-
function get({token, jwtToken, id, headers}) {
|
|
52
|
+
function get({token, jwtToken, id, format, headers}) {
|
|
52
53
|
return client({
|
|
53
54
|
url: `/parcels-manifests/${id}`,
|
|
54
55
|
method: "get",
|
|
55
|
-
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
56
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
57
|
+
params: format != null ? {format} : undefined
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* Request body for POST /cancellations (btrz-api-sales). CancelPostData. Item IDs grouped by family; trxId required.
|
|
4
5
|
* @typedef {{
|
|
5
|
-
*
|
|
6
|
+
* trxId: string,
|
|
7
|
+
* fees: number[],
|
|
6
8
|
* flexPasses: string[],
|
|
7
9
|
* parcels: string[],
|
|
8
10
|
* redeemableItems: string[],
|
|
9
11
|
* soldItems: string[],
|
|
10
12
|
* tickets: string[],
|
|
11
13
|
* giftCertificates: string[],
|
|
14
|
+
* reservations: string[],
|
|
12
15
|
* insurances: string[],
|
|
13
|
-
*
|
|
14
|
-
* penalty?: {
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
16
|
+
* channel: string,
|
|
17
|
+
* penalty?: { amount: number, reason: string },
|
|
18
|
+
* overrideCancelFees?: Array<{ _id: string, reason: string }>,
|
|
19
|
+
* currency?: string,
|
|
20
|
+
* terminalPayload?: { status: string, provider: string, auth?: string },
|
|
21
|
+
* paymentDetails?: Array<{ _id: string, authorization: string }>
|
|
22
|
+
* }} CancelPostData
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Request body for PUT /cancellations (btrz-api-sales). CancelPutData. Unmodified cancel set from POST response (must include _id and signature).
|
|
27
|
+
* @typedef {{ _id: string, cancellation: Object, signature: string }} CancelPutData
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Request body for PUT /cancellations/:pendingTransactionId (btrz-api-sales). CompletePaymentCancellationData.
|
|
20
32
|
* @typedef {{
|
|
21
33
|
* provider: string,
|
|
22
34
|
* type: string,
|
|
@@ -28,17 +40,17 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
28
40
|
* referenceNumber: string,
|
|
29
41
|
* authCode?: string
|
|
30
42
|
* }} CompletePaymentCancellationData
|
|
31
|
-
*/
|
|
43
|
+
*/
|
|
32
44
|
|
|
33
45
|
function cancellationEndpointsFactory({client, internalAuthTokenProvider}) {
|
|
34
46
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param {Object}
|
|
37
|
-
* @param {string}
|
|
38
|
-
* @param {string}
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {Object}
|
|
41
|
-
* @returns {Promise}
|
|
47
|
+
* POST /cancellations - creates a cancel set (preview) with calculated refunds and signature. Does not execute refunds. API does not accept query params.
|
|
48
|
+
* @param {Object} opts
|
|
49
|
+
* @param {string} [opts.token] - API key
|
|
50
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
51
|
+
* @param {CancelPostData} opts.cancelData - Refundable item IDs by family, trxId, channel, penalty (optional), etc.
|
|
52
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
53
|
+
* @returns {Promise<import("axios").AxiosResponse<{ _id: string, cancellation: Object, signature: string }>>} Cancel set (signed). Rejects with 400 (e.g. MISSING_CANCELLABLE_IDS, INVALID_CANCEL_SET, [itemType]_NOT_REFUNDABLE), 401, 403 (NOT_ALLOWED_FOR_ONLINE, FEE_OVERRIDE_NOT_ALLOWED), 404 ([itemType]_NOT_FOUND), 409 (CURRENCY_EXCHANGE_MISMATCH, AGENCY_CURRENCY_MISMATCH), 500.
|
|
42
54
|
*/
|
|
43
55
|
function createCancelSet({token, jwtToken, cancelData, headers}) {
|
|
44
56
|
return client({
|
|
@@ -52,13 +64,13 @@ function cancellationEndpointsFactory({client, internalAuthTokenProvider}) {
|
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param {Object}
|
|
57
|
-
* @param {string}
|
|
58
|
-
* @param {string}
|
|
59
|
-
* @param {
|
|
60
|
-
* @param {Object}
|
|
61
|
-
* @returns {Promise}
|
|
67
|
+
* PUT /cancellations - executes the refund using the signed cancel set from POST. Body is cancelSet (or object with cancelSet key). API does not accept query params. Duplicate submission (same dupKey within 30s) returns 409.
|
|
68
|
+
* @param {Object} opts
|
|
69
|
+
* @param {string} [opts.token] - API key
|
|
70
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
71
|
+
* @param {CancelPutData} opts.cancelSet - Unmodified cancel set from createCancelSet response
|
|
72
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
73
|
+
* @returns {Promise<import("axios").AxiosResponse<{ transaction: Object }>>} RefundResponse. Rejects with 400 (e.g. INVALID_SIGNATURE, MISSING_TERMINAL_PAYLOAD, REFUNDED_ITEM), 401, 409 (NOT_FOUND_FOR_REFUND, REFUND_EXECUTION_ERROR, PAYMENT_ROLLBACK_FAILED, CONFLICT duplicate), 500.
|
|
62
74
|
*/
|
|
63
75
|
function createRefund({token, jwtToken, cancelSet, headers}) {
|
|
64
76
|
return client({
|
|
@@ -70,14 +82,14 @@ function cancellationEndpointsFactory({client, internalAuthTokenProvider}) {
|
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @param {Object}
|
|
75
|
-
* @param {string}
|
|
76
|
-
* @param {string}
|
|
77
|
-
* @param {string}
|
|
78
|
-
* @param {CompletePaymentCancellationData}
|
|
79
|
-
* @param {Object}
|
|
80
|
-
* @returns {Promise}
|
|
85
|
+
* PUT /cancellations/:pendingTransactionId - completes a pending payment for a cancellation transaction (e.g. terminal refund). API does not accept query params.
|
|
86
|
+
* @param {Object} opts
|
|
87
|
+
* @param {string} [opts.token] - API key
|
|
88
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
89
|
+
* @param {string} opts.pendingTransactionId - Negative (pending) transaction ID (ObjectId)
|
|
90
|
+
* @param {CompletePaymentCancellationData} opts.paymentResult - Payment result from terminal/provider
|
|
91
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
92
|
+
* @returns {Promise<import("axios").AxiosResponse<{ transaction?: Object, paymentResult?: Object }>>} GetCompletePaymentCancellationResponse. Rejects with 400 (INVALID_PENDING_TRANSACTION_ID, INVALID_TRANSACTION_STATUS, PAYMENT_NOT_PENDING, etc.), 401, 404 (TRANSACTION_NOT_FOUND, PAYMENT_NOT_FOUND, etc.), 500.
|
|
81
93
|
*/
|
|
82
94
|
function updateCompletePayment({token, jwtToken, pendingTransactionId, paymentResult, headers}) {
|
|
83
95
|
return client({
|
|
@@ -20,6 +20,13 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
20
20
|
* @property {string} [internalId] - Internal id or code of the financing cost to match
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Query params for DELETE /carts/:cartId/paid-in-items (btrz-api-sales delete-cart-paid-in-items-handler getSpec).
|
|
25
|
+
* @typedef {Object} CartDeletePaidInItemsQuery
|
|
26
|
+
* @property {string} [operationId] - Optional operation id to filter which paid-in items to remove
|
|
27
|
+
* @property {string} [productId] - Optional product id to filter which paid-in items to remove
|
|
28
|
+
*/
|
|
29
|
+
|
|
23
30
|
/**
|
|
24
31
|
* Factory for cart API (btrz-api-sales).
|
|
25
32
|
* @param {Object} deps
|
|
@@ -29,23 +36,18 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
29
36
|
*/
|
|
30
37
|
function cartFactory({client, internalAuthTokenProvider}) {
|
|
31
38
|
/**
|
|
32
|
-
* GET /cart/:id - get cart by id.
|
|
39
|
+
* GET /cart/:id - get cart by id.
|
|
33
40
|
* @param {Object} opts
|
|
34
41
|
* @param {string} [opts.token] - API key
|
|
35
42
|
* @param {string} opts.id - Cart id
|
|
36
|
-
* @param {
|
|
43
|
+
* @param {CartGetQuery} [opts.query] - Query params (providerId, transactionStatus)
|
|
37
44
|
* @param {Object} [opts.headers] - Optional headers
|
|
38
45
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
39
46
|
*/
|
|
40
|
-
function get({token, id,
|
|
41
|
-
let url = `/cart/${id}`;
|
|
42
|
-
|
|
43
|
-
if (providerId) {
|
|
44
|
-
url = `${url}?providerId=${providerId}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
+
function get({token, id, query = {}, headers}) {
|
|
47
48
|
return client({
|
|
48
|
-
url
|
|
49
|
+
url: `/cart/${id}`,
|
|
50
|
+
params: query,
|
|
49
51
|
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
50
52
|
});
|
|
51
53
|
}
|
|
@@ -125,11 +127,11 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
/**
|
|
128
|
-
* DELETE /carts/:cartId/paid-in-items - delete paid-in items.
|
|
130
|
+
* DELETE /carts/:cartId/paid-in-items - delete paid-in items.
|
|
129
131
|
* @param {Object} opts
|
|
130
132
|
* @param {string} [opts.token] - API key
|
|
131
133
|
* @param {string} opts.cartId - Cart id
|
|
132
|
-
* @param {
|
|
134
|
+
* @param {CartDeletePaidInItemsQuery} [opts.params] - Query params (operationId, productId)
|
|
133
135
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
134
136
|
* @param {Object} [opts.headers] - Optional headers
|
|
135
137
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
@@ -139,7 +141,7 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
139
141
|
url: `/carts/${cartId}/paid-in-items`,
|
|
140
142
|
method: "delete",
|
|
141
143
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
142
|
-
params
|
|
144
|
+
params: params || {}
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -184,13 +186,13 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
184
186
|
|
|
185
187
|
const partialDepositStatus = {
|
|
186
188
|
/**
|
|
187
|
-
* GET /cart/:shiftId/partial-deposit-status - get partial deposit status. API does not accept query params.
|
|
189
|
+
* GET /cart/:shiftId/partial-deposit-status - get shift partial deposit status. API does not accept query params. Response: partialDeposit.
|
|
188
190
|
* @param {Object} opts
|
|
189
191
|
* @param {string} [opts.token] - API key
|
|
190
192
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
191
|
-
* @param {string} opts.shiftId - Shift id
|
|
193
|
+
* @param {string} opts.shiftId - Shift id (24 hex characters)
|
|
192
194
|
* @param {Object} [opts.headers] - Optional headers
|
|
193
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
195
|
+
* @returns {Promise<import("axios").AxiosResponse<{ partialDeposit: * }>>}
|
|
194
196
|
*/
|
|
195
197
|
get({token, jwtToken, shiftId, headers}) {
|
|
196
198
|
return client.get(`/cart/${shiftId}/partial-deposit-status`, {
|
|
@@ -238,13 +240,13 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
238
240
|
|
|
239
241
|
const taxExemptPaymentMethod = {
|
|
240
242
|
/**
|
|
241
|
-
* POST /carts/:cartId/tax-exempt-payment-method -
|
|
243
|
+
* POST /carts/:cartId/tax-exempt-payment-method - recalculate taxes for a tax exempt payment method. Body: amountExempt (number).
|
|
242
244
|
* @param {Object} opts
|
|
243
245
|
* @param {string} [opts.token] - API key
|
|
244
246
|
* @param {string} opts.cartId - Cart id
|
|
245
247
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
246
248
|
* @param {Object} [opts.headers] - Optional headers
|
|
247
|
-
* @param {Object}
|
|
249
|
+
* @param {Object} opts.data - Request body; must include amountExempt (number, amount exempted of taxes)
|
|
248
250
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
249
251
|
*/
|
|
250
252
|
post({token, cartId, jwtToken, headers, data = {}}) {
|
|
@@ -10,18 +10,17 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
10
10
|
*/
|
|
11
11
|
function flexpassesEndpointsFactory({client, internalAuthTokenProvider}) {
|
|
12
12
|
/**
|
|
13
|
-
* GET /flexpasses/:flexpassId - get flexpass by id. API does not accept query params
|
|
13
|
+
* GET /flexpasses/:flexpassId - get flexpass by id. API does not accept query params.
|
|
14
14
|
* @param {Object} opts
|
|
15
15
|
* @param {string} [opts.token] - API key
|
|
16
16
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
17
|
-
* @param {string} opts.flexpassId - Flexpass id
|
|
17
|
+
* @param {string} opts.flexpassId - Flexpass id (24 hex characters)
|
|
18
18
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
19
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
20
20
|
*/
|
|
21
|
-
function get({token, jwtToken, flexpassId,
|
|
21
|
+
function get({token, jwtToken, flexpassId, headers}) {
|
|
22
22
|
return client({
|
|
23
23
|
url: `/flexpasses/${flexpassId}`,
|
|
24
|
-
params: query,
|
|
25
24
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
26
25
|
});
|
|
27
26
|
}
|