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
|
@@ -16,7 +16,8 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
16
16
|
* @param {string} [opts.token] - API key
|
|
17
17
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
18
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminalsSettings: Object[], next?: string, previous?: string, count: number }>>}
|
|
20
|
+
* @throws When the request fails (e.g. 401 Unauthorized, 500 Internal Server Error)
|
|
20
21
|
*/
|
|
21
22
|
function all({
|
|
22
23
|
token,
|
|
@@ -35,9 +36,10 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
35
36
|
* @param {Object} opts
|
|
36
37
|
* @param {string} [opts.token] - API key
|
|
37
38
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
38
|
-
* @param {string} opts.id - MIT terminal setting id
|
|
39
|
+
* @param {string} opts.id - MIT terminal setting id (24-char hex ObjectId)
|
|
39
40
|
* @param {Object} [opts.headers] - Optional headers
|
|
40
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
41
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminalSettings: Object }>>}
|
|
42
|
+
* @throws When the request fails (e.g. 400 INVALID_ID, 401 Unauthorized, 404 MITTERMINALSETTING_NOT_FOUND, 500 Internal Server Error)
|
|
41
43
|
*/
|
|
42
44
|
function get({id, token, jwtToken, headers}) {
|
|
43
45
|
return client.get(`/mit-terminals-settings/${id}`, {
|
|
@@ -50,9 +52,10 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
50
52
|
* @param {Object} opts
|
|
51
53
|
* @param {string} [opts.token] - API key
|
|
52
54
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
53
|
-
* @param {Object} opts.mitTerminalSettings - MIT terminal settings payload
|
|
55
|
+
* @param {Object} opts.mitTerminalSettings - MIT terminal settings payload (name, operatingCompanyId, shiftLocationId, user, password)
|
|
54
56
|
* @param {Object} [opts.headers] - Optional headers
|
|
55
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
57
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminalSettings: Object }>>}
|
|
58
|
+
* @throws When the request fails (e.g. 400 WRONG_DATA, 401 Unauthorized, 500 Internal Server Error)
|
|
56
59
|
*/
|
|
57
60
|
function create({jwtToken, token, mitTerminalSettings, headers}) {
|
|
58
61
|
return client({
|
|
@@ -70,9 +73,10 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
70
73
|
* @param {Object} opts
|
|
71
74
|
* @param {string} [opts.token] - API key
|
|
72
75
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
73
|
-
* @param {string} opts.id - MIT terminal setting id
|
|
76
|
+
* @param {string} opts.id - MIT terminal setting id (24-char hex ObjectId)
|
|
74
77
|
* @param {Object} [opts.headers] - Optional headers
|
|
75
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
78
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitterminalsettingId: string }>>}
|
|
79
|
+
* @throws When the request fails (e.g. 400 INVALID_ID, 401 Unauthorized, 404 MITTERMINALSETTING_NOT_FOUND, 500 Internal Server Error)
|
|
76
80
|
*/
|
|
77
81
|
function remove({jwtToken, id, token, headers}) {
|
|
78
82
|
return client({
|
|
@@ -87,10 +91,11 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
87
91
|
* @param {Object} opts
|
|
88
92
|
* @param {string} [opts.token] - API key
|
|
89
93
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
90
|
-
* @param {string} opts.id - MIT terminal setting id
|
|
91
|
-
* @param {Object} opts.mitTerminalSettings - MIT terminal settings payload
|
|
94
|
+
* @param {string} opts.id - MIT terminal setting id (24-char hex ObjectId)
|
|
95
|
+
* @param {Object} opts.mitTerminalSettings - MIT terminal settings payload (name, operatingCompanyId, shiftLocationId, user, password)
|
|
92
96
|
* @param {Object} [opts.headers] - Optional headers
|
|
93
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
97
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminalSettings: Object }>>}
|
|
98
|
+
* @throws When the request fails (e.g. 400 WRONG_DATA/INVALID_ID, 401, 404 MITTERMINALSETTING_NOT_FOUND, 500)
|
|
94
99
|
*/
|
|
95
100
|
function update({jwtToken, token, id, mitTerminalSettings, headers}) {
|
|
96
101
|
return client({
|
|
@@ -11,12 +11,13 @@ const {
|
|
|
11
11
|
*/
|
|
12
12
|
function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
13
13
|
/**
|
|
14
|
-
* GET /mit-terminals - list MIT terminals. API does not accept query params.
|
|
14
|
+
* GET /mit-terminals - list MIT terminals (paginated). API does not accept query params.
|
|
15
15
|
* @param {Object} opts
|
|
16
16
|
* @param {string} [opts.token] - API key
|
|
17
17
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
18
18
|
* @param {Object} [opts.headers] - Optional headers
|
|
19
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
19
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminals: Object[], next?: string, previous?: string, count: number }>>}
|
|
20
|
+
* @throws 401; 500.
|
|
20
21
|
*/
|
|
21
22
|
function all({
|
|
22
23
|
token,
|
|
@@ -34,9 +35,10 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
34
35
|
* @param {Object} opts
|
|
35
36
|
* @param {string} [opts.token] - API key
|
|
36
37
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
37
|
-
* @param {string} opts.mitTerminalId - MIT terminal id
|
|
38
|
+
* @param {string} opts.mitTerminalId - MIT terminal id (24 hex characters)
|
|
38
39
|
* @param {Object} [opts.headers] - Optional headers
|
|
39
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
40
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminal: Object }>>}
|
|
41
|
+
* @throws 400 INVALID_MIT_TERMINAL_ID; 401; 404 MIT_TERMINAL_NOT_FOUND; 500.
|
|
40
42
|
*/
|
|
41
43
|
function get({mitTerminalId, token, headers}) {
|
|
42
44
|
return client.get(`/mit-terminals/${mitTerminalId}`, {
|
|
@@ -49,9 +51,10 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
49
51
|
* @param {Object} opts
|
|
50
52
|
* @param {string} [opts.token] - API key
|
|
51
53
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
52
|
-
* @param {Object} opts.mitTerminal - MIT terminal payload
|
|
54
|
+
* @param {Object} opts.mitTerminal - MIT terminal payload (name, serialNumber required; user, password per API)
|
|
53
55
|
* @param {Object} [opts.headers] - Optional headers
|
|
54
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
56
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminal: Object }>>}
|
|
57
|
+
* @throws 400 WRONG_DATA (mitTerminal, name, serialNumber, user, password); 401; 404 MIT_TERMINAL_NOT_FOUND; 500.
|
|
55
58
|
*/
|
|
56
59
|
function create({jwtToken, token, mitTerminal, headers}) {
|
|
57
60
|
return client({
|
|
@@ -69,9 +72,10 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
69
72
|
* @param {Object} opts
|
|
70
73
|
* @param {string} [opts.token] - API key
|
|
71
74
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
72
|
-
* @param {string} opts.mitTerminalId - MIT terminal id
|
|
75
|
+
* @param {string} opts.mitTerminalId - MIT terminal id (24 hex characters)
|
|
73
76
|
* @param {Object} [opts.headers] - Optional headers
|
|
74
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
77
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminalId: string }>>}
|
|
78
|
+
* @throws 400 INVALID_MIT_TERMINAL_ID; 401; 404 MIT_TERMINAL_NOT_FOUND; 500.
|
|
75
79
|
*/
|
|
76
80
|
function remove({jwtToken, mitTerminalId, token, headers}) {
|
|
77
81
|
return client({
|
|
@@ -86,10 +90,11 @@ function mitTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
86
90
|
* @param {Object} opts
|
|
87
91
|
* @param {string} [opts.token] - API key
|
|
88
92
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
89
|
-
* @param {string} opts.mitTerminalId - MIT terminal id
|
|
90
|
-
* @param {Object} opts.mitTerminal - MIT terminal payload
|
|
93
|
+
* @param {string} opts.mitTerminalId - MIT terminal id (24 hex characters)
|
|
94
|
+
* @param {Object} opts.mitTerminal - MIT terminal payload (MitTerminalPost)
|
|
91
95
|
* @param {Object} [opts.headers] - Optional headers
|
|
92
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
96
|
+
* @returns {Promise<import("axios").AxiosResponse<{ mitTerminal: Object }>>}
|
|
97
|
+
* @throws 400 WRONG_DATA; 401; 404 MIT_TERMINAL_NOT_FOUND; 500.
|
|
93
98
|
*/
|
|
94
99
|
function update({jwtToken, token, mitTerminalId, mitTerminal, headers}) {
|
|
95
100
|
return client({
|
|
@@ -28,7 +28,8 @@ function operationMessagesFactory({client, internalAuthTokenProvider}) {
|
|
|
28
28
|
* @param {string} [opts.token] - API key
|
|
29
29
|
* @param {OperationMessagesListQuery} [opts.query] - Query params
|
|
30
30
|
* @param {Object} [opts.headers] - Optional headers
|
|
31
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
31
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationMessages: Object[], count?: number, next?: string, previous?: string }>>}
|
|
32
|
+
* @throws When the request fails (e.g. 401 Unauthorized, 500 Internal Server Error)
|
|
32
33
|
*/
|
|
33
34
|
function all({token, query = {}, headers}) {
|
|
34
35
|
return client({
|
|
@@ -44,9 +45,10 @@ function operationMessagesFactory({client, internalAuthTokenProvider}) {
|
|
|
44
45
|
* @param {Object} opts
|
|
45
46
|
* @param {string} [opts.token] - API key
|
|
46
47
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
47
|
-
* @param {Object} opts.opMsgData - Operation message payload
|
|
48
|
+
* @param {Object} opts.opMsgData - Operation message payload (message, name, type, effectiveDateTimeStart/End, etc.)
|
|
48
49
|
* @param {Object} [opts.headers] - Optional headers
|
|
49
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
50
|
+
* @returns {Promise<import("axios").AxiosResponse<Object>>} Created OperationMessage
|
|
51
|
+
* @throws When the request fails (400, 401, 409 duplicate key, 500)
|
|
50
52
|
*/
|
|
51
53
|
function create({token, jwtToken, opMsgData, headers}) {
|
|
52
54
|
return client({
|
|
@@ -62,10 +64,11 @@ function operationMessagesFactory({client, internalAuthTokenProvider}) {
|
|
|
62
64
|
* @param {Object} opts
|
|
63
65
|
* @param {string} [opts.token] - API key
|
|
64
66
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
65
|
-
* @param {string} opts.operationMessageId - Operation message id
|
|
66
|
-
* @param {Object} opts.opMsgData - Operation message payload
|
|
67
|
+
* @param {string} opts.operationMessageId - Operation message id (24-char hex ObjectId)
|
|
68
|
+
* @param {Object} opts.opMsgData - Operation message payload (message, name, type, etc.)
|
|
67
69
|
* @param {Object} [opts.headers] - Optional headers
|
|
68
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
70
|
+
* @returns {Promise<import("axios").AxiosResponse<Object>>} Updated OperationMessage
|
|
71
|
+
* @throws When the request fails (400, 401, 404 NOT_FOUND, 500)
|
|
69
72
|
*/
|
|
70
73
|
function update({token, jwtToken, operationMessageId, opMsgData, headers}) {
|
|
71
74
|
return client({
|
|
@@ -80,9 +83,10 @@ function operationMessagesFactory({client, internalAuthTokenProvider}) {
|
|
|
80
83
|
* GET /operation-messages/:operationMessageId - get operation message by id. API does not accept query params.
|
|
81
84
|
* @param {Object} opts
|
|
82
85
|
* @param {string} [opts.token] - API key
|
|
83
|
-
* @param {string} opts.operationMessageId - Operation message id
|
|
86
|
+
* @param {string} opts.operationMessageId - Operation message id (24-char hex ObjectId)
|
|
84
87
|
* @param {Object} [opts.headers] - Optional headers
|
|
85
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
88
|
+
* @returns {Promise<import("axios").AxiosResponse<Object>>} Response body is the OperationMessage
|
|
89
|
+
* @throws When the request fails (e.g. 401 Unauthorized, 404 NOT_FOUND, 500 Internal Server Error)
|
|
86
90
|
*/
|
|
87
91
|
function get({token, operationMessageId, headers}) {
|
|
88
92
|
return client({
|
|
@@ -96,10 +100,11 @@ function operationMessagesFactory({client, internalAuthTokenProvider}) {
|
|
|
96
100
|
* DELETE /operation-messages/:operationMessageId - remove operation message. API does not accept query params.
|
|
97
101
|
* @param {Object} opts
|
|
98
102
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
99
|
-
* @param {string} opts.operationMessageId - Operation message id
|
|
103
|
+
* @param {string} opts.operationMessageId - Operation message id (24-char hex ObjectId)
|
|
100
104
|
* @param {string} [opts.token] - API key
|
|
101
105
|
* @param {Object} [opts.headers] - Optional headers
|
|
102
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
106
|
+
* @returns {Promise<import("axios").AxiosResponse<void>>} 204 No Content on success
|
|
107
|
+
* @throws When the request fails (e.g. 401 Unauthorized, 404 NOT_FOUND, 500 Internal Server Error)
|
|
103
108
|
*/
|
|
104
109
|
function remove({jwtToken, operationMessageId, token, headers}) {
|
|
105
110
|
return client({
|
|
@@ -114,9 +119,10 @@ function operationMessagesFactory({client, internalAuthTokenProvider}) {
|
|
|
114
119
|
* @param {Object} opts
|
|
115
120
|
* @param {string} [opts.token] - API key
|
|
116
121
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
117
|
-
* @param {Object} opts.opMsgData - Request body (station criteria)
|
|
122
|
+
* @param {Object} opts.opMsgData - Request body (OperationMessagesStationsQuery: station criteria and dates)
|
|
118
123
|
* @param {Object} [opts.headers] - Optional headers
|
|
119
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
124
|
+
* @returns {Promise<import("axios").AxiosResponse<Object>>} Response body matches OperationMessagesStations schema
|
|
125
|
+
* @throws When the request fails (e.g. 400 INVALID_DATE_RANGE/INVALID_STATION, 401, 500)
|
|
120
126
|
*/
|
|
121
127
|
function getByStation({token, jwtToken, opMsgData, headers}) {
|
|
122
128
|
return client({
|
|
@@ -21,7 +21,8 @@ function operationReasonFactory({client, internalAuthTokenProvider}) {
|
|
|
21
21
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
22
22
|
* @param {OperationReasonsListQuery} [opts.query] - Query params (page)
|
|
23
23
|
* @param {Object} [opts.headers] - Optional headers
|
|
24
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
24
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationReasons: Object[], next?: string, previous?: string, count: number }>>}
|
|
25
|
+
* @throws When the request fails (e.g. 400 INVALID_PAGE, 401 Unauthorized, 500)
|
|
25
26
|
*/
|
|
26
27
|
function all({token, jwtToken, query = {}, headers}) {
|
|
27
28
|
return client({
|
|
@@ -37,9 +38,10 @@ function operationReasonFactory({client, internalAuthTokenProvider}) {
|
|
|
37
38
|
* @param {Object} opts
|
|
38
39
|
* @param {string} [opts.token] - API key
|
|
39
40
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
40
|
-
* @param {string} opts.id - Operation reason id
|
|
41
|
+
* @param {string} opts.id - Operation reason id (24-char hex ObjectId)
|
|
41
42
|
* @param {Object} [opts.headers] - Optional headers
|
|
42
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
43
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationReason: Object }>>}
|
|
44
|
+
* @throws When the request fails (400 INVALID_OPERATION_REASON_ID, 401, 404 OPERATION_REASON_NOT_FOUND, 500)
|
|
43
45
|
*/
|
|
44
46
|
function get({token, jwtToken, id, query = {}, headers}) {
|
|
45
47
|
return client({
|
|
@@ -55,10 +57,11 @@ function operationReasonFactory({client, internalAuthTokenProvider}) {
|
|
|
55
57
|
* @param {Object} opts
|
|
56
58
|
* @param {string} [opts.token] - API key
|
|
57
59
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
58
|
-
* @param {string} opts.id - Operation reason id
|
|
59
|
-
* @param {Object} opts.operationReason - Operation reason payload
|
|
60
|
+
* @param {string} opts.id - Operation reason id (24-char hex ObjectId)
|
|
61
|
+
* @param {Object} opts.operationReason - Operation reason payload (name, type, lexiconKeys, etc.)
|
|
60
62
|
* @param {Object} [opts.headers] - Optional headers
|
|
61
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
63
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationReason: Object }>>}
|
|
64
|
+
* @throws When the request fails (400 WRONG_DATA/INVALID_OPERATION_REASON_ID, 401, 404, 500)
|
|
62
65
|
*/
|
|
63
66
|
function update({token, jwtToken, id, operationReason, query = {}, headers}) {
|
|
64
67
|
return client({
|
|
@@ -75,9 +78,10 @@ function operationReasonFactory({client, internalAuthTokenProvider}) {
|
|
|
75
78
|
* @param {Object} opts
|
|
76
79
|
* @param {string} [opts.token] - API key
|
|
77
80
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
78
|
-
* @param {string} opts.id - Operation reason id
|
|
81
|
+
* @param {string} opts.id - Operation reason id (24-char hex ObjectId)
|
|
79
82
|
* @param {Object} [opts.headers] - Optional headers
|
|
80
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
83
|
+
* @returns {Promise<import("axios").AxiosResponse<{ _id: string }>>}
|
|
84
|
+
* @throws When the request fails (400 INVALID_OPERATION_REASON_ID, 401, 404 OPERATION_REASON_NOT_FOUND, 500)
|
|
81
85
|
*/
|
|
82
86
|
function remove({token, jwtToken, id, query = {}, headers}) {
|
|
83
87
|
return client({
|
|
@@ -93,9 +97,10 @@ function operationReasonFactory({client, internalAuthTokenProvider}) {
|
|
|
93
97
|
* @param {Object} opts
|
|
94
98
|
* @param {string} [opts.token] - API key
|
|
95
99
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
96
|
-
* @param {Object} opts.operationReason - Operation reason payload
|
|
100
|
+
* @param {Object} opts.operationReason - Operation reason payload (name, type, lexiconKeys required)
|
|
97
101
|
* @param {Object} [opts.headers] - Optional headers
|
|
98
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
102
|
+
* @returns {Promise<import("axios").AxiosResponse<{ operationReason: Object }>>}
|
|
103
|
+
* @throws When the request fails (400 WRONG_DATA, 401, 409 CANNOT_CREATE_LEXICON_ENTRIES, 500)
|
|
99
104
|
*/
|
|
100
105
|
function create({token, jwtToken, operationReason, query = {}, headers}) {
|
|
101
106
|
return client({
|
|
@@ -20,14 +20,15 @@ const {authorizationHeaders} = require("../endpoints_helpers.js");
|
|
|
20
20
|
*/
|
|
21
21
|
function payOnAccountsFactory({client, internalAuthTokenProvider}) {
|
|
22
22
|
/**
|
|
23
|
-
* GET /pay-on-accounts - list pay-on accounts.
|
|
23
|
+
* GET /pay-on-accounts - list pay-on accounts. When format=csv returns CSV (text/csv); otherwise JSON with pagination.
|
|
24
24
|
* @param {Object} opts
|
|
25
25
|
* @param {string} [opts.token] - API key
|
|
26
26
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
27
|
-
* @param {PayOnAccountsListQuery} [opts.query] - Query params
|
|
28
|
-
* @param {string} [opts.responseType] - Response type (e.g. json)
|
|
27
|
+
* @param {PayOnAccountsListQuery} [opts.query] - Query params (page, format, disabled, term, fareIds, providerId)
|
|
28
|
+
* @param {string} [opts.responseType] - Response type (e.g. json); use for CSV when format=csv
|
|
29
29
|
* @param {Object} [opts.headers] - Optional headers
|
|
30
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
30
|
+
* @returns {Promise<import("axios").AxiosResponse<{ payOnAccounts: Object[], next?: string, previous?: string, count: number }|string>>}
|
|
31
|
+
* @throws When the request fails (400 INVALID_PAGE/INVALID_FARE_IDS/INVALID_PROVIDER_ID/INVALID_SEARCH_TERM, 401, 500)
|
|
31
32
|
*/
|
|
32
33
|
function all({token, jwtToken, query = {}, responseType = "json", headers}) {
|
|
33
34
|
return client.get("/pay-on-accounts", {
|
|
@@ -15,7 +15,8 @@ function paymentTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
15
15
|
* @param {Object} opts
|
|
16
16
|
* @param {string} [opts.token] - API key
|
|
17
17
|
* @param {Object} [opts.headers] - Optional headers
|
|
18
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
18
|
+
* @returns {Promise<import("axios").AxiosResponse<{ paymentTerminals: Object[], next?: string, previous?: string, count: number }>>}
|
|
19
|
+
* @throws When the request fails (401 Unauthorized, 500 Internal Server Error)
|
|
19
20
|
*/
|
|
20
21
|
function all({
|
|
21
22
|
token,
|
|
@@ -31,10 +32,11 @@ function paymentTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
31
32
|
/**
|
|
32
33
|
* GET /payment-terminals/:paymentTerminalId - get payment terminal by id. API does not accept query params.
|
|
33
34
|
* @param {Object} opts
|
|
34
|
-
* @param {string} opts.paymentTerminalId - Payment terminal id
|
|
35
|
+
* @param {string} opts.paymentTerminalId - Payment terminal id (24-char hex ObjectId)
|
|
35
36
|
* @param {string} [opts.token] - API key
|
|
36
37
|
* @param {Object} [opts.headers] - Optional headers
|
|
37
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
38
|
+
* @returns {Promise<import("axios").AxiosResponse<{ paymentTerminal: Object }>>}
|
|
39
|
+
* @throws When the request fails (400 INVALID_PAYMENT_TERMINAL_ID, 401, 404 PAYMENT_TERMINAL_NOT_FOUND, 500)
|
|
38
40
|
*/
|
|
39
41
|
function get({paymentTerminalId, token, headers}) {
|
|
40
42
|
return client.get(`/payment-terminals/${paymentTerminalId}`, {
|
|
@@ -47,9 +49,10 @@ function paymentTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
47
49
|
* @param {Object} opts
|
|
48
50
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
49
51
|
* @param {string} [opts.token] - API key
|
|
50
|
-
* @param {Object} opts.paymentTerminal - Payment terminal payload
|
|
52
|
+
* @param {Object} opts.paymentTerminal - Payment terminal payload (name, protocol, ip, locationId, partNumber, serialNumber)
|
|
51
53
|
* @param {Object} [opts.headers] - Optional headers
|
|
52
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
54
|
+
* @returns {Promise<import("axios").AxiosResponse<{ paymentTerminal: Object }>>}
|
|
55
|
+
* @throws When the request fails (400 WRONG_DATA, 401, 500)
|
|
53
56
|
*/
|
|
54
57
|
function create({jwtToken, token, paymentTerminal, headers}) {
|
|
55
58
|
return client({
|
|
@@ -66,10 +69,11 @@ function paymentTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
66
69
|
* DELETE /payment-terminals/:paymentTerminalId - remove payment terminal. API does not accept query params.
|
|
67
70
|
* @param {Object} opts
|
|
68
71
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
69
|
-
* @param {string} opts.paymentTerminalId - Payment terminal id
|
|
72
|
+
* @param {string} opts.paymentTerminalId - Payment terminal id (24-char hex ObjectId)
|
|
70
73
|
* @param {string} [opts.token] - API key
|
|
71
74
|
* @param {Object} [opts.headers] - Optional headers
|
|
72
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
75
|
+
* @returns {Promise<import("axios").AxiosResponse<{ paymentTerminalId: string }>>}
|
|
76
|
+
* @throws When the request fails (400 INVALID_PAYMENT_TERMINAL_ID, 401, 404 PAYMENT_TERMINAL_NOT_FOUND, 500)
|
|
73
77
|
*/
|
|
74
78
|
function remove({jwtToken, paymentTerminalId, token, headers}) {
|
|
75
79
|
return client({
|
|
@@ -84,10 +88,11 @@ function paymentTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
84
88
|
* @param {Object} opts
|
|
85
89
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
86
90
|
* @param {string} [opts.token] - API key
|
|
87
|
-
* @param {string} opts.paymentTerminalId - Payment terminal id
|
|
88
|
-
* @param {Object} opts.paymentTerminal - Payment terminal payload
|
|
91
|
+
* @param {string} opts.paymentTerminalId - Payment terminal id (24-char hex ObjectId)
|
|
92
|
+
* @param {Object} opts.paymentTerminal - Payment terminal payload (name, protocol, ip, locationId, partNumber, serialNumber)
|
|
89
93
|
* @param {Object} [opts.headers] - Optional headers
|
|
90
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
94
|
+
* @returns {Promise<import("axios").AxiosResponse<{ paymentTerminal: Object }>>}
|
|
95
|
+
* @throws When the request fails (400 WRONG_DATA, 401, 404 PAYMENT_TERMINAL_NOT_FOUND, 500)
|
|
91
96
|
*/
|
|
92
97
|
function update({jwtToken, token, paymentTerminalId, paymentTerminal, headers}) {
|
|
93
98
|
return client({
|
|
@@ -40,7 +40,9 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
40
40
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
41
41
|
* @param {ProductsListQuery} [opts.query] - Query params
|
|
42
42
|
* @param {Object} [opts.headers] - Optional headers
|
|
43
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
43
|
+
* @returns {Promise<import("axios").AxiosResponse<{ products: Array<object> }>>}
|
|
44
|
+
* Resolves with list of products; response.data has Products shape.
|
|
45
|
+
* @throws When the request fails (400 invalid channels, 401 unauthorized, 500). ErrorResponse body.
|
|
44
46
|
*/
|
|
45
47
|
function all({token, query = {}, headers}) {
|
|
46
48
|
return client({
|
|
@@ -58,7 +60,9 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
58
60
|
* @param {string} opts.productId - Product id
|
|
59
61
|
* @param {ProductGetQuery} [opts.query] - Query params (providerIds, channels, enabled)
|
|
60
62
|
* @param {Object} [opts.headers] - Optional headers
|
|
61
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
63
|
+
* @returns {Promise<import("axios").AxiosResponse<{ product: object }>>}
|
|
64
|
+
* Resolves with single product; response.data.product is the Product.
|
|
65
|
+
* @throws When the request fails (400/401/404/500). Body: INVALID_PRODUCTID, WRONG_DATA, PRODUCT_NOTFOUND.
|
|
62
66
|
*/
|
|
63
67
|
function get({productId, token, jwtToken, query = {}, headers}) {
|
|
64
68
|
return client({
|
|
@@ -69,13 +73,16 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
/**
|
|
72
|
-
* POST /products - create product.
|
|
76
|
+
* POST /products - create product. No query params. Requires BETTEREZ_APP JWT or API key.
|
|
73
77
|
* @param {Object} opts
|
|
74
78
|
* @param {string} [opts.token] - API key
|
|
75
79
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
76
|
-
* @param {Object} opts.data - Product payload
|
|
80
|
+
* @param {Object} opts.data - Product payload (PostedProduct); must not include _id.
|
|
77
81
|
* @param {Object} [opts.headers] - Optional headers
|
|
78
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
82
|
+
* @returns {Promise<import("axios").AxiosResponse<{ product: object }>>}
|
|
83
|
+
* Resolves with the created product.
|
|
84
|
+
* @throws When the request fails (400/401/500). Body: DUPLICATE_PRODUCT, CANNOT_CREATE_PRODUCT_WITH_ID,
|
|
85
|
+
* INVALID_PAYMENT_METHODS, INVALID_PARENT_PRODUCT_ID, INVALID_JOURNEY_RESTRICTIONS, INVALID_PRODUCT_NAME, etc.
|
|
79
86
|
*/
|
|
80
87
|
function create({data, token, jwtToken, headers}) {
|
|
81
88
|
return client({
|
|
@@ -87,14 +94,17 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
/**
|
|
90
|
-
* PUT /products/:productId - update product.
|
|
97
|
+
* PUT /products/:productId - update product. No query params. Requires BETTEREZ_APP JWT or API key.
|
|
91
98
|
* @param {Object} opts
|
|
92
99
|
* @param {string} [opts.token] - API key
|
|
93
100
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
94
101
|
* @param {string} opts.productId - Product id
|
|
95
|
-
* @param {Object} opts.data - Product payload
|
|
102
|
+
* @param {Object} opts.data - Product payload (PostedProduct).
|
|
96
103
|
* @param {Object} [opts.headers] - Optional headers
|
|
97
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
104
|
+
* @returns {Promise<import("axios").AxiosResponse<{ product: object }>>}
|
|
105
|
+
* Resolves with the updated product. Emits product.updated webhook.
|
|
106
|
+
* @throws When the request fails (400/401/404/500). Body: NOT_FOUND, INVALID_PAYMENT_METHODS,
|
|
107
|
+
* CANNOT_SET_PARENT_AS_CHILD, INVALID_JOURNEY_RESTRICTIONS, INVALID_PRODUCT_NAME, etc.
|
|
98
108
|
*/
|
|
99
109
|
function update({productId, data, token, jwtToken, headers}) {
|
|
100
110
|
return client({
|
|
@@ -114,7 +124,8 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
114
124
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
115
125
|
* @param {string} opts.domain - Domain
|
|
116
126
|
* @param {Object} [opts.headers] - Optional headers
|
|
117
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
127
|
+
* @returns {Promise<import("axios").AxiosResponse>} Resolves on success. May emit product.updated.
|
|
128
|
+
* @throws When the request fails (401, 404, 500).
|
|
118
129
|
*/
|
|
119
130
|
remove: ({token, jwtToken, domain, headers}) => {
|
|
120
131
|
return client({
|
|
@@ -133,7 +144,8 @@ function productsFactory({client, internalAuthTokenProvider}) {
|
|
|
133
144
|
* @param {string} [opts.token] - API key
|
|
134
145
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
135
146
|
* @param {Object} [opts.headers] - Optional headers
|
|
136
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
147
|
+
* @returns {Promise<import("axios").AxiosResponse>} Resolves with list of product families.
|
|
148
|
+
* @throws When the request fails (401, 500).
|
|
137
149
|
*/
|
|
138
150
|
all: ({token, query = {}, headers}) => {
|
|
139
151
|
return client({
|
|
@@ -40,7 +40,9 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
40
40
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
41
41
|
* @param {PromosListQuery} [opts.query] - Query params
|
|
42
42
|
* @param {Object} [opts.headers] - Optional headers
|
|
43
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
43
|
+
* @returns {Promise<import("axios").AxiosResponse<{ promos: Array<object>, total: number }>>}
|
|
44
|
+
* Resolves with paginated promos; response.data has Promos shape.
|
|
45
|
+
* @throws When the request fails (400/401/404/500). Body: WRONG_DATA, PROMO_NOT_FOUND.
|
|
44
46
|
*/
|
|
45
47
|
function all({token, query = {}, headers}) {
|
|
46
48
|
return client.get("/promos", {
|
|
@@ -66,13 +68,15 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/**
|
|
69
|
-
* POST /promos - create promo.
|
|
71
|
+
* POST /promos - create promo. No query params. Requires BETTEREZ_APP JWT or API key. Emits promo.created.
|
|
70
72
|
* @param {Object} opts
|
|
71
73
|
* @param {string} [opts.token] - API key
|
|
72
74
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
73
|
-
* @param {Object} opts.promo - Promo payload
|
|
75
|
+
* @param {Object} opts.promo - Promo payload (PromoUpdateRequest); must not include _id.
|
|
74
76
|
* @param {Object} [opts.headers] - Optional headers
|
|
75
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
77
|
+
* @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with created Promo.
|
|
78
|
+
* @throws When the request fails (400/401/500). Body: WRONG_DATA, INTERNALID_USED,
|
|
79
|
+
* CANNOT_CREATE_PROMO_WITH_ID, INVALID_PAYMENT_METHOD_TYPE, etc.
|
|
76
80
|
*/
|
|
77
81
|
function create({jwtToken, promo, token, headers}) {
|
|
78
82
|
return client({
|
|
@@ -84,13 +88,14 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
/**
|
|
87
|
-
* DELETE /promos/:promoId -
|
|
91
|
+
* DELETE /promos/:promoId - disable promo (soft delete). No query params. Requires BETTEREZ_APP. Emits promo.deleted.
|
|
88
92
|
* @param {Object} opts
|
|
89
93
|
* @param {string} [opts.token] - API key
|
|
90
94
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
91
95
|
* @param {string} opts.promoId - Promo id
|
|
92
96
|
* @param {Object} [opts.headers] - Optional headers
|
|
93
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
97
|
+
* @returns {Promise<import("axios").AxiosResponse>} Resolves with disabled promo.
|
|
98
|
+
* @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PROMO_ID, PROMO_NOT_FOUND.
|
|
94
99
|
*/
|
|
95
100
|
function remove({jwtToken, promoId, token, headers}) {
|
|
96
101
|
return client({
|
|
@@ -101,14 +106,15 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
/**
|
|
104
|
-
* PATCH /promos/:promoId - update promo.
|
|
109
|
+
* PATCH /promos/:promoId - update promo (partial). No query params. Requires BETTEREZ_APP. Emits promo.updated.
|
|
105
110
|
* @param {Object} opts
|
|
106
111
|
* @param {string} [opts.token] - API key
|
|
107
112
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
108
113
|
* @param {string} opts.promoId - Promo id
|
|
109
|
-
* @param {Object} opts.update -
|
|
114
|
+
* @param {Object} opts.update - Partial update (PromoUpdateRequest).
|
|
110
115
|
* @param {Object} [opts.headers] - Optional headers
|
|
111
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
116
|
+
* @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with updated Promo.
|
|
117
|
+
* @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INTERNALID_USED, PROMO_NOT_FOUND, etc.
|
|
112
118
|
*/
|
|
113
119
|
// eslint-disable-next-line no-shadow
|
|
114
120
|
function update({jwtToken, token, promoId, update, headers}) {
|
|
@@ -121,14 +127,15 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
/**
|
|
124
|
-
* PATCH /promo/:promoId -
|
|
130
|
+
* PATCH /promo/:promoId - update rule availability (add/subtract). No query params. Emits promo.updated.
|
|
125
131
|
* @param {Object} opts
|
|
126
132
|
* @param {string} [opts.token] - API key
|
|
127
133
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
128
134
|
* @param {string} opts.promoId - Promo id
|
|
129
|
-
* @param {Object} opts.operations -
|
|
135
|
+
* @param {Object} opts.operations - Array of PromoUpdateOperation (op, path, value).
|
|
130
136
|
* @param {Object} [opts.headers] - Optional headers
|
|
131
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
137
|
+
* @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with PatchedPromos.
|
|
138
|
+
* @throws When the request fails (400/401/404/500).
|
|
132
139
|
*/
|
|
133
140
|
function patch({jwtToken, token, promoId, operations, headers}) {
|
|
134
141
|
return client({
|
|
@@ -140,14 +147,15 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
/**
|
|
143
|
-
* POST /promos/:promoId/rules - add promo rule.
|
|
150
|
+
* POST /promos/:promoId/rules - add promo rule. No query params. Requires BETTEREZ_APP. May emit promo.updated.
|
|
144
151
|
* @param {Object} opts
|
|
145
152
|
* @param {string} [opts.token] - API key
|
|
146
153
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
147
154
|
* @param {string} opts.promoId - Promo id
|
|
148
|
-
* @param {Object} opts.rule - Rule payload
|
|
155
|
+
* @param {Object} opts.rule - Rule payload (PromoRule).
|
|
149
156
|
* @param {Object} [opts.headers] - Optional headers
|
|
150
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
157
|
+
* @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with Promo including new rule.
|
|
158
|
+
* @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
|
|
151
159
|
*/
|
|
152
160
|
function addRule({jwtToken, token, promoId, rule, headers}) {
|
|
153
161
|
return client({
|
|
@@ -159,15 +167,16 @@ function promosFactory({client, internalAuthTokenProvider}) {
|
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
/**
|
|
162
|
-
* PUT /promos/:promoId/rules/:ruleId - update promo rule.
|
|
170
|
+
* PUT /promos/:promoId/rules/:ruleId - update promo rule. No query params. Requires BETTEREZ_APP. Emits promo.updated.
|
|
163
171
|
* @param {Object} opts
|
|
164
172
|
* @param {string} [opts.token] - API key
|
|
165
173
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
166
174
|
* @param {string} opts.promoId - Promo id
|
|
167
175
|
* @param {string} opts.ruleId - Rule id
|
|
168
|
-
* @param {Object} opts.rule -
|
|
176
|
+
* @param {Object} opts.rule - Full rule payload (PromoRule).
|
|
169
177
|
* @param {Object} [opts.headers] - Optional headers
|
|
170
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
178
|
+
* @returns {Promise<import("axios").AxiosResponse<object>>} Resolves with updated Promo.
|
|
179
|
+
* @throws When the request fails (400/401/404/500). Body: WRONG_DATA, INVALID_PRODUCT_ID, INVALID_FARE_ID, etc.
|
|
171
180
|
*/
|
|
172
181
|
function updateRule({jwtToken, token, promoId, ruleId, rule, headers}) {
|
|
173
182
|
return client({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
const {
|
|
2
3
|
authorizationHeaders
|
|
3
4
|
} = require("./../endpoints_helpers.js");
|
|
@@ -5,7 +6,7 @@ const {
|
|
|
5
6
|
/**
|
|
6
7
|
* Query params for GET /segments-information-tables/:routeId (btrz-api-inventory-trips). See get-by-id-handler getSpec().
|
|
7
8
|
* @typedef {Object} SegmentsInformationTablesQuery
|
|
8
|
-
* @property {string} [providerId] - Provider id of the route
|
|
9
|
+
* @property {string} [providerId] - Provider/account id of the route when different from the authenticated user (24-char hex ObjectId)
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -17,18 +18,23 @@ const {
|
|
|
17
18
|
*/
|
|
18
19
|
function segmentInformationTableFactory({client, internalAuthTokenProvider}) {
|
|
19
20
|
/**
|
|
20
|
-
* GET /segments-information-tables/:routeId
|
|
21
|
+
* GET /segments-information-tables/:routeId — Returns segment information tables for the route (distances, durations, durationsHHMM between stops). Requires BETTEREZ_APP audience.
|
|
21
22
|
* @param {Object} opts
|
|
22
|
-
* @param {string} [opts.token] - API key
|
|
23
|
-
* @param {string} [opts.jwtToken] - JWT or internal auth
|
|
24
|
-
* @param {string} opts.routeId - Route id (ObjectId
|
|
25
|
-
* @param {SegmentsInformationTablesQuery} [opts.query] -
|
|
23
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
24
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
|
|
25
|
+
* @param {string} opts.routeId - Route id (24-char hex ObjectId)
|
|
26
|
+
* @param {SegmentsInformationTablesQuery} [opts.query] - Optional providerId
|
|
26
27
|
* @param {Object} [opts.headers] - Optional headers
|
|
27
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
28
|
+
* @returns {Promise<import("axios").AxiosResponse<{ segmentInformationTables: { distances: Object, durations: Object, durationsHHMM: Object } }>>}
|
|
29
|
+
* @throws 400 INVALID_ROUTE_ID — routeId not 24 hex characters
|
|
30
|
+
* @throws 401 Unauthorized
|
|
31
|
+
* @throws 404 ROUTE_NOT_FOUND
|
|
32
|
+
* @throws 500 Internal server error
|
|
28
33
|
*/
|
|
29
34
|
function get({token, jwtToken, routeId, query = {}, headers}) {
|
|
30
35
|
return client({
|
|
31
36
|
url: `/segments-information-tables/${routeId}`,
|
|
37
|
+
method: "get",
|
|
32
38
|
params: query,
|
|
33
39
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
34
40
|
});
|
|
@@ -20,14 +20,12 @@ function stationGroupsFactory({client, internalAuthTokenProvider}) {
|
|
|
20
20
|
* GET /station-groups - list station groups.
|
|
21
21
|
* @param {Object} opts
|
|
22
22
|
* @param {string} [opts.token] - API key
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {StationGroupsListQuery} [opts.query] - Query params
|
|
23
|
+
* @param {StationGroupsListQuery} [opts.query] - Query params (e.g. providerIds)
|
|
25
24
|
* @param {Object} [opts.headers] - Optional headers
|
|
26
25
|
* @returns {Promise<import("axios").AxiosResponse>}
|
|
27
26
|
*/
|
|
28
27
|
function all({token, query = {}, headers}) {
|
|
29
|
-
return client({
|
|
30
|
-
url: "/station-groups",
|
|
28
|
+
return client.get("/station-groups", {
|
|
31
29
|
params: query,
|
|
32
30
|
headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
|
|
33
31
|
});
|