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.
Files changed (160) hide show
  1. package/lib/client-standalone-min.js +3 -3
  2. package/lib/client.js +10 -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/inventory/banks.js +39 -21
  17. package/lib/endpoints/inventory/change-requests.js +59 -31
  18. package/lib/endpoints/inventory/control-classes.js +39 -20
  19. package/lib/endpoints/inventory/countries.js +25 -9
  20. package/lib/endpoints/inventory/custom-content.js +39 -21
  21. package/lib/endpoints/inventory/custom-fields.js +25 -17
  22. package/lib/endpoints/inventory/document-types.js +33 -42
  23. package/lib/endpoints/inventory/external-wallets.js +26 -20
  24. package/lib/endpoints/inventory/fees.js +19 -13
  25. package/lib/endpoints/inventory/filtered-trips.js +34 -8
  26. package/lib/endpoints/inventory/financing-costs.js +19 -14
  27. package/lib/endpoints/inventory/garages.js +19 -14
  28. package/lib/endpoints/inventory/getnet-terminals.js +20 -15
  29. package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
  30. package/lib/endpoints/inventory/holidays.js +158 -0
  31. package/lib/endpoints/inventory/insurances.js +17 -13
  32. package/lib/endpoints/inventory/items.js +13 -9
  33. package/lib/endpoints/inventory/labels.js +16 -11
  34. package/lib/endpoints/inventory/marital-status.js +16 -11
  35. package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
  36. package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
  37. package/lib/endpoints/inventory/mit-terminals.js +16 -11
  38. package/lib/endpoints/inventory/operation-messages.js +18 -12
  39. package/lib/endpoints/inventory/operation-reasons.js +15 -10
  40. package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
  41. package/lib/endpoints/inventory/payment-terminals.js +15 -10
  42. package/lib/endpoints/inventory/products.js +22 -10
  43. package/lib/endpoints/inventory/promos.js +27 -18
  44. package/lib/endpoints/inventory/segments-information-tables.js +13 -7
  45. package/lib/endpoints/inventory/station-groups.js +2 -4
  46. package/lib/endpoints/inventory/taxes.js +11 -2
  47. package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
  48. package/lib/endpoints/inventory/trip-ids.js +67 -0
  49. package/lib/endpoints/inventory/trips.js +60 -13
  50. package/lib/endpoints/inventory/vehicle-types.js +2 -5
  51. package/lib/endpoints/inventory/vehicles.js +4 -2
  52. package/lib/endpoints/invoices/emails.js +15 -5
  53. package/lib/endpoints/invoices/invoices.js +46 -25
  54. package/lib/endpoints/invoices/pdfs.js +15 -8
  55. package/lib/endpoints/invoices/providers.js +42 -25
  56. package/lib/endpoints/invoices/tax-ids.js +11 -7
  57. package/lib/endpoints/notifications/customers.js +1 -1
  58. package/lib/endpoints/notifications/external-customers.js +54 -0
  59. package/lib/endpoints/notifications/pdfs.js +0 -3
  60. package/lib/endpoints/operations/accounting_items.js +7 -1
  61. package/lib/endpoints/operations/flexpasses.js +9 -7
  62. package/lib/endpoints/operations/gift-certificates.js +53 -0
  63. package/lib/endpoints/operations/loans.js +16 -10
  64. package/lib/endpoints/operations/movements.js +17 -6
  65. package/lib/endpoints/operations/pago-express.js +96 -0
  66. package/lib/endpoints/operations/parcels.js +11 -11
  67. package/lib/endpoints/operations/parcels_manifests.js +7 -4
  68. package/lib/endpoints/sales/cancellations.js +43 -31
  69. package/lib/endpoints/sales/cart.js +21 -18
  70. package/lib/endpoints/sales/flexpasses.js +2 -5
  71. package/lib/endpoints/sales/order.js +41 -7
  72. package/lib/endpoints/sales/parcel-quotes.js +2 -2
  73. package/package.json +1 -1
  74. package/src/client.js +10 -2
  75. package/src/endpoints/btrzpay/adyen.js +44 -0
  76. package/src/endpoints/btrzpay/cardpointe.js +6 -4
  77. package/src/endpoints/btrzpay/customerCards.js +19 -19
  78. package/src/endpoints/btrzpay/customers.js +13 -13
  79. package/src/endpoints/btrzpay/cybersource3ds.js +114 -0
  80. package/src/endpoints/btrzpay/datalogic.js +63 -28
  81. package/src/endpoints/btrzpay/oxxo.js +53 -26
  82. package/src/endpoints/btrzpay/prismaTerminals.js +24 -15
  83. package/src/endpoints/btrzpay/referenced-payments.js +4 -4
  84. package/src/endpoints/btrzpay/square.js +8 -8
  85. package/src/endpoints/btrzpay/stripe-terminals.js +17 -10
  86. package/src/endpoints/btrzpay/stripe3ds.js +40 -0
  87. package/src/endpoints/btrzpay/terminalPayments.js +19 -19
  88. package/src/endpoints/inventory/banks.js +39 -21
  89. package/src/endpoints/inventory/change-requests.js +59 -31
  90. package/src/endpoints/inventory/control-classes.js +39 -20
  91. package/src/endpoints/inventory/countries.js +25 -10
  92. package/src/endpoints/inventory/custom-content.js +39 -22
  93. package/src/endpoints/inventory/custom-fields.js +25 -19
  94. package/src/endpoints/inventory/document-types.js +34 -33
  95. package/src/endpoints/inventory/external-wallets.js +25 -20
  96. package/src/endpoints/inventory/fees.js +19 -14
  97. package/src/endpoints/inventory/filtered-trips.js +29 -8
  98. package/src/endpoints/inventory/financing-costs.js +19 -14
  99. package/src/endpoints/inventory/garages.js +19 -14
  100. package/src/endpoints/inventory/getnet-terminals.js +20 -15
  101. package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
  102. package/src/endpoints/inventory/holidays.js +121 -0
  103. package/src/endpoints/inventory/insurances.js +17 -13
  104. package/src/endpoints/inventory/items.js +13 -9
  105. package/src/endpoints/inventory/labels.js +16 -11
  106. package/src/endpoints/inventory/marital-status.js +16 -11
  107. package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
  108. package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
  109. package/src/endpoints/inventory/mit-terminals.js +16 -11
  110. package/src/endpoints/inventory/operation-messages.js +18 -12
  111. package/src/endpoints/inventory/operation-reasons.js +15 -10
  112. package/src/endpoints/inventory/pay-on-accounts.js +5 -4
  113. package/src/endpoints/inventory/payment-terminals.js +15 -10
  114. package/src/endpoints/inventory/products.js +22 -10
  115. package/src/endpoints/inventory/promos.js +27 -18
  116. package/src/endpoints/inventory/segments-information-tables.js +13 -7
  117. package/src/endpoints/inventory/station-groups.js +2 -4
  118. package/src/endpoints/inventory/taxes.js +11 -2
  119. package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
  120. package/src/endpoints/inventory/trip-ids.js +54 -0
  121. package/src/endpoints/inventory/trips.js +52 -14
  122. package/src/endpoints/inventory/vehicle-types.js +3 -4
  123. package/src/endpoints/inventory/vehicles.js +4 -3
  124. package/src/endpoints/invoices/emails.js +15 -5
  125. package/src/endpoints/invoices/invoices.js +46 -25
  126. package/src/endpoints/invoices/pdfs.js +15 -8
  127. package/src/endpoints/invoices/providers.js +42 -25
  128. package/src/endpoints/invoices/tax-ids.js +11 -7
  129. package/src/endpoints/notifications/customers.js +1 -1
  130. package/src/endpoints/notifications/external-customers.js +41 -0
  131. package/src/endpoints/notifications/pdfs.js +0 -3
  132. package/src/endpoints/operations/accounting_items.js +7 -2
  133. package/src/endpoints/operations/flexpasses.js +9 -7
  134. package/src/endpoints/operations/gift-certificates.js +39 -0
  135. package/src/endpoints/operations/loans.js +16 -11
  136. package/src/endpoints/operations/movements.js +17 -6
  137. package/src/endpoints/operations/pago-express.js +73 -0
  138. package/src/endpoints/operations/parcels.js +11 -11
  139. package/src/endpoints/operations/parcels_manifests.js +7 -5
  140. package/src/endpoints/sales/cancellations.js +43 -31
  141. package/src/endpoints/sales/cart.js +20 -18
  142. package/src/endpoints/sales/flexpasses.js +3 -4
  143. package/src/endpoints/sales/order.js +34 -7
  144. package/src/endpoints/sales/parcel-quotes.js +2 -2
  145. package/test/endpoints/btrzpay/adyen.tests.js +27 -0
  146. package/test/endpoints/btrzpay/carpointe.tests.js +14 -0
  147. package/test/endpoints/btrzpay/customerCards.test.js +9 -6
  148. package/test/endpoints/btrzpay/cybersource3ds.tests.js +55 -0
  149. package/test/endpoints/btrzpay/stripe-terminals.tests.js +5 -6
  150. package/test/endpoints/btrzpay/stripe3ds.tests.js +31 -0
  151. package/test/endpoints/inventory/banks.test.js +8 -10
  152. package/test/endpoints/inventory/filtered-trips.test.js +6 -0
  153. package/test/endpoints/inventory/holidays.test.js +52 -0
  154. package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
  155. package/test/endpoints/inventory/trip-ids.test.js +27 -0
  156. package/test/endpoints/inventory/trips.test.js +19 -14
  157. package/test/endpoints/notifications/external-customers.test.js +30 -0
  158. package/test/endpoints/operations/gift_certificates.test.js +37 -0
  159. package/test/endpoints/operations/operations.test.js +30 -0
  160. package/test/endpoints/sales/order.test.js +7 -1
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ /* eslint-disable max-len */
4
+ var _require = require("../endpoints_helpers.js"),
5
+ authorizationHeaders = _require.authorizationHeaders;
6
+
7
+ /**
8
+ * Request body for POST /stripe-payment-intent (btrz-api-payments). PaymentIntentPostData.
9
+ * @typedef {Object} PaymentIntentPostData
10
+ * @property {string} providerName - Provider name (e.g. "stripe") used to resolve the payment method with Stripe 3DS
11
+ * @property {Object} data - Payment data: card details, amount, currency, transactionId, customer info, etc.
12
+ */
13
+
14
+ /**
15
+ * Factory for Stripe 3DS API (btrz-api-payments): create Stripe Payment Intent for 3DS flows.
16
+ * @param {Object} deps
17
+ * @param {import("axios").AxiosInstance} deps.client
18
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
19
+ * @returns {{ createPaymentIntent: function }}
20
+ */
21
+
22
+
23
+ function stripe3dsFactory(_ref) {
24
+ var client = _ref.client,
25
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
26
+
27
+ /**
28
+ * POST /stripe-payment-intent - creates a Stripe Payment Intent for 3DS; returns requires_action and payment_intent_client_secret.
29
+ * @param {Object} opts
30
+ * @param {string} [opts.token] - API key
31
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
+ * @param {string} opts.providerName - Provider name (e.g. "stripe")
33
+ * @param {Object} opts.data - Payment data (card, amount, currency, transactionId, etc.)
34
+ * @param {Object} [opts.headers] - Optional request headers
35
+ * @returns {Promise<import("axios").AxiosResponse<{ requires_action: boolean, payment_intent_client_secret: string }>>} PaymentIntentResponse. Rejects with 400 (WRONG_DATA, PAYMENT_INTENT_MISSING_PAYMENT_DATA, PAYMENT_INTENT_MISSING_PROVIDER, PROVIDER_NOT_FOUND, MISSING_PAYMENT_METHOD_PARAMS, PAYMENT_METHOD_NOT_FOUND, STRIPE_MISSING_PRIVATE_KEY, MISSING_PAYMENT_DATA), 401, 500.
36
+ */
37
+ function createPaymentIntent(_ref2) {
38
+ var token = _ref2.token,
39
+ jwtToken = _ref2.jwtToken,
40
+ providerName = _ref2.providerName,
41
+ data = _ref2.data,
42
+ headers = _ref2.headers;
43
+
44
+ return client.post("/stripe-payment-intent", { providerName: providerName, data: data }, {
45
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
46
+ });
47
+ }
48
+
49
+ return {
50
+ createPaymentIntent: createPaymentIntent
51
+ };
52
+ }
53
+
54
+ module.exports = stripe3dsFactory;
@@ -6,10 +6,10 @@ var _require = require("../endpoints_helpers.js"),
6
6
  /**
7
7
  * Query params for GET /terminal-payments/mit/:id (btrz-api-payments). See get-mit-by-id-handler getSpec().
8
8
  * @typedef {Object} TerminalPaymentsMitGetQuery
9
- * @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers
10
- * @property {string} [branchId] - Branch id where payment started (required for GET)
11
- * @property {string} [companyId] - Company id where payment started (required for GET)
12
- * @property {string} [date] - Date when payment started; format dd/mm/yyyy (required for GET)
9
+ * @property {string} [providerId] - Account provider (operator) ID; used by agencies/sellers; when omitted, authenticated account is used
10
+ * @property {string} branchId - Branch id where payment started (required). Example: 00676
11
+ * @property {string} companyId - Company id where payment started (required). Example: Z890
12
+ * @property {string} date - Date when payment started; format dd/mm/yyyy (required)
13
13
  */
14
14
 
15
15
  /**
@@ -33,15 +33,15 @@ function terminalPaymentsFactory(_ref) {
33
33
 
34
34
  var mit = {
35
35
  /**
36
- * PUT /terminal-payments/mit/:id - update MIT terminal payment.
36
+ * PUT /terminal-payments/mit/:terminalPaymentId - complete MIT terminal payment with result from terminal.
37
37
  * @param {Object} opts
38
38
  * @param {string} [opts.token] - API key
39
39
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
40
- * @param {string} opts.id - Terminal payment id
41
- * @param {Object} opts.terminalPayment - Terminal payment payload
42
- * @param {TerminalPaymentsMitPutQuery} [opts.query] - Query params (providerId)
40
+ * @param {string} opts.id - Terminal payment ID (UUID)
41
+ * @param {{ result?: Object, paymentRequest: Object, orderId: string }} opts.terminalPayment - Terminal payment data (result, paymentRequest, orderId)
42
+ * @param {TerminalPaymentsMitPutQuery} [opts.query] - Optional providerId
43
43
  * @param {Object} [opts.headers] - Optional headers
44
- * @returns {Promise<import("axios").AxiosResponse>}
44
+ * @returns {Promise<import("axios").AxiosResponse<{ terminalPayment: Object }>>} Rejects with 400 (WRONG_DATA, INVALID_TERMINALPAYMENT_ID, INVALID_RESULT_OBJECT, MIT_*), 401, 404 (TERMINALPAYMENT_NOT_FOUND, MIT_PAYMENT_NOT_FOUND), 409 (CANT_UPDATE_ORDER), 500.
45
45
  */
46
46
  update: function update(_ref2) {
47
47
  var token = _ref2.token,
@@ -62,14 +62,14 @@ function terminalPaymentsFactory(_ref) {
62
62
  },
63
63
 
64
64
  /**
65
- * GET /terminal-payments/mit/:id - get MIT terminal payment.
65
+ * GET /terminal-payments/mit/:terminalPaymentId - get MIT terminal payment result from MIT servers.
66
66
  * @param {Object} opts
67
67
  * @param {string} [opts.token] - API key
68
68
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
69
- * @param {string} opts.id - Terminal payment id
70
- * @param {TerminalPaymentsMitGetQuery} [opts.query] - Query params (providerId, branchId, companyId, date)
69
+ * @param {string} opts.id - Terminal payment ID (UUID)
70
+ * @param {TerminalPaymentsMitGetQuery} opts.query - branchId, companyId, date (required); optional providerId
71
71
  * @param {Object} [opts.headers] - Optional headers
72
- * @returns {Promise<import("axios").AxiosResponse>}
72
+ * @returns {Promise<import("axios").AxiosResponse<{ terminalPayment: Object }>>} Rejects with 400 (WRONG_DATA, INVALID_TERMINALPAYMENT_ID, INVALID_DATE, MIT_*), 401, 404 (TERMINALPAYMENT_NOT_FOUND, MIT_PAYMENT_NOT_FOUND), 500.
73
73
  */
74
74
  get: function get(_ref3) {
75
75
  var token = _ref3.token,
@@ -88,14 +88,14 @@ function terminalPaymentsFactory(_ref) {
88
88
 
89
89
  var webhooks = {
90
90
  /**
91
- * POST /terminal-payments/webhooks/getnet/:providerId - Getnet webhook. API does not accept query params.
91
+ * POST /terminal-payments/webhooks/getnet/:providerId - Getnet Terminal webhook (inbound). API does not accept query params.
92
92
  * @param {Object} opts
93
- * @param {Object} opts.data - Request body
94
- * @param {string} opts.providerId - Provider id
93
+ * @param {Object} opts.data - Getnet webhook payload (e.g. TrxResult, TrxReference, userId)
94
+ * @param {string} opts.providerId - Provider (account) ID for getnet_terminal payment method
95
95
  * @param {Object} [opts.headers] - Optional headers
96
- * @param {string} [opts.token] - API key
97
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
98
- * @returns {Promise<import("axios").AxiosResponse>}
96
+ * @param {string} [opts.token] - API key (optional when no userId in payload)
97
+ * @param {string} [opts.jwtToken] - JWT or internal auth (required when userId is in payload)
98
+ * @returns {Promise<import("axios").AxiosResponse<{ status: string }>>} Rejects with 400 (INVALID_WEBHOOK_PAYLOAD), 401 (when userId present but not authenticated), 404 (PAYMENT_NOT_FOUND_FOR_WEBHOOK_EVENT, PAYMENT_METHOD_NOT_FOUND, USER_NOT_FOUND), 409 (CANT_UPDATE_ORDER), 500.
99
99
  */
100
100
  getnet: function getnet(_ref4) {
101
101
  var data = _ref4.data,
@@ -17,12 +17,15 @@ function banksFactory(_ref) {
17
17
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
18
 
19
19
  /**
20
- * GET /banks - list banks. API does not accept query params.
20
+ * GET /banks List banks for the account. Paginated; optional page query param (1-based).
21
21
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
+ * @param {string} [opts.token] - API key (X-API-KEY)
23
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
24
+ * @param {Object} [opts.query] - Query params: page (1-based page number)
24
25
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ banks: Object[], count: number, next: string, previous: string }>>}
27
+ * @throws 401 Unauthorized
28
+ * @throws 500 Internal server error
26
29
  */
27
30
  function all(_ref2) {
28
31
  var token = _ref2.token,
@@ -38,13 +41,17 @@ function banksFactory(_ref) {
38
41
  }
39
42
 
40
43
  /**
41
- * GET /banks/:bankId - get bank by id. API does not accept query params.
44
+ * GET /banks/:bankId Get a single bank by ID (24 hex characters).
42
45
  * @param {Object} opts
43
46
  * @param {string} [opts.token] - API key
44
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
- * @param {string} opts.bankId - Bank id
47
+ * @param {string} [opts.jwtToken] - JWT or internal auth
48
+ * @param {string} opts.bankId - Bank id (24 hex characters)
46
49
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
50
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
51
+ * @throws 400 INVALID_BANK_ID
52
+ * @throws 401 Unauthorized
53
+ * @throws 404 BANK_NOT_FOUND
54
+ * @throws 500 Internal server error
48
55
  */
49
56
  function get(_ref3) {
50
57
  var bankId = _ref3.bankId,
@@ -58,13 +65,16 @@ function banksFactory(_ref) {
58
65
  }
59
66
 
60
67
  /**
61
- * POST /banks - create bank. API does not accept query params.
68
+ * POST /banks Create a bank. Body: BankPostData (name, accountNumbers required; optional depositAlgorithmCode).
62
69
  * @param {Object} opts
63
70
  * @param {string} [opts.token] - API key
64
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
- * @param {Object} opts.bank - Bank payload
71
+ * @param {string} [opts.jwtToken] - JWT or internal auth
72
+ * @param {Object} opts.bank - Bank payload (name, accountNumbers; each accountNumber: number, currency, alias)
66
73
  * @param {Object} [opts.headers] - Optional headers
67
- * @returns {Promise<import("axios").AxiosResponse>}
74
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
75
+ * @throws 400 WRONG_DATA, STATION_INVALID_COST_CENTER
76
+ * @throws 401 Unauthorized
77
+ * @throws 500 Internal server error
68
78
  */
69
79
  function create(_ref4) {
70
80
  var jwtToken = _ref4.jwtToken,
@@ -83,13 +93,17 @@ function banksFactory(_ref) {
83
93
  }
84
94
 
85
95
  /**
86
- * DELETE /banks/:bankId - remove bank. API does not accept query params.
96
+ * DELETE /banks/:bankId Delete a bank by ID.
87
97
  * @param {Object} opts
88
98
  * @param {string} [opts.token] - API key
89
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
90
- * @param {string} opts.bankId - Bank id
99
+ * @param {string} [opts.jwtToken] - JWT or internal auth
100
+ * @param {string} opts.bankId - Bank id (24 hex characters)
91
101
  * @param {Object} [opts.headers] - Optional headers
92
- * @returns {Promise<import("axios").AxiosResponse>}
102
+ * @returns {Promise<import("axios").AxiosResponse<{ bankId: string }>>}
103
+ * @throws 400 BANK_ID
104
+ * @throws 401 Unauthorized
105
+ * @throws 404 BANK_NOT_FOUND
106
+ * @throws 500 Internal server error
93
107
  */
94
108
  function remove(_ref5) {
95
109
  var jwtToken = _ref5.jwtToken,
@@ -105,14 +119,18 @@ function banksFactory(_ref) {
105
119
  }
106
120
 
107
121
  /**
108
- * PUT /banks/:bankId - update bank. API does not accept query params.
122
+ * PUT /banks/:bankId Update a bank by ID. Body: BankPostData (name, accountNumbers required).
109
123
  * @param {Object} opts
110
124
  * @param {string} [opts.token] - API key
111
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
112
- * @param {string} opts.bankId - Bank id
113
- * @param {Object} opts.bank - Bank payload
125
+ * @param {string} [opts.jwtToken] - JWT or internal auth
126
+ * @param {string} opts.bankId - Bank id (24 hex characters)
127
+ * @param {Object} opts.bank - Bank payload (name, accountNumbers; each accountNumber: number, currency, alias)
114
128
  * @param {Object} [opts.headers] - Optional headers
115
- * @returns {Promise<import("axios").AxiosResponse>}
129
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
130
+ * @throws 400 WRONG_DATA, STATION_INVALID_COST_CENTER
131
+ * @throws 401 Unauthorized
132
+ * @throws 404 BANK_NOT_FOUND
133
+ * @throws 500 Internal server error
116
134
  */
117
135
  function update(_ref6) {
118
136
  var jwtToken = _ref6.jwtToken,
@@ -33,13 +33,16 @@ function changeRequestsFactory(_ref) {
33
33
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
34
34
 
35
35
  /**
36
- * GET /change-requests - list change requests.
36
+ * GET /change-requests List change requests with optional filters and pagination.
37
37
  * @param {Object} opts
38
- * @param {string} [opts.token] - API key
39
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
40
- * @param {ChangeRequestsListQuery} [opts.query] - Query params
38
+ * @param {string} [opts.token] - API key (X-API-KEY)
39
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
40
+ * @param {ChangeRequestsListQuery} [opts.query] - Query params (type, status, createdBy, from, to, etc.)
41
41
  * @param {Object} [opts.headers] - Optional headers
42
- * @returns {Promise<import("axios").AxiosResponse>}
42
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequests: Object[], count: number, next: string, previous: string }>>}
43
+ * @throws 400 INVALID_PAGE, INVALID_TYPE_PARAMETER, INVALID_STATUS_PARAMETER, etc.
44
+ * @throws 401 Unauthorized
45
+ * @throws 500 Internal server error
43
46
  */
44
47
  function all(_ref2) {
45
48
  var token = _ref2.token,
@@ -55,13 +58,18 @@ function changeRequestsFactory(_ref) {
55
58
  }
56
59
 
57
60
  /**
58
- * GET /change-requests/:changerequestId/manifests - get change request manifests. API does not accept query params.
61
+ * GET /change-requests/:changerequestId/manifests Get manifest change request by ID. Requires multipleManifestEditing.
59
62
  * @param {Object} opts
60
63
  * @param {string} [opts.token] - API key
61
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
62
- * @param {string} opts.changerequestId - Change request id
64
+ * @param {string} [opts.jwtToken] - JWT or internal auth
65
+ * @param {string} opts.changerequestId - Change request id (24 hex characters)
63
66
  * @param {Object} [opts.headers] - Optional headers
64
- * @returns {Promise<import("axios").AxiosResponse>}
67
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
68
+ * @throws 400 INVALID_CHANGEREQUEST_ID, FAILED_TO_FETCH_OPERATION_SETTINGS
69
+ * @throws 401 Unauthorized
70
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
71
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
72
+ * @throws 500 Internal server error
65
73
  */
66
74
  function get(_ref3) {
67
75
  var changerequestId = _ref3.changerequestId,
@@ -79,13 +87,17 @@ function changeRequestsFactory(_ref) {
79
87
  }
80
88
 
81
89
  /**
82
- * POST /change-requests/manifests - create change request manifest. API does not accept query params.
90
+ * POST /change-requests/manifests Create manifest change request. Emits changeRequests.manifests.created.
83
91
  * @param {Object} opts
84
92
  * @param {string} [opts.token] - API key
85
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
86
- * @param {Object} opts.data - Manifest payload
93
+ * @param {string} [opts.jwtToken] - JWT or internal auth
94
+ * @param {Object} opts.data - Manifest change request payload (manifestId, request, routeId, scheduleId, date, etc.)
87
95
  * @param {Object} [opts.headers] - Optional headers
88
- * @returns {Promise<import("axios").AxiosResponse>}
96
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
97
+ * @throws 400 WRONG_DATA, FAILED_TO_FETCH_OPERATION_SETTINGS, MANIFEST_NOT_FOUND, etc.
98
+ * @throws 401 Unauthorized
99
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
100
+ * @throws 500 Internal server error
89
101
  */
90
102
  function create(_ref4) {
91
103
  var data = _ref4.data,
@@ -102,14 +114,19 @@ function changeRequestsFactory(_ref) {
102
114
  }
103
115
 
104
116
  /**
105
- * PUT /change-requests/:changerequestId/manifests - update change request manifest. API does not accept query params.
117
+ * PUT /change-requests/:changerequestId/manifests Update manifest change request. Emits changeRequests.manifests.updated.
106
118
  * @param {Object} opts
107
119
  * @param {string} [opts.token] - API key
108
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
109
- * @param {string} opts.changerequestId - Change request id
110
- * @param {Object} opts.data - Manifest payload
120
+ * @param {string} [opts.jwtToken] - JWT or internal auth
121
+ * @param {string} opts.changerequestId - Change request id (24 hex characters)
122
+ * @param {Object} opts.data - Update payload (status: 'approved' or 'rejected')
111
123
  * @param {Object} [opts.headers] - Optional headers
112
- * @returns {Promise<import("axios").AxiosResponse>}
124
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
125
+ * @throws 400 WRONG_DATA, CHANGEREQUEST_STATUS_NOT_PENDING, etc.
126
+ * @throws 401 Unauthorized
127
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
128
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
129
+ * @throws 500 Internal server error
113
130
  */
114
131
  function update(_ref5) {
115
132
  var changerequestId = _ref5.changerequestId,
@@ -129,13 +146,17 @@ function changeRequestsFactory(_ref) {
129
146
  /** @type {{ get: function, create: function, update: function }} */
130
147
  var schedules = {
131
148
  /**
132
- * GET /change-requests/:changeRequestId/schedules - get change request schedules. API does not accept query params.
149
+ * GET /change-requests/:changeRequestId/schedules Get schedule change request by ID.
133
150
  * @param {Object} opts
134
151
  * @param {string} [opts.token] - API key
135
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
136
- * @param {string} opts.changeRequestId - Change request id
152
+ * @param {string} [opts.jwtToken] - JWT or internal auth
153
+ * @param {string} opts.changeRequestId - Change request id (24 hex characters)
137
154
  * @param {Object} [opts.headers] - Optional headers
138
- * @returns {Promise<import("axios").AxiosResponse>}
155
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
156
+ * @throws 400 INVALID_CHANGEREQUEST_ID, FAILED_TO_FETCH_OPERATION_SETTINGS, etc.
157
+ * @throws 401 Unauthorized
158
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
159
+ * @throws 500 Internal server error
139
160
  */
140
161
  get: function get(_ref6) {
141
162
  var changeRequestId = _ref6.changeRequestId,
@@ -154,13 +175,16 @@ function changeRequestsFactory(_ref) {
154
175
 
155
176
 
156
177
  /**
157
- * POST /change-requests/schedules - create change request schedule. API does not accept query params.
178
+ * POST /change-requests/schedules Create a schedule change request. Emits webhook changeRequests.schedules.created.
158
179
  * @param {Object} opts
159
180
  * @param {string} [opts.token] - API key
160
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
161
- * @param {Object} opts.data - Schedule payload
181
+ * @param {string} [opts.jwtToken] - JWT or internal auth
182
+ * @param {Object} opts.data - Schedule change request payload (request, routeId, scheduleId, legs, etc.)
162
183
  * @param {Object} [opts.headers] - Optional headers
163
- * @returns {Promise<import("axios").AxiosResponse>}
184
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
185
+ * @throws 400 WRONG_DATA, FAILED_TO_FETCH_OPERATION_SETTINGS, etc.
186
+ * @throws 401 Unauthorized
187
+ * @throws 500 Internal server error
164
188
  */
165
189
  create: function create(_ref7) {
166
190
  var data = _ref7.data,
@@ -178,14 +202,18 @@ function changeRequestsFactory(_ref) {
178
202
 
179
203
 
180
204
  /**
181
- * PUT /change-requests/:changeRequestId/schedules - update change request schedule. API does not accept query params.
205
+ * PUT .../schedules Update schedule change request (approve/reject). Emits changeRequests.schedules.updated.
182
206
  * @param {Object} opts
183
207
  * @param {string} [opts.token] - API key
184
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
185
- * @param {string} opts.changeRequestId - Change request id
186
- * @param {Object} opts.data - Schedule payload
208
+ * @param {string} [opts.jwtToken] - JWT or internal auth
209
+ * @param {string} opts.changeRequestId - Change request id (24 hex characters)
210
+ * @param {Object} opts.data - Update payload (status: 'approved' or 'rejected')
187
211
  * @param {Object} [opts.headers] - Optional headers
188
- * @returns {Promise<import("axios").AxiosResponse>}
212
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
213
+ * @throws 400 WRONG_DATA, CHANGEREQUEST_STATUS_NOT_PENDING, etc.
214
+ * @throws 401 Unauthorized
215
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
216
+ * @throws 500 Internal server error
189
217
  */
190
218
  update: function update(_ref8) {
191
219
  var changeRequestId = _ref8.changeRequestId,
@@ -47,13 +47,17 @@ function controlClassesFactory(_ref) {
47
47
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
48
48
 
49
49
  /**
50
- * GET /control-classes - list control classes.
50
+ * GET /control-classes List control class roots (paginated). Emits no webhooks.
51
51
  * @param {Object} opts
52
52
  * @param {string} [opts.token] - API key
53
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
53
+ * @param {string} [opts.jwtToken] - JWT or internal auth
54
54
  * @param {ControlClassesListQuery} [opts.query] - Query params
55
55
  * @param {Object} [opts.headers] - Optional headers
56
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClasses: Object[], authorizationsEnabled?: boolean }>>}
57
+ * @throws 400 INVALID_PAGE, INVALID_SCHEDULE_ID, INVALID_ASSIGNED_SCHEDULE_ID
58
+ * @throws 401 Unauthorized
59
+ * @throws 404 SCHEDULE_NOT_FOUND
60
+ * @throws 500 Internal server error
57
61
  */
58
62
  function all(_ref2) {
59
63
  var token = _ref2.token,
@@ -69,14 +73,18 @@ function controlClassesFactory(_ref) {
69
73
  }
70
74
 
71
75
  /**
72
- * GET /control-classes/:controlClassId - get control class by id.
76
+ * GET /control-classes/:controlClassId Get one control class (optional tree, schedules).
73
77
  * @param {Object} opts
74
78
  * @param {string} [opts.token] - API key
75
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
76
- * @param {string} opts.controlClassId - Control class id
79
+ * @param {string} [opts.jwtToken] - JWT or internal auth
80
+ * @param {string} opts.controlClassId - Control class id (24 hex)
77
81
  * @param {ControlClassGetQuery} [opts.query] - Query params (tree, scheduleId, etc.)
78
82
  * @param {Object} [opts.headers] - Optional headers
79
- * @returns {Promise<import("axios").AxiosResponse>}
83
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass, root?, parent?, siblings?, children?, schedules?, tree? }>>}
84
+ * @throws 400 INVALID_CONTROLCLASS_ID
85
+ * @throws 401 Unauthorized
86
+ * @throws 404 CONTROLCLASS_NOT_FOUND
87
+ * @throws 500 Internal server error
80
88
  */
81
89
  function get(_ref3) {
82
90
  var controlClassId = _ref3.controlClassId,
@@ -93,13 +101,16 @@ function controlClassesFactory(_ref) {
93
101
  }
94
102
 
95
103
  /**
96
- * POST /control-classes - create control class. API does not accept query params.
104
+ * POST /control-classes Create control class. Body: { controlClass }. Emits controlclasses.created.
97
105
  * @param {Object} opts
98
106
  * @param {string} [opts.token] - API key
99
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
100
- * @param {Object} opts.controlClass - Control class payload
107
+ * @param {string} [opts.jwtToken] - JWT or internal auth
108
+ * @param {Object} opts.controlClass - ControlClassData (name, props required)
101
109
  * @param {Object} [opts.headers] - Optional headers
102
- * @returns {Promise<import("axios").AxiosResponse>}
110
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass: Object }>>}
111
+ * @throws 400 WRONG_DATA, DUPLICATE_CLASS_NAME, NO_ROOT_PROPS, PARENT_CLASS_NOT_FOUND, etc.
112
+ * @throws 401 Unauthorized
113
+ * @throws 500 Internal server error
103
114
  */
104
115
  function create(_ref4) {
105
116
  var jwtToken = _ref4.jwtToken,
@@ -118,13 +129,17 @@ function controlClassesFactory(_ref) {
118
129
  }
119
130
 
120
131
  /**
121
- * DELETE /control-classes/:controlClassId - remove control class.
132
+ * DELETE /control-classes/:controlClassId Delete control class. Emits controlclasses.deleted.
122
133
  * @param {Object} opts
123
134
  * @param {string} [opts.token] - API key
124
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
125
- * @param {string} opts.controlClassId - Control class id
135
+ * @param {string} [opts.jwtToken] - JWT or internal auth
136
+ * @param {string} opts.controlClassId - Control class id (24 hex)
126
137
  * @param {Object} [opts.headers] - Optional headers
127
- * @returns {Promise<import("axios").AxiosResponse>}
138
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassId: string }>>}
139
+ * @throws 400 INVALID_CONTROLCLASS_ID, CANNOT_DELETE_CLASS_WITH_CHILDREN
140
+ * @throws 401 Unauthorized
141
+ * @throws 404 CONTROLCLASS_NOT_FOUND
142
+ * @throws 500 Internal server error
128
143
  */
129
144
  function remove(_ref5) {
130
145
  var jwtToken = _ref5.jwtToken,
@@ -140,14 +155,18 @@ function controlClassesFactory(_ref) {
140
155
  }
141
156
 
142
157
  /**
143
- * PUT /control-classes/:controlClassId - update control class. API does not accept query params.
158
+ * PUT /control-classes/:controlClassId Update control class. Body: { controlClass }. Emits controlclasses.updated.
144
159
  * @param {Object} opts
145
160
  * @param {string} [opts.token] - API key
146
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
147
- * @param {string} opts.controlClassId - Control class id
148
- * @param {Object} opts.controlClass - Control class payload
161
+ * @param {string} [opts.jwtToken] - JWT or internal auth
162
+ * @param {string} opts.controlClassId - Control class id (24 hex)
163
+ * @param {Object} opts.controlClass - ControlClassData (name, props required)
149
164
  * @param {Object} [opts.headers] - Optional headers
150
- * @returns {Promise<import("axios").AxiosResponse>}
165
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass: Object }>>}
166
+ * @throws 400 WRONG_DATA, INVALID_CONTROLCLASS_ID, DUPLICATE_CLASS_NAME, etc.
167
+ * @throws 401 Unauthorized
168
+ * @throws 404 CONTROLCLASS_NOT_FOUND
169
+ * @throws 500 Internal server error
151
170
  */
152
171
  function update(_ref6) {
153
172
  var jwtToken = _ref6.jwtToken,
@@ -6,7 +6,14 @@ var _require = require("./../endpoints_helpers.js"),
6
6
  /**
7
7
  * Query params for GET /countries (btrz-api-inventory). See get-countries getSpec().
8
8
  * @typedef {Object} CountriesListQuery
9
- * @property {string} [isoCode] - Country 2 or 3 letter ISO code
9
+ * @property {string} [isoCode] - Country 2- or 3-letter ISO code (must be 2 or 3 chars if provided)
10
+ */
11
+
12
+ /**
13
+ * Query params for GET /countries/:countryId (btrz-api-inventory). See getCountryById getSpec().
14
+ * @typedef {Object} CountryGetQuery
15
+ * @property {string} [include] - Address level to include: "provinces" (default), "counties", "cities", "neighborhoods"
16
+ * @property {string} [parentKey] - Parent address level to filter by when include is not provinces
10
17
  */
11
18
 
12
19
  /**
@@ -23,16 +30,20 @@ function countriesFactory(_ref) {
23
30
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
31
 
25
32
  /**
26
- * GET /countries - list countries.
33
+ * GET /countries List countries. Optional filter by isoCode (2 or 3 characters).
27
34
  * @param {Object} opts
28
35
  * @param {string} [opts.token] - API key
29
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
36
+ * @param {string} [opts.jwtToken] - JWT or internal auth
30
37
  * @param {CountriesListQuery} [opts.query] - Query params (isoCode)
31
38
  * @param {Object} [opts.headers] - Optional headers
32
- * @returns {Promise<import("axios").AxiosResponse>}
39
+ * @returns {Promise<import("axios").AxiosResponse<{ countries: Object[] }>>}
40
+ * @throws 400 Validation failure (e.g. invalid isoCode length)
41
+ * @throws 401 Unauthorized
42
+ * @throws 500 Internal server error
33
43
  */
34
44
  function all(_ref2) {
35
45
  var token = _ref2.token,
46
+ jwtToken = _ref2.jwtToken,
36
47
  _ref2$query = _ref2.query,
37
48
  query = _ref2$query === undefined ? {} : _ref2$query,
38
49
  headers = _ref2.headers;
@@ -40,18 +51,23 @@ function countriesFactory(_ref) {
40
51
  return client({
41
52
  url: "/countries",
42
53
  params: query,
43
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
54
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
44
55
  });
45
56
  }
46
57
 
47
58
  /**
48
- * GET /countries/:id - get country by id. API does not accept query params.
59
+ * GET /countries/:id Get country by id. Optional include (provinces/counties/cities/neighborhoods) and parentKey.
49
60
  * @param {Object} opts
50
61
  * @param {string} [opts.token] - API key
51
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
- * @param {string} opts.id - Country id
62
+ * @param {string} [opts.jwtToken] - JWT or internal auth
63
+ * @param {string} opts.id - Country id (24 hex)
64
+ * @param {CountryGetQuery} [opts.query] - Query params (include, parentKey)
53
65
  * @param {Object} [opts.headers] - Optional headers
54
- * @returns {Promise<import("axios").AxiosResponse>}
66
+ * @returns {Promise<import("axios").AxiosResponse<{ country: Object }>>}
67
+ * @throws 400 INVALID_COUNTRY_ID
68
+ * @throws 401 Unauthorized
69
+ * @throws 404 COUNTRY_NOT_FOUND
70
+ * @throws 500 Internal server error
55
71
  */
56
72
  function get(_ref3) {
57
73
  var token = _ref3.token,