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
@@ -1,7 +1,7 @@
1
1
  const {authorizationHeaders} = require("./../endpoints_helpers.js");
2
2
 
3
3
  /**
4
- * Query params for GET /document-types (btrz-api-inventory). See get-document-types getSpec().
4
+ * Query params for GET /document-types (btrz-api-inventory).
5
5
  * @typedef {Object} DocumentTypesListQuery
6
6
  * @property {string} [providerIds] - Comma-separated provider IDs to get document types for
7
7
  */
@@ -15,99 +15,100 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
15
15
  */
16
16
  function documentTypesFactory({client, internalAuthTokenProvider}) {
17
17
  /**
18
- * GET /document-types - list document types.
18
+ * GET /document-types - list document types (paginated).
19
19
  * @param {Object} opts
20
20
  * @param {string} [opts.token] - API key
21
21
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
- * @param {DocumentTypesListQuery} [opts.query] - Query params (providerIds); opts.providerId merged into query if set
23
- * @param {string} [opts.providerId] - Provider id (added to query if set)
22
+ * @param {DocumentTypesListQuery} [opts.query] - Query params (providerIds)
24
23
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
24
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttypes: Array, next?: string, previous?: string, count: number }>>}
25
+ * @throws When response is 4xx/5xx (401 Unauthorized, 500)
26
26
  */
27
- function all({token, jwtToken, query = {}, headers, providerId}) {
28
- const query_ = providerId ? {...query, providerId} : query;
27
+ function all({token, jwtToken, query = {}, headers}) {
29
28
  return client({
30
29
  url: "/document-types",
31
30
  method: "get",
32
31
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
33
- params: query_
32
+ params: query
34
33
  });
35
34
  }
36
35
 
37
36
  /**
38
- * GET /document-types/:id - get document type by id. API does not accept query params.
37
+ * GET /document-types/:documenttypeId - get document type by id.
39
38
  * @param {Object} opts
40
39
  * @param {string} [opts.token] - API key
41
40
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
42
- * @param {string} opts.id - Document type id
43
- * @param {string} [opts.providerId] - Provider id (added to query if set)
41
+ * @param {string} opts.id - Document type id (24 hex characters)
44
42
  * @param {Object} [opts.headers] - Optional headers
45
- * @returns {Promise<import("axios").AxiosResponse>}
43
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
44
+ * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)
46
45
  */
47
- function get({token, jwtToken, id, query = {}, headers, providerId}) {
48
- const query_ = providerId ? {...query, providerId} : query;
46
+ function get({token, jwtToken, id, headers}) {
49
47
  return client({
50
48
  url: `/document-types/${id}`,
51
49
  method: "get",
52
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
53
- params: query_
50
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
54
51
  });
55
52
  }
56
53
 
57
54
  /**
58
- * PUT /document-types/:id - update document type. API does not accept query params.
55
+ * PUT /document-types/:documenttypeId - update document type.
59
56
  * @param {Object} opts
60
57
  * @param {string} [opts.token] - API key
61
58
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
62
59
  * @param {string} opts.id - Document type id
63
- * @param {Object} opts.data - Document type payload
60
+ * @param {Object} [opts.documenttype] - Document type payload (DocumentTypePutData)
61
+ * @param {Object} [opts.data] - Alias for documenttype (deprecated, use documenttype)
64
62
  * @param {Object} [opts.headers] - Optional headers
65
- * @returns {Promise<import("axios").AxiosResponse>}
63
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
64
+ * @throws When response is 4xx/5xx (400, 401, 404, 409 CANNOT_UPDATE_LEXICON_ENTRIES, 500)
66
65
  */
67
- function update({token, jwtToken, id, data, query = {}, headers}) {
66
+ function update({token, jwtToken, id, documenttype, data, headers}) {
67
+ const payload = documenttype || data;
68
68
  return client({
69
69
  url: `/document-types/${id}`,
70
70
  method: "put",
71
71
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
72
- params: query,
73
- data
72
+ data: {documenttype: payload}
74
73
  });
75
74
  }
76
75
 
77
76
  /**
78
- * DELETE /document-types/:id - remove document type. API does not accept query params.
77
+ * DELETE /document-types/:documenttypeId - remove document type.
79
78
  * @param {Object} opts
80
79
  * @param {string} [opts.token] - API key
81
80
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
82
81
  * @param {string} opts.id - Document type id
83
82
  * @param {Object} [opts.headers] - Optional headers
84
- * @returns {Promise<import("axios").AxiosResponse>}
83
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttypeId: string }>>}
84
+ * @throws When response is 4xx/5xx (400, 401, 404 DOCUMENTTYPE_NOT_FOUND, 500)
85
85
  */
86
- function remove({token, jwtToken, id, query = {}, headers}) {
86
+ function remove({token, jwtToken, id, headers}) {
87
87
  return client({
88
88
  url: `/document-types/${id}`,
89
89
  method: "delete",
90
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
91
- params: query
90
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
92
91
  });
93
92
  }
94
93
 
95
94
  /**
96
- * POST /document-types - create document type. API does not accept query params.
95
+ * POST /document-types - create document type.
97
96
  * @param {Object} opts
98
97
  * @param {string} [opts.token] - API key
99
98
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
100
- * @param {Object} opts.data - Document type payload
99
+ * @param {Object} [opts.documenttype] - Document type payload (DocumentTypePostData)
100
+ * @param {Object} [opts.data] - Alias for documenttype (deprecated, use documenttype)
101
101
  * @param {Object} [opts.headers] - Optional headers
102
- * @returns {Promise<import("axios").AxiosResponse>}
102
+ * @returns {Promise<import("axios").AxiosResponse<{ documenttype: Object }>>}
103
+ * @throws When response is 4xx/5xx (400, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
103
104
  */
104
- function create({token, jwtToken, data, query = {}, headers}) {
105
+ function create({token, jwtToken, documenttype, data, headers}) {
106
+ const payload = documenttype || data;
105
107
  return client({
106
108
  url: "/document-types",
107
109
  method: "post",
108
110
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
109
- params: query,
110
- data
111
+ data: {documenttype: payload}
111
112
  });
112
113
  }
113
114
 
@@ -3,22 +3,24 @@ const {
3
3
  } = require("../endpoints_helpers.js");
4
4
 
5
5
  /**
6
- * Factory for external-wallets API (btrz-api-inventory).
6
+ * Factory for external-wallets API (btrz-api-inventory). SaldoMax external wallets only.
7
7
  * @param {Object} deps
8
8
  * @param {import("axios").AxiosInstance} deps.client
9
9
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
10
- * @returns {{ saldoMax: object }}
10
+ * @returns {{ saldoMax: { all: function, get: function, create: function, update: function, movements: { create: function } } }}
11
11
  */
12
12
  function externalWalletsFactory({client, internalAuthTokenProvider}) {
13
13
  /** @type {{ all: function, create: function, get: function, update: function, movements: object }} */
14
14
  const saldoMax = {
15
15
  /**
16
- * GET /external-wallets/saldo-max - list saldo max wallets. API does not accept query params.
16
+ * GET /external-wallets/saldo-max - list SaldoMax external wallets (paginated).
17
17
  * @param {Object} opts
18
18
  * @param {string} [opts.token] - API key
19
19
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
20
+ * @param {Object} [opts.query] - Pagination query params
20
21
  * @param {Object} [opts.headers] - Optional headers
21
- * @returns {Promise<import("axios").AxiosResponse>}
22
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallets: Array, next?: string, previous?: string, count: number }>>}
23
+ * @throws When response is 4xx/5xx (401, 500)
22
24
  */
23
25
  all: ({token, jwtToken, query = {}, headers}) => {
24
26
  return client.get("/external-wallets/saldo-max", {
@@ -27,13 +29,14 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
27
29
  });
28
30
  },
29
31
  /**
30
- * POST /external-wallets/saldo-max - create saldo max wallet. API does not accept query params.
32
+ * POST /external-wallets/saldo-max - create SaldoMax external wallet.
31
33
  * @param {Object} opts
32
34
  * @param {string} [opts.token] - API key
33
35
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
34
- * @param {Object} opts.externalWallet - External wallet payload
36
+ * @param {Object} opts.externalWallet - External wallet payload (ExternalWalletData: firstName, lastName, email, tel, dob, nip)
35
37
  * @param {Object} [opts.headers] - Optional headers
36
- * @returns {Promise<import("axios").AxiosResponse>}
38
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
39
+ * @throws When response is 4xx/5xx (400, 401, 409 DUPLICATE_EXTERNAL_WALLET_EMAIL/TEL, 500)
37
40
  */
38
41
  create: ({token, jwtToken, externalWallet, headers}) => {
39
42
  return client({
@@ -44,13 +47,14 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
44
47
  });
45
48
  },
46
49
  /**
47
- * GET /external-wallets/saldo-max/:walletId - get saldo max wallet. API does not accept query params.
50
+ * GET /external-wallets/saldo-max/:walletId - get SaldoMax external wallet by id.
48
51
  * @param {Object} opts
49
52
  * @param {string} [opts.token] - API key
50
53
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
51
- * @param {string} opts.walletId - Wallet id
54
+ * @param {string} opts.walletId - Wallet id (24 hex characters)
52
55
  * @param {Object} [opts.headers] - Optional headers
53
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
57
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
54
58
  */
55
59
  get: ({token, jwtToken, walletId, headers}) => {
56
60
  return client.get(`/external-wallets/saldo-max/${walletId}`, {
@@ -58,13 +62,14 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
58
62
  });
59
63
  },
60
64
  /**
61
- * PUT /external-wallets/saldo-max/:externalWallet._id - update saldo max wallet. API does not accept query params.
65
+ * PUT /external-wallets/saldo-max/:walletId - update SaldoMax external wallet.
62
66
  * @param {Object} opts
63
67
  * @param {string} [opts.token] - API key
64
68
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
69
  * @param {Object} opts.externalWallet - External wallet payload (must include _id)
66
70
  * @param {Object} [opts.headers] - Optional headers
67
- * @returns {Promise<import("axios").AxiosResponse>}
71
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
72
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
68
73
  */
69
74
  update: ({token, jwtToken, externalWallet, headers}) => {
70
75
  const externalWalletFieldsToUpdate = {
@@ -85,22 +90,22 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
85
90
  /** @type {{ create: function }} */
86
91
  movements: {
87
92
  /**
88
- * PUT /external-wallets/saldo-max/:walletId/movements - create movement. API does not accept query params.
93
+ * PUT /external-wallets/saldo-max/:walletId/movements - add movement to wallet.
89
94
  * @param {Object} opts
90
95
  * @param {string} [opts.token] - API key
91
96
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
92
97
  * @param {string} opts.walletId - Wallet id
93
- * @param {Object} opts.movement - Movement payload
94
- * @returns {Promise<import("axios").AxiosResponse>}
98
+ * @param {Object} opts.movement - Movement payload (amount, type: payment|refund|manual, reason, nip)
99
+ * @param {Object} [opts.headers] - Optional headers
100
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
101
+ * @throws When response is 4xx/5xx (400, 401, 403 INVALID_NIP/WALLET_BLOCKED/WALLET_NOT_ACTIVE, 404, 500)
95
102
  */
96
- create: ({token, jwtToken, walletId, movement}) => {
103
+ create: ({token, jwtToken, walletId, movement, headers}) => {
97
104
  return client({
98
105
  url: `/external-wallets/saldo-max/${walletId}/movements`,
99
106
  method: "put",
100
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider}),
101
- data: {
102
- movement
103
- }
107
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
108
+ data: {movement}
104
109
  });
105
110
  }
106
111
  }
@@ -18,28 +18,31 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
18
18
  */
19
19
  function feesFactory({client, internalAuthTokenProvider}) {
20
20
  /**
21
- * GET /fees - list fees.
21
+ * GET /fees - list fees (paginated).
22
22
  * @param {Object} opts
23
23
  * @param {string} [opts.token] - API key
24
- * @param {InventoryFeesQuery} [opts.query] - Optional query params (forwarded to API)
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
25
+ * @param {InventoryFeesQuery} [opts.query] - Query params (providerIds, rules, productId, internalId)
25
26
  * @param {Object} [opts.headers] - Optional headers
26
- * @returns {Promise<import("axios").AxiosResponse>}
27
+ * @returns {Promise<import("axios").AxiosResponse<{ fees: Array, next?: string, previous?: string, count: number }>>}
28
+ * @throws When response is 4xx/5xx (401, 500)
27
29
  */
28
- function all({token, query = {}, headers}) {
30
+ function all({token, jwtToken, query = {}, headers}) {
29
31
  return client.get("/fees", {
30
32
  params: query,
31
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
33
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
32
34
  });
33
35
  }
34
36
 
35
37
  /**
36
- * GET /fees/:feeId - get fee by id. API does not accept query params.
38
+ * GET /fees/:feeId - get fee by id.
37
39
  * @param {Object} opts
38
40
  * @param {string} [opts.token] - API key
39
41
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
40
- * @param {string} opts.feeId - Fee id
42
+ * @param {string} opts.feeId - Fee id (24 hex characters)
41
43
  * @param {Object} [opts.headers] - Optional headers
42
- * @returns {Promise<import("axios").AxiosResponse>}
44
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
45
+ * @throws When response is 4xx/5xx (400, 401, 404 FEE_NOT_FOUND, 500)
43
46
  */
44
47
  function get({token, jwtToken, feeId, headers}) {
45
48
  return client.get(`/fees/${feeId}`, {
@@ -48,13 +51,14 @@ function feesFactory({client, internalAuthTokenProvider}) {
48
51
  }
49
52
 
50
53
  /**
51
- * POST /fees - create fee. API does not accept query params.
54
+ * POST /fees - create fee.
52
55
  * @param {Object} opts
53
56
  * @param {string} [opts.token] - API key
54
57
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
55
- * @param {Object} opts.fee - Fee payload
58
+ * @param {Object} opts.fee - Fee payload (FeePostData: name, internalId, valueType, value, rules, products, lexiconKeys, etc.)
56
59
  * @param {Object} [opts.headers] - Optional headers
57
- * @returns {Promise<import("axios").AxiosResponse>}
60
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
61
+ * @throws When response is 4xx/5xx (400, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
58
62
  */
59
63
  function create({token, jwtToken, fee, headers}) {
60
64
  return client({
@@ -66,14 +70,15 @@ function feesFactory({client, internalAuthTokenProvider}) {
66
70
  }
67
71
 
68
72
  /**
69
- * PUT /fees/:feeId - update fee. API does not accept query params.
73
+ * PUT /fees/:feeId - update fee.
70
74
  * @param {Object} opts
71
75
  * @param {string} [opts.token] - API key
72
76
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
73
77
  * @param {string} opts.feeId - Fee id
74
- * @param {Object} opts.fee - Fee payload
78
+ * @param {Object} opts.fee - Fee payload (partial FeePostData)
75
79
  * @param {Object} [opts.headers] - Optional headers
76
- * @returns {Promise<import("axios").AxiosResponse>}
80
+ * @returns {Promise<import("axios").AxiosResponse<{ fee: Object }>>}
81
+ * @throws When response is 4xx/5xx (400, 401, 404 FEE_NOT_FOUND, 409 CANNOT_UPDATE_LEXICON_ENTRIES, 500)
77
82
  */
78
83
  function update({token, jwtToken, feeId, fee, headers}) {
79
84
  return client({
@@ -17,17 +17,18 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
17
17
  * @param {Object} deps
18
18
  * @param {import("axios").AxiosInstance} deps.client
19
19
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
20
- * @returns {{ all: function, create: function }}
20
+ * @returns {{ all: function, create: function, remove: function }}
21
21
  */
22
22
  function filteredTripsFactory({client, internalAuthTokenProvider}) {
23
23
  /**
24
- * GET /filtered-trips - list filtered trips.
24
+ * GET /filtered-trips - list filtered trips (paginated).
25
25
  * @param {Object} opts
26
26
  * @param {string} [opts.token] - API key
27
27
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
28
- * @param {FilteredTripsListQuery} [opts.query] - Query params (providerIds, productId, originId, destinationId, page, orderBy, orderDir)
28
+ * @param {FilteredTripsListQuery} [opts.query] - Query params
29
29
  * @param {Object} [opts.headers] - Optional headers
30
- * @returns {Promise<import("axios").AxiosResponse>}
30
+ * @returns {Promise<import("axios").AxiosResponse<{ filteredTrips: Array, next?: string, previous?: string, count: number }>>}
31
+ * @throws When response is 4xx/5xx (401, 500)
31
32
  */
32
33
  function all({token, jwtToken, query = {}, headers}) {
33
34
  return client.get("/filtered-trips", {
@@ -37,13 +38,14 @@ function filteredTripsFactory({client, internalAuthTokenProvider}) {
37
38
  }
38
39
 
39
40
  /**
40
- * POST /filtered-trips - create filtered trip. API does not accept query params.
41
+ * POST /filtered-trips - add a trip to the blacklist (filtered trips).
41
42
  * @param {Object} opts
42
43
  * @param {string} [opts.token] - API key
43
44
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
44
- * @param {Object} opts.tripSegmentsId - Trip segments id payload
45
+ * @param {string} opts.tripSegmentsId - Base64-encoded JSON (FilteredTripRequest: productId, segments)
45
46
  * @param {Object} [opts.headers] - Optional headers
46
- * @returns {Promise<import("axios").AxiosResponse>}
47
+ * @returns {Promise<import("axios").AxiosResponse<{ filteredTrip: Object }>>}
48
+ * @throws When response is 4xx/5xx (400, 401, 409 TRIP_ALREADY_FILTERED, 500)
47
49
  */
48
50
  function create({token, jwtToken, tripSegmentsId, headers}) {
49
51
  return client({
@@ -54,9 +56,28 @@ function filteredTripsFactory({client, internalAuthTokenProvider}) {
54
56
  });
55
57
  }
56
58
 
59
+ /**
60
+ * DELETE /filtered-trip/:filteredTripId - remove a filtered trip from the blacklist.
61
+ * @param {Object} opts
62
+ * @param {string} [opts.token] - API key
63
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
64
+ * @param {string} opts.filteredTripId - Filtered trip id (24 hex characters)
65
+ * @param {Object} [opts.headers] - Optional headers
66
+ * @returns {Promise<import("axios").AxiosResponse<void>>}
67
+ * @throws When response is 4xx/5xx (400, 401, 500)
68
+ */
69
+ function remove({token, jwtToken, filteredTripId, headers}) {
70
+ return client({
71
+ url: `/filtered-trip/${filteredTripId}`,
72
+ method: "delete",
73
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
74
+ });
75
+ }
76
+
57
77
  return {
58
78
  all,
59
- create
79
+ create,
80
+ remove
60
81
  };
61
82
  }
62
83
 
@@ -24,13 +24,14 @@ const {
24
24
  */
25
25
  function financingCostsFactory({client, internalAuthTokenProvider}) {
26
26
  /**
27
- * GET /financing-costs - list financing costs.
27
+ * GET /financing-costs - list financing costs (paginated).
28
28
  * @param {Object} opts
29
29
  * @param {string} [opts.token] - API key
30
30
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
31
31
  * @param {FinancingCostsListQuery} [opts.query] - Query params (page, providerId)
32
32
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcosts: Array, next: string, previous: string, count: number }>>}
34
+ * @throws When response is 4xx/5xx (400 INVALID_PAGE, 401, 500)
34
35
  */
35
36
  function all({
36
37
  token,
@@ -49,10 +50,11 @@ function financingCostsFactory({client, internalAuthTokenProvider}) {
49
50
  * @param {Object} opts
50
51
  * @param {string} [opts.token] - API key
51
52
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
- * @param {string} opts.id - Financing cost id
53
+ * @param {string} opts.id - Financing cost id (24 hex characters)
53
54
  * @param {FinancingCostGetQuery} [opts.query] - Query params (providerId)
54
55
  * @param {Object} [opts.headers] - Optional headers
55
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcost: Object }>>}
57
+ * @throws When response is 4xx/5xx (400 INVALID_FINANCINGCOST_ID, 401, 404 FINANCINGCOST_NOT_FOUND, 500)
56
58
  */
57
59
  function get({
58
60
  id,
@@ -68,13 +70,14 @@ function financingCostsFactory({client, internalAuthTokenProvider}) {
68
70
  }
69
71
 
70
72
  /**
71
- * POST /financing-costs - create financing cost. API does not accept query params.
73
+ * POST /financing-costs - create financing cost.
72
74
  * @param {Object} opts
73
75
  * @param {string} [opts.token] - API key
74
76
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
75
- * @param {Object} opts.financingCost - Financing cost payload
77
+ * @param {Object} opts.financingCost - Financing cost (name, internalId, currencyCode, dow, creditCard, maxQuota, interest, enabled)
76
78
  * @param {Object} [opts.headers] - Optional headers
77
- * @returns {Promise<import("axios").AxiosResponse>}
79
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcost: Object }>>}
80
+ * @throws When response is 4xx/5xx (400 WRONG_DATA, 401, 409 duplicated internalId, 500)
78
81
  */
79
82
  function create({jwtToken, token, financingCost, headers}) {
80
83
  return client({
@@ -88,13 +91,14 @@ function financingCostsFactory({client, internalAuthTokenProvider}) {
88
91
  }
89
92
 
90
93
  /**
91
- * DELETE /financing-costs/:id - remove financing cost. API does not accept query params.
94
+ * DELETE /financing-costs/:id - remove financing cost.
92
95
  * @param {Object} opts
93
96
  * @param {string} [opts.token] - API key
94
97
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
95
- * @param {string} opts.id - Financing cost id
98
+ * @param {string} opts.id - Financing cost id (24 hex characters)
96
99
  * @param {Object} [opts.headers] - Optional headers
97
- * @returns {Promise<import("axios").AxiosResponse>}
100
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcostId: string }>>}
101
+ * @throws When response is 4xx/5xx (400 INVALID_FINANCINGCOST_ID, 401, 404 FINANCINGCOST_NOT_FOUND, 500)
98
102
  */
99
103
  function remove({jwtToken, id, token, headers, query = {}}) {
100
104
  return client({
@@ -106,14 +110,15 @@ function financingCostsFactory({client, internalAuthTokenProvider}) {
106
110
  }
107
111
 
108
112
  /**
109
- * PUT /financing-costs/:id - update financing cost. API does not accept query params.
113
+ * PUT /financing-costs/:id - update financing cost.
110
114
  * @param {Object} opts
111
115
  * @param {string} [opts.token] - API key
112
116
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
113
- * @param {string} opts.id - Financing cost id
114
- * @param {Object} opts.financingCost - Financing cost payload
117
+ * @param {string} opts.id - Financing cost id (24 hex characters)
118
+ * @param {Object} opts.financingCost - Financing cost (name, internalId, currencyCode, dow, creditCard, maxQuota, interest, enabled)
115
119
  * @param {Object} [opts.headers] - Optional headers
116
- * @returns {Promise<import("axios").AxiosResponse>}
120
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcost: Object }>>}
121
+ * @throws When response is 4xx/5xx (400 WRONG_DATA, 401, 404 not found, 409 duplicated internalId, 500)
117
122
  */
118
123
  function update({jwtToken, token, id, financingCost, headers}) {
119
124
  return client({
@@ -16,13 +16,14 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
16
16
  */
17
17
  function garagesFactory({client, internalAuthTokenProvider}) {
18
18
  /**
19
- * GET /garages - list garages.
19
+ * GET /garages - list garages (paginated).
20
20
  * @param {Object} opts
21
21
  * @param {string} [opts.token] - API key
22
22
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
23
23
  * @param {GaragesQuery} [opts.query] - Query params (location, stationId)
24
24
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
25
+ * @returns {Promise<import("axios").AxiosResponse<{ garages: Array, next?: string, previous?: string, count: number }>>}
26
+ * @throws When response is 4xx/5xx (401, 500)
26
27
  */
27
28
  function all({token, jwtToken, query = {}, headers}) {
28
29
  return client.get("/garages", {
@@ -32,13 +33,14 @@ function garagesFactory({client, internalAuthTokenProvider}) {
32
33
  }
33
34
 
34
35
  /**
35
- * GET /garages/:garageId - get garage by id. API does not accept query params.
36
+ * GET /garages/:garageId - get garage by id.
36
37
  * @param {Object} opts
37
38
  * @param {string} [opts.token] - API key
38
39
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
39
- * @param {string} opts.garageId - Garage id
40
+ * @param {string} opts.garageId - Garage id (24 hex characters)
40
41
  * @param {Object} [opts.headers] - Optional headers
41
- * @returns {Promise<import("axios").AxiosResponse>}
42
+ * @returns {Promise<import("axios").AxiosResponse<{ garage: Object }>>}
43
+ * @throws When response is 4xx/5xx (400 INVALID_GARAGE_ID, 401, 404 GARAGE_NOT_FOUND, 500)
42
44
  */
43
45
  function get({token, jwtToken, garageId, headers}) {
44
46
  return client.get(`/garages/${garageId}`, {
@@ -47,13 +49,14 @@ function garagesFactory({client, internalAuthTokenProvider}) {
47
49
  }
48
50
 
49
51
  /**
50
- * POST /garages - create garage. API does not accept query params.
52
+ * POST /garages - create garage.
51
53
  * @param {Object} opts
52
54
  * @param {string} [opts.token] - API key
53
55
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
54
- * @param {Object} opts.data - Garage payload
56
+ * @param {Object} opts.data - Garage payload (name, location, stationId)
55
57
  * @param {Object} [opts.headers] - Optional headers
56
- * @returns {Promise<import("axios").AxiosResponse>}
58
+ * @returns {Promise<import("axios").AxiosResponse<{ garage: Object }>>}
59
+ * @throws When response is 4xx/5xx (400 WRONG_DATA, 401, 500)
57
60
  */
58
61
  function create({token, jwtToken, data, headers}) {
59
62
  return client({
@@ -71,10 +74,11 @@ function garagesFactory({client, internalAuthTokenProvider}) {
71
74
  * @param {Object} opts
72
75
  * @param {string} [opts.token] - API key
73
76
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
74
- * @param {string} opts.garageId - Garage id
75
- * @param {Object} opts.data - Garage payload
77
+ * @param {string} opts.garageId - Garage id (24 hex characters)
78
+ * @param {Object} opts.data - Garage payload (name, location, stationId)
76
79
  * @param {Object} [opts.headers] - Optional headers
77
- * @returns {Promise<import("axios").AxiosResponse>}
80
+ * @returns {Promise<import("axios").AxiosResponse<{ garage: Object }>>}
81
+ * @throws When response is 4xx/5xx (400, 401, 404 GARAGE_NOT_FOUND/STATION_NOT_FOUND, 500)
78
82
  */
79
83
  function update({token, jwtToken, garageId, data, headers}) {
80
84
  return client({
@@ -88,13 +92,14 @@ function garagesFactory({client, internalAuthTokenProvider}) {
88
92
  }
89
93
 
90
94
  /**
91
- * DELETE /garages/:garageId - remove garage. API does not accept query params.
95
+ * DELETE /garages/:garageId - remove garage.
92
96
  * @param {Object} opts
93
97
  * @param {string} [opts.token] - API key
94
98
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
95
- * @param {string} opts.garageId - Garage id
99
+ * @param {string} opts.garageId - Garage id (24 hex characters)
96
100
  * @param {Object} [opts.headers] - Optional headers
97
- * @returns {Promise<import("axios").AxiosResponse>}
101
+ * @returns {Promise<import("axios").AxiosResponse<{ success: boolean }>>}
102
+ * @throws When response is 4xx/5xx (400 INVALID_GARAGE_ID or GARAGE_WITH_VEHICLES, 401, 404, 500)
98
103
  */
99
104
  function remove({token, jwtToken, garageId, headers}) {
100
105
  return client({