btrz-api-client 7.21.0 → 7.22.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.
@@ -22,8 +22,27 @@ function stripeTerminalsFactory(_ref) {
22
22
  });
23
23
  }
24
24
 
25
+ function simulate(_ref3) {
26
+ var token = _ref3.token,
27
+ jwtToken = _ref3.jwtToken,
28
+ id = _ref3.id,
29
+ stripePayment = _ref3.stripePayment,
30
+ _ref3$query = _ref3.query,
31
+ query = _ref3$query === undefined ? {} : _ref3$query,
32
+ headers = _ref3.headers;
33
+
34
+ return client({
35
+ url: "/stripe-terminals/" + id + "/simulate",
36
+ method: "post",
37
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
38
+ params: query,
39
+ data: { stripePayment: stripePayment }
40
+ });
41
+ }
42
+
25
43
  return {
26
- all: all
44
+ all: all,
45
+ simulate: simulate
27
46
  };
28
47
  }
29
48
  module.exports = stripeTerminalsFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "7.21.0",
3
+ "version": "7.22.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,8 +12,19 @@ function stripeTerminalsFactory({client, internalAuthTokenProvider}) {
12
12
  });
13
13
  }
14
14
 
15
+ function simulate({token, jwtToken, id, stripePayment, query = {}, headers}) {
16
+ return client({
17
+ url: `/stripe-terminals/${id}/simulate`,
18
+ method: "post",
19
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
20
+ params: query,
21
+ data: {stripePayment}
22
+ });
23
+ }
24
+
15
25
  return {
16
- all
26
+ all,
27
+ simulate
17
28
  };
18
29
  }
19
30
  module.exports = stripeTerminalsFactory;
@@ -24,4 +24,20 @@ describe("btrzpay/stripe-terminals", () => {
24
24
  query
25
25
  });
26
26
  });
27
+
28
+ it("should simulate a stripe terminal payment", () => {
29
+ const data = {ccNumber: "4242424242424242"};
30
+ const terminalId = "tm_123";
31
+ axiosMock.onPost(`/stripe-terminals/${terminalId}/simulate`).reply(expectRequest({
32
+ statusCode: 200, token, jwtToken, data
33
+ }));
34
+ return api.btrzpay.stripeTerminals.simulate({
35
+ id: terminalId,
36
+ token,
37
+ jwtToken,
38
+ data: {
39
+ stripePayment: data
40
+ }
41
+ });
42
+ });
27
43
  });
package/types/client.d.ts CHANGED
@@ -4889,6 +4889,14 @@ export function createApiClient(options: {
4889
4889
  headers: any;
4890
4890
  query?: {};
4891
4891
  }) => any;
4892
+ simulate: ({ token, jwtToken, id, stripePayment, query, headers }: {
4893
+ token: any;
4894
+ jwtToken: any;
4895
+ id: any;
4896
+ stripePayment: any;
4897
+ query?: {};
4898
+ headers: any;
4899
+ }) => any;
4892
4900
  };
4893
4901
  __test: {
4894
4902
  client: axios.AxiosInstance;
@@ -9,4 +9,12 @@ declare function stripeTerminalsFactory({ client, internalAuthTokenProvider }: {
9
9
  headers: any;
10
10
  query?: {};
11
11
  }) => any;
12
+ simulate: ({ token, jwtToken, id, stripePayment, query, headers }: {
13
+ token: any;
14
+ jwtToken: any;
15
+ id: any;
16
+ stripePayment: any;
17
+ query?: {};
18
+ headers: any;
19
+ }) => any;
12
20
  };
@@ -4843,6 +4843,14 @@ declare const _exports: {
4843
4843
  headers: any;
4844
4844
  query?: {};
4845
4845
  }) => any;
4846
+ simulate: ({ token, jwtToken, id, stripePayment, query, headers }: {
4847
+ token: any;
4848
+ jwtToken: any;
4849
+ id: any;
4850
+ stripePayment: any;
4851
+ query?: {};
4852
+ headers: any;
4853
+ }) => any;
4846
4854
  };
4847
4855
  __test: {
4848
4856
  client: import("axios").AxiosInstance;