btrz-api-client 7.20.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.
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +1 -0
- package/lib/endpoints/btrzpay/stripe-terminals.js +20 -1
- package/lib/endpoints/notifications/notify-tickets.js +0 -17
- package/lib/endpoints/notifications/notify-vouchers.js +29 -0
- package/package.json +1 -1
- package/src/client.js +1 -0
- package/src/endpoints/btrzpay/stripe-terminals.js +12 -1
- package/src/endpoints/notifications/notify-tickets.js +0 -11
- package/src/endpoints/notifications/notify-vouchers.js +21 -0
- package/test/endpoints/btrzpay/stripe-terminals.tests.js +16 -0
- package/test/endpoints/notifications/notify-tickets.test.js +0 -20
- package/test/endpoints/notifications/notify-vouchers.test.js +31 -0
- package/types/client.d.ts +17 -9
- package/types/endpoints/btrzpay/stripe-terminals.d.ts +8 -0
- package/types/endpoints/notifications/notify-tickets.d.ts +0 -9
- package/types/endpoints/notifications/notify-vouchers.d.ts +13 -0
- package/types/initializedClient.d.ts +17 -9
package/lib/client.js
CHANGED
|
@@ -356,6 +356,7 @@ function createNotifications(_ref8) {
|
|
|
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
358
|
notify: require("./endpoints/notifications/notify-tickets.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
359
|
+
notifyVoucher: require("./endpoints/notifications/notify-vouchers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
359
360
|
ordersRulesValidations: require("./endpoints/notifications/orders-rules-validations.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
360
361
|
__test: {
|
|
361
362
|
client: client
|
|
@@ -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;
|
|
@@ -29,23 +29,6 @@ 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
|
-
}
|
|
49
32
|
}
|
|
50
33
|
};
|
|
51
34
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -294,6 +294,7 @@ function createNotifications({baseURL, headers, timeout, overrideFn, internalAut
|
|
|
294
294
|
twilio: require("./endpoints/notifications/twilio.js")({client, internalAuthTokenProvider}),
|
|
295
295
|
salesforce: require("./endpoints/notifications/salesforce.js")({client, internalAuthTokenProvider}),
|
|
296
296
|
notify: require("./endpoints/notifications/notify-tickets.js")({client, internalAuthTokenProvider}),
|
|
297
|
+
notifyVoucher: require("./endpoints/notifications/notify-vouchers.js")({client, internalAuthTokenProvider}),
|
|
297
298
|
ordersRulesValidations: require("./endpoints/notifications/orders-rules-validations.js")({client, internalAuthTokenProvider}),
|
|
298
299
|
__test: {
|
|
299
300
|
client
|
|
@@ -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;
|
|
@@ -19,17 +19,6 @@ 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
|
-
}
|
|
33
22
|
}
|
|
34
23
|
};
|
|
35
24
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -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
|
});
|
|
@@ -29,24 +29,4 @@ 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
|
-
});
|
|
52
32
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
});
|
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
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
};
|
|
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;
|
|
4279
4279
|
};
|
|
4280
4280
|
ordersRulesValidations: {
|
|
4281
4281
|
create: ({ token, jwtToken, query, orderRulesValidation, headers }: {
|
|
@@ -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
|
};
|
|
@@ -14,13 +14,4 @@ declare function notifyTicketFactory({ client, internalAuthTokenProvider }: {
|
|
|
14
14
|
headers: any;
|
|
15
15
|
}): any;
|
|
16
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
17
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export = notifyVoucherFactory;
|
|
2
|
+
declare function notifyVoucherFactory({ client, internalAuthTokenProvider }: {
|
|
3
|
+
client: any;
|
|
4
|
+
internalAuthTokenProvider: any;
|
|
5
|
+
}): {
|
|
6
|
+
create({ token, jwtToken, query, data, headers }: {
|
|
7
|
+
token: any;
|
|
8
|
+
jwtToken: any;
|
|
9
|
+
query: any;
|
|
10
|
+
data: any;
|
|
11
|
+
headers: any;
|
|
12
|
+
}): any;
|
|
13
|
+
};
|
|
@@ -4221,15 +4221,15 @@ declare const _exports: {
|
|
|
4221
4221
|
headers: any;
|
|
4222
4222
|
}): any;
|
|
4223
4223
|
};
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
};
|
|
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;
|
|
4233
4233
|
};
|
|
4234
4234
|
ordersRulesValidations: {
|
|
4235
4235
|
create: ({ token, jwtToken, query, orderRulesValidation, headers }: {
|
|
@@ -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;
|