btrz-api-client 7.22.0 → 7.23.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
@@ -355,8 +355,7 @@ function createNotifications(_ref8) {
355
355
  customers: require("./endpoints/notifications/customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
356
356
  twilio: require("./endpoints/notifications/twilio.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
357
357
  salesforce: require("./endpoints/notifications/salesforce.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
358
- notify: require("./endpoints/notifications/notify-tickets.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
359
- notifyVoucher: require("./endpoints/notifications/notify-vouchers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
358
+ notify: require("./endpoints/notifications/notify.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
360
359
  ordersRulesValidations: require("./endpoints/notifications/orders-rules-validations.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
361
360
  __test: {
362
361
  client: client
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _require = require("./../endpoints_helpers.js"),
3
+ var _require = require("../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
6
  function notifyTicketFactory(_ref) {
@@ -29,6 +29,23 @@ function notifyTicketFactory(_ref) {
29
29
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
30
30
  });
31
31
  }
32
+ },
33
+ vouchers: {
34
+ create: function create(_ref3) {
35
+ var token = _ref3.token,
36
+ jwtToken = _ref3.jwtToken,
37
+ query = _ref3.query,
38
+ data = _ref3.data,
39
+ headers = _ref3.headers;
40
+
41
+ return client({
42
+ url: "/notify-vouchers",
43
+ method: "post",
44
+ params: query,
45
+ data: data,
46
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
47
+ });
48
+ }
32
49
  }
33
50
  };
34
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "7.22.0",
3
+ "version": "7.23.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -293,8 +293,7 @@ function createNotifications({baseURL, headers, timeout, overrideFn, internalAut
293
293
  customers: require("./endpoints/notifications/customers.js")({client, internalAuthTokenProvider}),
294
294
  twilio: require("./endpoints/notifications/twilio.js")({client, internalAuthTokenProvider}),
295
295
  salesforce: require("./endpoints/notifications/salesforce.js")({client, internalAuthTokenProvider}),
296
- notify: require("./endpoints/notifications/notify-tickets.js")({client, internalAuthTokenProvider}),
297
- notifyVoucher: require("./endpoints/notifications/notify-vouchers.js")({client, internalAuthTokenProvider}),
296
+ notify: require("./endpoints/notifications/notify.js")({client, internalAuthTokenProvider}),
298
297
  ordersRulesValidations: require("./endpoints/notifications/orders-rules-validations.js")({client, internalAuthTokenProvider}),
299
298
  __test: {
300
299
  client
@@ -1,6 +1,6 @@
1
1
  const {
2
2
  authorizationHeaders
3
- } = require("./../endpoints_helpers.js");
3
+ } = require("../endpoints_helpers.js");
4
4
 
5
5
  function notifyTicketFactory({
6
6
  client, internalAuthTokenProvider
@@ -19,6 +19,17 @@ function notifyTicketFactory({
19
19
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
20
20
  });
21
21
  }
22
+ },
23
+ vouchers: {
24
+ create({token, jwtToken, query, data, headers}) {
25
+ return client({
26
+ url: "/notify-vouchers",
27
+ method: "post",
28
+ params: query,
29
+ data,
30
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
31
+ });
32
+ }
22
33
  }
23
34
  };
24
35
  }
@@ -1,5 +1,5 @@
1
- const {axiosMock} = require("./../../test-helpers.js");
2
- const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock} = require("../../test-helpers.js");
2
+ const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("notifications/notify-tickets", () => {
5
5
  const token = "my-api-key";
@@ -29,4 +29,24 @@ describe("notifications/notify-tickets", () => {
29
29
  ticketId
30
30
  });
31
31
  });
32
+
33
+ it("should post send an email with voucher", () => {
34
+ const query = {
35
+ lang: "en"
36
+ };
37
+ axiosMock.onPost("/notify-vouchers").reply(({headers}) => {
38
+ if (headers["x-api-key"] === token && headers.authorization === `Bearer ${jwtToken}`) {
39
+ return [200];
40
+ }
41
+ return [403];
42
+ });
43
+ return api.notifications.notify.vouchers.create({
44
+ token,
45
+ jwtToken,
46
+ query,
47
+ data: {
48
+ voucherIds: []
49
+ }
50
+ });
51
+ });
32
52
  });
package/types/client.d.ts CHANGED
@@ -4267,15 +4267,15 @@ export function createApiClient(options: {
4267
4267
  headers: any;
4268
4268
  }): any;
4269
4269
  };
4270
- };
4271
- notifyVoucher: {
4272
- create({ token, jwtToken, query, data, headers }: {
4273
- token: any;
4274
- jwtToken: any;
4275
- query: any;
4276
- data: any;
4277
- headers: any;
4278
- }): any;
4270
+ vouchers: {
4271
+ create({ token, jwtToken, query, data, headers }: {
4272
+ token: any;
4273
+ jwtToken: any;
4274
+ query: any;
4275
+ data: any;
4276
+ headers: any;
4277
+ }): any;
4278
+ };
4279
4279
  };
4280
4280
  ordersRulesValidations: {
4281
4281
  create: ({ token, jwtToken, query, orderRulesValidation, headers }: {
@@ -0,0 +1,26 @@
1
+ export = notifyTicketFactory;
2
+ declare function notifyTicketFactory({ client, internalAuthTokenProvider }: {
3
+ client: any;
4
+ internalAuthTokenProvider: any;
5
+ }): {
6
+ tickets: {
7
+ create({ token, jwtToken, query, operation, to, ticketId, headers }: {
8
+ token: any;
9
+ jwtToken: any;
10
+ query: any;
11
+ operation: any;
12
+ to: any;
13
+ ticketId: any;
14
+ headers: any;
15
+ }): any;
16
+ };
17
+ vouchers: {
18
+ create({ token, jwtToken, query, data, headers }: {
19
+ token: any;
20
+ jwtToken: any;
21
+ query: any;
22
+ data: any;
23
+ headers: any;
24
+ }): any;
25
+ };
26
+ };
@@ -4221,15 +4221,15 @@ declare const _exports: {
4221
4221
  headers: any;
4222
4222
  }): any;
4223
4223
  };
4224
- };
4225
- notifyVoucher: {
4226
- create({ token, jwtToken, query, data, headers }: {
4227
- token: any;
4228
- jwtToken: any;
4229
- query: any;
4230
- data: any;
4231
- headers: any;
4232
- }): any;
4224
+ vouchers: {
4225
+ create({ token, jwtToken, query, data, headers }: {
4226
+ token: any;
4227
+ jwtToken: any;
4228
+ query: any;
4229
+ data: any;
4230
+ headers: any;
4231
+ }): any;
4232
+ };
4233
4233
  };
4234
4234
  ordersRulesValidations: {
4235
4235
  create: ({ token, jwtToken, query, orderRulesValidation, headers }: {
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- var _require = require("./../endpoints_helpers.js"),
4
- authorizationHeaders = _require.authorizationHeaders;
5
-
6
- function notifyVoucherFactory(_ref) {
7
- var client = _ref.client,
8
- internalAuthTokenProvider = _ref.internalAuthTokenProvider;
9
-
10
- return {
11
- create: function create(_ref2) {
12
- var token = _ref2.token,
13
- jwtToken = _ref2.jwtToken,
14
- query = _ref2.query,
15
- data = _ref2.data,
16
- headers = _ref2.headers;
17
-
18
- return client({
19
- url: "/notify-vouchers",
20
- method: "post",
21
- params: query,
22
- data: data,
23
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
24
- });
25
- }
26
- };
27
- }
28
-
29
- module.exports = notifyVoucherFactory;
@@ -1,21 +0,0 @@
1
- const {
2
- authorizationHeaders
3
- } = require("./../endpoints_helpers.js");
4
-
5
- function notifyVoucherFactory({
6
- client, internalAuthTokenProvider
7
- }) {
8
- return {
9
- create({token, jwtToken, query, data, headers}) {
10
- return client({
11
- url: "/notify-vouchers",
12
- method: "post",
13
- params: query,
14
- data,
15
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
16
- });
17
- }
18
- };
19
- }
20
-
21
- module.exports = notifyVoucherFactory;
@@ -1,31 +0,0 @@
1
- const {axiosMock} = require("./../../test-helpers.js");
2
- const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
-
4
- describe("notifications/notify-vouchers", () => {
5
- const token = "my-api-key";
6
- const jwtToken = "my-jwt";
7
-
8
- afterEach(() => {
9
- axiosMock.reset();
10
- });
11
-
12
- it("should post send an email with voucher", () => {
13
- const query = {
14
- lang: "en"
15
- };
16
- axiosMock.onPost("/notify-vouchers").reply(({headers}) => {
17
- if (headers["x-api-key"] === token && headers.authorization === `Bearer ${jwtToken}`) {
18
- return [200];
19
- }
20
- return [403];
21
- });
22
- return api.notifications.notifyVoucher.create({
23
- token,
24
- jwtToken,
25
- query,
26
- data: {
27
- voucherIds: []
28
- }
29
- });
30
- });
31
- });