btrz-api-client 7.8.0 → 7.9.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.
@@ -30,8 +30,28 @@ function vouchersFactory(_ref) {
30
30
  });
31
31
  }
32
32
 
33
+ function compensationsCreate(_ref3) {
34
+ var token = _ref3.token,
35
+ jwtToken = _ref3.jwtToken,
36
+ compensation = _ref3.compensation,
37
+ _ref3$query = _ref3.query,
38
+ query = _ref3$query === undefined ? {} : _ref3$query,
39
+ headers = _ref3.headers;
40
+
41
+ return client({
42
+ url: "/vouchers/compensations",
43
+ method: "post",
44
+ params: query,
45
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
46
+ data: compensation
47
+ });
48
+ }
49
+
33
50
  return {
34
- create: create
51
+ create: create,
52
+ compensations: {
53
+ create: compensationsCreate
54
+ }
35
55
  };
36
56
  }
37
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,21 @@ function vouchersFactory({
22
22
  });
23
23
  }
24
24
 
25
+ function compensationsCreate({token, jwtToken, compensation, query = {}, headers}) {
26
+ return client({
27
+ url: "/vouchers/compensations",
28
+ method: "post",
29
+ params: query,
30
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
31
+ data: compensation
32
+ });
33
+ }
34
+
25
35
  return {
26
- create
36
+ create,
37
+ compensations: {
38
+ create: compensationsCreate
39
+ }
27
40
  };
28
41
  }
29
42
 
@@ -27,3 +27,29 @@ describe("operations/vouchers", () => {
27
27
  return api.operations.vouchers.create({jwtToken, token, voucher});
28
28
  });
29
29
  });
30
+
31
+ describe("operations/vouchers/compensations", () => {
32
+ const token = "I owe you a token";
33
+ const jwtToken = "I owe you a JWT token";
34
+
35
+ afterEach(() => {
36
+ axiosMock.reset();
37
+ });
38
+
39
+ it("should POST a compensation", () => {
40
+ const compensation = {
41
+ voucherInfo: {
42
+ type: "voucher",
43
+ amount: "100",
44
+ typeAmount: "%"
45
+ },
46
+ ticketIds: []
47
+ };
48
+
49
+ axiosMock
50
+ .onPost("/vouchers/compensations")
51
+ .reply(expectRequest({statusCode: 200, token, jwtToken}));
52
+
53
+ return api.operations.vouchers.compensations.create({jwtToken, token, compensation});
54
+ });
55
+ });
package/types/client.d.ts CHANGED
@@ -3947,6 +3947,15 @@ export function createApiClient(options: {
3947
3947
  query?: {};
3948
3948
  voucher?: {};
3949
3949
  }) => any;
3950
+ compensations: {
3951
+ create: ({ token, jwtToken, compensation, query, headers }: {
3952
+ token: any;
3953
+ jwtToken: any;
3954
+ compensation: any;
3955
+ query?: {};
3956
+ headers: any;
3957
+ }) => any;
3958
+ };
3950
3959
  };
3951
3960
  waitlists: {
3952
3961
  all: ({ token, jwtToken, query, headers }: {
@@ -10,4 +10,13 @@ declare function vouchersFactory({ client, internalAuthTokenProvider }: {
10
10
  query?: {};
11
11
  voucher?: {};
12
12
  }) => any;
13
+ compensations: {
14
+ create: ({ token, jwtToken, compensation, query, headers }: {
15
+ token: any;
16
+ jwtToken: any;
17
+ compensation: any;
18
+ query?: {};
19
+ headers: any;
20
+ }) => any;
21
+ };
13
22
  };
@@ -3901,6 +3901,15 @@ declare const _exports: {
3901
3901
  query?: {};
3902
3902
  voucher?: {};
3903
3903
  }) => any;
3904
+ compensations: {
3905
+ create: ({ token, jwtToken, compensation, query, headers }: {
3906
+ token: any;
3907
+ jwtToken: any;
3908
+ compensation: any;
3909
+ query?: {};
3910
+ headers: any;
3911
+ }) => any;
3912
+ };
3904
3913
  };
3905
3914
  waitlists: {
3906
3915
  all: ({ token, jwtToken, query, headers }: {