btrz-api-client 8.32.0 → 8.34.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.
Files changed (73) hide show
  1. package/lib/client-standalone-min.js +3 -3
  2. package/lib/client.js +8 -2
  3. package/lib/endpoints/btrzpay/adyen.js +58 -0
  4. package/lib/endpoints/btrzpay/cardpointe.js +6 -3
  5. package/lib/endpoints/btrzpay/customerCards.js +19 -19
  6. package/lib/endpoints/btrzpay/customers.js +13 -13
  7. package/lib/endpoints/btrzpay/cybersource3ds.js +142 -0
  8. package/lib/endpoints/btrzpay/datalogic.js +64 -28
  9. package/lib/endpoints/btrzpay/oxxo.js +54 -28
  10. package/lib/endpoints/btrzpay/prismaTerminals.js +24 -15
  11. package/lib/endpoints/btrzpay/referenced-payments.js +4 -4
  12. package/lib/endpoints/btrzpay/square.js +8 -8
  13. package/lib/endpoints/btrzpay/stripe-terminals.js +16 -11
  14. package/lib/endpoints/btrzpay/stripe3ds.js +54 -0
  15. package/lib/endpoints/btrzpay/terminalPayments.js +19 -19
  16. package/lib/endpoints/coltrane/healthcheck.js +35 -0
  17. package/lib/endpoints/coltrane/info.js +35 -0
  18. package/lib/endpoints/coltrane/paths.js +17 -13
  19. package/lib/endpoints/inventory/segments-information-tables.js +13 -7
  20. package/lib/endpoints/inventory/trip-ids.js +67 -0
  21. package/lib/endpoints/inventory/trips.js +60 -13
  22. package/lib/endpoints/invoices/emails.js +15 -5
  23. package/lib/endpoints/invoices/invoices.js +46 -25
  24. package/lib/endpoints/invoices/pdfs.js +15 -8
  25. package/lib/endpoints/invoices/providers.js +42 -25
  26. package/lib/endpoints/invoices/tax-ids.js +11 -7
  27. package/lib/endpoints/sales/cancellations.js +43 -31
  28. package/lib/endpoints/sales/cart.js +21 -18
  29. package/lib/endpoints/sales/flexpasses.js +2 -5
  30. package/lib/endpoints/sales/order.js +41 -7
  31. package/lib/endpoints/sales/parcel-quotes.js +2 -2
  32. package/package.json +1 -1
  33. package/src/client.js +8 -2
  34. package/src/endpoints/btrzpay/adyen.js +44 -0
  35. package/src/endpoints/btrzpay/cardpointe.js +6 -4
  36. package/src/endpoints/btrzpay/customerCards.js +19 -19
  37. package/src/endpoints/btrzpay/customers.js +13 -13
  38. package/src/endpoints/btrzpay/cybersource3ds.js +114 -0
  39. package/src/endpoints/btrzpay/datalogic.js +63 -28
  40. package/src/endpoints/btrzpay/oxxo.js +53 -26
  41. package/src/endpoints/btrzpay/prismaTerminals.js +24 -15
  42. package/src/endpoints/btrzpay/referenced-payments.js +4 -4
  43. package/src/endpoints/btrzpay/square.js +8 -8
  44. package/src/endpoints/btrzpay/stripe-terminals.js +17 -10
  45. package/src/endpoints/btrzpay/stripe3ds.js +40 -0
  46. package/src/endpoints/btrzpay/terminalPayments.js +19 -19
  47. package/src/endpoints/coltrane/healthcheck.js +28 -0
  48. package/src/endpoints/coltrane/info.js +28 -0
  49. package/src/endpoints/coltrane/paths.js +17 -13
  50. package/src/endpoints/inventory/segments-information-tables.js +13 -7
  51. package/src/endpoints/inventory/trip-ids.js +54 -0
  52. package/src/endpoints/inventory/trips.js +52 -14
  53. package/src/endpoints/invoices/emails.js +15 -5
  54. package/src/endpoints/invoices/invoices.js +46 -25
  55. package/src/endpoints/invoices/pdfs.js +15 -8
  56. package/src/endpoints/invoices/providers.js +42 -25
  57. package/src/endpoints/invoices/tax-ids.js +11 -7
  58. package/src/endpoints/sales/cancellations.js +43 -31
  59. package/src/endpoints/sales/cart.js +20 -18
  60. package/src/endpoints/sales/flexpasses.js +3 -4
  61. package/src/endpoints/sales/order.js +34 -7
  62. package/src/endpoints/sales/parcel-quotes.js +2 -2
  63. package/test/endpoints/btrzpay/adyen.tests.js +27 -0
  64. package/test/endpoints/btrzpay/carpointe.tests.js +14 -0
  65. package/test/endpoints/btrzpay/customerCards.test.js +9 -6
  66. package/test/endpoints/btrzpay/cybersource3ds.tests.js +55 -0
  67. package/test/endpoints/btrzpay/stripe-terminals.tests.js +5 -6
  68. package/test/endpoints/btrzpay/stripe3ds.tests.js +31 -0
  69. package/test/endpoints/coltrane/healthcheck.test.js +13 -0
  70. package/test/endpoints/coltrane/info.test.js +13 -0
  71. package/test/endpoints/inventory/trip-ids.test.js +27 -0
  72. package/test/endpoints/inventory/trips.test.js +19 -14
  73. package/test/endpoints/sales/order.test.js +7 -1
@@ -5,15 +5,16 @@ var _require = require("./../endpoints_helpers.js"),
5
5
  authorizationHeaders = _require.authorizationHeaders;
6
6
 
7
7
  /**
8
- * Query params for GET /paths (btrz-api-coltrane). See get-paths getSpec().
8
+ * Query params for GET /paths (btrz-api-coltrane). All except metrics and preferredAlgorithm are required by the API.
9
9
  * @typedef {Object} ColtranePathsListQuery
10
- * @property {string} [providerId] - Account ID of the travel provider (required by API)
11
- * @property {string} [productId] - Product ID belonging to the provider (required by API)
12
- * @property {string} [originId] - Origin station id (required by API)
13
- * @property {string} [destinationId] - Destination station id (required by API)
14
- * @property {string} [departureFromDate] - Start of search interval; ISO 8601 (e.g. 2021-10-07T17:30:00.000-0400)
15
- * @property {string} [departureToDate] - End of search interval; ISO 8601; interval max 25h
16
- * @property {string} [metrics] - If true, response includes metrics (debugging)
10
+ * @property {string} [providerId] - Account ID of the travel provider (24-char hex)
11
+ * @property {string} [productId] - Product ID belonging to the provider (24-char hex)
12
+ * @property {string} [originId] - Origin station ID (24-char hex); must differ from destinationId
13
+ * @property {string} [destinationId] - Destination station ID (24-char hex)
14
+ * @property {string} [departureFromDate] - Start of departure interval; ISO 8601 (e.g. 2021-10-07T17:30:00.000-0400)
15
+ * @property {string} [departureToDate] - End of departure interval; ISO 8601; interval max 25h, must be after departureFromDate
16
+ * @property {string} [preferredAlgorithm] - "search_algorithm_fast" or "search_algorithm_exhaustive"
17
+ * @property {string|boolean} [metrics] - If true, response includes metrics object (debugging)
17
18
  */
18
19
 
19
20
  /**
@@ -30,12 +31,15 @@ function coltraneFactory(_ref) {
30
31
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
31
32
 
32
33
  /**
33
- * GET /paths - list Coltrane paths.
34
+ * GET /paths search for travel paths between two stations in a departure time interval.
34
35
  * @param {Object} opts
35
- * @param {string} [opts.token] - API key
36
- * @param {ColtranePathsListQuery} [opts.query] - Query params (providerId, productId, originId, destinationId, etc.)
37
- * @param {Object} [opts.headers] - Optional headers
38
- * @returns {Promise<import("axios").AxiosResponse>}
36
+ * @param {string} [opts.token] - API key (X-API-KEY)
37
+ * @param {ColtranePathsListQuery} [opts.query] - Query params; providerId, productId, originId, destinationId, departureFromDate, departureToDate required
38
+ * @param {Object} [opts.headers] - Optional request headers
39
+ * @returns {Promise<import("axios").AxiosResponse<{ data: { paths: Array<{ segments: Array<{ scheduleId: string, manifestDay: string, fromLegIndex: number, toLegIndex: number }> }>, metrics?: object } }>>}
40
+ * @throws {import("axios").AxiosError} 400 INVALID_QUERY_PARAMETERS (invalid params, originId=destinationId, interval &gt; 25h, or invalid preferredAlgorithm)
41
+ * @throws {import("axios").AxiosError} 401 Unauthorized
42
+ * @throws {import("axios").AxiosError} 500 Internal server error
39
43
  */
40
44
  function all(_ref2) {
41
45
  var token = _ref2.token,
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-len */
3
4
  var _require = require("./../endpoints_helpers.js"),
4
5
  authorizationHeaders = _require.authorizationHeaders;
5
6
 
6
7
  /**
7
8
  * Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
8
9
  * @typedef {Object} SegmentsInformationTablesQuery
9
- * @property {string} [providerId] - Provider id of the route if not the same as the user making the request (ObjectId format)
10
+ * @property {string} [providerId] - Provider/account id of the route when different from the authenticated user (24-char hex ObjectId)
10
11
  */
11
12
 
12
13
  /**
@@ -23,14 +24,18 @@ function segmentInformationTableFactory(_ref) {
23
24
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
25
 
25
26
  /**
26
- * GET /segments-information-tables/:routeId - get segments information table by route id.
27
+ * GET /segments-information-tables/:routeId Returns segment information tables for the route (distances, durations, durationsHHMM between stops). Requires BETTEREZ_APP audience.
27
28
  * @param {Object} opts
28
- * @param {string} [opts.token] - API key
29
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
30
- * @param {string} opts.routeId - Route id (ObjectId format)
31
- * @param {SegmentsInformationTablesQuery} [opts.query] - Query params (providerId)
29
+ * @param {string} [opts.token] - API key (X-API-KEY)
30
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
31
+ * @param {string} opts.routeId - Route id (24-char hex ObjectId)
32
+ * @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
32
33
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
34
+ * @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
35
+ * @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
36
+ * @throws 401 Unauthorized
37
+ * @throws 404 ROUTE_NOT_FOUND
38
+ * @throws 500 Internal server error
34
39
  */
35
40
  function get(_ref2) {
36
41
  var token = _ref2.token,
@@ -42,6 +47,7 @@ function segmentInformationTableFactory(_ref) {
42
47
 
43
48
  return client({
44
49
  url: "/segments-information-tables/" + routeId,
50
+ method: "get",
45
51
  params: query,
46
52
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
47
53
  });
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable max-len */
4
+ var _require = require("./../endpoints_helpers.js"),
5
+ authorizationHeaders = _require.authorizationHeaders;
6
+
7
+ /**
8
+ * Body for POST /direct-trip-ids (btrz-api-inventory-trips). See TripIdPostData in post-handler getSpec().
9
+ * @typedef {Object} TripIdPostData
10
+ * @property {string} providerId - Provider id (24-char hex ObjectId)
11
+ * @property {string} routeId - Route id (24-char hex ObjectId)
12
+ * @property {string} scheduleId - Schedule id
13
+ * @property {string} departureDate - Departure date (yyyy-mm-dd)
14
+ * @property {string} fareIds - Fare ids and quantities (e.g. fareId:qty)
15
+ * @property {string} channel - One of: backoffice, agency-backoffice, websales, agency-websales
16
+ * @property {string} productId - Product id (24-char hex ObjectId)
17
+ * @property {string} originId - Origin station id (24-char hex ObjectId)
18
+ * @property {string} destinationId - Destination station id (24-char hex ObjectId)
19
+ * @property {string} [currency] - ISO currency code (optional, for multicurrency)
20
+ */
21
+
22
+ /**
23
+ * Factory for trip-ids API (btrz-api-inventory-trips).
24
+ * @param {Object} deps
25
+ * @param {import("axios").AxiosInstance} deps.client
26
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
27
+ * @returns {{ create: function }}
28
+ */
29
+
30
+
31
+ function tripIdsFactory(_ref) {
32
+ var client = _ref.client,
33
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
34
+
35
+ /**
36
+ * 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 }.
37
+ * @param {Object} opts
38
+ * @param {string} [opts.token] - API key (X-API-KEY)
39
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
40
+ * @param {TripIdPostData|{ tripId: TripIdPostData }} opts.data - Trip parameters (or wrapped in tripId key)
41
+ * @param {Object} [opts.headers] - Optional headers
42
+ * @returns {Promise<import("axios").AxiosResponse<{ tripId: { tripId: string|null } }>>}
43
+ * @throws 400 WRONG_DATA — tripId required or required fields missing
44
+ * @throws 401 Unauthorized
45
+ * @throws 404 TRIP_IDS_NOT_FOUND
46
+ * @throws 500 Internal server error
47
+ */
48
+ function create(_ref2) {
49
+ var token = _ref2.token,
50
+ jwtToken = _ref2.jwtToken,
51
+ data = _ref2.data,
52
+ headers = _ref2.headers;
53
+
54
+ return client({
55
+ url: "/direct-trip-ids",
56
+ method: "post",
57
+ data: data,
58
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
59
+ });
60
+ }
61
+
62
+ return {
63
+ create: create
64
+ };
65
+ }
66
+
67
+ module.exports = tripIdsFactory;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-len */
3
4
  var _require = require("./../endpoints_helpers.js"),
4
5
  authorizationHeaders = _require.authorizationHeaders;
5
6
 
6
7
  /**
7
- * Factory for trips API (btrz-api-inventory).
8
+ * Factory for trips API (btrz-api-inventory-trips).
8
9
  * @param {Object} deps
9
10
  * @param {import("axios").AxiosInstance} deps.client
10
11
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
- * @returns {{ all: function, get: function }}
12
+ * @returns {{ all: function, get: function, getPricingSimulation: function }}
12
13
  */
13
14
 
14
15
 
@@ -17,12 +18,17 @@ function tripsFactory(_ref) {
17
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
19
 
19
20
  /**
20
- * GET /trips - list trips. API source of truth in btrz-api-inventory-trips; query not documented here.
21
+ * 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.).
21
22
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
23
+ * @param {string} [opts.token] - API key (X-API-KEY)
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
25
+ * @param {Object} [opts.query] - Query params (productId, originId, destinationId, fareIds, departureDate, returnDate, etc.)
24
26
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
27
+ * @returns {Promise<import("axios").AxiosResponse<{ trips: { departures: Object[], returns: Object[] } }>>}
28
+ * @throws 400 INVALID_DATE, INVALID_DATE_FORMAT, INVALID_PRODUCTID, INVALID_ORIGIN, INVALID_DESTINATION, INVALID_CHANNEL, INVALID_FARE, INVALID_FAREID, INVALID_MANIFEST_STATUS, WRONG_DATA
29
+ * @throws 401 Unauthorized
30
+ * @throws 409 NO_HIGHER_OR_EQL_PRICE
31
+ * @throws 500 Internal server error
26
32
  */
27
33
  function all(_ref2) {
28
34
  var token = _ref2.token,
@@ -33,32 +39,73 @@ function tripsFactory(_ref) {
33
39
 
34
40
  return client({
35
41
  url: "/trips",
42
+ method: "get",
36
43
  params: query,
37
44
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
38
45
  });
39
46
  }
40
47
 
41
48
  /**
42
- * GET /trip/:id - get trip by id. API does not accept query params.
49
+ * 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.
43
50
  * @param {Object} opts
44
- * @param {string} [opts.token] - API key
45
- * @param {string} opts.id - Trip id
51
+ * @param {string} [opts.token] - API key (X-API-KEY)
52
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
53
+ * @param {string} opts.id - Trip id (base64-encoded)
54
+ * @param {Object} [opts.query] - Optional: extraCapacityImpact, ignoreCutoffs, currency, ignoreOmitByAvailability, includeMoveToTrips
46
55
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ trip: Object }>>}
57
+ * @throws 400 INVALID_TRIP — tripId is invalid
58
+ * @throws 401 Unauthorized
59
+ * @throws 500 Internal server error
48
60
  */
49
61
  function get(_ref3) {
50
62
  var token = _ref3.token,
63
+ jwtToken = _ref3.jwtToken,
51
64
  id = _ref3.id,
65
+ _ref3$query = _ref3.query,
66
+ query = _ref3$query === undefined ? {} : _ref3$query,
52
67
  headers = _ref3.headers;
53
68
 
54
- return client.get("/trip/" + id, {
55
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
69
+ return client({
70
+ url: "/trip/" + id,
71
+ method: "get",
72
+ params: query,
73
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
74
+ });
75
+ }
76
+
77
+ /**
78
+ * GET /trips/pricing-simulation — Get pricing simulation for all purchase combinations for a schedule. Query: scheduleId, productId (required); purchaseDate, travelDate, includeReadable, includeMetadata, minimize (optional).
79
+ * @param {Object} opts
80
+ * @param {string} [opts.token] - API key (X-API-KEY)
81
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
82
+ * @param {Object} [opts.query] - scheduleId, productId (required); purchaseDate, travelDate, includeReadable, includeMetadata, minimize
83
+ * @param {Object} [opts.headers] - Optional headers
84
+ * @returns {Promise<import("axios").AxiosResponse<Object>>} Response shape per PricingSimulationResult definition
85
+ * @throws 400 INVALID_SCHEDULE_ID, INVALID_PRODUCT_ID, INVALID_PRODUCT, ROUTE_NOT_FOUND, ONLY_JP_SUPPORTED, INVALID_DATE
86
+ * @throws 401 Unauthorized, PRICING_SIMULATOR_DISABLED, PROVIDER_UNAUTHORIZED
87
+ * @throws 404 SCHEDULE_NOT_FOUND, NO_MANIFEST
88
+ * @throws 500 Internal server error
89
+ */
90
+ function getPricingSimulation(_ref4) {
91
+ var token = _ref4.token,
92
+ jwtToken = _ref4.jwtToken,
93
+ _ref4$query = _ref4.query,
94
+ query = _ref4$query === undefined ? {} : _ref4$query,
95
+ headers = _ref4.headers;
96
+
97
+ return client({
98
+ url: "/trips/pricing-simulation",
99
+ method: "get",
100
+ params: query,
101
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
56
102
  });
57
103
  }
58
104
 
59
105
  return {
60
106
  all: all,
61
- get: get
107
+ get: get,
108
+ getPricingSimulation: getPricingSimulation
62
109
  };
63
110
  }
64
111
 
@@ -18,13 +18,23 @@ function emailsFactory(_ref) {
18
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
19
 
20
20
  /**
21
- * POST /emails - create/send invoice email. API does not accept query params.
21
+ * POST /emails Send invoice by email to the given addresses.
22
+ * Request body may be sent as root object or under key "email". On success the API emits webhook invoiceemail.created.
23
+ *
22
24
  * @param {Object} opts
23
- * @param {string} [opts.token] - API key
24
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
25
- * @param {Object} opts.data - Request body
25
+ * @param {string} [opts.token] - API key (X-API-KEY)
26
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol (Authorization: Bearer)
27
+ * @param {Object} opts.data - Request body (EmailPostData)
28
+ * @param {string} opts.data.invoiceId - Invoice ID (required, 24-char hex ObjectId)
29
+ * @param {string[]} opts.data.emails - Recipient email addresses (required)
30
+ * @param {string} [opts.data.language] - Language code for template (e.g. "en-us")
31
+ * @param {Object} [opts.query] - Query params (none used by this endpoint)
26
32
  * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ status: "OK" }>>} Resolves with { status: "OK" } on success
34
+ * @throws 400 WRONG_DATA, ACCOUNT_CANT_SEND_EMAILS, NO_VERIFIED_OR_ACTIVE_EMAIL, INVALID_EMAIL_TO_SEND
35
+ * @throws 401 Unauthorized (missing/invalid X-API-KEY or Authorization)
36
+ * @throws 404 INVOICE_NOT_FOUND
37
+ * @throws 500 Internal server error
28
38
  */
29
39
  function create(_ref2) {
30
40
  var token = _ref2.token,
@@ -30,13 +30,15 @@ function invoicesFactory(_ref) {
30
30
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
31
31
 
32
32
  /**
33
- * GET /invoices - list invoices.
33
+ * GET /invoices List invoices by transaction (paginated).
34
34
  * @param {Object} opts
35
- * @param {string} [opts.token] - API key
36
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
37
- * @param {InvoicesListQuery} [opts.query] - Query params (transactionId required)
35
+ * @param {string} [opts.token] - API key (X-API-KEY)
36
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
37
+ * @param {InvoicesListQuery} [opts.query] - Query; transactionId (required) = 24-char hex ObjectId
38
38
  * @param {Object} [opts.headers] - Optional headers
39
- * @returns {Promise<import("axios").AxiosResponse>}
39
+ * @returns {Promise<import("axios").AxiosResponse<{ invoices: Object[], total: number, page?: number, ... }>>}
40
+ * @throws 401 Unauthorized
41
+ * @throws 500 Internal server error
40
42
  */
41
43
  function all(_ref2) {
42
44
  var token = _ref2.token,
@@ -54,13 +56,17 @@ function invoicesFactory(_ref) {
54
56
  }
55
57
 
56
58
  /**
57
- * GET /invoices/:id - get invoice by id. API does not accept query params.
59
+ * GET /invoices/:id Get a single invoice by ID.
58
60
  * @param {Object} opts
59
- * @param {string} [opts.token] - API key
60
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
61
- * @param {string} opts.id - Invoice id
61
+ * @param {string} [opts.token] - API key (X-API-KEY)
62
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
63
+ * @param {string} opts.id - Invoice ID (24-character hex ObjectId)
62
64
  * @param {Object} [opts.headers] - Optional headers
63
- * @returns {Promise<import("axios").AxiosResponse>}
65
+ * @returns {Promise<import("axios").AxiosResponse<{ invoice: Object }>>}
66
+ * @throws 400 WRONG_DATA, INVALID_INVOICE_ID
67
+ * @throws 401 Unauthorized
68
+ * @throws 404 INVOICE_NOT_FOUND
69
+ * @throws 500 Internal server error
64
70
  */
65
71
  function get(_ref3) {
66
72
  var token = _ref3.token,
@@ -79,13 +85,16 @@ function invoicesFactory(_ref) {
79
85
  }
80
86
 
81
87
  /**
82
- * GET /failures - list invoice failures.
88
+ * GET /failures List invoice failures (paginated). Optional transactionId filter.
83
89
  * @param {Object} opts
84
- * @param {string} [opts.token] - API key
85
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
86
- * @param {InvoicesFailuresQuery} [opts.query] - Query params (transactionId optional)
90
+ * @param {string} [opts.token] - API key (X-API-KEY)
91
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
92
+ * @param {InvoicesFailuresQuery} [opts.query] - Query; transactionId optional (24-char hex; if present must be valid)
87
93
  * @param {Object} [opts.headers] - Optional headers
88
- * @returns {Promise<import("axios").AxiosResponse>}
94
+ * @returns {Promise<import("axios").AxiosResponse<{ invoicesFailures: Object[], total: number, ... }>>}
95
+ * @throws 400 WRONG_DATA, INVALID_TRANSACTION_ID (if transactionId provided and invalid)
96
+ * @throws 401 Unauthorized
97
+ * @throws 500 Internal server error
89
98
  */
90
99
  function getInvoicesFailures(_ref4) {
91
100
  var token = _ref4.token,
@@ -103,13 +112,19 @@ function invoicesFactory(_ref) {
103
112
  }
104
113
 
105
114
  /**
106
- * POST /retry - retry invoicing. API does not accept query params.
115
+ * POST /retry Retry invoicing from an invoice failure using saved data. Body: transactionId (required).
116
+ * On success may emit webhooks invoices.created or invoices.updated.
107
117
  * @param {Object} opts
108
- * @param {string} [opts.token] - API key
109
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
110
- * @param {Object} opts.data - Request body
118
+ * @param {string} [opts.token] - API key (X-API-KEY)
119
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
120
+ * @param {Object} opts.data - Body: { transactionId } (transactionId = 24-char hex ObjectId)
111
121
  * @param {Object} [opts.headers] - Optional headers
112
- * @returns {Promise<import("axios").AxiosResponse>}
122
+ * @returns {Promise<import("axios").AxiosResponse<{ invoice: Object }>>}
123
+ * @throws 400 WRONG_DATA, INVOICE_NOT_CREATED, INVOICE_PROVIDER_TYPE_NOT_SUPPORTED, INVOICE_PROVIDER_NOT_FOUND, TRANSACTION_ALREADY_INVOICED
124
+ * @throws 401 Unauthorized
125
+ * @throws 404 TRANSACTION_NOT_FOUND, INVOICE_FAILURE_NOT_FOUND
126
+ * @throws 409 INFILE_SIGN_FAILED, INFILE_CERTIFICATION_FAILED
127
+ * @throws 500 Internal server error
113
128
  */
114
129
  function retryInvoicing(_ref5) {
115
130
  var token = _ref5.token,
@@ -129,13 +144,19 @@ function invoicesFactory(_ref) {
129
144
  }
130
145
 
131
146
  /**
132
- * PUT /retry - override buyer and retry invoicing. API does not accept query params.
147
+ * PUT /retry Override buyer and retry invoicing from an invoice failure. Body: retryData with transactionId and overrideBuyer.
148
+ * On success may emit webhooks invoices.created or invoices.updated.
133
149
  * @param {Object} opts
134
- * @param {string} [opts.token] - API key
135
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
136
- * @param {Object} opts.data - Request body
150
+ * @param {string} [opts.token] - API key (X-API-KEY)
151
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
152
+ * @param {Object} opts.data - Body: { transactionId, overrideBuyer } (RetryPutData); overrideBuyer required when no certified invoice exists
137
153
  * @param {Object} [opts.headers] - Optional headers
138
- * @returns {Promise<import("axios").AxiosResponse>}
154
+ * @returns {Promise<import("axios").AxiosResponse<{ invoice: Object }>>}
155
+ * @throws 400 WRONG_DATA, INVOICE_NOT_CREATED, INVOICE_PROVIDER_TYPE_NOT_SUPPORTED, INVOICE_PROVIDER_NOT_FOUND, TRANSACTION_ALREADY_INVOICED, OVERRIDE_BUYER_IS_MANDATORY
156
+ * @throws 401 Unauthorized
157
+ * @throws 404 TRANSACTION_NOT_FOUND, INVOICE_FAILURE_NOT_FOUND
158
+ * @throws 409 INFILE_SIGN_FAILED, INFILE_CERTIFICATION_FAILED
159
+ * @throws 500 Internal server error
139
160
  */
140
161
  function overrideBuyerRetryInvoicing(_ref6) {
141
162
  var token = _ref6.token,
@@ -6,8 +6,8 @@ var _require = require("./../endpoints_helpers.js"),
6
6
 
7
7
  /**
8
8
  * Query params for GET /pdfs (btrz-api-invoices). See pdfs get-handler getSpec().
9
- * @typedef {Object} PdfsListQuery
10
- * @property {string} transactionId - Transaction id of the invoice (required)
9
+ * @typedef {Object} PdfsQuery
10
+ * @property {string} transactionId - Transaction ID of the invoice (required, 24-char hex ObjectId)
11
11
  */
12
12
 
13
13
  /**
@@ -24,14 +24,21 @@ function pdfsFactory(_ref) {
24
24
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
25
25
 
26
26
  /**
27
- * GET /pdfs - list invoice PDFs.
27
+ * GET /pdfs Returns the invoice PDF for the invoice associated with the given transaction.
28
+ * Response is binary (application/pdf) with Content-Disposition attachment; filename=invoice-{invoiceId}.pdf.
29
+ * Use responseType "blob" or "arraybuffer" to receive binary data.
30
+ *
28
31
  * @param {Object} opts
29
- * @param {string} [opts.token] - API key
30
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
31
- * @param {PdfsListQuery} [opts.query] - Query params (transactionId required)
32
- * @param {string} [opts.responseType] - Response type (e.g. "json", "blob")
32
+ * @param {string} [opts.token] - API key (X-API-KEY)
33
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
34
+ * @param {PdfsQuery} [opts.query] - Query; transactionId (required)
35
+ * @param {string} [opts.responseType] - Response type: "blob" or "arraybuffer" for binary PDF; "json" default
33
36
  * @param {Object} [opts.headers] - Optional headers
34
- * @returns {Promise<import("axios").AxiosResponse>}
37
+ * @returns {Promise<import("axios").AxiosResponse<ArrayBuffer|Blob|*>>} PDF binary when responseType is blob/arraybuffer
38
+ * @throws 400 WRONG_DATA — transactionId is required
39
+ * @throws 401 Unauthorized
40
+ * @throws 404 INVOICE_NOT_FOUND — Invoice not found for the transactionId
41
+ * @throws 500 Internal server error (e.g. unsupported invoice provider type)
35
42
  */
36
43
  function all(_ref2) {
37
44
  var token = _ref2.token,
@@ -28,13 +28,15 @@ function providersFactory(_ref) {
28
28
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
29
29
 
30
30
  /**
31
- * GET /providers - list invoice providers.
31
+ * GET /providers List invoice providers (paginated). Optional filters: enabled, invoiceProviderType, channel, country, operatingCompany.
32
32
  * @param {Object} opts
33
- * @param {string} [opts.token] - API key
34
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
+ * @param {string} [opts.token] - API key (X-API-KEY)
34
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
35
35
  * @param {ProvidersListQuery} [opts.query] - Query params (all optional)
36
36
  * @param {Object} [opts.headers] - Optional headers
37
- * @returns {Promise<import("axios").AxiosResponse>}
37
+ * @returns {Promise<import("axios").AxiosResponse<{ providers: Object[], total?: number, ... }>>}
38
+ * @throws 401 Unauthorized
39
+ * @throws 500 Internal server error
38
40
  */
39
41
  function all(_ref2) {
40
42
  var token = _ref2.token,
@@ -52,13 +54,17 @@ function providersFactory(_ref) {
52
54
  }
53
55
 
54
56
  /**
55
- * GET /providers/:id - get invoice provider by id. API does not accept query params.
57
+ * GET /providers/:id Get a single invoice provider by ID.
56
58
  * @param {Object} opts
57
- * @param {string} [opts.token] - API key
58
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
59
- * @param {string} opts.id - Provider id
59
+ * @param {string} [opts.token] - API key (X-API-KEY)
60
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
61
+ * @param {string} opts.id - Provider ID (24-character hex ObjectId)
60
62
  * @param {Object} [opts.headers] - Optional headers
61
- * @returns {Promise<import("axios").AxiosResponse>}
63
+ * @returns {Promise<import("axios").AxiosResponse<{ provider: Object }>>}
64
+ * @throws 400 WRONG_DATA, INVALID_PROVIDER_ID
65
+ * @throws 401 Unauthorized
66
+ * @throws 404 PROVIDER_NOT_FOUND
67
+ * @throws 500 Internal server error
62
68
  */
63
69
  function get(_ref3) {
64
70
  var token = _ref3.token,
@@ -77,14 +83,18 @@ function providersFactory(_ref) {
77
83
  }
78
84
 
79
85
  /**
80
- * PUT /providers/:id - update invoice provider. API does not accept query params.
86
+ * PUT /providers/:id Update invoice provider. Body may be provider or body.provider. Emits webhook invoice_providers.updated on success.
81
87
  * @param {Object} opts
82
- * @param {string} [opts.token] - API key
83
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
84
- * @param {string} opts.id - Provider id
85
- * @param {Object} opts.data - Request body
88
+ * @param {string} [opts.token] - API key (X-API-KEY)
89
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
90
+ * @param {string} opts.id - Provider ID (24-character hex ObjectId)
91
+ * @param {Object} opts.data - Request body (ProviderPutData)
86
92
  * @param {Object} [opts.headers] - Optional headers
87
- * @returns {Promise<import("axios").AxiosResponse>}
93
+ * @returns {Promise<import("axios").AxiosResponse<{ provider: Object }>>}
94
+ * @throws 400 INVALID_PHRASES, OPERATING_COMPANY_NOT_FOUND, CANNOT_CHANGE_PROVIDER, INVALID_IVA_AFFILIATION, CANT_REMOVE_*, INVALID_PARAM_VALUE, CANT_DELETE_DOCUMENT_TYPE_*
95
+ * @throws 401 Unauthorized
96
+ * @throws 404 PROVIDER_NOT_FOUND
97
+ * @throws 500 Internal server error
88
98
  */
89
99
  function update(_ref4) {
90
100
  var token = _ref4.token,
@@ -105,13 +115,17 @@ function providersFactory(_ref) {
105
115
  }
106
116
 
107
117
  /**
108
- * DELETE /providers/:id - remove invoice provider. API does not accept query params.
118
+ * DELETE /providers/:id Remove invoice provider. Emits webhook invoice_providers.deleted on success.
109
119
  * @param {Object} opts
110
- * @param {string} [opts.token] - API key
111
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
112
- * @param {string} opts.id - Provider id
120
+ * @param {string} [opts.token] - API key (X-API-KEY)
121
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
122
+ * @param {string} opts.id - Provider ID (24-character hex ObjectId)
113
123
  * @param {Object} [opts.headers] - Optional headers
114
- * @returns {Promise<import("axios").AxiosResponse>}
124
+ * @returns {Promise<import("axios").AxiosResponse<{ providerId: string }>>}
125
+ * @throws 400 WRONG_DATA, INVALID_PROVIDER_ID
126
+ * @throws 401 Unauthorized
127
+ * @throws 404 PROVIDER_NOT_FOUND
128
+ * @throws 500 Internal server error
115
129
  */
116
130
  function remove(_ref5) {
117
131
  var token = _ref5.token,
@@ -130,13 +144,16 @@ function providersFactory(_ref) {
130
144
  }
131
145
 
132
146
  /**
133
- * POST /providers - create invoice provider. API does not accept query params.
147
+ * POST /providers Create invoice provider. Body may be provider or body.provider (ProviderPostData). Emits webhook invoice_providers.created on success.
134
148
  * @param {Object} opts
135
- * @param {string} [opts.token] - API key
136
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
137
- * @param {Object} opts.data - Request body
149
+ * @param {string} [opts.token] - API key (X-API-KEY)
150
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
151
+ * @param {Object} opts.data - Request body (ProviderPostData: invoiceProviderType, currencies, params required)
138
152
  * @param {Object} [opts.headers] - Optional headers
139
- * @returns {Promise<import("axios").AxiosResponse>}
153
+ * @returns {Promise<import("axios").AxiosResponse<{ provider: Object }>>}
154
+ * @throws 400 WRONG_DATA, INVALID_PHRASES, REQUIRED_PARAM_MISSING, INVALID_PARAM_VALUE, OPERATING_COMPANY_NOT_FOUND, INVALID_IVA_AFFILIATION
155
+ * @throws 401 Unauthorized
156
+ * @throws 500 Internal server error
140
157
  */
141
158
  function create(_ref6) {
142
159
  var token = _ref6.token,
@@ -9,8 +9,8 @@ var _require = require("./../endpoints_helpers.js"),
9
9
  * @typedef {Object} TaxIdsListQuery
10
10
  * @property {string} taxNumber - Tax number to look up (required)
11
11
  * @property {string} country - ISO code of the country of the tax information (required)
12
- * @property {string} [invoiceProviderId] - Invoice provider id (24 hex chars)
13
- * @property {string} [documentType] - Tax identification type to check against validation service
12
+ * @property {string} [invoiceProviderId] - Invoice provider id (24-char hex ObjectId); optional, for external validation
13
+ * @property {string} [documentType] - Tax identification type for validation (e.g. NIT, DPI for infile)
14
14
  */
15
15
 
16
16
  /**
@@ -27,13 +27,17 @@ function taxIdsFactory(_ref) {
27
27
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
28
28
 
29
29
  /**
30
- * GET /tax-ids - list tax IDs.
30
+ * GET /tax-ids List tax ID information (paginated). Merges internal tax IDs with external provider validation when invoiceProviderId is provided.
31
31
  * @param {Object} opts
32
- * @param {string} [opts.token] - API key
33
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
- * @param {TaxIdsListQuery} opts.query - taxNumber, country; optional invoiceProviderId, documentType
32
+ * @param {string} [opts.token] - API key (X-API-KEY)
33
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
34
+ * @param {TaxIdsListQuery} [opts.query] - taxNumber and country (required); optional invoiceProviderId, documentType
35
35
  * @param {Object} [opts.headers] - Optional headers
36
- * @returns {Promise<import("axios").AxiosResponse>} 400 WRONG_DATA, INVALID_PROVIDER_ID; 404 TAXID_NOT_FOUND
36
+ * @returns {Promise<import("axios").AxiosResponse<{ taxIds: Object[], total?: number, ... }>>}
37
+ * @throws 400 WRONG_DATA, INVALID_PROVIDER_ID, INVALID_TAX_NUMBER, INVALID_PROVIDER_CREDENTIALS
38
+ * @throws 401 Unauthorized
39
+ * @throws 404 TAXID_NOT_FOUND, PROVIDER_NOT_FOUND
40
+ * @throws 500 Internal server error
37
41
  */
38
42
  function all(_ref2) {
39
43
  var token = _ref2.token,