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,96 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Pago Express (Datalogic) endpoints for the Operations API.
8
+ * Used to get info, pay, and reverse reference payments.
9
+ * @param {Object} deps
10
+ * @param {import("axios").AxiosInstance} deps.client
11
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
12
+ * @returns {Object} pagoExpress API methods
13
+ */
14
+
15
+
16
+ function pagoExpressFactory(_ref) {
17
+ var client = _ref.client,
18
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
+
20
+ /**
21
+ * POST /pago-express/info - get transaction information for a Pago Express reference.
22
+ * @param {Object} opts
23
+ * @param {string} [opts.token] - API key (x-api-key)
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth
25
+ * @param {Object} opts.payment - Request body: folio (20-digit string), id_terminal (number), local_date (string DD/MM/YYYY HH:mm:ss), trx_no (number)
26
+ * @param {Object} [opts.headers] - Optional headers
27
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostInfoResponse (code, message, result with folio, id_terminal, local_date, saldo, trx_no, responsecode, descriptioncode)
28
+ */
29
+ function info(_ref2) {
30
+ var token = _ref2.token,
31
+ jwtToken = _ref2.jwtToken,
32
+ payment = _ref2.payment,
33
+ headers = _ref2.headers;
34
+
35
+ return client({
36
+ method: "post",
37
+ url: "/pago-express/info",
38
+ data: { payment: payment },
39
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
40
+ });
41
+ }
42
+
43
+ /**
44
+ * POST /pago-express/pay - pay a Pago Express reference payment.
45
+ * @param {Object} opts
46
+ * @param {string} [opts.token] - API key (x-api-key)
47
+ * @param {string} [opts.jwtToken] - JWT or internal auth
48
+ * @param {Object} opts.payment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
49
+ * @param {Object} [opts.headers] - Optional headers
50
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostPayResponse (code, message, result with folio, id_terminal, local_date, trx_no, noauto, amount, responsecode, descriptioncode)
51
+ */
52
+ function pay(_ref3) {
53
+ var token = _ref3.token,
54
+ jwtToken = _ref3.jwtToken,
55
+ payment = _ref3.payment,
56
+ headers = _ref3.headers;
57
+
58
+ return client({
59
+ method: "post",
60
+ url: "/pago-express/pay",
61
+ data: { payment: payment },
62
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
63
+ });
64
+ }
65
+
66
+ /**
67
+ * POST /pago-express/reverse - reverse (cancel) a Pago Express reference payment. Emits transaction.reversed webhook.
68
+ * @param {Object} opts
69
+ * @param {string} [opts.token] - API key (x-api-key)
70
+ * @param {string} [opts.jwtToken] - JWT or internal auth
71
+ * @param {Object} opts.reversePayment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
72
+ * @param {Object} [opts.headers] - Optional headers
73
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostReverseResponse (code, message, result)
74
+ */
75
+ function reverse(_ref4) {
76
+ var token = _ref4.token,
77
+ jwtToken = _ref4.jwtToken,
78
+ reversePayment = _ref4.reversePayment,
79
+ headers = _ref4.headers;
80
+
81
+ return client({
82
+ method: "post",
83
+ url: "/pago-express/reverse",
84
+ data: { reversePayment: reversePayment },
85
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
86
+ });
87
+ }
88
+
89
+ return {
90
+ info: info,
91
+ pay: pay,
92
+ reverse: reverse
93
+ };
94
+ }
95
+
96
+ module.exports = pagoExpressFactory;
@@ -38,13 +38,13 @@ function parcelFactory(_ref) {
38
38
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
39
39
 
40
40
  /**
41
- * GET /parcels/:id - get parcel by id. API does not accept query params.
41
+ * GET /parcels/{parcelId} - get parcel by id. Requires JwtAuth. No query params.
42
42
  * @param {Object} opts
43
43
  * @param {string} [opts.token] - API key
44
44
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
- * @param {string} opts.id - Parcel id
45
+ * @param {string} opts.id - Parcel id (24 hex characters)
46
46
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
47
+ * @returns {Promise<import("axios").AxiosResponse>} 200 { parcel }; 400 INVALID_PARCEL_ID; 401 Unauthorized; 404 PARCEL_NOT_FOUND; 500
48
48
  */
49
49
  function get(_ref2) {
50
50
  var token = _ref2.token,
@@ -112,14 +112,14 @@ function parcelFactory(_ref) {
112
112
  }
113
113
 
114
114
  /**
115
- * POST /parcels/:id/user-comments - add comment to parcel. API does not accept query params.
115
+ * POST /parcels/{parcelId}/user-comments - add user comment to parcel. Requires JwtAuth. Body: { comment } (string).
116
116
  * @param {Object} opts
117
117
  * @param {string} [opts.token] - API key
118
118
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
119
- * @param {string} opts.id - Parcel id
120
- * @param {Object} opts.comment - Comment payload
119
+ * @param {string} opts.id - Parcel id (path parcelId)
120
+ * @param {string} opts.comment - Comment text (sent as body.comment)
121
121
  * @param {Object} [opts.headers] - Optional headers
122
- * @returns {Promise<import("axios").AxiosResponse>}
122
+ * @returns {Promise<import("axios").AxiosResponse>} 200 ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND; 409
123
123
  */
124
124
  function addComment(_ref5) {
125
125
  var token = _ref5.token,
@@ -137,14 +137,14 @@ function parcelFactory(_ref) {
137
137
  }
138
138
 
139
139
  /**
140
- * DELETE /parcels/:id/user-comments/:commentId - delete parcel comment. API does not accept query params.
140
+ * DELETE /parcels/{parcelId}/user-comments/{commentId} - delete user comment from parcel. Requires JwtAuth.
141
141
  * @param {Object} opts
142
142
  * @param {string} [opts.token] - API key
143
143
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
144
- * @param {string} opts.id - Parcel id
145
- * @param {string} opts.commentId - Comment id
144
+ * @param {string} opts.id - Parcel id (path parcelId)
145
+ * @param {string} opts.commentId - Comment id (path)
146
146
  * @param {Object} [opts.headers] - Optional headers
147
- * @returns {Promise<import("axios").AxiosResponse>}
147
+ * @returns {Promise<import("axios").AxiosResponse>} 200 deleted ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND, COMMENT_NOT_FOUND; 409
148
148
  */
149
149
  function deleteComment(_ref6) {
150
150
  var token = _ref6.token,
@@ -53,24 +53,27 @@ function parcelsManifestsFactory(_ref) {
53
53
  }
54
54
 
55
55
  /**
56
- * GET /parcels-manifests/:id - get parcels manifest by id. API does not accept query params.
56
+ * GET /parcels-manifests/:id - get parcels manifest by id.
57
57
  * @param {Object} opts
58
58
  * @param {string} [opts.token] - API key
59
59
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
60
- * @param {string} opts.id - Parcel manifest id (ObjectId)
60
+ * @param {string} opts.id - Parcel manifest id (ObjectId, 24 hex chars)
61
+ * @param {"standard"|"webhook"} [opts.format="standard"] - Response format (standard | webhook)
61
62
  * @param {Object} [opts.headers] - Optional request headers
62
- * @returns {Promise<import("axios").AxiosResponse>} response.data parcel manifest; 404 PARCELMANIFEST_NOT_FOUND
63
+ * @returns {Promise<import("axios").AxiosResponse>} response.data parcel manifest; 400 WRONG_DATA; 404 MANIFEST_NOT_FOUND, PARCELMANIFEST_NOT_FOUND
63
64
  */
64
65
  function get(_ref3) {
65
66
  var token = _ref3.token,
66
67
  jwtToken = _ref3.jwtToken,
67
68
  id = _ref3.id,
69
+ format = _ref3.format,
68
70
  headers = _ref3.headers;
69
71
 
70
72
  return client({
71
73
  url: "/parcels-manifests/" + id,
72
74
  method: "get",
73
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
75
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
76
+ params: format != null ? { format: format } : undefined
74
77
  });
75
78
  }
76
79
 
@@ -4,22 +4,34 @@ var _require = require("./../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
6
  /**
7
+ * Request body for POST /cancellations (btrz-api-sales). CancelPostData. Item IDs grouped by family; trxId required.
7
8
  * @typedef {{
8
- * fees: string[],
9
+ * trxId: string,
10
+ * fees: number[],
9
11
  * flexPasses: string[],
10
12
  * parcels: string[],
11
13
  * redeemableItems: string[],
12
14
  * soldItems: string[],
13
15
  * tickets: string[],
14
16
  * giftCertificates: string[],
17
+ * reservations: string[],
15
18
  * insurances: string[],
16
- * trxId: string,
17
- * penalty?: {
18
- * amount: number,
19
- * reason: string
20
- * }
21
- * }} CancelSetData
22
- *
19
+ * channel: string,
20
+ * penalty?: { amount: number, reason: string },
21
+ * overrideCancelFees?: Array<{ _id: string, reason: string }>,
22
+ * currency?: string,
23
+ * terminalPayload?: { status: string, provider: string, auth?: string },
24
+ * paymentDetails?: Array<{ _id: string, authorization: string }>
25
+ * }} CancelPostData
26
+ */
27
+
28
+ /**
29
+ * Request body for PUT /cancellations (btrz-api-sales). CancelPutData. Unmodified cancel set from POST response (must include _id and signature).
30
+ * @typedef {{ _id: string, cancellation: Object, signature: string }} CancelPutData
31
+ */
32
+
33
+ /**
34
+ * Request body for PUT /cancellations/:pendingTransactionId (btrz-api-sales). CompletePaymentCancellationData.
23
35
  * @typedef {{
24
36
  * provider: string,
25
37
  * type: string,
@@ -31,20 +43,20 @@ var _require = require("./../endpoints_helpers.js"),
31
43
  * referenceNumber: string,
32
44
  * authCode?: string
33
45
  * }} CompletePaymentCancellationData
34
- */
46
+ */
35
47
 
36
48
  function cancellationEndpointsFactory(_ref) {
37
49
  var client = _ref.client,
38
50
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
39
51
 
40
52
  /**
41
- * Creates a set of refundable items and payments to be refunded. API does not accept query params.
42
- * @param {Object} params
43
- * @param {string} params.token Public key
44
- * @param {string} params.jwtToken Auth token
45
- * @param {CancelSetData} params.cancelData List of item ids grouped by family
46
- * @param {Object} params.headers HTTP Headers
47
- * @returns {Promise} A cancel set object
53
+ * POST /cancellations - creates a cancel set (preview) with calculated refunds and signature. Does not execute refunds. API does not accept query params.
54
+ * @param {Object} opts
55
+ * @param {string} [opts.token] - API key
56
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
57
+ * @param {CancelPostData} opts.cancelData - Refundable item IDs by family, trxId, channel, penalty (optional), etc.
58
+ * @param {Object} [opts.headers] - Optional headers
59
+ * @returns {Promise<import("axios").AxiosResponse<{ _id: string, cancellation: Object, signature: string }>>} Cancel set (signed). Rejects with 400 (e.g. MISSING_CANCELLABLE_IDS, INVALID_CANCEL_SET, [itemType]_NOT_REFUNDABLE), 401, 403 (NOT_ALLOWED_FOR_ONLINE, FEE_OVERRIDE_NOT_ALLOWED), 404 ([itemType]_NOT_FOUND), 409 (CURRENCY_EXCHANGE_MISMATCH, AGENCY_CURRENCY_MISMATCH), 500.
48
60
  */
49
61
  function createCancelSet(_ref2) {
50
62
  var token = _ref2.token,
@@ -63,13 +75,13 @@ function cancellationEndpointsFactory(_ref) {
63
75
  }
64
76
 
65
77
  /**
66
- * Creates and runs payment refunds
67
- * @param {Object} params
68
- * @param {string} params.token Public key
69
- * @param {string} params.jwtToken Auth token
70
- * @param {Object} params.cancelSet An unmodified cancel set object generated by the cancellations endpoint
71
- * @param {Object} params.headers HTTP Headers
72
- * @returns {Promise} Refund result
78
+ * PUT /cancellations - executes the refund using the signed cancel set from POST. Body is cancelSet (or object with cancelSet key). API does not accept query params. Duplicate submission (same dupKey within 30s) returns 409.
79
+ * @param {Object} opts
80
+ * @param {string} [opts.token] - API key
81
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
82
+ * @param {CancelPutData} opts.cancelSet - Unmodified cancel set from createCancelSet response
83
+ * @param {Object} [opts.headers] - Optional headers
84
+ * @returns {Promise<import("axios").AxiosResponse<{ transaction: Object }>>} RefundResponse. Rejects with 400 (e.g. INVALID_SIGNATURE, MISSING_TERMINAL_PAYLOAD, REFUNDED_ITEM), 401, 409 (NOT_FOUND_FOR_REFUND, REFUND_EXECUTION_ERROR, PAYMENT_ROLLBACK_FAILED, CONFLICT duplicate), 500.
73
85
  */
74
86
  function createRefund(_ref3) {
75
87
  var token = _ref3.token,
@@ -86,14 +98,14 @@ function cancellationEndpointsFactory(_ref) {
86
98
  }
87
99
 
88
100
  /**
89
- * Completes a pending payment for a cancellation transaction (e.g. one terminal refund). API does not accept query params.
90
- * @param {Object} params
91
- * @param {string} params.token Public key
92
- * @param {string} params.jwtToken Auth token
93
- * @param {string} params.pendingTransactionId Negative transaction id (ObjectId)
94
- * @param {CompletePaymentCancellationData} params.paymentResult Payment result for one completed terminal refund
95
- * @param {Object} params.headers HTTP Headers
96
- * @returns {Promise} Updated negative transaction (with remaining pending payments if any)
101
+ * PUT /cancellations/:pendingTransactionId - completes a pending payment for a cancellation transaction (e.g. terminal refund). API does not accept query params.
102
+ * @param {Object} opts
103
+ * @param {string} [opts.token] - API key
104
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
105
+ * @param {string} opts.pendingTransactionId - Negative (pending) transaction ID (ObjectId)
106
+ * @param {CompletePaymentCancellationData} opts.paymentResult - Payment result from terminal/provider
107
+ * @param {Object} [opts.headers] - Optional headers
108
+ * @returns {Promise<import("axios").AxiosResponse<{ transaction?: Object, paymentResult?: Object }>>} GetCompletePaymentCancellationResponse. Rejects with 400 (INVALID_PENDING_TRANSACTION_ID, INVALID_TRANSACTION_STATUS, PAYMENT_NOT_PENDING, etc.), 401, 404 (TRANSACTION_NOT_FOUND, PAYMENT_NOT_FOUND, etc.), 500.
97
109
  */
98
110
  function updateCompletePayment(_ref4) {
99
111
  var token = _ref4.token,
@@ -23,6 +23,13 @@ var _require = require("./../endpoints_helpers.js"),
23
23
  * @property {string} [internalId] - Internal id or code of the financing cost to match
24
24
  */
25
25
 
26
+ /**
27
+ * Query params for DELETE /carts/:cartId/paid-in-items (btrz-api-sales delete-cart-paid-in-items-handler getSpec).
28
+ * @typedef {Object} CartDeletePaidInItemsQuery
29
+ * @property {string} [operationId] - Optional operation id to filter which paid-in items to remove
30
+ * @property {string} [productId] - Optional product id to filter which paid-in items to remove
31
+ */
32
+
26
33
  /**
27
34
  * Factory for cart API (btrz-api-sales).
28
35
  * @param {Object} deps
@@ -37,28 +44,24 @@ function cartFactory(_ref) {
37
44
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
38
45
 
39
46
  /**
40
- * GET /cart/:id - get cart by id. Query: providerId, transactionStatus (per get-cart getSpec).
47
+ * GET /cart/:id - get cart by id.
41
48
  * @param {Object} opts
42
49
  * @param {string} [opts.token] - API key
43
50
  * @param {string} opts.id - Cart id
44
- * @param {string} [opts.providerId] - Provider id (sent as query)
51
+ * @param {CartGetQuery} [opts.query] - Query params (providerId, transactionStatus)
45
52
  * @param {Object} [opts.headers] - Optional headers
46
53
  * @returns {Promise<import("axios").AxiosResponse>}
47
54
  */
48
55
  function get(_ref2) {
49
56
  var token = _ref2.token,
50
57
  id = _ref2.id,
51
- providerId = _ref2.providerId,
58
+ _ref2$query = _ref2.query,
59
+ query = _ref2$query === undefined ? {} : _ref2$query,
52
60
  headers = _ref2.headers;
53
61
 
54
- var url = "/cart/" + id;
55
-
56
- if (providerId) {
57
- url = url + "?providerId=" + providerId;
58
- }
59
-
60
62
  return client({
61
- url: url,
63
+ url: "/cart/" + id,
64
+ params: query,
62
65
  headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
63
66
  });
64
67
  }
@@ -161,11 +164,11 @@ function cartFactory(_ref) {
161
164
  }
162
165
 
163
166
  /**
164
- * DELETE /carts/:cartId/paid-in-items - delete paid-in items. Query forwarded via opts.params if provided.
167
+ * DELETE /carts/:cartId/paid-in-items - delete paid-in items.
165
168
  * @param {Object} opts
166
169
  * @param {string} [opts.token] - API key
167
170
  * @param {string} opts.cartId - Cart id
168
- * @param {Object} opts.params - Query params (forwarded to API)
171
+ * @param {CartDeletePaidInItemsQuery} [opts.params] - Query params (operationId, productId)
169
172
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
170
173
  * @param {Object} [opts.headers] - Optional headers
171
174
  * @returns {Promise<import("axios").AxiosResponse>}
@@ -181,7 +184,7 @@ function cartFactory(_ref) {
181
184
  url: "/carts/" + cartId + "/paid-in-items",
182
185
  method: "delete",
183
186
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
184
- params: params
187
+ params: params || {}
185
188
  });
186
189
  }
187
190
 
@@ -238,13 +241,13 @@ function cartFactory(_ref) {
238
241
 
239
242
  var partialDepositStatus = {
240
243
  /**
241
- * GET /cart/:shiftId/partial-deposit-status - get partial deposit status. API does not accept query params.
244
+ * GET /cart/:shiftId/partial-deposit-status - get shift partial deposit status. API does not accept query params. Response: partialDeposit.
242
245
  * @param {Object} opts
243
246
  * @param {string} [opts.token] - API key
244
247
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
245
- * @param {string} opts.shiftId - Shift id
248
+ * @param {string} opts.shiftId - Shift id (24 hex characters)
246
249
  * @param {Object} [opts.headers] - Optional headers
247
- * @returns {Promise<import("axios").AxiosResponse>}
250
+ * @returns {Promise<import("axios").AxiosResponse<{ partialDeposit: * }>>}
248
251
  */
249
252
  get: function get(_ref10) {
250
253
  var token = _ref10.token,
@@ -309,13 +312,13 @@ function cartFactory(_ref) {
309
312
 
310
313
  var taxExemptPaymentMethod = {
311
314
  /**
312
- * POST /carts/:cartId/tax-exempt-payment-method - set tax exempt payment method. API does not accept query params.
315
+ * POST /carts/:cartId/tax-exempt-payment-method - recalculate taxes for a tax exempt payment method. Body: amountExempt (number).
313
316
  * @param {Object} opts
314
317
  * @param {string} [opts.token] - API key
315
318
  * @param {string} opts.cartId - Cart id
316
319
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
317
320
  * @param {Object} [opts.headers] - Optional headers
318
- * @param {Object} [opts.data] - Request body
321
+ * @param {Object} opts.data - Request body; must include amountExempt (number, amount exempted of taxes)
319
322
  * @returns {Promise<import("axios").AxiosResponse>}
320
323
  */
321
324
  post: function post(_ref13) {
@@ -18,11 +18,11 @@ function flexpassesEndpointsFactory(_ref) {
18
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
19
 
20
20
  /**
21
- * GET /flexpasses/:flexpassId - get flexpass by id. API does not accept query params (btrz-api-sales).
21
+ * GET /flexpasses/:flexpassId - get flexpass by id. API does not accept query params.
22
22
  * @param {Object} opts
23
23
  * @param {string} [opts.token] - API key
24
24
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
25
- * @param {string} opts.flexpassId - Flexpass id
25
+ * @param {string} opts.flexpassId - Flexpass id (24 hex characters)
26
26
  * @param {Object} [opts.headers] - Optional headers
27
27
  * @returns {Promise<import("axios").AxiosResponse>}
28
28
  */
@@ -30,13 +30,10 @@ function flexpassesEndpointsFactory(_ref) {
30
30
  var token = _ref2.token,
31
31
  jwtToken = _ref2.jwtToken,
32
32
  flexpassId = _ref2.flexpassId,
33
- _ref2$query = _ref2.query,
34
- query = _ref2$query === undefined ? {} : _ref2$query,
35
33
  headers = _ref2.headers;
36
34
 
37
35
  return client({
38
36
  url: "/flexpasses/" + flexpassId,
39
- params: query,
40
37
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
41
38
  });
42
39
  }
@@ -17,12 +17,18 @@ var _require = require("./../endpoints_helpers.js"),
17
17
  * @property {string} [providerId] - Provider account id
18
18
  */
19
19
 
20
+ /**
21
+ * Query params for PATCH /orders (btrz-api-sales patch-handler getSpec).
22
+ * @typedef {Object} OrderPatchQuery
23
+ * @property {string} [includePaidOrExpired] - 'true' or 'false'; whether to update when transaction is already paid or expired
24
+ */
25
+
20
26
  /**
21
27
  * Factory for order API (btrz-api-sales).
22
28
  * @param {Object} deps
23
29
  * @param {import("axios").AxiosInstance} deps.client
24
30
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
25
- * @returns {{ create: function, get: function, overwrite: function }}
31
+ * @returns {{ create: function, get: function, overwrite: function, patch: function }}
26
32
  */
27
33
 
28
34
 
@@ -31,10 +37,10 @@ function orderFactory(_ref) {
31
37
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
32
38
 
33
39
  /**
34
- * POST /order - create order.
40
+ * POST /order - create order. Body: orderRequest (cartId, customerInfo, payments, channel, etc.).
35
41
  * @param {Object} opts
36
42
  * @param {string} [opts.token] - API key
37
- * @param {Object} opts.order - Order payload
43
+ * @param {Object} opts.order - Order request body (orderRequest)
38
44
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
39
45
  * @param {Object} [opts.headers] - Optional headers
40
46
  * @returns {Promise<import("axios").AxiosResponse>}
@@ -77,11 +83,11 @@ function orderFactory(_ref) {
77
83
  }
78
84
 
79
85
  /**
80
- * POST /orders/:orderId/payments - overwrite order payments.
86
+ * POST /orders/:orderId/payments - overwrite order payments. Body must include payments (array). Endpoint is internal (hideInDocumentation).
81
87
  * @param {Object} opts
82
88
  * @param {string} [opts.token] - API key
83
- * @param {string} opts.orderId - Order id
84
- * @param {Object} opts.payments - Payments payload
89
+ * @param {string} opts.orderId - Order (transaction) id
90
+ * @param {Object} opts.payments - Request body; must include property payments (array of payment objects)
85
91
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
86
92
  * @param {Object} [opts.headers] - Optional headers
87
93
  * @param {OrderPaymentsQuery} [opts.query] - Query params (channel, providerId)
@@ -105,10 +111,38 @@ function orderFactory(_ref) {
105
111
  });
106
112
  }
107
113
 
114
+ /**
115
+ * PATCH /orders - complete order creation after referenced payment (e.g. waitForPaymentCompletion). Body: operation (name, data with transactionId, paymentResult). Query: includePaidOrExpired.
116
+ * @param {Object} opts
117
+ * @param {string} [opts.token] - API key
118
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
119
+ * @param {Object} [opts.headers] - Optional headers
120
+ * @param {Object} opts.operation - Operation object: { name, data: { transactionId, paymentResult } }
121
+ * @param {OrderPatchQuery} [opts.query] - Query params (includePaidOrExpired)
122
+ * @returns {Promise<import("axios").AxiosResponse>}
123
+ */
124
+ function patch(_ref5) {
125
+ var token = _ref5.token,
126
+ jwtToken = _ref5.jwtToken,
127
+ headers = _ref5.headers,
128
+ operation = _ref5.operation,
129
+ _ref5$query = _ref5.query,
130
+ query = _ref5$query === undefined ? {} : _ref5$query;
131
+
132
+ return client({
133
+ url: "/orders",
134
+ method: "patch",
135
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
136
+ data: { operation: operation },
137
+ params: query
138
+ });
139
+ }
140
+
108
141
  return {
109
142
  create: create,
110
143
  get: get,
111
- overwrite: overwrite
144
+ overwrite: overwrite,
145
+ patch: patch
112
146
  };
113
147
  }
114
148
 
@@ -18,10 +18,10 @@ function parcelQuotesFactory(_ref) {
18
18
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
19
 
20
20
  /**
21
- * POST /parcel-quotes - get parcel quote. API does not accept query params.
21
+ * POST /parcel-quotes - request a parcel quote. Body: parcelQuoteData (fromId, toId, productId, channel, parcels). API does not accept query params.
22
22
  * @param {Object} opts
23
23
  * @param {string} [opts.token] - API key
24
- * @param {Object} opts.parcelQuoteData - Parcel quote request payload
24
+ * @param {Object} opts.parcelQuoteData - Parcel quote request: fromId, toId, productId, channel, parcels (array of { fareId, weight, measure })
25
25
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
26
26
  * @param {Object} [opts.headers] - Optional headers
27
27
  * @returns {Promise<import("axios").AxiosResponse>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.33.0",
3
+ "version": "8.35.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -85,6 +85,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
85
85
  getnetTerminals: require("./endpoints/inventory/getnet-terminals.js")({client, internalAuthTokenProvider}),
86
86
  giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({client, internalAuthTokenProvider}),
87
87
  healthCheck: require("./endpoints/inventory/healthcheck.js")({client, internalAuthTokenProvider}),
88
+ holidays: require("./endpoints/inventory/holidays.js")({client, internalAuthTokenProvider}),
88
89
  insurances: require("./endpoints/inventory/insurances.js")({client, internalAuthTokenProvider}),
89
90
  insurancesCost: require("./endpoints/inventory/insurancesCost.js")({client, internalAuthTokenProvider}),
90
91
  items: require("./endpoints/inventory/items.js")({client, internalAuthTokenProvider}),
@@ -134,15 +135,16 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
134
135
  }
135
136
 
136
137
  /**
137
- * Creates the trips API client (trips, segmentsInformationTables). Uses inventory base path.
138
+ * Creates the trips API client (trips, tripIds, segmentsInformationTables). Uses inventory base path.
138
139
  * @param {CreateModuleOptions} opts - Client options
139
- * @returns {Object} Object with trips and segmentsInformationTables endpoint namespaces and __test_trips.client
140
+ * @returns {Object} Object with trips, tripIds, segmentsInformationTables endpoint namespaces and __test_trips.client
140
141
  */
141
142
  function createTrips({baseURL, headers, timeout, overrideFn, internalAuthTokenProvider, agents}) {
142
143
  const client = clientFactory({baseURL, headers, timeout, overrideFn, agents});
143
144
 
144
145
  return {
145
146
  trips: require("./endpoints/inventory/trips.js")({client, internalAuthTokenProvider}),
147
+ tripIds: require("./endpoints/inventory/trip-ids.js")({client, internalAuthTokenProvider}),
146
148
  segmentsInformationTables: require("./endpoints/inventory/segments-information-tables.js")({client, internalAuthTokenProvider}),
147
149
  __test_trips: {
148
150
  client
@@ -292,11 +294,13 @@ function createOperations({baseURL, headers, timeout, overrideFn, internalAuthTo
292
294
  calendarEntries: require("./endpoints/operations/calendar_entries.js")({client, internalAuthTokenProvider}),
293
295
  externalBookings: require("./endpoints/operations/external-bookings.js")({client, internalAuthTokenProvider}),
294
296
  flexpasses: require("./endpoints/operations/flexpasses.js")({client, internalAuthTokenProvider}),
297
+ giftCertificates: require("./endpoints/operations/gift-certificates.js")({client, internalAuthTokenProvider}),
295
298
  loans: require("./endpoints/operations/loans.js")({client, internalAuthTokenProvider}),
296
299
  manifest: require("./endpoints/operations/manifest.js")({client, internalAuthTokenProvider}),
297
300
  manifestLegForTickets: require("./endpoints/operations/manifest_leg_for_tickets.js")({client, internalAuthTokenProvider}),
298
301
  movements: require("./endpoints/operations/movements.js")({client, internalAuthTokenProvider}),
299
302
  outlookTrips: require("./endpoints/operations/outlook-trips.js")({client, internalAuthTokenProvider}),
303
+ pagoExpress: require("./endpoints/operations/pago-express.js")({client, internalAuthTokenProvider}),
300
304
  parcel: require("./endpoints/operations/parcels.js")({client, internalAuthTokenProvider}),
301
305
  parcelManifests: require("./endpoints/operations/parcels_manifests.js")({client, internalAuthTokenProvider}),
302
306
  passengerCheckInInfo: require("./endpoints/operations/passenger_check_in_info.js")({client, internalAuthTokenProvider}),
@@ -355,6 +359,7 @@ function createNotifications({baseURL, headers, timeout, overrideFn, internalAut
355
359
  pdfData: require("./endpoints/notifications/pdf-data.js")({client, internalAuthTokenProvider}),
356
360
  email: require("./endpoints/notifications/email.js")({client, internalAuthTokenProvider}),
357
361
  customers: require("./endpoints/notifications/customers.js")({client, internalAuthTokenProvider}),
362
+ externalCustomers: require("./endpoints/notifications/external-customers.js")({client, internalAuthTokenProvider}),
358
363
  twilio: require("./endpoints/notifications/twilio.js")({client, internalAuthTokenProvider}),
359
364
  salesforce: require("./endpoints/notifications/salesforce.js")({client, internalAuthTokenProvider}),
360
365
  notify: require("./endpoints/notifications/notify.js")({client, internalAuthTokenProvider}),
@@ -444,6 +449,8 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
444
449
  const client = clientFactory({baseURL, headers, timeout, overrideFn, agents});
445
450
 
446
451
  return {
452
+ adyen: require("./endpoints/btrzpay/adyen.js")({client, internalAuthTokenProvider}),
453
+ cybersource3ds: require("./endpoints/btrzpay/cybersource3ds.js")({client, internalAuthTokenProvider}),
447
454
  docs: require("./endpoints/btrzpay/docs.js")({client}),
448
455
  cardpointeTerminals: require("./endpoints/btrzpay/cardpointe.js").cardpointeTerminalsFactory({client, internalAuthTokenProvider}),
449
456
  paymentMethods: require("./endpoints/btrzpay/payment-methods.js")({client, internalAuthTokenProvider}),
@@ -459,6 +466,7 @@ function createBtrzPay({baseURL, headers, timeout, overrideFn, internalAuthToken
459
466
  prismaTerminals: require("./endpoints/btrzpay/prismaTerminals.js")({client, internalAuthTokenProvider}),
460
467
  terminalPayments: require("./endpoints/btrzpay/terminalPayments.js")({client, internalAuthTokenProvider}),
461
468
  stripeTerminals: require("./endpoints/btrzpay/stripe-terminals.js")({client, internalAuthTokenProvider}),
469
+ stripe3ds: require("./endpoints/btrzpay/stripe3ds.js")({client, internalAuthTokenProvider}),
462
470
  __test: {
463
471
  client
464
472
  }