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.
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +10 -2
- package/lib/endpoints/btrzpay/adyen.js +58 -0
- package/lib/endpoints/btrzpay/cardpointe.js +6 -3
- package/lib/endpoints/btrzpay/customerCards.js +19 -19
- package/lib/endpoints/btrzpay/customers.js +13 -13
- package/lib/endpoints/btrzpay/cybersource3ds.js +142 -0
- package/lib/endpoints/btrzpay/datalogic.js +64 -28
- package/lib/endpoints/btrzpay/oxxo.js +54 -28
- package/lib/endpoints/btrzpay/prismaTerminals.js +24 -15
- package/lib/endpoints/btrzpay/referenced-payments.js +4 -4
- package/lib/endpoints/btrzpay/square.js +8 -8
- package/lib/endpoints/btrzpay/stripe-terminals.js +16 -11
- package/lib/endpoints/btrzpay/stripe3ds.js +54 -0
- package/lib/endpoints/btrzpay/terminalPayments.js +19 -19
- package/lib/endpoints/inventory/banks.js +39 -21
- package/lib/endpoints/inventory/change-requests.js +59 -31
- package/lib/endpoints/inventory/control-classes.js +39 -20
- package/lib/endpoints/inventory/countries.js +25 -9
- package/lib/endpoints/inventory/custom-content.js +39 -21
- package/lib/endpoints/inventory/custom-fields.js +25 -17
- package/lib/endpoints/inventory/document-types.js +33 -42
- package/lib/endpoints/inventory/external-wallets.js +26 -20
- package/lib/endpoints/inventory/fees.js +19 -13
- package/lib/endpoints/inventory/filtered-trips.js +34 -8
- package/lib/endpoints/inventory/financing-costs.js +19 -14
- package/lib/endpoints/inventory/garages.js +19 -14
- package/lib/endpoints/inventory/getnet-terminals.js +20 -15
- package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
- package/lib/endpoints/inventory/holidays.js +158 -0
- package/lib/endpoints/inventory/insurances.js +17 -13
- package/lib/endpoints/inventory/items.js +13 -9
- package/lib/endpoints/inventory/labels.js +16 -11
- package/lib/endpoints/inventory/marital-status.js +16 -11
- package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
- package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
- package/lib/endpoints/inventory/mit-terminals.js +16 -11
- package/lib/endpoints/inventory/operation-messages.js +18 -12
- package/lib/endpoints/inventory/operation-reasons.js +15 -10
- package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
- package/lib/endpoints/inventory/payment-terminals.js +15 -10
- package/lib/endpoints/inventory/products.js +22 -10
- package/lib/endpoints/inventory/promos.js +27 -18
- package/lib/endpoints/inventory/segments-information-tables.js +13 -7
- package/lib/endpoints/inventory/station-groups.js +2 -4
- package/lib/endpoints/inventory/taxes.js +11 -2
- package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
- package/lib/endpoints/inventory/trip-ids.js +67 -0
- package/lib/endpoints/inventory/trips.js +60 -13
- package/lib/endpoints/inventory/vehicle-types.js +2 -5
- package/lib/endpoints/inventory/vehicles.js +4 -2
- package/lib/endpoints/invoices/emails.js +15 -5
- package/lib/endpoints/invoices/invoices.js +46 -25
- package/lib/endpoints/invoices/pdfs.js +15 -8
- package/lib/endpoints/invoices/providers.js +42 -25
- package/lib/endpoints/invoices/tax-ids.js +11 -7
- package/lib/endpoints/notifications/customers.js +1 -1
- package/lib/endpoints/notifications/external-customers.js +54 -0
- package/lib/endpoints/notifications/pdfs.js +0 -3
- package/lib/endpoints/operations/accounting_items.js +7 -1
- package/lib/endpoints/operations/flexpasses.js +9 -7
- package/lib/endpoints/operations/gift-certificates.js +53 -0
- package/lib/endpoints/operations/loans.js +16 -10
- package/lib/endpoints/operations/movements.js +17 -6
- package/lib/endpoints/operations/pago-express.js +96 -0
- package/lib/endpoints/operations/parcels.js +11 -11
- package/lib/endpoints/operations/parcels_manifests.js +7 -4
- package/lib/endpoints/sales/cancellations.js +43 -31
- package/lib/endpoints/sales/cart.js +21 -18
- package/lib/endpoints/sales/flexpasses.js +2 -5
- package/lib/endpoints/sales/order.js +41 -7
- package/lib/endpoints/sales/parcel-quotes.js +2 -2
- package/package.json +1 -1
- package/src/client.js +10 -2
- package/src/endpoints/btrzpay/adyen.js +44 -0
- package/src/endpoints/btrzpay/cardpointe.js +6 -4
- package/src/endpoints/btrzpay/customerCards.js +19 -19
- package/src/endpoints/btrzpay/customers.js +13 -13
- package/src/endpoints/btrzpay/cybersource3ds.js +114 -0
- package/src/endpoints/btrzpay/datalogic.js +63 -28
- package/src/endpoints/btrzpay/oxxo.js +53 -26
- package/src/endpoints/btrzpay/prismaTerminals.js +24 -15
- package/src/endpoints/btrzpay/referenced-payments.js +4 -4
- package/src/endpoints/btrzpay/square.js +8 -8
- package/src/endpoints/btrzpay/stripe-terminals.js +17 -10
- package/src/endpoints/btrzpay/stripe3ds.js +40 -0
- package/src/endpoints/btrzpay/terminalPayments.js +19 -19
- package/src/endpoints/inventory/banks.js +39 -21
- package/src/endpoints/inventory/change-requests.js +59 -31
- package/src/endpoints/inventory/control-classes.js +39 -20
- package/src/endpoints/inventory/countries.js +25 -10
- package/src/endpoints/inventory/custom-content.js +39 -22
- package/src/endpoints/inventory/custom-fields.js +25 -19
- package/src/endpoints/inventory/document-types.js +34 -33
- package/src/endpoints/inventory/external-wallets.js +25 -20
- package/src/endpoints/inventory/fees.js +19 -14
- package/src/endpoints/inventory/filtered-trips.js +29 -8
- package/src/endpoints/inventory/financing-costs.js +19 -14
- package/src/endpoints/inventory/garages.js +19 -14
- package/src/endpoints/inventory/getnet-terminals.js +20 -15
- package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
- package/src/endpoints/inventory/holidays.js +121 -0
- package/src/endpoints/inventory/insurances.js +17 -13
- package/src/endpoints/inventory/items.js +13 -9
- package/src/endpoints/inventory/labels.js +16 -11
- package/src/endpoints/inventory/marital-status.js +16 -11
- package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
- package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
- package/src/endpoints/inventory/mit-terminals.js +16 -11
- package/src/endpoints/inventory/operation-messages.js +18 -12
- package/src/endpoints/inventory/operation-reasons.js +15 -10
- package/src/endpoints/inventory/pay-on-accounts.js +5 -4
- package/src/endpoints/inventory/payment-terminals.js +15 -10
- package/src/endpoints/inventory/products.js +22 -10
- package/src/endpoints/inventory/promos.js +27 -18
- package/src/endpoints/inventory/segments-information-tables.js +13 -7
- package/src/endpoints/inventory/station-groups.js +2 -4
- package/src/endpoints/inventory/taxes.js +11 -2
- package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
- package/src/endpoints/inventory/trip-ids.js +54 -0
- package/src/endpoints/inventory/trips.js +52 -14
- package/src/endpoints/inventory/vehicle-types.js +3 -4
- package/src/endpoints/inventory/vehicles.js +4 -3
- package/src/endpoints/invoices/emails.js +15 -5
- package/src/endpoints/invoices/invoices.js +46 -25
- package/src/endpoints/invoices/pdfs.js +15 -8
- package/src/endpoints/invoices/providers.js +42 -25
- package/src/endpoints/invoices/tax-ids.js +11 -7
- package/src/endpoints/notifications/customers.js +1 -1
- package/src/endpoints/notifications/external-customers.js +41 -0
- package/src/endpoints/notifications/pdfs.js +0 -3
- package/src/endpoints/operations/accounting_items.js +7 -2
- package/src/endpoints/operations/flexpasses.js +9 -7
- package/src/endpoints/operations/gift-certificates.js +39 -0
- package/src/endpoints/operations/loans.js +16 -11
- package/src/endpoints/operations/movements.js +17 -6
- package/src/endpoints/operations/pago-express.js +73 -0
- package/src/endpoints/operations/parcels.js +11 -11
- package/src/endpoints/operations/parcels_manifests.js +7 -5
- package/src/endpoints/sales/cancellations.js +43 -31
- package/src/endpoints/sales/cart.js +20 -18
- package/src/endpoints/sales/flexpasses.js +3 -4
- package/src/endpoints/sales/order.js +34 -7
- package/src/endpoints/sales/parcel-quotes.js +2 -2
- package/test/endpoints/btrzpay/adyen.tests.js +27 -0
- package/test/endpoints/btrzpay/carpointe.tests.js +14 -0
- package/test/endpoints/btrzpay/customerCards.test.js +9 -6
- package/test/endpoints/btrzpay/cybersource3ds.tests.js +55 -0
- package/test/endpoints/btrzpay/stripe-terminals.tests.js +5 -6
- package/test/endpoints/btrzpay/stripe3ds.tests.js +31 -0
- package/test/endpoints/inventory/banks.test.js +8 -10
- package/test/endpoints/inventory/filtered-trips.test.js +6 -0
- package/test/endpoints/inventory/holidays.test.js +52 -0
- package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
- package/test/endpoints/inventory/trip-ids.test.js +27 -0
- package/test/endpoints/inventory/trips.test.js +19 -14
- package/test/endpoints/notifications/external-customers.test.js +30 -0
- package/test/endpoints/operations/gift_certificates.test.js +37 -0
- package/test/endpoints/operations/operations.test.js +30 -0
- 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
|
|
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
|
|
37
|
-
* @param {InvoicesListQuery} [opts.query] - Query
|
|
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
|
|
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
|
|
61
|
-
* @param {string} opts.id - Invoice
|
|
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
|
|
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
|
|
86
|
-
* @param {InvoicesFailuresQuery} [opts.query] - Query
|
|
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
|
|
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
|
|
110
|
-
* @param {Object} opts.data -
|
|
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
|
|
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
|
|
136
|
-
* @param {Object} opts.data -
|
|
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}
|
|
10
|
-
* @property {string} transactionId - Transaction
|
|
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
|
|
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
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {string} [opts.responseType] - Response type
|
|
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
|
|
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
|
|
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
|
|
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
|
|
59
|
-
* @param {string} opts.id - Provider
|
|
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
|
|
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
|
|
84
|
-
* @param {string} opts.id - Provider
|
|
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
|
|
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
|
|
112
|
-
* @param {string} opts.id - Provider
|
|
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
|
|
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
|
|
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
|
|
13
|
-
* @property {string} [documentType] - Tax identification type
|
|
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
|
|
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
|
|
34
|
-
* @param {TaxIdsListQuery} opts.query - taxNumber
|
|
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
|
|
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}
|
|
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.
|
|
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 -
|
|
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
|
|
24
|
-
* @param {string} opts.flexpassId - Flexpass
|
|
25
|
-
* @param {string} opts.tripId - Trip
|
|
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 {
|
|
35
|
-
* @param {
|
|
36
|
-
* @
|
|
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
|
|
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.
|
|
59
|
-
* @param {
|
|
60
|
-
* @
|
|
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
|
|
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
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {Object} [opts.
|
|
26
|
-
* @
|
|
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,
|