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
|
@@ -6,6 +6,15 @@ const {authorizationHeaders} = require("../endpoints_helpers.js");
|
|
|
6
6
|
* @property {string} [providerIds] - The id of the providers to get taxes for
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Query params for GET /taxes/exceptions (btrz-api-inventory). See get-tax-exceptions-handler getSpec().
|
|
11
|
+
* @typedef {Object} TaxExceptionsListQuery
|
|
12
|
+
* @property {string} [originId] - Origin station id (24 hex characters)
|
|
13
|
+
* @property {string} [destinationId] - Destination station id (24 hex characters)
|
|
14
|
+
* @property {number} [page] - Page to return
|
|
15
|
+
* @property {number} [recordsPerPage] - Records per page
|
|
16
|
+
*/
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
* Factory for taxes API (btrz-api-inventory).
|
|
11
20
|
* @param {Object} deps
|
|
@@ -99,7 +108,7 @@ function taxesFactory({client, internalAuthTokenProvider}) {
|
|
|
99
108
|
url: "/taxes/exceptions",
|
|
100
109
|
method: "post",
|
|
101
110
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
102
|
-
data: taxException
|
|
111
|
+
data: {taxException}
|
|
103
112
|
});
|
|
104
113
|
},
|
|
105
114
|
/**
|
|
@@ -117,7 +126,7 @@ function taxesFactory({client, internalAuthTokenProvider}) {
|
|
|
117
126
|
url: `/taxes/exceptions/${taxExceptionId}`,
|
|
118
127
|
method: "put",
|
|
119
128
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
120
|
-
data: taxException
|
|
129
|
+
data: {taxException}
|
|
121
130
|
});
|
|
122
131
|
},
|
|
123
132
|
/**
|
|
@@ -2,6 +2,7 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Factory for traveller-card-providers types API (btrz-api-inventory).
|
|
5
|
+
* Returns the list of supported traveller card provider types (e.g. "custom", "caa").
|
|
5
6
|
* @param {Object} deps
|
|
6
7
|
* @param {import("axios").AxiosInstance} deps.client
|
|
7
8
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -9,16 +10,16 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
9
10
|
*/
|
|
10
11
|
function travellerCardProvidersTypesFactory({client, internalAuthTokenProvider}) {
|
|
11
12
|
/**
|
|
12
|
-
* GET /traveller-card-providers/types - list traveller card provider types.
|
|
13
|
+
* GET /traveller-card-providers/types - list traveller card provider types (e.g. "custom", "caa"). No query or path params.
|
|
13
14
|
* @param {Object} opts
|
|
14
15
|
* @param {string} [opts.token] - API key
|
|
16
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
15
17
|
* @param {Object} [opts.headers] - Optional headers
|
|
16
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
18
|
+
* @returns {Promise<import("axios").AxiosResponse<{ travellerCardProviderTypes: Array<{ type: string, properties: Object }> }>>}
|
|
17
19
|
*/
|
|
18
|
-
function all({token,
|
|
20
|
+
function all({token, jwtToken, headers}) {
|
|
19
21
|
return client.get("/traveller-card-providers/types", {
|
|
20
|
-
|
|
21
|
-
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
22
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Body for POST /direct-trip-ids (btrz-api-inventory-trips). See TripIdPostData in post-handler getSpec().
|
|
6
|
+
* @typedef {Object} TripIdPostData
|
|
7
|
+
* @property {string} providerId - Provider id (24-char hex ObjectId)
|
|
8
|
+
* @property {string} routeId - Route id (24-char hex ObjectId)
|
|
9
|
+
* @property {string} scheduleId - Schedule id
|
|
10
|
+
* @property {string} departureDate - Departure date (yyyy-mm-dd)
|
|
11
|
+
* @property {string} fareIds - Fare ids and quantities (e.g. fareId:qty)
|
|
12
|
+
* @property {string} channel - One of: backoffice, agency-backoffice, websales, agency-websales
|
|
13
|
+
* @property {string} productId - Product id (24-char hex ObjectId)
|
|
14
|
+
* @property {string} originId - Origin station id (24-char hex ObjectId)
|
|
15
|
+
* @property {string} destinationId - Destination station id (24-char hex ObjectId)
|
|
16
|
+
* @property {string} [currency] - ISO currency code (optional, for multicurrency)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Factory for trip-ids API (btrz-api-inventory-trips).
|
|
21
|
+
* @param {Object} deps
|
|
22
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
23
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
24
|
+
* @returns {{ create: function }}
|
|
25
|
+
*/
|
|
26
|
+
function tripIdsFactory({client, internalAuthTokenProvider}) {
|
|
27
|
+
/**
|
|
28
|
+
* POST /direct-trip-ids — Resolve trip parameters to a trip id. Runs trip search internally and returns the matching trip's base64 id (or null). Body can be TripIdPostData or { tripId: TripIdPostData }.
|
|
29
|
+
* @param {Object} opts
|
|
30
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
31
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
32
|
+
* @param {TripIdPostData|{ tripId: TripIdPostData }} opts.data - Trip parameters (or wrapped in tripId key)
|
|
33
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
34
|
+
* @returns {Promise<import("axios").AxiosResponse<{ tripId: { tripId: string|null } }>>}
|
|
35
|
+
* @throws 400 WRONG_DATA — tripId required or required fields missing
|
|
36
|
+
* @throws 401 Unauthorized
|
|
37
|
+
* @throws 404 TRIP_IDS_NOT_FOUND
|
|
38
|
+
* @throws 500 Internal server error
|
|
39
|
+
*/
|
|
40
|
+
function create({token, jwtToken, data, headers}) {
|
|
41
|
+
return client({
|
|
42
|
+
url: "/direct-trip-ids",
|
|
43
|
+
method: "post",
|
|
44
|
+
data,
|
|
45
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
create
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = tripIdsFactory;
|
|
@@ -1,46 +1,84 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* Factory for trips API (btrz-api-inventory).
|
|
5
|
+
* Factory for trips API (btrz-api-inventory-trips).
|
|
5
6
|
* @param {Object} deps
|
|
6
7
|
* @param {import("axios").AxiosInstance} deps.client
|
|
7
8
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
8
|
-
* @returns {{ all: function, get: function }}
|
|
9
|
+
* @returns {{ all: function, get: function, getPricingSimulation: function }}
|
|
9
10
|
*/
|
|
10
11
|
function tripsFactory({client, internalAuthTokenProvider}) {
|
|
11
12
|
/**
|
|
12
|
-
* GET /trips
|
|
13
|
+
* GET /trips — Search for available trips by date, origin, destination, fare, product, channel, and price. Rate limited (e.g. 8000 req/10 min). See get-trips getSpec() for full query params (productId, originId, destinationId, fareIds, departureDate, returnDate, channel, currency, etc.).
|
|
13
14
|
* @param {Object} opts
|
|
14
|
-
* @param {string} [opts.token] - API key
|
|
15
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
15
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
16
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
17
|
+
* @param {Object} [opts.query] - Query params (productId, originId, destinationId, fareIds, departureDate, returnDate, etc.)
|
|
16
18
|
* @param {Object} [opts.headers] - Optional headers
|
|
17
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ trips: { departures: Object[], returns: Object[] } }>>}
|
|
20
|
+
* @throws 400 INVALID_DATE, INVALID_DATE_FORMAT, INVALID_PRODUCTID, INVALID_ORIGIN, INVALID_DESTINATION, INVALID_CHANNEL, INVALID_FARE, INVALID_FAREID, INVALID_MANIFEST_STATUS, WRONG_DATA
|
|
21
|
+
* @throws 401 Unauthorized
|
|
22
|
+
* @throws 409 NO_HIGHER_OR_EQL_PRICE
|
|
23
|
+
* @throws 500 Internal server error
|
|
18
24
|
*/
|
|
19
25
|
function all({token, jwtToken, query = {}, headers}) {
|
|
20
26
|
return client({
|
|
21
27
|
url: "/trips",
|
|
28
|
+
method: "get",
|
|
22
29
|
params: query,
|
|
23
30
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
24
31
|
});
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
|
-
* GET /trip/:id -
|
|
35
|
+
* GET /trip/:id — Get up-to-date information for a trip by its ID (base64-encoded trip summary from a search). Optional query: extraCapacityImpact, ignoreCutoffs, currency, ignoreOmitByAvailability, includeMoveToTrips.
|
|
29
36
|
* @param {Object} opts
|
|
30
|
-
* @param {string} [opts.token] - API key
|
|
31
|
-
* @param {string} opts.
|
|
37
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
38
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
39
|
+
* @param {string} opts.id - Trip id (base64-encoded)
|
|
40
|
+
* @param {Object} [opts.query] - Optional: extraCapacityImpact, ignoreCutoffs, currency, ignoreOmitByAvailability, includeMoveToTrips
|
|
32
41
|
* @param {Object} [opts.headers] - Optional headers
|
|
33
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
42
|
+
* @returns {Promise<import("axios").AxiosResponse<{ trip: Object }>>}
|
|
43
|
+
* @throws 400 INVALID_TRIP — tripId is invalid
|
|
44
|
+
* @throws 401 Unauthorized
|
|
45
|
+
* @throws 500 Internal server error
|
|
34
46
|
*/
|
|
35
|
-
function get({token, id, headers}) {
|
|
36
|
-
return client
|
|
37
|
-
|
|
47
|
+
function get({token, jwtToken, id, query = {}, headers}) {
|
|
48
|
+
return client({
|
|
49
|
+
url: `/trip/${id}`,
|
|
50
|
+
method: "get",
|
|
51
|
+
params: query,
|
|
52
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* GET /trips/pricing-simulation — Get pricing simulation for all purchase combinations for a schedule. Query: scheduleId, productId (required); purchaseDate, travelDate, includeReadable, includeMetadata, minimize (optional).
|
|
58
|
+
* @param {Object} opts
|
|
59
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
60
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
61
|
+
* @param {Object} [opts.query] - scheduleId, productId (required); purchaseDate, travelDate, includeReadable, includeMetadata, minimize
|
|
62
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
63
|
+
* @returns {Promise<import("axios").AxiosResponse<Object>>} Response shape per PricingSimulationResult definition
|
|
64
|
+
* @throws 400 INVALID_SCHEDULE_ID, INVALID_PRODUCT_ID, INVALID_PRODUCT, ROUTE_NOT_FOUND, ONLY_JP_SUPPORTED, INVALID_DATE
|
|
65
|
+
* @throws 401 Unauthorized, PRICING_SIMULATOR_DISABLED, PROVIDER_UNAUTHORIZED
|
|
66
|
+
* @throws 404 SCHEDULE_NOT_FOUND, NO_MANIFEST
|
|
67
|
+
* @throws 500 Internal server error
|
|
68
|
+
*/
|
|
69
|
+
function getPricingSimulation({token, jwtToken, query = {}, headers}) {
|
|
70
|
+
return client({
|
|
71
|
+
url: "/trips/pricing-simulation",
|
|
72
|
+
method: "get",
|
|
73
|
+
params: query,
|
|
74
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
38
75
|
});
|
|
39
76
|
}
|
|
40
77
|
|
|
41
78
|
return {
|
|
42
79
|
all,
|
|
43
|
-
get
|
|
80
|
+
get,
|
|
81
|
+
getPricingSimulation
|
|
44
82
|
};
|
|
45
83
|
}
|
|
46
84
|
|
|
@@ -11,16 +11,15 @@ const {
|
|
|
11
11
|
*/
|
|
12
12
|
function vehicleTypesFactory({client, internalAuthTokenProvider}) {
|
|
13
13
|
/**
|
|
14
|
-
* GET /vehicle-types - list vehicle types (e.g. Bus, Shuttle, Van, Train, Ferry, Tram).
|
|
14
|
+
* GET /vehicle-types - list vehicle types (e.g. Bus, Shuttle, Van, Train, Ferry, Tram). No query or path params.
|
|
15
15
|
* @param {Object} opts
|
|
16
16
|
* @param {string} [opts.token] - API key
|
|
17
17
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
18
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ vehicleTypes: Array<{ _id: string, name: string }> }>>}
|
|
20
20
|
*/
|
|
21
|
-
function all({token, jwtToken,
|
|
21
|
+
function all({token, jwtToken, headers}) {
|
|
22
22
|
return client.get("/vehicle-types", {
|
|
23
|
-
params: query,
|
|
24
23
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
25
24
|
});
|
|
26
25
|
}
|
|
@@ -41,12 +41,13 @@ function vehiclesFactory({client, internalAuthTokenProvider}) {
|
|
|
41
41
|
*/
|
|
42
42
|
function all({
|
|
43
43
|
token,
|
|
44
|
+
jwtToken,
|
|
44
45
|
query = {},
|
|
45
46
|
headers
|
|
46
47
|
}) {
|
|
47
48
|
return client.get("/vehicles", {
|
|
48
49
|
params: query,
|
|
49
|
-
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
50
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -59,9 +60,9 @@ function vehiclesFactory({client, internalAuthTokenProvider}) {
|
|
|
59
60
|
* @param {Object} [opts.headers] - Optional headers
|
|
60
61
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
61
62
|
*/
|
|
62
|
-
function get({vehicleId, token, headers}) {
|
|
63
|
+
function get({vehicleId, token, jwtToken, headers}) {
|
|
63
64
|
return client.get(`/vehicles/${vehicleId}`, {
|
|
64
|
-
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
65
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -10,13 +10,23 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
10
10
|
*/
|
|
11
11
|
function emailsFactory({client, internalAuthTokenProvider}) {
|
|
12
12
|
/**
|
|
13
|
-
* POST /emails
|
|
13
|
+
* POST /emails — Send invoice by email to the given addresses.
|
|
14
|
+
* Request body may be sent as root object or under key "email". On success the API emits webhook invoiceemail.created.
|
|
15
|
+
*
|
|
14
16
|
* @param {Object} opts
|
|
15
|
-
* @param {string} [opts.token] - API key
|
|
16
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
17
|
-
* @param {Object} opts.data - Request body
|
|
17
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
18
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol (Authorization: Bearer)
|
|
19
|
+
* @param {Object} opts.data - Request body (EmailPostData)
|
|
20
|
+
* @param {string} opts.data.invoiceId - Invoice ID (required, 24-char hex ObjectId)
|
|
21
|
+
* @param {string[]} opts.data.emails - Recipient email addresses (required)
|
|
22
|
+
* @param {string} [opts.data.language] - Language code for template (e.g. "en-us")
|
|
23
|
+
* @param {Object} [opts.query] - Query params (none used by this endpoint)
|
|
18
24
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
25
|
+
* @returns {Promise<import("axios").AxiosResponse<{ status: "OK" }>>} Resolves with { status: "OK" } on success
|
|
26
|
+
* @throws 400 WRONG_DATA, ACCOUNT_CANT_SEND_EMAILS, NO_VERIFIED_OR_ACTIVE_EMAIL, INVALID_EMAIL_TO_SEND
|
|
27
|
+
* @throws 401 Unauthorized (missing/invalid X-API-KEY or Authorization)
|
|
28
|
+
* @throws 404 INVOICE_NOT_FOUND
|
|
29
|
+
* @throws 500 Internal server error
|
|
20
30
|
*/
|
|
21
31
|
function create({token, jwtToken, data, query = {}, headers}) {
|
|
22
32
|
return client({
|
|
@@ -22,13 +22,15 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
22
22
|
*/
|
|
23
23
|
function invoicesFactory({client, internalAuthTokenProvider}) {
|
|
24
24
|
/**
|
|
25
|
-
* GET /invoices
|
|
25
|
+
* GET /invoices — List invoices by transaction (paginated).
|
|
26
26
|
* @param {Object} opts
|
|
27
|
-
* @param {string} [opts.token] - API key
|
|
28
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
29
|
-
* @param {InvoicesListQuery} [opts.query] - Query
|
|
27
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
28
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
29
|
+
* @param {InvoicesListQuery} [opts.query] - Query; transactionId (required) = 24-char hex ObjectId
|
|
30
30
|
* @param {Object} [opts.headers] - Optional headers
|
|
31
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
31
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invoices: Object[], total: number, page?: number, ... }>>}
|
|
32
|
+
* @throws 401 Unauthorized
|
|
33
|
+
* @throws 500 Internal server error
|
|
32
34
|
*/
|
|
33
35
|
function all({token, jwtToken, query = {}, headers}) {
|
|
34
36
|
return client({
|
|
@@ -40,13 +42,17 @@ function invoicesFactory({client, internalAuthTokenProvider}) {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
|
-
* GET /invoices/:id
|
|
45
|
+
* GET /invoices/:id — Get a single invoice by ID.
|
|
44
46
|
* @param {Object} opts
|
|
45
|
-
* @param {string} [opts.token] - API key
|
|
46
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
47
|
-
* @param {string} opts.id - Invoice
|
|
47
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
48
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
49
|
+
* @param {string} opts.id - Invoice ID (24-character hex ObjectId)
|
|
48
50
|
* @param {Object} [opts.headers] - Optional headers
|
|
49
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
51
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invoice: Object }>>}
|
|
52
|
+
* @throws 400 WRONG_DATA, INVALID_INVOICE_ID
|
|
53
|
+
* @throws 401 Unauthorized
|
|
54
|
+
* @throws 404 INVOICE_NOT_FOUND
|
|
55
|
+
* @throws 500 Internal server error
|
|
50
56
|
*/
|
|
51
57
|
function get({token, jwtToken, id, query = {}, headers}) {
|
|
52
58
|
return client({
|
|
@@ -58,13 +64,16 @@ function invoicesFactory({client, internalAuthTokenProvider}) {
|
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
/**
|
|
61
|
-
* GET /failures
|
|
67
|
+
* GET /failures — List invoice failures (paginated). Optional transactionId filter.
|
|
62
68
|
* @param {Object} opts
|
|
63
|
-
* @param {string} [opts.token] - API key
|
|
64
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
65
|
-
* @param {InvoicesFailuresQuery} [opts.query] - Query
|
|
69
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
70
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
71
|
+
* @param {InvoicesFailuresQuery} [opts.query] - Query; transactionId optional (24-char hex; if present must be valid)
|
|
66
72
|
* @param {Object} [opts.headers] - Optional headers
|
|
67
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
73
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invoicesFailures: Object[], total: number, ... }>>}
|
|
74
|
+
* @throws 400 WRONG_DATA, INVALID_TRANSACTION_ID (if transactionId provided and invalid)
|
|
75
|
+
* @throws 401 Unauthorized
|
|
76
|
+
* @throws 500 Internal server error
|
|
68
77
|
*/
|
|
69
78
|
function getInvoicesFailures({token, jwtToken, query = {}, headers}) {
|
|
70
79
|
return client({
|
|
@@ -76,13 +85,19 @@ function invoicesFactory({client, internalAuthTokenProvider}) {
|
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
/**
|
|
79
|
-
* POST /retry
|
|
88
|
+
* POST /retry — Retry invoicing from an invoice failure using saved data. Body: transactionId (required).
|
|
89
|
+
* On success may emit webhooks invoices.created or invoices.updated.
|
|
80
90
|
* @param {Object} opts
|
|
81
|
-
* @param {string} [opts.token] - API key
|
|
82
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
83
|
-
* @param {Object} opts.data -
|
|
91
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
92
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
93
|
+
* @param {Object} opts.data - Body: { transactionId } (transactionId = 24-char hex ObjectId)
|
|
84
94
|
* @param {Object} [opts.headers] - Optional headers
|
|
85
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
95
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invoice: Object }>>}
|
|
96
|
+
* @throws 400 WRONG_DATA, INVOICE_NOT_CREATED, INVOICE_PROVIDER_TYPE_NOT_SUPPORTED, INVOICE_PROVIDER_NOT_FOUND, TRANSACTION_ALREADY_INVOICED
|
|
97
|
+
* @throws 401 Unauthorized
|
|
98
|
+
* @throws 404 TRANSACTION_NOT_FOUND, INVOICE_FAILURE_NOT_FOUND
|
|
99
|
+
* @throws 409 INFILE_SIGN_FAILED, INFILE_CERTIFICATION_FAILED
|
|
100
|
+
* @throws 500 Internal server error
|
|
86
101
|
*/
|
|
87
102
|
function retryInvoicing({token, jwtToken, data, query = {}, headers}) {
|
|
88
103
|
return client({
|
|
@@ -95,13 +110,19 @@ function invoicesFactory({client, internalAuthTokenProvider}) {
|
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
/**
|
|
98
|
-
* PUT /retry
|
|
113
|
+
* PUT /retry — Override buyer and retry invoicing from an invoice failure. Body: retryData with transactionId and overrideBuyer.
|
|
114
|
+
* On success may emit webhooks invoices.created or invoices.updated.
|
|
99
115
|
* @param {Object} opts
|
|
100
|
-
* @param {string} [opts.token] - API key
|
|
101
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
102
|
-
* @param {Object} opts.data -
|
|
116
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
117
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
118
|
+
* @param {Object} opts.data - Body: { transactionId, overrideBuyer } (RetryPutData); overrideBuyer required when no certified invoice exists
|
|
103
119
|
* @param {Object} [opts.headers] - Optional headers
|
|
104
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
120
|
+
* @returns {Promise<import("axios").AxiosResponse<{ invoice: Object }>>}
|
|
121
|
+
* @throws 400 WRONG_DATA, INVOICE_NOT_CREATED, INVOICE_PROVIDER_TYPE_NOT_SUPPORTED, INVOICE_PROVIDER_NOT_FOUND, TRANSACTION_ALREADY_INVOICED, OVERRIDE_BUYER_IS_MANDATORY
|
|
122
|
+
* @throws 401 Unauthorized
|
|
123
|
+
* @throws 404 TRANSACTION_NOT_FOUND, INVOICE_FAILURE_NOT_FOUND
|
|
124
|
+
* @throws 409 INFILE_SIGN_FAILED, INFILE_CERTIFICATION_FAILED
|
|
125
|
+
* @throws 500 Internal server error
|
|
105
126
|
*/
|
|
106
127
|
function overrideBuyerRetryInvoicing({token, jwtToken, data, query = {}, headers}) {
|
|
107
128
|
return client({
|
|
@@ -3,8 +3,8 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Query params for GET /pdfs (btrz-api-invoices). See pdfs get-handler getSpec().
|
|
6
|
-
* @typedef {Object}
|
|
7
|
-
* @property {string} transactionId - Transaction
|
|
6
|
+
* @typedef {Object} PdfsQuery
|
|
7
|
+
* @property {string} transactionId - Transaction ID of the invoice (required, 24-char hex ObjectId)
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -16,14 +16,21 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
16
16
|
*/
|
|
17
17
|
function pdfsFactory({client, internalAuthTokenProvider}) {
|
|
18
18
|
/**
|
|
19
|
-
* GET /pdfs
|
|
19
|
+
* GET /pdfs — Returns the invoice PDF for the invoice associated with the given transaction.
|
|
20
|
+
* Response is binary (application/pdf) with Content-Disposition attachment; filename=invoice-{invoiceId}.pdf.
|
|
21
|
+
* Use responseType "blob" or "arraybuffer" to receive binary data.
|
|
22
|
+
*
|
|
20
23
|
* @param {Object} opts
|
|
21
|
-
* @param {string} [opts.token] - API key
|
|
22
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {string} [opts.responseType] - Response type
|
|
24
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
25
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
26
|
+
* @param {PdfsQuery} [opts.query] - Query; transactionId (required)
|
|
27
|
+
* @param {string} [opts.responseType] - Response type: "blob" or "arraybuffer" for binary PDF; "json" default
|
|
25
28
|
* @param {Object} [opts.headers] - Optional headers
|
|
26
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
29
|
+
* @returns {Promise<import("axios").AxiosResponse<ArrayBuffer|Blob|*>>} PDF binary when responseType is blob/arraybuffer
|
|
30
|
+
* @throws 400 WRONG_DATA — transactionId is required
|
|
31
|
+
* @throws 401 Unauthorized
|
|
32
|
+
* @throws 404 INVOICE_NOT_FOUND — Invoice not found for the transactionId
|
|
33
|
+
* @throws 500 Internal server error (e.g. unsupported invoice provider type)
|
|
27
34
|
*/
|
|
28
35
|
function all({token, jwtToken, query = {}, responseType = "json", headers}) {
|
|
29
36
|
return client({
|
|
@@ -20,13 +20,15 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
20
20
|
*/
|
|
21
21
|
function providersFactory({client, internalAuthTokenProvider}) {
|
|
22
22
|
/**
|
|
23
|
-
* GET /providers
|
|
23
|
+
* GET /providers — List invoice providers (paginated). Optional filters: enabled, invoiceProviderType, channel, country, operatingCompany.
|
|
24
24
|
* @param {Object} opts
|
|
25
|
-
* @param {string} [opts.token] - API key
|
|
26
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
25
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
26
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
27
27
|
* @param {ProvidersListQuery} [opts.query] - Query params (all optional)
|
|
28
28
|
* @param {Object} [opts.headers] - Optional headers
|
|
29
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
29
|
+
* @returns {Promise<import("axios").AxiosResponse<{ providers: Object[], total?: number, ... }>>}
|
|
30
|
+
* @throws 401 Unauthorized
|
|
31
|
+
* @throws 500 Internal server error
|
|
30
32
|
*/
|
|
31
33
|
function all({token, jwtToken, query = {}, headers}) {
|
|
32
34
|
return client({
|
|
@@ -38,13 +40,17 @@ function providersFactory({client, internalAuthTokenProvider}) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
|
-
* GET /providers/:id
|
|
43
|
+
* GET /providers/:id — Get a single invoice provider by ID.
|
|
42
44
|
* @param {Object} opts
|
|
43
|
-
* @param {string} [opts.token] - API key
|
|
44
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
45
|
-
* @param {string} opts.id - Provider
|
|
45
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
46
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
47
|
+
* @param {string} opts.id - Provider ID (24-character hex ObjectId)
|
|
46
48
|
* @param {Object} [opts.headers] - Optional headers
|
|
47
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
49
|
+
* @returns {Promise<import("axios").AxiosResponse<{ provider: Object }>>}
|
|
50
|
+
* @throws 400 WRONG_DATA, INVALID_PROVIDER_ID
|
|
51
|
+
* @throws 401 Unauthorized
|
|
52
|
+
* @throws 404 PROVIDER_NOT_FOUND
|
|
53
|
+
* @throws 500 Internal server error
|
|
48
54
|
*/
|
|
49
55
|
function get({token, jwtToken, id, query = {}, headers}) {
|
|
50
56
|
return client({
|
|
@@ -56,14 +62,18 @@ function providersFactory({client, internalAuthTokenProvider}) {
|
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
|
-
* PUT /providers/:id
|
|
65
|
+
* PUT /providers/:id — Update invoice provider. Body may be provider or body.provider. Emits webhook invoice_providers.updated on success.
|
|
60
66
|
* @param {Object} opts
|
|
61
|
-
* @param {string} [opts.token] - API key
|
|
62
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
63
|
-
* @param {string} opts.id - Provider
|
|
64
|
-
* @param {Object} opts.data - Request body
|
|
67
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
68
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
69
|
+
* @param {string} opts.id - Provider ID (24-character hex ObjectId)
|
|
70
|
+
* @param {Object} opts.data - Request body (ProviderPutData)
|
|
65
71
|
* @param {Object} [opts.headers] - Optional headers
|
|
66
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
72
|
+
* @returns {Promise<import("axios").AxiosResponse<{ provider: Object }>>}
|
|
73
|
+
* @throws 400 INVALID_PHRASES, OPERATING_COMPANY_NOT_FOUND, CANNOT_CHANGE_PROVIDER, INVALID_IVA_AFFILIATION, CANT_REMOVE_*, INVALID_PARAM_VALUE, CANT_DELETE_DOCUMENT_TYPE_*
|
|
74
|
+
* @throws 401 Unauthorized
|
|
75
|
+
* @throws 404 PROVIDER_NOT_FOUND
|
|
76
|
+
* @throws 500 Internal server error
|
|
67
77
|
*/
|
|
68
78
|
function update({token, jwtToken, id, data, query = {}, headers}) {
|
|
69
79
|
return client({
|
|
@@ -76,13 +86,17 @@ function providersFactory({client, internalAuthTokenProvider}) {
|
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
/**
|
|
79
|
-
* DELETE /providers/:id
|
|
89
|
+
* DELETE /providers/:id — Remove invoice provider. Emits webhook invoice_providers.deleted on success.
|
|
80
90
|
* @param {Object} opts
|
|
81
|
-
* @param {string} [opts.token] - API key
|
|
82
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
83
|
-
* @param {string} opts.id - Provider
|
|
91
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
92
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
93
|
+
* @param {string} opts.id - Provider ID (24-character hex ObjectId)
|
|
84
94
|
* @param {Object} [opts.headers] - Optional headers
|
|
85
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
95
|
+
* @returns {Promise<import("axios").AxiosResponse<{ providerId: string }>>}
|
|
96
|
+
* @throws 400 WRONG_DATA, INVALID_PROVIDER_ID
|
|
97
|
+
* @throws 401 Unauthorized
|
|
98
|
+
* @throws 404 PROVIDER_NOT_FOUND
|
|
99
|
+
* @throws 500 Internal server error
|
|
86
100
|
*/
|
|
87
101
|
function remove({token, jwtToken, id, query = {}, headers}) {
|
|
88
102
|
return client({
|
|
@@ -94,13 +108,16 @@ function providersFactory({client, internalAuthTokenProvider}) {
|
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
/**
|
|
97
|
-
* POST /providers
|
|
111
|
+
* POST /providers — Create invoice provider. Body may be provider or body.provider (ProviderPostData). Emits webhook invoice_providers.created on success.
|
|
98
112
|
* @param {Object} opts
|
|
99
|
-
* @param {string} [opts.token] - API key
|
|
100
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
101
|
-
* @param {Object} opts.data - Request body
|
|
113
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
114
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
115
|
+
* @param {Object} opts.data - Request body (ProviderPostData: invoiceProviderType, currencies, params required)
|
|
102
116
|
* @param {Object} [opts.headers] - Optional headers
|
|
103
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
117
|
+
* @returns {Promise<import("axios").AxiosResponse<{ provider: Object }>>}
|
|
118
|
+
* @throws 400 WRONG_DATA, INVALID_PHRASES, REQUIRED_PARAM_MISSING, INVALID_PARAM_VALUE, OPERATING_COMPANY_NOT_FOUND, INVALID_IVA_AFFILIATION
|
|
119
|
+
* @throws 401 Unauthorized
|
|
120
|
+
* @throws 500 Internal server error
|
|
104
121
|
*/
|
|
105
122
|
function create({token, jwtToken, data, query = {}, headers}) {
|
|
106
123
|
return client({
|
|
@@ -6,8 +6,8 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
6
6
|
* @typedef {Object} TaxIdsListQuery
|
|
7
7
|
* @property {string} taxNumber - Tax number to look up (required)
|
|
8
8
|
* @property {string} country - ISO code of the country of the tax information (required)
|
|
9
|
-
* @property {string} [invoiceProviderId] - Invoice provider id (24 hex
|
|
10
|
-
* @property {string} [documentType] - Tax identification type
|
|
9
|
+
* @property {string} [invoiceProviderId] - Invoice provider id (24-char hex ObjectId); optional, for external validation
|
|
10
|
+
* @property {string} [documentType] - Tax identification type for validation (e.g. NIT, DPI for infile)
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -19,13 +19,17 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
|
|
|
19
19
|
*/
|
|
20
20
|
function taxIdsFactory({client, internalAuthTokenProvider}) {
|
|
21
21
|
/**
|
|
22
|
-
* GET /tax-ids
|
|
22
|
+
* GET /tax-ids — List tax ID information (paginated). Merges internal tax IDs with external provider validation when invoiceProviderId is provided.
|
|
23
23
|
* @param {Object} opts
|
|
24
|
-
* @param {string} [opts.token] - API key
|
|
25
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
26
|
-
* @param {TaxIdsListQuery} opts.query - taxNumber
|
|
24
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
25
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
26
|
+
* @param {TaxIdsListQuery} [opts.query] - taxNumber and country (required); optional invoiceProviderId, documentType
|
|
27
27
|
* @param {Object} [opts.headers] - Optional headers
|
|
28
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
28
|
+
* @returns {Promise<import("axios").AxiosResponse<{ taxIds: Object[], total?: number, ... }>>}
|
|
29
|
+
* @throws 400 WRONG_DATA, INVALID_PROVIDER_ID, INVALID_TAX_NUMBER, INVALID_PROVIDER_CREDENTIALS
|
|
30
|
+
* @throws 401 Unauthorized
|
|
31
|
+
* @throws 404 TAXID_NOT_FOUND, PROVIDER_NOT_FOUND
|
|
32
|
+
* @throws 500 Internal server error
|
|
29
33
|
*/
|
|
30
34
|
function all({token, jwtToken, query = {}, headers}) {
|
|
31
35
|
return client({
|
|
@@ -62,7 +62,7 @@ function customersFactory({
|
|
|
62
62
|
* @param {Object} opts
|
|
63
63
|
* @param {string} [opts.token] - API key
|
|
64
64
|
* @param {CustomersActivationPostQuery} [opts.query] - Query params (providerId required)
|
|
65
|
-
* @param {Object}
|
|
65
|
+
* @param {Object} opts.data - Body: CustomerForActivation (firstName, lastName, email; optional activateCustomerEmailLoginToken)
|
|
66
66
|
* @param {Object} [opts.headers] - Optional headers
|
|
67
67
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
68
68
|
*/
|