btrz-api-client 8.31.0 → 8.33.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/.cursor/rules/jsdoc-endpoints.mdc +1 -1
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +5 -0
- package/lib/endpoints/accounts/agencies.js +52 -0
- package/lib/endpoints/accounts/application-settings.js +19 -18
- package/lib/endpoints/accounts/applications.js +8 -7
- package/lib/endpoints/accounts/customers.js +27 -24
- package/lib/endpoints/accounts/domains.js +16 -11
- package/lib/endpoints/accounts/email-settings.js +22 -18
- package/lib/endpoints/accounts/email-templates.js +8 -4
- package/lib/endpoints/accounts/exchange-rates.js +12 -7
- package/lib/endpoints/accounts/exchange-receipts.js +10 -6
- package/lib/endpoints/accounts/external-customers.js +50 -0
- package/lib/endpoints/accounts/goal-settings.js +8 -6
- package/lib/endpoints/accounts/images.js +14 -13
- package/lib/endpoints/accounts/interline.js +35 -27
- package/lib/endpoints/accounts/journey-prices-settings.js +8 -6
- package/lib/endpoints/accounts/lexicons.js +13 -13
- package/lib/endpoints/accounts/market-pricing-settings.js +7 -6
- package/lib/endpoints/accounts/multiproduct-sales-settings.js +7 -6
- package/lib/endpoints/accounts/network.js +28 -13
- package/lib/endpoints/accounts/operation-settings.js +8 -6
- package/lib/endpoints/accounts/people-lookups.js +17 -17
- package/lib/endpoints/accounts/point-to-point-settings.js +6 -6
- package/lib/endpoints/accounts/print-settings.js +9 -6
- package/lib/endpoints/accounts/print-templates.js +37 -21
- package/lib/endpoints/accounts/printers.js +10 -4
- package/lib/endpoints/accounts/rms-settings.js +19 -11
- package/lib/endpoints/accounts/salesforce-settings.js +8 -6
- package/lib/endpoints/accounts/shift-settings.js +7 -6
- package/lib/endpoints/accounts/shifts.js +13 -9
- package/lib/endpoints/accounts/sms-templates.js +28 -19
- package/lib/endpoints/accounts/sub-print-templates.js +5 -3
- package/lib/endpoints/accounts/ticket-movement-settings.js +8 -5
- package/lib/endpoints/accounts/travellers.js +18 -12
- package/lib/endpoints/accounts/trusted-machines.js +11 -8
- package/lib/endpoints/accounts/twilio-settings.js +8 -5
- package/lib/endpoints/accounts/users.js +105 -63
- package/lib/endpoints/accounts/verified-emails.js +130 -0
- package/lib/endpoints/accounts/websales-config.js +7 -5
- package/lib/endpoints/coltrane/healthcheck.js +35 -0
- package/lib/endpoints/coltrane/info.js +35 -0
- package/lib/endpoints/coltrane/paths.js +17 -13
- package/package.json +1 -1
- package/src/client.js +5 -0
- package/src/endpoints/accounts/agencies.js +40 -0
- package/src/endpoints/accounts/application-settings.js +19 -18
- package/src/endpoints/accounts/applications.js +8 -7
- package/src/endpoints/accounts/customers.js +27 -24
- package/src/endpoints/accounts/domains.js +16 -11
- package/src/endpoints/accounts/email-settings.js +22 -18
- package/src/endpoints/accounts/email-templates.js +8 -4
- package/src/endpoints/accounts/exchange-rates.js +12 -7
- package/src/endpoints/accounts/exchange-receipts.js +10 -6
- package/src/endpoints/accounts/external-customers.js +37 -0
- package/src/endpoints/accounts/goal-settings.js +8 -6
- package/src/endpoints/accounts/images.js +14 -13
- package/src/endpoints/accounts/interline.js +35 -28
- package/src/endpoints/accounts/journey-prices-settings.js +8 -6
- package/src/endpoints/accounts/lexicons.js +13 -13
- package/src/endpoints/accounts/market-pricing-settings.js +7 -6
- package/src/endpoints/accounts/multiproduct-sales-settings.js +7 -6
- package/src/endpoints/accounts/network.js +28 -14
- package/src/endpoints/accounts/operation-settings.js +8 -6
- package/src/endpoints/accounts/people-lookups.js +17 -17
- package/src/endpoints/accounts/point-to-point-settings.js +6 -6
- package/src/endpoints/accounts/print-settings.js +9 -7
- package/src/endpoints/accounts/print-templates.js +31 -19
- package/src/endpoints/accounts/printers.js +10 -5
- package/src/endpoints/accounts/rms-settings.js +19 -11
- package/src/endpoints/accounts/salesforce-settings.js +8 -6
- package/src/endpoints/accounts/shift-settings.js +7 -6
- package/src/endpoints/accounts/shifts.js +13 -9
- package/src/endpoints/accounts/sms-templates.js +28 -19
- package/src/endpoints/accounts/sub-print-templates.js +5 -3
- package/src/endpoints/accounts/ticket-movement-settings.js +8 -5
- package/src/endpoints/accounts/travellers.js +18 -12
- package/src/endpoints/accounts/trusted-machines.js +11 -8
- package/src/endpoints/accounts/twilio-settings.js +8 -5
- package/src/endpoints/accounts/users.js +42 -5
- package/src/endpoints/accounts/verified-emails.js +100 -0
- package/src/endpoints/accounts/websales-config.js +7 -5
- package/src/endpoints/coltrane/healthcheck.js +28 -0
- package/src/endpoints/coltrane/info.js +28 -0
- package/src/endpoints/coltrane/paths.js +17 -13
- package/test/endpoints/accounts/agencies.test.js +58 -0
- package/test/endpoints/accounts/external-customers.test.js +62 -0
- package/test/endpoints/accounts/users.js +10 -0
- package/test/endpoints/accounts/verified-emails.test.js +35 -0
- package/test/endpoints/coltrane/healthcheck.test.js +13 -0
- package/test/endpoints/coltrane/info.test.js +13 -0
- package/types/endpoints/accounts/users.d.ts +2 -1
- package/types/endpoints/accounts/verified-emails.d.ts +19 -0
package/lib/client.js
CHANGED
|
@@ -187,6 +187,8 @@ function createColtrane(_ref3) {
|
|
|
187
187
|
|
|
188
188
|
return {
|
|
189
189
|
docs: require("./endpoints/coltrane/docs.js")({ client: client }),
|
|
190
|
+
healthcheck: require("./endpoints/coltrane/healthcheck.js")({ client: client }),
|
|
191
|
+
info: require("./endpoints/coltrane/info.js")({ client: client }),
|
|
190
192
|
paths: require("./endpoints/coltrane/paths.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
191
193
|
mergedFareTables: require("./endpoints/coltrane/merged-fare-tables.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
192
194
|
__test: {
|
|
@@ -212,6 +214,7 @@ function createAccounts(_ref4) {
|
|
|
212
214
|
|
|
213
215
|
return {
|
|
214
216
|
accounts: require("./endpoints/accounts/accounts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
217
|
+
agencies: require("./endpoints/accounts/agencies.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
215
218
|
application: require("./endpoints/accounts/application.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
216
219
|
applications: require("./endpoints/accounts/applications.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
217
220
|
applicationSettings: require("./endpoints/accounts/application-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -227,6 +230,7 @@ function createAccounts(_ref4) {
|
|
|
227
230
|
smsTemplates: require("./endpoints/accounts/sms-templates.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
228
231
|
exchangeRates: require("./endpoints/accounts/exchange-rates.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
229
232
|
exchangeReceipts: require("./endpoints/accounts/exchange-receipts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
233
|
+
externalCustomers: require("./endpoints/accounts/external-customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
230
234
|
goalSettings: require("./endpoints/accounts/goal-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
231
235
|
images: require("./endpoints/accounts/images.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
232
236
|
interline: require("./endpoints/accounts/interline.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
@@ -265,6 +269,7 @@ function createAccounts(_ref4) {
|
|
|
265
269
|
trustedMachines: require("./endpoints/accounts/trusted-machines.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
266
270
|
twilioSettings: require("./endpoints/accounts/twilio-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
267
271
|
users: require("./endpoints/accounts/users.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
272
|
+
verifiedEmails: require("./endpoints/accounts/verified-emails.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
268
273
|
__test: {
|
|
269
274
|
client: client
|
|
270
275
|
},
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
var _require = require("../endpoints_helpers.js"),
|
|
5
|
+
authorizationHeaders = _require.authorizationHeaders;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Factory for agencies endpoints (btrz-api-accounts).
|
|
9
|
+
* @param {Object} deps
|
|
10
|
+
* @param {import("axios").AxiosInstance} deps.client
|
|
11
|
+
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
12
|
+
* @returns {{ putCreditLimit: function }}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function agenciesFactory(_ref) {
|
|
17
|
+
var client = _ref.client,
|
|
18
|
+
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* PUT /agencies/:agencyId/credit-limit - update credit limit for an agency (seller) in the provider's network.
|
|
22
|
+
* Requires BETTEREZ_APP audience. Request body can be { limitAmount, unlimited } or { creditLimit: { limitAmount, unlimited } }.
|
|
23
|
+
* Side effect: Emits webhook event creditlimit.updated.
|
|
24
|
+
* @param {Object} opts
|
|
25
|
+
* @param {string} [opts.token] - API key
|
|
26
|
+
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
27
|
+
* @param {string} opts.agencyId - Agency (seller) ID, 24-char hex ObjectId. Must not be the provider's own accountId.
|
|
28
|
+
* @param {Object} opts.data - Credit limit payload: { limitAmount: number, unlimited: boolean } or { creditLimit: { limitAmount, unlimited } }
|
|
29
|
+
* @param {Object} [opts.headers] - Optional headers
|
|
30
|
+
* @returns {Promise<import("axios").AxiosResponse<{ creditLimit: { _id: string, sellerId: string, providerId: string, unlimited: boolean, overrideLimit: number, currentLimit: number } }>>}
|
|
31
|
+
*/
|
|
32
|
+
function putCreditLimit(_ref2) {
|
|
33
|
+
var token = _ref2.token,
|
|
34
|
+
jwtToken = _ref2.jwtToken,
|
|
35
|
+
agencyId = _ref2.agencyId,
|
|
36
|
+
data = _ref2.data,
|
|
37
|
+
headers = _ref2.headers;
|
|
38
|
+
|
|
39
|
+
return client({
|
|
40
|
+
url: "/agencies/" + agencyId + "/credit-limit",
|
|
41
|
+
method: "put",
|
|
42
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
43
|
+
data: data
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
putCreditLimit: putCreditLimit
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = agenciesFactory;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable max-len */
|
|
3
4
|
var _require = require("./../endpoints_helpers.js"),
|
|
4
5
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {Object} ApplicationSettingsQuery
|
|
8
|
-
* @property {string} [name] -
|
|
9
|
+
* @property {string} [name] - Optional. Filter by application name. When set, unauthenticated returns one object or 404; authenticated returns array with at most one item.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -22,14 +23,14 @@ function applicationSettingsFactory(_ref) {
|
|
|
22
23
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
* GET /application-settings/:providerId - get application settings for provider.
|
|
26
|
+
* GET /application-settings/:providerId - get application settings for a provider (account). Auth is optional: without auth returns one public object { key, settings, requestEndpoint }; with valid token returns array of application documents (see API docs for privateKey handling for internal apps).
|
|
26
27
|
* @param {Object} opts
|
|
27
28
|
* @param {string} [opts.token] - API key
|
|
28
29
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
29
|
-
* @param {string} opts.providerId -
|
|
30
|
-
* @param {ApplicationSettingsQuery} [opts.query] -
|
|
30
|
+
* @param {string} opts.providerId - Account (provider) ID whose application settings to return
|
|
31
|
+
* @param {ApplicationSettingsQuery} [opts.query] - Optional query; use name to filter by application name
|
|
31
32
|
* @param {Object} [opts.headers] - Optional headers
|
|
32
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
33
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: unauthenticated = { key, settings, requestEndpoint }; authenticated = array of application objects (see API docs)
|
|
33
34
|
*/
|
|
34
35
|
function get(_ref2) {
|
|
35
36
|
var token = _ref2.token,
|
|
@@ -46,14 +47,14 @@ function applicationSettingsFactory(_ref) {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
|
-
* PUT /application-settings/:id - update application settings.
|
|
50
|
+
* PUT /application-settings/:id - update an application. Body can be { application: { name, description?, settings?, requestEndpoint?, enableUserSignOn?, channels?, roles? } } or direct. Emits webhook applications.updated.
|
|
50
51
|
* @param {Object} opts
|
|
51
52
|
* @param {string} [opts.token] - API key
|
|
52
53
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
53
|
-
* @param {string} opts.id - Application
|
|
54
|
-
* @param {Object} opts.application - Application payload
|
|
54
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
55
|
+
* @param {Object} opts.application - Application payload (name required; optional description, settings, requestEndpoint, enableUserSignOn, channels, roles)
|
|
55
56
|
* @param {Object} [opts.headers] - Optional headers
|
|
56
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
57
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { application }
|
|
57
58
|
*/
|
|
58
59
|
function update(_ref3) {
|
|
59
60
|
var jwtToken = _ref3.jwtToken,
|
|
@@ -71,13 +72,13 @@ function applicationSettingsFactory(_ref) {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/**
|
|
74
|
-
* DELETE /application-settings/:id -
|
|
75
|
+
* DELETE /application-settings/:id - soft-delete an application. Emits webhook applications.deleted.
|
|
75
76
|
* @param {Object} opts
|
|
76
77
|
* @param {string} [opts.token] - API key
|
|
77
78
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
78
|
-
* @param {string} opts.id - Application
|
|
79
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
79
80
|
* @param {Object} [opts.headers] - Optional headers
|
|
80
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
81
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { id } (deleted application id)
|
|
81
82
|
*/
|
|
82
83
|
function remove(_ref4) {
|
|
83
84
|
var jwtToken = _ref4.jwtToken,
|
|
@@ -93,13 +94,13 @@ function applicationSettingsFactory(_ref) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
/**
|
|
96
|
-
* POST /application-settings/:id/keys - regenerate application keys.
|
|
97
|
+
* POST /application-settings/:id/keys - regenerate application keys; returns new key and privateKey. Emits webhook applications.updated.
|
|
97
98
|
* @param {Object} opts
|
|
98
99
|
* @param {string} [opts.token] - API key
|
|
99
100
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
100
|
-
* @param {string} opts.id - Application
|
|
101
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
101
102
|
* @param {Object} [opts.headers] - Optional headers
|
|
102
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
103
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { keys: { key, privateKey } }
|
|
103
104
|
*/
|
|
104
105
|
function regenerateKeys(_ref5) {
|
|
105
106
|
var jwtToken = _ref5.jwtToken,
|
|
@@ -115,13 +116,13 @@ function applicationSettingsFactory(_ref) {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
/**
|
|
118
|
-
* POST /application-settings - create application settings.
|
|
119
|
+
* POST /application-settings - create an application. Body can be { application: { name, description?, settings?, requestEndpoint?, enableUserSignOn?, channels?, roles? } } or direct. Emits webhook applications.created.
|
|
119
120
|
* @param {Object} opts
|
|
120
121
|
* @param {string} [opts.token] - API key
|
|
121
122
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
122
|
-
* @param {Object} opts.application - Application payload
|
|
123
|
+
* @param {Object} opts.application - Application payload (name required; optional description, settings, requestEndpoint, enableUserSignOn, channels, roles)
|
|
123
124
|
* @param {Object} [opts.headers] - Optional headers
|
|
124
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
125
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { application }
|
|
125
126
|
*/
|
|
126
127
|
function create(_ref6) {
|
|
127
128
|
var jwtToken = _ref6.jwtToken,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable max-len */
|
|
3
4
|
var _require = require("./../endpoints_helpers.js"),
|
|
4
5
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* Factory for applications
|
|
8
|
+
* Factory for applications API (btrz-api-accounts): get by id or by name. Requires BETTEREZ_APP or MOBILE_SCANNER (get by id); get by name requires authentication.
|
|
8
9
|
* @param {Object} deps
|
|
9
10
|
* @param {import("axios").AxiosInstance} deps.client
|
|
10
11
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -17,13 +18,13 @@ function applicationsFactory(_ref) {
|
|
|
17
18
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
|
-
* GET /applications/:id - get an application by id.
|
|
21
|
+
* GET /applications/:id - get an application by id. Application must belong to the authenticated account.
|
|
21
22
|
* @param {Object} opts
|
|
22
23
|
* @param {string} [opts.token] - API key
|
|
23
24
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
24
|
-
* @param {string} opts.id - Application id (ObjectId)
|
|
25
|
+
* @param {string} opts.id - Application id (24-char hex ObjectId)
|
|
25
26
|
* @param {Object} [opts.headers] - Optional headers
|
|
26
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
27
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { application } (full application document including privateKey)
|
|
27
28
|
*/
|
|
28
29
|
function get(_ref2) {
|
|
29
30
|
var token = _ref2.token,
|
|
@@ -36,13 +37,13 @@ function applicationsFactory(_ref) {
|
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
|
-
* GET /applications/name/:appName - get an application by name.
|
|
40
|
+
* GET /applications/name/:appName - get an application by name. Returns non-internal, non-deleted application for the account; response excludes privateKey.
|
|
40
41
|
* @param {Object} opts
|
|
41
42
|
* @param {string} [opts.token] - API key
|
|
42
43
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
43
|
-
* @param {string} opts.appName - Application name
|
|
44
|
+
* @param {string} opts.appName - Application name (exact match)
|
|
44
45
|
* @param {Object} [opts.headers] - Optional headers
|
|
45
|
-
* @returns {Promise<import("axios").AxiosResponse>}
|
|
46
|
+
* @returns {Promise<import("axios").AxiosResponse>} Response data: { application } (application document without privateKey)
|
|
46
47
|
*/
|
|
47
48
|
function getByName(_ref3) {
|
|
48
49
|
var token = _ref3.token,
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
4
4
|
|
|
5
|
+
/* eslint-disable max-len */
|
|
5
6
|
var base64 = require("base-64");
|
|
6
7
|
|
|
7
8
|
var _require = require("./../endpoints_helpers.js"),
|
|
8
9
|
authorizationHeaders = _require.authorizationHeaders;
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
* Query params for GET /customers (btrz-api-accounts).
|
|
12
|
+
* Query params for GET /customers (btrz-api-accounts). Response is paginated (customers array + pagination).
|
|
12
13
|
* @typedef {Object} CustomersQuery
|
|
13
|
-
* @property {string} [customerNumber] -
|
|
14
|
-
* @property {string} [externalId] -
|
|
15
|
-
* @property {string} [providerIds] -
|
|
16
|
-
* @property {string} [lookupSearchParams] - Lookup search
|
|
14
|
+
* @property {string} [customerNumber] - Filter: only that customer will be listed
|
|
15
|
+
* @property {string} [externalId] - Filter: same format as when creating the customer; only that customer listed
|
|
16
|
+
* @property {string} [providerIds] - Filter: provider ids to get customers from (comma-separated)
|
|
17
|
+
* @property {string} [lookupSearchParams] - Lookup search in format "documentTypeId|DNI,documentNumber|1234567" (documentNumber required)
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -30,14 +31,14 @@ function customersFactory(_ref) {
|
|
|
30
31
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* PUT /customers/:customerId - update a customer (full replace).
|
|
34
|
+
* PUT /customers/:customerId - update a customer (full replace). Requires BETTEREZ_APP or CUSTOMER audience; customer token may only update own record. Side effect: may emit customer.updated webhook.
|
|
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.customerId - Customer id (ObjectId)
|
|
38
|
-
* @param {Object} opts.customer - Customer payload
|
|
38
|
+
* @param {string} opts.customerId - Customer id (24-char hex ObjectId)
|
|
39
|
+
* @param {Object} opts.customer - Customer payload (CustomerData)
|
|
39
40
|
* @param {Object} [opts.headers] - Optional headers
|
|
40
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
41
|
+
* @returns {Promise<import("axios").AxiosResponse<{ _id: string, customerNumber: string, ... }>>}
|
|
41
42
|
*/
|
|
42
43
|
function put(_ref2) {
|
|
43
44
|
var customerId = _ref2.customerId,
|
|
@@ -55,14 +56,14 @@ function customersFactory(_ref) {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
|
-
* GET /customers - list customers.
|
|
59
|
+
* GET /customers - list customers (paginated). Optional filters: customerNumber, externalId, providerIds, lookupSearchParams.
|
|
59
60
|
* @param {Object} opts
|
|
60
61
|
* @param {string} [opts.token] - API key
|
|
61
62
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
62
|
-
* @param {CustomersQuery} [opts.query] - Query params
|
|
63
|
-
* @param {string} [opts.providerId] -
|
|
63
|
+
* @param {CustomersQuery} [opts.query] - Query params; API expects providerIds (comma-separated). Use providerId to send a single id.
|
|
64
|
+
* @param {string} [opts.providerId] - Convenience: added to query as providerId (single provider)
|
|
64
65
|
* @param {Object} [opts.headers] - Optional headers
|
|
65
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
66
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customers: Array<object>, total: number, ... }>>}
|
|
66
67
|
*/
|
|
67
68
|
function all(_ref3) {
|
|
68
69
|
var token = _ref3.token,
|
|
@@ -81,13 +82,14 @@ function customersFactory(_ref) {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
|
-
* POST /customer - create a customer.
|
|
85
|
+
* POST /customer - create a customer. Body: { customer }. If password is included, activation token is created and activation email sent. Side effect: may emit customer.created webhook.
|
|
85
86
|
* @param {Object} opts
|
|
86
87
|
* @param {string} [opts.token] - API key
|
|
87
88
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
88
|
-
* @param {Object} opts.customer - Customer payload
|
|
89
|
+
* @param {Object} opts.customer - Customer payload (CustomerPost); email, firstName, lastName required
|
|
90
|
+
* @param {Object} [opts.query] - Optional: uniqueEmail, lang, channel, platform, appVersion, appName, activateIfExists
|
|
89
91
|
* @param {Object} [opts.headers] - Optional headers
|
|
90
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
92
|
+
* @returns {Promise<import("axios").AxiosResponse<{ _id: string, customerNumber: string, ... }>>}
|
|
91
93
|
*/
|
|
92
94
|
function create(_ref4) {
|
|
93
95
|
var customer = _ref4.customer,
|
|
@@ -162,14 +164,15 @@ function customersFactory(_ref) {
|
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
/**
|
|
165
|
-
* PATCH /customers/:customerId -
|
|
167
|
+
* PATCH /customers/:customerId - apply operations (activate, reset password, activateEmailAndPwd). Body: { operations } array of PatchCustomerOperation. Returns Customer and auth tokens. Side effect: may emit customer.updated webhook.
|
|
166
168
|
* @param {Object} opts
|
|
167
169
|
* @param {string} [opts.token] - API key
|
|
168
170
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
169
|
-
* @param {string} opts.customerId - Customer id (ObjectId)
|
|
170
|
-
* @param {Object} opts.data -
|
|
171
|
+
* @param {string} opts.customerId - Customer id (24-char hex ObjectId)
|
|
172
|
+
* @param {Object} opts.data - Body: { operations } or array of { op, path, value }
|
|
173
|
+
* @param {Object} [opts.query] - Optional query
|
|
171
174
|
* @param {Object} [opts.headers] - Optional headers
|
|
172
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
175
|
+
* @returns {Promise<import("axios").AxiosResponse<CustomerWithAuthToken>>}
|
|
173
176
|
*/
|
|
174
177
|
function update(_ref7) {
|
|
175
178
|
var customerId = _ref7.customerId,
|
|
@@ -189,13 +192,13 @@ function customersFactory(_ref) {
|
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
/**
|
|
192
|
-
* POST /customers/merge - merge source customers into destination.
|
|
195
|
+
* POST /customers/merge - merge source customers into destination. Requires BETTEREZ_APP. Side effect: emits customers.merged webhook.
|
|
193
196
|
* @param {Object} opts
|
|
194
197
|
* @param {string} [opts.token] - API key
|
|
195
198
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
196
|
-
* @param {string} opts.destinationCustomerId - Destination customer id (ObjectId)
|
|
197
|
-
* @param {Array<string>} opts.sourceCustomerIds - Source customer ids (ObjectIds)
|
|
198
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
199
|
+
* @param {string} opts.destinationCustomerId - Destination customer id (24-char hex ObjectId)
|
|
200
|
+
* @param {Array<string>} opts.sourceCustomerIds - Source customer ids (24-char hex ObjectIds)
|
|
201
|
+
* @returns {Promise<import("axios").AxiosResponse<{ customerMerge: object }>>}
|
|
199
202
|
*/
|
|
200
203
|
function merge(_ref8) {
|
|
201
204
|
var destinationCustomerId = _ref8.destinationCustomerId,
|
|
@@ -5,6 +5,7 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Factory for domains API (btrz-api-accounts).
|
|
8
|
+
* Endpoints manage subdomains for the account: list, create (with DNS and websales config), and delete.
|
|
8
9
|
* @param {Object} deps
|
|
9
10
|
* @param {import("axios").AxiosInstance} deps.client
|
|
10
11
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -17,11 +18,12 @@ function domainsFactory(_ref) {
|
|
|
17
18
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
|
-
* GET /domains
|
|
21
|
+
* GET /domains – List all domain names for the current account.
|
|
22
|
+
* Response body is an array of strings (primary domain first, then secondary domains). No query parameters.
|
|
21
23
|
* @param {Object} opts
|
|
22
|
-
* @param {string} [opts.token] - API key
|
|
24
|
+
* @param {string} [opts.token] - API key (X-API-KEY)
|
|
23
25
|
* @param {Object} [opts.headers] - Optional headers
|
|
24
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
26
|
+
* @returns {Promise<import("axios").AxiosResponse<string[]>>} response.data is string[]
|
|
25
27
|
*/
|
|
26
28
|
function all(_ref2) {
|
|
27
29
|
var token = _ref2.token,
|
|
@@ -37,13 +39,14 @@ function domainsFactory(_ref) {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
|
-
* POST /domains
|
|
42
|
+
* POST /domains – Create a new subdomain for the account.
|
|
43
|
+
* Adds DNS CNAME and default websales config. Requires BETTEREZ_APP JWT. Emits domains.created (and websalesConfig.created) webhooks.
|
|
41
44
|
* @param {Object} opts
|
|
42
45
|
* @param {string} [opts.token] - API key
|
|
43
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
44
|
-
* @param {Object} opts.data -
|
|
46
|
+
* @param {string} [opts.jwtToken] - JWT (required for BETTEREZ_APP audience)
|
|
47
|
+
* @param {Object} opts.data - Body: { domain } or { domainInfo: { domain } }. domain must match pattern (no dots, no underscores).
|
|
45
48
|
* @param {Object} [opts.headers] - Optional headers
|
|
46
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
49
|
+
* @returns {Promise<import("axios").AxiosResponse<{ domain: string }>>} response.data is AddedDomainResponse
|
|
47
50
|
*/
|
|
48
51
|
function create(_ref3) {
|
|
49
52
|
var data = _ref3.data,
|
|
@@ -60,13 +63,15 @@ function domainsFactory(_ref) {
|
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
/**
|
|
63
|
-
* DELETE /domains/:domain
|
|
66
|
+
* DELETE /domains/:domain – Remove a subdomain from the account.
|
|
67
|
+
* Removes DNS entry, websales config, and domain from payment methods and inventory products.
|
|
68
|
+
* Primary domain cannot be deleted. Emits domains.deleted and websalesConfig.deleted.
|
|
64
69
|
* @param {Object} opts
|
|
65
70
|
* @param {string} [opts.token] - API key
|
|
66
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
67
|
-
* @param {string} opts.domain - Domain name
|
|
71
|
+
* @param {string} [opts.jwtToken] - JWT (required for BETTEREZ_APP audience)
|
|
72
|
+
* @param {string} opts.domain - Domain name (path parameter)
|
|
68
73
|
* @param {Object} [opts.headers] - Optional headers
|
|
69
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
74
|
+
* @returns {Promise<import("axios").AxiosResponse<{ domain: string }>>} response.data is DeletedDomainResponse
|
|
70
75
|
*/
|
|
71
76
|
function remove(_ref4) {
|
|
72
77
|
var domain = _ref4.domain,
|
|
@@ -6,6 +6,7 @@ var _require = require("./../endpoints_helpers.js"),
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Factory for email-settings API (btrz-api-accounts).
|
|
9
|
+
* Manage account email settings (identity/verified senders). Path parameter is email address.
|
|
9
10
|
* @param {Object} deps
|
|
10
11
|
* @param {import("axios").AxiosInstance} deps.client
|
|
11
12
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -18,12 +19,13 @@ function emailSettingsFactory(_ref) {
|
|
|
18
19
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
|
-
* GET /email-settings
|
|
22
|
+
* GET /email-settings – List all email settings for the account.
|
|
23
|
+
* Response may trigger AWS verification and commIdentity updates. No query params.
|
|
22
24
|
* @param {Object} opts
|
|
23
25
|
* @param {string} [opts.token] - API key
|
|
24
26
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
25
27
|
* @param {Object} [opts.headers] - Optional headers
|
|
26
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
28
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailSettings: object[] }>>}
|
|
27
29
|
*/
|
|
28
30
|
function all(_ref2) {
|
|
29
31
|
var token = _ref2.token,
|
|
@@ -39,13 +41,13 @@ function emailSettingsFactory(_ref) {
|
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
|
-
* GET /email-settings/:email
|
|
44
|
+
* GET /email-settings/:email – Get one email setting by email address (path param).
|
|
43
45
|
* @param {Object} opts
|
|
44
46
|
* @param {string} [opts.token] - API key
|
|
45
47
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
46
|
-
* @param {string} opts.email - Email address
|
|
48
|
+
* @param {string} opts.email - Email address (path parameter; must match email pattern)
|
|
47
49
|
* @param {Object} [opts.headers] - Optional headers
|
|
48
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
50
|
+
* @returns {Promise<import("axios").AxiosResponse<object>>} response.data is EmailSetting
|
|
49
51
|
*/
|
|
50
52
|
function getByEmail(_ref3) {
|
|
51
53
|
var token = _ref3.token,
|
|
@@ -63,13 +65,14 @@ function emailSettingsFactory(_ref) {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
/**
|
|
66
|
-
* POST /email-settings
|
|
68
|
+
* POST /email-settings – Create an email setting. Requires BETTEREZ_APP JWT. Emits emailSetting.created.
|
|
69
|
+
* Body: { emailSetting } or { name, email, active }. Email and domain are verified in AWS.
|
|
67
70
|
* @param {Object} opts
|
|
68
71
|
* @param {string} [opts.token] - API key
|
|
69
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
70
|
-
* @param {Object} opts.data -
|
|
72
|
+
* @param {string} [opts.jwtToken] - JWT (required for BETTEREZ_APP audience)
|
|
73
|
+
* @param {Object} opts.data - Body: { name, email, active? } or { emailSetting: { name, email, active? } }
|
|
71
74
|
* @param {Object} [opts.headers] - Optional headers
|
|
72
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
75
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailSetting: object }>>}
|
|
73
76
|
*/
|
|
74
77
|
function create(_ref4) {
|
|
75
78
|
var data = _ref4.data,
|
|
@@ -86,14 +89,14 @@ function emailSettingsFactory(_ref) {
|
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
/**
|
|
89
|
-
* PUT /email-settings/:email
|
|
92
|
+
* PUT /email-settings/:email – Update an email setting. Requires BETTEREZ_APP JWT. Emits emailSetting.updated.
|
|
90
93
|
* @param {Object} opts
|
|
91
94
|
* @param {string} [opts.token] - API key
|
|
92
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
93
|
-
* @param {string} opts.email - Email address
|
|
94
|
-
* @param {Object} opts.data -
|
|
95
|
+
* @param {string} [opts.jwtToken] - JWT (required for BETTEREZ_APP audience)
|
|
96
|
+
* @param {string} opts.email - Email address (path parameter)
|
|
97
|
+
* @param {Object} opts.data - Body: { name, email, active?, ... } or { emailSetting: { ... } }
|
|
95
98
|
* @param {Object} [opts.headers] - Optional headers
|
|
96
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
99
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailSetting: object }>>}
|
|
97
100
|
*/
|
|
98
101
|
function update(_ref5) {
|
|
99
102
|
var token = _ref5.token,
|
|
@@ -111,13 +114,14 @@ function emailSettingsFactory(_ref) {
|
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
/**
|
|
114
|
-
* DELETE /email-settings/:email
|
|
117
|
+
* DELETE /email-settings/:email – Remove an email setting. Requires BETTEREZ_APP JWT. Emits emailSetting.deleted.
|
|
118
|
+
* Fails with 400 if the email is currently active.
|
|
115
119
|
* @param {Object} opts
|
|
116
120
|
* @param {string} [opts.token] - API key
|
|
117
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
118
|
-
* @param {string} opts.email - Email address
|
|
121
|
+
* @param {string} [opts.jwtToken] - JWT (required for BETTEREZ_APP audience)
|
|
122
|
+
* @param {string} opts.email - Email address (path parameter)
|
|
119
123
|
* @param {Object} [opts.headers] - Optional headers
|
|
120
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
124
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailSetting: object }>>}
|
|
121
125
|
*/
|
|
122
126
|
function remove(_ref6) {
|
|
123
127
|
var email = _ref6.email,
|
|
@@ -13,6 +13,7 @@ var _require = require("../endpoints_helpers.js"),
|
|
|
13
13
|
* @property {string} [sort] - relevance | natural | createdAsc | createdDesc | updatedAsc | updatedDesc
|
|
14
14
|
* @property {string} [templateCollectionId] - default | custom
|
|
15
15
|
* @property {string} [status] - draft | published
|
|
16
|
+
* @property {string} [agencyId] - Filter sub-templates for this agency (ObjectId)
|
|
16
17
|
* @property {string} [mainTemplateAccountId] - Filter by source provider (ObjectId)
|
|
17
18
|
* @property {string} [lang] - ISO language code (e.g. en-us)
|
|
18
19
|
* @property {number} [page] - 1-based page for pagination
|
|
@@ -198,7 +199,8 @@ function emailTemplatesFactory(_ref) {
|
|
|
198
199
|
* @param {string} opts.mainTemplateId - Main template id (ObjectId)
|
|
199
200
|
* @param {string} opts.agencyId - Agency id (ObjectId)
|
|
200
201
|
* @param {Object} [opts.headers] - Optional headers
|
|
201
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
202
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailTemplate: object }>>}
|
|
203
|
+
* @throws {import("axios").AxiosError} 400 validation (WRONG_DATA, MAIN_TEMPLATE_IS_NOT_CUSTOM), 401 (MAIN_TEMPLATE_ACCOUNT_MISMATCH, MAIN_TEMPLATE_NOT_FROM_PROVIDER), 404 MAIN_TEMPLATE_NOT_FOUND, 500
|
|
202
204
|
*/
|
|
203
205
|
function createSub(_ref8) {
|
|
204
206
|
var token = _ref8.token,
|
|
@@ -217,14 +219,16 @@ function emailTemplatesFactory(_ref) {
|
|
|
217
219
|
|
|
218
220
|
var versions = {
|
|
219
221
|
/**
|
|
220
|
-
* PUT /email-templates/:emailTemplateId/versions/:versionId -
|
|
222
|
+
* PUT /email-templates/:emailTemplateId/versions/:versionId - roll back template to a saved version (versionId is zero-based index in versions array).
|
|
221
223
|
* @param {Object} opts
|
|
222
224
|
* @param {string} [opts.token] - API key
|
|
223
225
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
224
226
|
* @param {string} opts.emailTemplateId - Template id (ObjectId)
|
|
225
|
-
* @param {string} opts.versionId -
|
|
227
|
+
* @param {string} opts.versionId - Zero-based version index (e.g. "0", "1")
|
|
228
|
+
* @param {Object} [opts.query] - Optional query (superUserId, superUserHash for default templates)
|
|
226
229
|
* @param {Object} [opts.headers] - Optional headers
|
|
227
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
230
|
+
* @returns {Promise<import("axios").AxiosResponse<{ emailTemplate: object }>>}
|
|
231
|
+
* @throws {import("axios").AxiosError} 400 WRONG_DATA, 401 NOT_SUPER_USER, 404 EMAIL_TEMPLATE_NOT_FOUND / EMAIL_TEMPLATE_VERSION_NOT_FOUND, 500
|
|
228
232
|
*/
|
|
229
233
|
update: function update(_ref9) {
|
|
230
234
|
var token = _ref9.token,
|
|
@@ -7,6 +7,7 @@ var _require = require("./../endpoints_helpers"),
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Factory for exchange-rates API (btrz-api-accounts).
|
|
10
|
+
* Manage account exchange rates by currency ISO code. GET returns paginated list; POST creates a rate and updates account preferences.
|
|
10
11
|
* @param {Object} deps
|
|
11
12
|
* @param {import("axios").AxiosInstance} deps.client
|
|
12
13
|
* @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
|
|
@@ -19,13 +20,15 @@ function exchangeRatesFactory(_ref) {
|
|
|
19
20
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* GET /exchange-rates/:isoCode
|
|
23
|
+
* GET /exchange-rates/:isoCode – List exchange rates for the account filtered by currency ISO code (3 letters).
|
|
24
|
+
* Response is paginated (exchangeRates array + totalRecords, page, etc.).
|
|
23
25
|
* @param {Object} opts
|
|
24
26
|
* @param {string} [opts.token] - API key
|
|
25
27
|
* @param {string} [opts.jwtToken] - JWT or internal auth symbol
|
|
26
|
-
* @param {string} opts.isoCode - Currency ISO code (3
|
|
28
|
+
* @param {string} opts.isoCode - Currency ISO code (3 uppercase letters, e.g. USD, MXN)
|
|
29
|
+
* @param {Object} [opts.query] - Optional query (e.g. page for pagination)
|
|
27
30
|
* @param {Object} [opts.headers] - Optional headers
|
|
28
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
31
|
+
* @returns {Promise<import("axios").AxiosResponse<{ exchangeRates: object[], totalRecords: number, ... }>>}
|
|
29
32
|
*/
|
|
30
33
|
function allByIsoCode(_ref2) {
|
|
31
34
|
var token = _ref2.token,
|
|
@@ -43,13 +46,15 @@ function exchangeRatesFactory(_ref) {
|
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
|
-
* POST /exchange-rates
|
|
49
|
+
* POST /exchange-rates – Create an exchange rate. Requires BETTEREZ_APP JWT. Currency must be in account preferences and enabled.
|
|
50
|
+
* Updates account preferences.supportedCurrencies for that currency. Emits exchangeRates.created.
|
|
51
|
+
* Body: { exchangeRate } or { isoCode, buy, sell }. buy and sell must be > 0.
|
|
47
52
|
* @param {Object} opts
|
|
48
53
|
* @param {string} [opts.token] - API key
|
|
49
|
-
* @param {string} [opts.jwtToken] - JWT
|
|
50
|
-
* @param {Object} opts.data -
|
|
54
|
+
* @param {string} [opts.jwtToken] - JWT (required for BETTEREZ_APP audience)
|
|
55
|
+
* @param {Object} opts.data - Body: { isoCode, buy, sell } or { exchangeRate: { isoCode, buy, sell } }
|
|
51
56
|
* @param {Object} [opts.headers] - Optional headers
|
|
52
|
-
* @returns {Promise<import("axios").AxiosResponse
|
|
57
|
+
* @returns {Promise<import("axios").AxiosResponse<{ exchangeRate: object }>>}
|
|
53
58
|
*/
|
|
54
59
|
function create(_ref3) {
|
|
55
60
|
var data = _ref3.data,
|