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
@@ -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,
@@ -70,7 +70,7 @@ function customersFactory(_ref) {
70
70
  * @param {Object} opts
71
71
  * @param {string} [opts.token] - API key
72
72
  * @param {CustomersActivationPostQuery} [opts.query] - Query params (providerId required)
73
- * @param {Object} [opts.data] - Request body (CustomerForActivation)
73
+ * @param {Object} opts.data - Body: CustomerForActivation (firstName, lastName, email; optional activateCustomerEmailLoginToken)
74
74
  * @param {Object} [opts.headers] - Optional headers
75
75
  * @returns {Promise<import("axios").AxiosResponse>}
76
76
  */
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Request body for POST /external-customers/ado/registration (btrz-api-notifications).
8
+ * @typedef {Object} SaldoMaxRegistrationRequest
9
+ * @property {string} email - User email to register in Saldo Max (verification code is sent to this email).
10
+ */
11
+
12
+ /**
13
+ * Factory for external-customers API (btrz-api-notifications). Saldo Max (ADO) verification-code registration.
14
+ * @param {Object} deps
15
+ * @param {import("axios").AxiosInstance} deps.client
16
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
17
+ * @returns {{ requestSaldoMaxVerificationCode: function }}
18
+ */
19
+
20
+
21
+ function externalCustomersFactory(_ref) {
22
+ var client = _ref.client,
23
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
+
25
+ /**
26
+ * POST /external-customers/ado/registration – Request a Saldo Max (ADO) verification code for the given email.
27
+ * Requires BETTEREZ_APP JWT. Forwards to Saldo Max; sends verification code to the email.
28
+ * @param {Object} opts
29
+ * @param {string} [opts.token] - API key
30
+ * @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
31
+ * @param {SaldoMaxRegistrationRequest} opts.data - Body: { email } (or { body: { email } })
32
+ * @param {Object} [opts.headers] - Optional headers
33
+ * @returns {Promise<import("axios").AxiosResponse<{ code: string, message: string }>>}
34
+ */
35
+ function requestSaldoMaxVerificationCode(_ref2) {
36
+ var data = _ref2.data,
37
+ token = _ref2.token,
38
+ jwtToken = _ref2.jwtToken,
39
+ headers = _ref2.headers;
40
+
41
+ return client({
42
+ url: "/external-customers/ado/registration",
43
+ method: "post",
44
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
45
+ data: data
46
+ });
47
+ }
48
+
49
+ return {
50
+ requestSaldoMaxVerificationCode: requestSaldoMaxVerificationCode
51
+ };
52
+ }
53
+
54
+ module.exports = externalCustomersFactory;
@@ -82,9 +82,6 @@ function pdfFactory(_ref) {
82
82
  if (query.type === "transaction") {
83
83
  url = "/pdf-transactions/" + itemId;
84
84
  }
85
- if (query.type === "transaction") {
86
- url = "/pdf-transactions/" + itemId;
87
- }
88
85
  if (query.type === "ssr") {
89
86
  url = "/pdf-ssrs/" + itemId;
90
87
  }
@@ -30,12 +30,14 @@ function accountingItemsFactory(_ref) {
30
30
  * GET /accounting-items - list accounting items.
31
31
  * @param {Object} opts
32
32
  * @param {string} [opts.token] - API key
33
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
33
34
  * @param {AccountingItemsListQuery} [opts.query] - Query params (all optional)
34
35
  * @param {Object} [opts.headers] - Optional headers
35
36
  * @returns {Promise<import("axios").AxiosResponse>}
36
37
  */
37
38
  function all(_ref2) {
38
39
  var token = _ref2.token,
40
+ jwtToken = _ref2.jwtToken,
39
41
  _ref2$query = _ref2.query,
40
42
  query = _ref2$query === undefined ? {} : _ref2$query,
41
43
  headers = _ref2.headers;
@@ -44,6 +46,7 @@ function accountingItemsFactory(_ref) {
44
46
  params: query,
45
47
  headers: authorizationHeaders({
46
48
  token: token,
49
+ jwtToken: jwtToken,
47
50
  internalAuthTokenProvider: internalAuthTokenProvider,
48
51
  headers: headers
49
52
  })
@@ -54,18 +57,21 @@ function accountingItemsFactory(_ref) {
54
57
  * GET /accounting-items/:accountingItemId - get accounting item by id. API does not accept query params.
55
58
  * @param {Object} opts
56
59
  * @param {string} [opts.token] - API key
57
- * @param {string} opts.accountingItemId - Accounting item id
60
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
61
+ * @param {string} opts.accountingItemId - Accounting item id (ObjectId format)
58
62
  * @param {Object} [opts.headers] - Optional headers
59
63
  * @returns {Promise<import("axios").AxiosResponse>}
60
64
  */
61
65
  function get(_ref3) {
62
66
  var accountingItemId = _ref3.accountingItemId,
63
67
  token = _ref3.token,
68
+ jwtToken = _ref3.jwtToken,
64
69
  headers = _ref3.headers;
65
70
 
66
71
  return client.get("/accounting-items/" + accountingItemId, {
67
72
  headers: authorizationHeaders({
68
73
  token: token,
74
+ jwtToken: jwtToken,
69
75
  internalAuthTokenProvider: internalAuthTokenProvider,
70
76
  headers: headers
71
77
  })
@@ -17,14 +17,16 @@ function flexpassesFactory(_ref) {
17
17
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
18
 
19
19
  /**
20
- * DELETE /flexpasses/:flexpassId/scannings/:tripId - delete scan by trip id. API does not accept query params.
20
+ * DELETE /flexpasses/:flexpassId/scannings/:tripId - deletes one flexpass scanning for the given trip ID.
21
+ * Removes the scan matching tripId from the flexpass's scans; if multiple scans exist for the same tripId, only one is removed.
22
+ * Requires operations API base URL (e.g. .../operations). No query parameters.
21
23
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
- * @param {string} opts.flexpassId - Flexpass id
25
- * @param {string} opts.tripId - Trip id
26
- * @param {Object} [opts.headers] - Optional headers
27
- * @returns {Promise<import("axios").AxiosResponse>}
24
+ * @param {string} [opts.token] - API key (X-API-KEY)
25
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
26
+ * @param {string} opts.flexpassId - Flexpass document ID (Mongo ObjectId string)
27
+ * @param {string} opts.tripId - Trip identifier of the scan to remove (e.g. routeId_scheduleName_date)
28
+ * @param {Object} [opts.headers] - Optional request headers
29
+ * @returns {Promise<import("axios").AxiosResponse<{ flexpassDeleted?: string }>>}
28
30
  */
29
31
  function deleteScanBytripId(_ref2) {
30
32
  var jwtToken = _ref2.jwtToken,
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Factory for gift-certificates API (btrz-api-operations).
8
+ * @param {Object} deps
9
+ * @param {import("axios").AxiosInstance} deps.client
10
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
+ * @returns {Object} gift-certificates API methods
12
+ */
13
+
14
+
15
+ function giftCertificatesFactory(_ref) {
16
+ var client = _ref.client,
17
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
+
19
+ /**
20
+ * GET /gift-certificates - list paid gift certificates for a customer. Paginated; requires customer JWT when used with JwtAuth.
21
+ * @param {Object} opts
22
+ * @param {string} [opts.token] - API key (X-API-KEY)
23
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer); when using customer JWT, must match customer param
24
+ * @param {string} opts.customer - Customer number to filter by (required)
25
+ * @param {number} [opts.page] - 1-based page number; page size is 20
26
+ * @param {Object} [opts.headers] - Optional request headers
27
+ * @returns {Promise<import("axios").AxiosResponse<{ giftCertificates: Array<object>, count: number, next?: string, previous?: string }>>}
28
+ */
29
+ function list(_ref2) {
30
+ var jwtToken = _ref2.jwtToken,
31
+ token = _ref2.token,
32
+ customer = _ref2.customer,
33
+ page = _ref2.page,
34
+ headers = _ref2.headers;
35
+
36
+ var params = { customer: customer };
37
+ if (page != null) {
38
+ params.page = page;
39
+ }
40
+ return client({
41
+ url: "/gift-certificates",
42
+ method: "get",
43
+ params: params,
44
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
45
+ });
46
+ }
47
+
48
+ return {
49
+ list: list
50
+ };
51
+ }
52
+
53
+ module.exports = giftCertificatesFactory;
@@ -28,15 +28,17 @@ function loansFactory(_ref) {
28
28
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
29
29
 
30
30
  /**
31
- * GET /loans - list loans.
31
+ * GET /loans - list loans for the account or provider. Paginated (20 per page). Requires operations API base URL.
32
32
  * @param {Object} opts
33
- * @param {string} [opts.token] - API key
34
- * @param {LoansListQuery} [opts.query] - Query params (all optional)
35
- * @param {Object} [opts.headers] - Optional headers
36
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @param {string} [opts.token] - API key (X-API-KEY)
34
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
35
+ * @param {LoansListQuery} [opts.query] - Query params (all optional): page, shiftId, type, trxId, status, providerId
36
+ * @param {Object} [opts.headers] - Optional request headers
37
+ * @returns {Promise<import("axios").AxiosResponse<{ loans: Array<object>, count: number, next?: string, previous?: string }>>}
37
38
  */
38
39
  function all(_ref2) {
39
40
  var token = _ref2.token,
41
+ jwtToken = _ref2.jwtToken,
40
42
  _ref2$query = _ref2.query,
41
43
  query = _ref2$query === undefined ? {} : _ref2$query,
42
44
  headers = _ref2.headers;
@@ -45,6 +47,7 @@ function loansFactory(_ref) {
45
47
  params: query,
46
48
  headers: authorizationHeaders({
47
49
  token: token,
50
+ jwtToken: jwtToken,
48
51
  internalAuthTokenProvider: internalAuthTokenProvider,
49
52
  headers: headers
50
53
  })
@@ -52,21 +55,24 @@ function loansFactory(_ref) {
52
55
  }
53
56
 
54
57
  /**
55
- * GET /loans/:loanId - get loan by id. API does not accept query params.
58
+ * GET /loans/:loanId - get a single loan by ID. Requires operations API base URL.
56
59
  * @param {Object} opts
57
- * @param {string} [opts.token] - API key
58
- * @param {string} opts.loanId - Loan id
59
- * @param {Object} [opts.headers] - Optional headers
60
- * @returns {Promise<import("axios").AxiosResponse>}
60
+ * @param {string} [opts.token] - API key (X-API-KEY)
61
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
62
+ * @param {string} opts.loanId - Loan document ID (24 hex characters)
63
+ * @param {Object} [opts.headers] - Optional request headers
64
+ * @returns {Promise<import("axios").AxiosResponse<{ loan: object }>>}
61
65
  */
62
66
  function get(_ref3) {
63
67
  var loanId = _ref3.loanId,
64
68
  token = _ref3.token,
69
+ jwtToken = _ref3.jwtToken,
65
70
  headers = _ref3.headers;
66
71
 
67
72
  return client.get("/loans/" + loanId, {
68
73
  headers: authorizationHeaders({
69
74
  token: token,
75
+ jwtToken: jwtToken,
70
76
  internalAuthTokenProvider: internalAuthTokenProvider,
71
77
  headers: headers
72
78
  })
@@ -3,6 +3,16 @@
3
3
  var _require = require("./../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
+ /**
7
+ * Request body for POST /movements (btrz-api-operations). See MovementPostData in movements models.
8
+ * @typedef {Object} MovementPostData
9
+ * @property {Array<{ _id: string, section?: string, sectionName?: string, seat?: string, row?: string, seatId?: string }>} tickets - Tickets to move (same transaction if more than one). Each must have _id; optional seat fields for destination seatmap.
10
+ * @property {{ routeId: string, scheduleId: string, date: string }} newManifest - Destination manifest: routeId (ObjectId), scheduleId (UUID), date (YYYY-MM-DD).
11
+ * @property {string} channel - Channel of the movement (e.g. backoffice). Must be a valid backoffice channel.
12
+ * @property {boolean} [allowsDifferentTrx] - If true, allows moving tickets from different transactions.
13
+ * @property {boolean} [newdesign] - If true, uses new seatmap design for accommodation.
14
+ */
15
+
6
16
  /**
7
17
  * Factory for movements API (btrz-api-operations).
8
18
  * @param {Object} deps
@@ -17,13 +27,14 @@ function movementsFactory(_ref) {
17
27
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
28
 
19
29
  /**
20
- * POST /movements - create movement. API does not accept query params.
30
+ * POST /movements - create a movement (move tickets to another manifest). No query params.
21
31
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
24
- * @param {Object} opts.movement - Movement payload
25
- * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
32
+ * @param {string} [opts.token] - API key (X-API-KEY)
33
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization Bearer)
34
+ * @param {MovementPostData} opts.movement - Request body: tickets, newManifest, channel; optional allowsDifferentTrx, newdesign
35
+ * @param {Object} [opts.query] - Optional query params (API accepts none)
36
+ * @param {Object} [opts.headers] - Optional request headers
37
+ * @returns {Promise<import("axios").AxiosResponse<{}>>}
27
38
  */
28
39
  function create(_ref2) {
29
40
  var token = _ref2.token,