btrz-api-client 8.71.0 → 8.72.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.js CHANGED
@@ -223,6 +223,7 @@ function createAccounts(_ref4) {
223
223
  applications: require("./endpoints/accounts/applications.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
224
224
  applicationSettings: require("./endpoints/accounts/application-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
225
225
  customers: require("./endpoints/accounts/customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
226
+ controlClassesSettings: require("./endpoints/accounts/control-classes-settings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
226
227
  currentShifts: require("./endpoints/accounts/current-shifts.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
227
228
  docs: require("./endpoints/accounts/docs.js")({
228
229
  client: client
@@ -0,0 +1,76 @@
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 control-classes-settings API (btrz-api-accounts).
9
+ * @param {Object} deps
10
+ * @param {import("axios").AxiosInstance} deps.client
11
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
12
+ * @returns {{ get: function, put: function }}
13
+ */
14
+
15
+
16
+ function controlClassesSettingsFactory(_ref) {
17
+ var client = _ref.client,
18
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
+
20
+ /**
21
+ * GET /control-classes-settings — get control classes settings for the account. No query parameters.
22
+ * @param {Object} opts
23
+ * @param {string} [opts.token] - API key (X-API-KEY)
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth token
25
+ * @param {Object} [opts.headers] - Optional request headers
26
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassesSettings: { namingPolicy: string, childSelectionCriteriaDefault: string } }>>}
27
+ * @throws {import("axios").AxiosError} 401 Unauthorized (missing or invalid API key/Authorization)
28
+ * @throws {import("axios").AxiosError} 500 Internal server error
29
+ */
30
+ function get(_ref2) {
31
+ var token = _ref2.token,
32
+ jwtToken = _ref2.jwtToken,
33
+ headers = _ref2.headers;
34
+
35
+ return client({
36
+ url: "/control-classes-settings",
37
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
38
+ });
39
+ }
40
+
41
+ /**
42
+ * PUT /control-classes-settings — update control classes settings. At least one of namingPolicy or childSelectionCriteriaDefault must be provided.
43
+ * @param {Object} opts
44
+ * @param {string} [opts.token] - API key (X-API-KEY)
45
+ * @param {string} [opts.jwtToken] - JWT or internal auth token
46
+ * @param {{ namingPolicy?: string, childSelectionCriteriaDefault?: string }} opts.controlClassesSettings - Settings payload
47
+ * @param {Object} [opts.headers] - Optional request headers
48
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassesSettings: { namingPolicy: string, childSelectionCriteriaDefault: string } }>>}
49
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA, ALLOW_DUPLICATES_NOT_ALLOWED_WITH_SALES_AUTHORIZATIONS_AVAILABILITY
50
+ * @throws {import("axios").AxiosError} 401 Unauthorized
51
+ * @throws {import("axios").AxiosError} 404 ACCOUNT_NOT_FOUND
52
+ * @throws {import("axios").AxiosError} 500 Internal server error
53
+ */
54
+ function put(_ref3) {
55
+ var token = _ref3.token,
56
+ jwtToken = _ref3.jwtToken,
57
+ controlClassesSettings = _ref3.controlClassesSettings,
58
+ headers = _ref3.headers;
59
+
60
+ return client({
61
+ url: "/control-classes-settings",
62
+ method: "put",
63
+ headers: authorizationHeaders({
64
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
65
+ }),
66
+ data: controlClassesSettings
67
+ });
68
+ }
69
+
70
+ return {
71
+ get: get,
72
+ put: put
73
+ };
74
+ }
75
+
76
+ module.exports = controlClassesSettingsFactory;
@@ -66,6 +66,30 @@ function externalCustomersFactory(_ref) {
66
66
  });
67
67
  }
68
68
 
69
+ /**
70
+ * POST /external-customers/ado/confirmation/resend – Resend a Saldo Max Profile V2 quick registration OTP.
71
+ * Requires BETTEREZ_APP JWT.
72
+ * @param {Object} opts
73
+ * @param {string} [opts.token] - API key
74
+ * @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
75
+ * @param {{confirmationToken: string}} opts.data - Confirmation token returned by quick registration
76
+ * @param {Object} [opts.headers] - Optional headers
77
+ * @returns {Promise<import("axios").AxiosResponse<{ code: string, message?: string }>>}
78
+ */
79
+ function resendSaldoMaxRegistrationConfirmation(_ref4) {
80
+ var data = _ref4.data,
81
+ token = _ref4.token,
82
+ jwtToken = _ref4.jwtToken,
83
+ headers = _ref4.headers;
84
+
85
+ return client({
86
+ url: "/external-customers/ado/confirmation/resend",
87
+ method: "post",
88
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
89
+ data: data
90
+ });
91
+ }
92
+
69
93
  var saldoMax = {
70
94
  /**
71
95
  * GET /external-customers/ado - get SaldoMax user by email, phone or walletId.
@@ -84,11 +108,11 @@ function externalCustomersFactory(_ref) {
84
108
  * @returns {Promise<import("axios").AxiosResponse<{ adoUsers: Array<Object> }>>}
85
109
  * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
86
110
  */
87
- get: function get(_ref4) {
88
- var token = _ref4.token,
89
- jwtToken = _ref4.jwtToken,
90
- query = _ref4.query,
91
- headers = _ref4.headers;
111
+ get: function get(_ref5) {
112
+ var token = _ref5.token,
113
+ jwtToken = _ref5.jwtToken,
114
+ query = _ref5.query,
115
+ headers = _ref5.headers;
92
116
 
93
117
  return client.get("/external-customers/ado", {
94
118
  params: query,
@@ -97,7 +121,10 @@ function externalCustomersFactory(_ref) {
97
121
  },
98
122
  create: registerSaldoMax,
99
123
  confirmation: {
100
- create: confirmSaldoMaxRegistration
124
+ create: confirmSaldoMaxRegistration,
125
+ resend: {
126
+ create: resendSaldoMaxRegistrationConfirmation
127
+ }
101
128
  }
102
129
  };
103
130
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.71.0",
3
+ "version": "8.72.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -189,6 +189,7 @@ function createAccounts({baseURL, headers, timeout, overrideFn, internalAuthToke
189
189
  applications: require("./endpoints/accounts/applications.js")({client, internalAuthTokenProvider}),
190
190
  applicationSettings: require("./endpoints/accounts/application-settings.js")({client, internalAuthTokenProvider}),
191
191
  customers: require("./endpoints/accounts/customers.js")({client, internalAuthTokenProvider}),
192
+ controlClassesSettings: require("./endpoints/accounts/control-classes-settings.js")({client, internalAuthTokenProvider}),
192
193
  currentShifts: require("./endpoints/accounts/current-shifts.js")({client, internalAuthTokenProvider}),
193
194
  docs: require("./endpoints/accounts/docs.js")({
194
195
  client
@@ -0,0 +1,61 @@
1
+ /* eslint-disable max-len */
2
+ const {
3
+ authorizationHeaders
4
+ } = require("../endpoints_helpers.js");
5
+
6
+ /**
7
+ * Factory for control-classes-settings API (btrz-api-accounts).
8
+ * @param {Object} deps
9
+ * @param {import("axios").AxiosInstance} deps.client
10
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
11
+ * @returns {{ get: function, put: function }}
12
+ */
13
+ function controlClassesSettingsFactory({client, internalAuthTokenProvider}) {
14
+ /**
15
+ * GET /control-classes-settings — get control classes settings for the account. No query parameters.
16
+ * @param {Object} opts
17
+ * @param {string} [opts.token] - API key (X-API-KEY)
18
+ * @param {string} [opts.jwtToken] - JWT or internal auth token
19
+ * @param {Object} [opts.headers] - Optional request headers
20
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassesSettings: { namingPolicy: string, childSelectionCriteriaDefault: string } }>>}
21
+ * @throws {import("axios").AxiosError} 401 Unauthorized (missing or invalid API key/Authorization)
22
+ * @throws {import("axios").AxiosError} 500 Internal server error
23
+ */
24
+ function get({token, jwtToken, headers}) {
25
+ return client({
26
+ url: "/control-classes-settings",
27
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
28
+ });
29
+ }
30
+
31
+ /**
32
+ * PUT /control-classes-settings — update control classes settings. At least one of namingPolicy or childSelectionCriteriaDefault must be provided.
33
+ * @param {Object} opts
34
+ * @param {string} [opts.token] - API key (X-API-KEY)
35
+ * @param {string} [opts.jwtToken] - JWT or internal auth token
36
+ * @param {{ namingPolicy?: string, childSelectionCriteriaDefault?: string }} opts.controlClassesSettings - Settings payload
37
+ * @param {Object} [opts.headers] - Optional request headers
38
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassesSettings: { namingPolicy: string, childSelectionCriteriaDefault: string } }>>}
39
+ * @throws {import("axios").AxiosError} 400 WRONG_DATA, ALLOW_DUPLICATES_NOT_ALLOWED_WITH_SALES_AUTHORIZATIONS_AVAILABILITY
40
+ * @throws {import("axios").AxiosError} 401 Unauthorized
41
+ * @throws {import("axios").AxiosError} 404 ACCOUNT_NOT_FOUND
42
+ * @throws {import("axios").AxiosError} 500 Internal server error
43
+ */
44
+ function put({token, jwtToken, controlClassesSettings, headers}) {
45
+ return client({
46
+ url: "/control-classes-settings",
47
+ method: "put",
48
+ headers: authorizationHeaders({
49
+ token, jwtToken, internalAuthTokenProvider, headers
50
+ }),
51
+ data: controlClassesSettings
52
+ });
53
+ }
54
+
55
+ return {
56
+ get,
57
+ put
58
+ };
59
+ }
60
+
61
+ module.exports = controlClassesSettingsFactory;
@@ -48,6 +48,25 @@ function externalCustomersFactory({client, internalAuthTokenProvider}) {
48
48
  });
49
49
  }
50
50
 
51
+ /**
52
+ * POST /external-customers/ado/confirmation/resend – Resend a Saldo Max Profile V2 quick registration OTP.
53
+ * Requires BETTEREZ_APP JWT.
54
+ * @param {Object} opts
55
+ * @param {string} [opts.token] - API key
56
+ * @param {string} [opts.jwtToken] - JWT (BETTEREZ_APP audience)
57
+ * @param {{confirmationToken: string}} opts.data - Confirmation token returned by quick registration
58
+ * @param {Object} [opts.headers] - Optional headers
59
+ * @returns {Promise<import("axios").AxiosResponse<{ code: string, message?: string }>>}
60
+ */
61
+ function resendSaldoMaxRegistrationConfirmation({data, token, jwtToken, headers}) {
62
+ return client({
63
+ url: "/external-customers/ado/confirmation/resend",
64
+ method: "post",
65
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
66
+ data
67
+ });
68
+ }
69
+
51
70
  const saldoMax = {
52
71
  /**
53
72
  * GET /external-customers/ado - get SaldoMax user by email, phone or walletId.
@@ -74,7 +93,10 @@ function externalCustomersFactory({client, internalAuthTokenProvider}) {
74
93
  },
75
94
  create: registerSaldoMax,
76
95
  confirmation: {
77
- create: confirmSaldoMaxRegistration
96
+ create: confirmSaldoMaxRegistration,
97
+ resend: {
98
+ create: resendSaldoMaxRegistrationConfirmation
99
+ }
78
100
  }
79
101
  };
80
102
 
@@ -0,0 +1,36 @@
1
+ const {axiosMock, expectRequest} = require("../../test-helpers.js");
2
+ const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
+
4
+ describe("accounts/control-classes-settings", () => {
5
+ const token = "I owe you a token";
6
+ const jwtToken = "secret";
7
+
8
+ afterEach(() => {
9
+ axiosMock.reset();
10
+ });
11
+
12
+ it("should get the control classes settings", () => {
13
+ axiosMock.onGet("/control-classes-settings")
14
+ .reply(expectRequest({statusCode: 200, token}));
15
+
16
+ return api.accounts.controlClassesSettings.get({token, jwtToken});
17
+ });
18
+
19
+ it("should update control classes settings", () => {
20
+ const controlClassesSettings = {
21
+ namingPolicy: "UNIQUE_BY_ACCOUNT",
22
+ childSelectionCriteriaDefault: "MOST_SPECIFIC"
23
+ };
24
+
25
+ axiosMock.onPut("/control-classes-settings")
26
+ .reply(expectRequest({
27
+ statusCode: 200,
28
+ token,
29
+ jwtToken
30
+ }));
31
+
32
+ return api.accounts.controlClassesSettings.put({
33
+ token, jwtToken, controlClassesSettings
34
+ });
35
+ });
36
+ });
@@ -77,4 +77,21 @@ describe("accounts/external-customers", () => {
77
77
  data
78
78
  });
79
79
  });
80
+
81
+ it("should POST Saldo Max Profile V2 registration confirmation resend", () => {
82
+ const data = {
83
+ confirmationToken: "confirmation-token"
84
+ };
85
+ axiosMock.onPost("/external-customers/ado/confirmation/resend").reply(expectRequest({
86
+ statusCode: 200,
87
+ token,
88
+ jwtToken,
89
+ body: data
90
+ }));
91
+ return api.accounts.externalCustomers.saldoMax.confirmation.resend.create({
92
+ token,
93
+ jwtToken,
94
+ data
95
+ });
96
+ });
80
97
  });
@@ -0,0 +1,17 @@
1
+ export = controlClassesSettingsFactory;
2
+ /**
3
+ * Factory for control-classes-settings API (btrz-api-accounts).
4
+ * @param {Object} deps
5
+ * @param {import("axios").AxiosInstance} deps.client
6
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
7
+ * @returns {{ get: function, put: function }}
8
+ */
9
+ declare function controlClassesSettingsFactory({ client, internalAuthTokenProvider }: {
10
+ client: import("axios").AxiosInstance;
11
+ internalAuthTokenProvider?: {
12
+ getToken: () => string;
13
+ };
14
+ }): {
15
+ get: Function;
16
+ put: Function;
17
+ };