btrz-api-client 5.152.0 → 5.154.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 +1 -5
- package/lib/endpoints/btrzpay/datalogic.js +32 -3
- package/lib/endpoints/sales/cart.js +19 -1
- package/package.json +1 -1
- package/src/endpoints/btrzpay/datalogic.js +22 -2
- package/src/endpoints/sales/cart.js +12 -1
- package/test/endpoints/btrzpay/datalogicAuthCode.tests.js +32 -0
- package/test/endpoints/btrzpay/datalogicPayments.tests.js +1 -1
- package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +32 -0
- package/test/endpoints/sales/cart.test.js +6 -0
- package/types/client.d.ts +25 -0
- package/types/endpoints/btrzpay/datalogic.d.ts +17 -2
- package/types/endpoints/sales/cart.d.ts +9 -0
- package/types/initializedClient.d.ts +25 -0
|
@@ -4,8 +4,7 @@ var _require = require("./../endpoints_helpers"),
|
|
|
4
4
|
authorizationHeaders = _require.authorizationHeaders;
|
|
5
5
|
|
|
6
6
|
function datalogicFactory(_ref) {
|
|
7
|
-
var client = _ref.client
|
|
8
|
-
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
7
|
+
var client = _ref.client;
|
|
9
8
|
|
|
10
9
|
var payments = {
|
|
11
10
|
all: function all(_ref2) {
|
|
@@ -40,8 +39,38 @@ function datalogicFactory(_ref) {
|
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
41
|
|
|
42
|
+
var referenceNumber = {
|
|
43
|
+
get: function get(_ref4) {
|
|
44
|
+
var token = _ref4.token,
|
|
45
|
+
jwtToken = _ref4.jwtToken,
|
|
46
|
+
headers = _ref4.headers,
|
|
47
|
+
internalAuthTokenProvider = _ref4.internalAuthTokenProvider;
|
|
48
|
+
|
|
49
|
+
return client({
|
|
50
|
+
url: "/datalogic/reference-number",
|
|
51
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var authCode = {
|
|
57
|
+
get: function get(_ref5) {
|
|
58
|
+
var token = _ref5.token,
|
|
59
|
+
jwtToken = _ref5.jwtToken,
|
|
60
|
+
headers = _ref5.headers,
|
|
61
|
+
internalAuthTokenProvider = _ref5.internalAuthTokenProvider;
|
|
62
|
+
|
|
63
|
+
return client({
|
|
64
|
+
url: "/datalogic/auth-code",
|
|
65
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
43
70
|
return {
|
|
44
|
-
payments: payments
|
|
71
|
+
payments: payments,
|
|
72
|
+
referenceNumber: referenceNumber,
|
|
73
|
+
authCode: authCode
|
|
45
74
|
};
|
|
46
75
|
}
|
|
47
76
|
|
|
@@ -129,6 +129,23 @@ function cartFactory(_ref) {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
var taxExemptPaymentMethod = {
|
|
133
|
+
post: function post(_ref10) {
|
|
134
|
+
var token = _ref10.token,
|
|
135
|
+
cartId = _ref10.cartId,
|
|
136
|
+
jwtToken = _ref10.jwtToken,
|
|
137
|
+
headers = _ref10.headers,
|
|
138
|
+
_ref10$query = _ref10.query,
|
|
139
|
+
query = _ref10$query === undefined ? {} : _ref10$query;
|
|
140
|
+
|
|
141
|
+
return client({
|
|
142
|
+
url: "/carts/" + cartId + "/tax-exempt-payment-method",
|
|
143
|
+
method: "POST",
|
|
144
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
132
149
|
return {
|
|
133
150
|
get: get,
|
|
134
151
|
create: create,
|
|
@@ -137,7 +154,8 @@ function cartFactory(_ref) {
|
|
|
137
154
|
loyaltyPointsAmount: loyaltyPointsAmount,
|
|
138
155
|
patch: patch,
|
|
139
156
|
partialDepositStatus: partialDepositStatus,
|
|
140
|
-
payments: payments
|
|
157
|
+
payments: payments,
|
|
158
|
+
taxExemptPaymentMethod: taxExemptPaymentMethod
|
|
141
159
|
};
|
|
142
160
|
}
|
|
143
161
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ const {
|
|
|
2
2
|
authorizationHeaders
|
|
3
3
|
} = require("./../endpoints_helpers");
|
|
4
4
|
|
|
5
|
-
function datalogicFactory({client
|
|
5
|
+
function datalogicFactory({client}) {
|
|
6
6
|
const payments = {
|
|
7
7
|
all({token, jwtToken, headers, query, internalAuthTokenProvider}) {
|
|
8
8
|
return client({
|
|
@@ -22,8 +22,28 @@ function datalogicFactory({client, internalAuthTokenProvider}) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
const referenceNumber = {
|
|
26
|
+
get({token, jwtToken, headers, internalAuthTokenProvider}) {
|
|
27
|
+
return client({
|
|
28
|
+
url: "/datalogic/reference-number",
|
|
29
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const authCode = {
|
|
35
|
+
get({token, jwtToken, headers, internalAuthTokenProvider}) {
|
|
36
|
+
return client({
|
|
37
|
+
url: "/datalogic/auth-code",
|
|
38
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
25
43
|
return {
|
|
26
|
-
payments
|
|
44
|
+
payments,
|
|
45
|
+
referenceNumber,
|
|
46
|
+
authCode
|
|
27
47
|
};
|
|
28
48
|
}
|
|
29
49
|
|
|
@@ -79,6 +79,16 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
const taxExemptPaymentMethod = {
|
|
83
|
+
post({token, cartId, jwtToken, headers, query = {}}) {
|
|
84
|
+
return client({
|
|
85
|
+
url: `/carts/${cartId}/tax-exempt-payment-method`,
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
82
92
|
return {
|
|
83
93
|
get,
|
|
84
94
|
create,
|
|
@@ -87,7 +97,8 @@ function cartFactory({client, internalAuthTokenProvider}) {
|
|
|
87
97
|
loyaltyPointsAmount,
|
|
88
98
|
patch,
|
|
89
99
|
partialDepositStatus,
|
|
90
|
-
payments
|
|
100
|
+
payments,
|
|
101
|
+
taxExemptPaymentMethod
|
|
91
102
|
};
|
|
92
103
|
}
|
|
93
104
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("../../test-helpers");
|
|
4
|
+
const api = require("../../../src/client").createApiClient({
|
|
5
|
+
baseURL: "http://test.com"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe("btrz-pay/datalogic/auth-code", () => {
|
|
9
|
+
const internalAuthTokenProvider = {
|
|
10
|
+
getToken: () => {
|
|
11
|
+
return "internalToken";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
axiosMock.reset();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should get a Authorization code", () => {
|
|
20
|
+
axiosMock.onGet("/datalogic/auth-code").reply(expectRequest({
|
|
21
|
+
statusCode: 200,
|
|
22
|
+
internalAuthTokenProvider,
|
|
23
|
+
withoutApiKey: true,
|
|
24
|
+
jwtToken: "internal_auth_token"
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
return api.btrzpay.datalogic.authCode.get({
|
|
28
|
+
internalAuthTokenProvider,
|
|
29
|
+
jwtToken: "internal_auth_token"
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -6,7 +6,7 @@ const api = require("../../../src/client").createApiClient({
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
describe("btrz-pay/datalogic/payments", () => {
|
|
9
|
-
const referenceNumber = "
|
|
9
|
+
const referenceNumber = "000000000000000000002";
|
|
10
10
|
const internalAuthTokenProvider = {
|
|
11
11
|
getToken: () => {
|
|
12
12
|
return "internalToken";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const {
|
|
2
|
+
axiosMock, expectRequest
|
|
3
|
+
} = require("../../test-helpers");
|
|
4
|
+
const api = require("../../../src/client").createApiClient({
|
|
5
|
+
baseURL: "http://test.com"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe("btrz-pay/datalogic/reference-number", () => {
|
|
9
|
+
const internalAuthTokenProvider = {
|
|
10
|
+
getToken: () => {
|
|
11
|
+
return "internalToken";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
axiosMock.reset();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should get a reference number", () => {
|
|
20
|
+
axiosMock.onGet("/datalogic/reference-number").reply(expectRequest({
|
|
21
|
+
statusCode: 200,
|
|
22
|
+
internalAuthTokenProvider,
|
|
23
|
+
withoutApiKey: true,
|
|
24
|
+
jwtToken: "internal_auth_token"
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
return api.btrzpay.datalogic.referenceNumber.get({
|
|
28
|
+
internalAuthTokenProvider,
|
|
29
|
+
jwtToken: "internal_auth_token"
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -69,4 +69,10 @@ describe("sales/cart", () => {
|
|
|
69
69
|
axiosMock.onDelete(`/carts/${cartId}/payments`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
70
70
|
return api.sales.cart.payments.delete({jwtToken, token, cartId});
|
|
71
71
|
});
|
|
72
|
+
|
|
73
|
+
it("should post a mount with tax exempt from the payment method", () => {
|
|
74
|
+
const cartId = "thisCartId";
|
|
75
|
+
axiosMock.onPost(`/carts/${cartId}/tax-exempt-payment-method`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
76
|
+
return api.sales.cart.taxExemptPaymentMethod.post({jwtToken, token, cartId});
|
|
77
|
+
});
|
|
72
78
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -2479,6 +2479,15 @@ export function createApiClient(options: {
|
|
|
2479
2479
|
headers: any;
|
|
2480
2480
|
}): any;
|
|
2481
2481
|
};
|
|
2482
|
+
taxExemptPaymentMethod: {
|
|
2483
|
+
post({ token, cartId, jwtToken, headers, query }: {
|
|
2484
|
+
token: any;
|
|
2485
|
+
cartId: any;
|
|
2486
|
+
jwtToken: any;
|
|
2487
|
+
headers: any;
|
|
2488
|
+
query?: {};
|
|
2489
|
+
}): any;
|
|
2490
|
+
};
|
|
2482
2491
|
};
|
|
2483
2492
|
giftCertificates: {
|
|
2484
2493
|
get: ({ token, GCNumber, query, headers }: {
|
|
@@ -3813,6 +3822,22 @@ export function createApiClient(options: {
|
|
|
3813
3822
|
internalAuthTokenProvider: any;
|
|
3814
3823
|
}): any;
|
|
3815
3824
|
};
|
|
3825
|
+
referenceNumber: {
|
|
3826
|
+
get({ token, jwtToken, headers, internalAuthTokenProvider }: {
|
|
3827
|
+
token: any;
|
|
3828
|
+
jwtToken: any;
|
|
3829
|
+
headers: any;
|
|
3830
|
+
internalAuthTokenProvider: any;
|
|
3831
|
+
}): any;
|
|
3832
|
+
};
|
|
3833
|
+
authCode: {
|
|
3834
|
+
get({ token, jwtToken, headers, internalAuthTokenProvider }: {
|
|
3835
|
+
token: any;
|
|
3836
|
+
jwtToken: any;
|
|
3837
|
+
headers: any;
|
|
3838
|
+
internalAuthTokenProvider: any;
|
|
3839
|
+
}): any;
|
|
3840
|
+
};
|
|
3816
3841
|
};
|
|
3817
3842
|
__test: {
|
|
3818
3843
|
client: axios.AxiosInstance;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export = datalogicFactory;
|
|
2
|
-
declare function datalogicFactory({ client
|
|
2
|
+
declare function datalogicFactory({ client }: {
|
|
3
3
|
client: any;
|
|
4
|
-
internalAuthTokenProvider: any;
|
|
5
4
|
}): {
|
|
6
5
|
payments: {
|
|
7
6
|
all({ token, jwtToken, headers, query, internalAuthTokenProvider }: {
|
|
@@ -21,4 +20,20 @@ declare function datalogicFactory({ client, internalAuthTokenProvider }: {
|
|
|
21
20
|
internalAuthTokenProvider: any;
|
|
22
21
|
}): any;
|
|
23
22
|
};
|
|
23
|
+
referenceNumber: {
|
|
24
|
+
get({ token, jwtToken, headers, internalAuthTokenProvider }: {
|
|
25
|
+
token: any;
|
|
26
|
+
jwtToken: any;
|
|
27
|
+
headers: any;
|
|
28
|
+
internalAuthTokenProvider: any;
|
|
29
|
+
}): any;
|
|
30
|
+
};
|
|
31
|
+
authCode: {
|
|
32
|
+
get({ token, jwtToken, headers, internalAuthTokenProvider }: {
|
|
33
|
+
token: any;
|
|
34
|
+
jwtToken: any;
|
|
35
|
+
headers: any;
|
|
36
|
+
internalAuthTokenProvider: any;
|
|
37
|
+
}): any;
|
|
38
|
+
};
|
|
24
39
|
};
|
|
@@ -61,4 +61,13 @@ declare function cartFactory({ client, internalAuthTokenProvider }: {
|
|
|
61
61
|
headers: any;
|
|
62
62
|
}): any;
|
|
63
63
|
};
|
|
64
|
+
taxExemptPaymentMethod: {
|
|
65
|
+
post({ token, cartId, jwtToken, headers, query }: {
|
|
66
|
+
token: any;
|
|
67
|
+
cartId: any;
|
|
68
|
+
jwtToken: any;
|
|
69
|
+
headers: any;
|
|
70
|
+
query?: {};
|
|
71
|
+
}): any;
|
|
72
|
+
};
|
|
64
73
|
};
|
|
@@ -2433,6 +2433,15 @@ declare const _exports: {
|
|
|
2433
2433
|
headers: any;
|
|
2434
2434
|
}): any;
|
|
2435
2435
|
};
|
|
2436
|
+
taxExemptPaymentMethod: {
|
|
2437
|
+
post({ token, cartId, jwtToken, headers, query }: {
|
|
2438
|
+
token: any;
|
|
2439
|
+
cartId: any;
|
|
2440
|
+
jwtToken: any;
|
|
2441
|
+
headers: any;
|
|
2442
|
+
query?: {};
|
|
2443
|
+
}): any;
|
|
2444
|
+
};
|
|
2436
2445
|
};
|
|
2437
2446
|
giftCertificates: {
|
|
2438
2447
|
get: ({ token, GCNumber, query, headers }: {
|
|
@@ -3767,6 +3776,22 @@ declare const _exports: {
|
|
|
3767
3776
|
internalAuthTokenProvider: any;
|
|
3768
3777
|
}): any;
|
|
3769
3778
|
};
|
|
3779
|
+
referenceNumber: {
|
|
3780
|
+
get({ token, jwtToken, headers, internalAuthTokenProvider }: {
|
|
3781
|
+
token: any;
|
|
3782
|
+
jwtToken: any;
|
|
3783
|
+
headers: any;
|
|
3784
|
+
internalAuthTokenProvider: any;
|
|
3785
|
+
}): any;
|
|
3786
|
+
};
|
|
3787
|
+
authCode: {
|
|
3788
|
+
get({ token, jwtToken, headers, internalAuthTokenProvider }: {
|
|
3789
|
+
token: any;
|
|
3790
|
+
jwtToken: any;
|
|
3791
|
+
headers: any;
|
|
3792
|
+
internalAuthTokenProvider: any;
|
|
3793
|
+
}): any;
|
|
3794
|
+
};
|
|
3770
3795
|
};
|
|
3771
3796
|
__test: {
|
|
3772
3797
|
client: import("axios").AxiosInstance;
|