btrz-api-client 5.169.0 → 5.171.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 -1
- package/lib/endpoints/accounts/users.js +18 -0
- package/lib/endpoints/sales/order.js +17 -1
- package/package.json +1 -1
- package/src/endpoints/accounts/users.js +11 -0
- package/src/endpoints/sales/order.js +12 -2
- package/test/endpoints/accounts/users.js +18 -0
- package/test/endpoints/sales/order.test.js +7 -1
- package/types/client.d.ts +16 -6
- package/types/endpoints/accounts/users.d.ts +9 -6
- package/types/endpoints/sales/order.d.ts +7 -0
- package/types/initializedClient.d.ts +16 -6
|
@@ -95,6 +95,24 @@ function usersFactory(_ref) {
|
|
|
95
95
|
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
96
96
|
data: sequence
|
|
97
97
|
});
|
|
98
|
+
},
|
|
99
|
+
transfer: function transfer(_ref8) {
|
|
100
|
+
var jwtToken = _ref8.jwtToken,
|
|
101
|
+
token = _ref8.token,
|
|
102
|
+
userId = _ref8.userId,
|
|
103
|
+
sequenceId = _ref8.sequenceId,
|
|
104
|
+
newUserId = _ref8.newUserId,
|
|
105
|
+
headers = _ref8.headers;
|
|
106
|
+
|
|
107
|
+
return client({
|
|
108
|
+
url: "/users/" + userId + "/sequences/" + sequenceId,
|
|
109
|
+
method: "patch",
|
|
110
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
111
|
+
data: {
|
|
112
|
+
operation: "transfer",
|
|
113
|
+
newUserId: newUserId
|
|
114
|
+
}
|
|
115
|
+
});
|
|
98
116
|
}
|
|
99
117
|
};
|
|
100
118
|
|
|
@@ -35,9 +35,25 @@ function orderFactory(_ref) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function overwrite(_ref4) {
|
|
39
|
+
var token = _ref4.token,
|
|
40
|
+
orderId = _ref4.orderId,
|
|
41
|
+
payments = _ref4.payments,
|
|
42
|
+
jwtToken = _ref4.jwtToken,
|
|
43
|
+
headers = _ref4.headers;
|
|
44
|
+
|
|
45
|
+
return client({
|
|
46
|
+
url: "/orders/" + orderId + "/payments",
|
|
47
|
+
method: "post",
|
|
48
|
+
data: payments,
|
|
49
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
return {
|
|
39
54
|
create: create,
|
|
40
|
-
get: get
|
|
55
|
+
get: get,
|
|
56
|
+
overwrite: overwrite
|
|
41
57
|
};
|
|
42
58
|
}
|
|
43
59
|
|
package/package.json
CHANGED
|
@@ -51,6 +51,17 @@ function usersFactory({client, internalAuthTokenProvider}) {
|
|
|
51
51
|
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
52
52
|
data: sequence
|
|
53
53
|
});
|
|
54
|
+
},
|
|
55
|
+
transfer({jwtToken, token, userId, sequenceId, newUserId, headers}) {
|
|
56
|
+
return client({
|
|
57
|
+
url: `/users/${userId}/sequences/${sequenceId}`,
|
|
58
|
+
method: "patch",
|
|
59
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
60
|
+
data: {
|
|
61
|
+
operation: "transfer",
|
|
62
|
+
newUserId
|
|
63
|
+
}
|
|
64
|
+
});
|
|
54
65
|
}
|
|
55
66
|
};
|
|
56
67
|
|
|
@@ -18,10 +18,20 @@ function orderFactory({ client, internalAuthTokenProvider }) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
function overwrite({token, orderId, payments, jwtToken, headers}) {
|
|
22
|
+
return client({
|
|
23
|
+
url: `/orders/${orderId}/payments`,
|
|
24
|
+
method: "post",
|
|
25
|
+
data: payments,
|
|
26
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
return {
|
|
22
31
|
create,
|
|
23
|
-
get
|
|
32
|
+
get,
|
|
33
|
+
overwrite
|
|
24
34
|
};
|
|
25
35
|
}
|
|
26
36
|
|
|
27
|
-
module.exports = orderFactory;
|
|
37
|
+
module.exports = orderFactory;
|
|
@@ -70,4 +70,22 @@ describe("accounts/user/{id}", () => {
|
|
|
70
70
|
sequence: userSequenceData
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
|
+
|
|
74
|
+
it("should transfer an user sequence", () => {
|
|
75
|
+
const sequenceId = "123";
|
|
76
|
+
const newUserId = "123";
|
|
77
|
+
const operationData = {
|
|
78
|
+
operation: "transfer",
|
|
79
|
+
newUserId
|
|
80
|
+
};
|
|
81
|
+
// eslint-disable-next-line max-len
|
|
82
|
+
axiosMock.onPatch(`/users/${id}/sequences/${sequenceId}`).reply(expectRequest({statusCode: 200, token, jwtToken, body: operationData}));
|
|
83
|
+
return api.accounts.users.sequences.transfer({
|
|
84
|
+
jwtToken,
|
|
85
|
+
userId: id,
|
|
86
|
+
sequenceId,
|
|
87
|
+
token,
|
|
88
|
+
newUserId
|
|
89
|
+
});
|
|
90
|
+
});
|
|
73
91
|
});
|
|
@@ -5,7 +5,8 @@ const expect = require("chai").expect;
|
|
|
5
5
|
describe('sales/order', function() {
|
|
6
6
|
const token = 'I owe you a token';
|
|
7
7
|
const jwtToken = 'I owe you a JWT token'
|
|
8
|
-
|
|
8
|
+
const orderId = "orderId1";
|
|
9
|
+
|
|
9
10
|
afterEach(function() {
|
|
10
11
|
axiosMock.reset();
|
|
11
12
|
});
|
|
@@ -20,4 +21,9 @@ describe('sales/order', function() {
|
|
|
20
21
|
axiosMock.onPost(`/order`).reply(expectRequest({ statusCode: 200, token, jwtToken }));
|
|
21
22
|
return api.sales.order.create({ jwtToken, token, order: { cartId: 1234 } });
|
|
22
23
|
});
|
|
24
|
+
|
|
25
|
+
it("should overwrite an order payment by id", function() {
|
|
26
|
+
axiosMock.onPost(`/orders/${orderId}/payments`).reply(expectRequest({ statusCode: 200, token, jwtToken}));
|
|
27
|
+
return api.sales.order.overwrite({ jwtToken, token, payments: [], orderId: "orderId1" });
|
|
28
|
+
});
|
|
23
29
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -2409,12 +2409,7 @@ export function createApiClient(options: {
|
|
|
2409
2409
|
}) => any;
|
|
2410
2410
|
};
|
|
2411
2411
|
users: {
|
|
2412
|
-
get: ({ token, jwtToken, id, headers }?: {
|
|
2413
|
-
token: any;
|
|
2414
|
-
jwtToken: any;
|
|
2415
|
-
id: any;
|
|
2416
|
-
headers: any;
|
|
2417
|
-
}) => any;
|
|
2412
|
+
get: ({ token, jwtToken, id, headers }?: {}) => any;
|
|
2418
2413
|
all: ({ token, jwtToken, query, headers }: {
|
|
2419
2414
|
token: any;
|
|
2420
2415
|
jwtToken: any;
|
|
@@ -2451,6 +2446,14 @@ export function createApiClient(options: {
|
|
|
2451
2446
|
sequence: any;
|
|
2452
2447
|
headers: any;
|
|
2453
2448
|
}): any;
|
|
2449
|
+
transfer({ jwtToken, token, userId, sequenceId, newUserId, headers }: {
|
|
2450
|
+
jwtToken: any;
|
|
2451
|
+
token: any;
|
|
2452
|
+
userId: any;
|
|
2453
|
+
sequenceId: any;
|
|
2454
|
+
newUserId: any;
|
|
2455
|
+
headers: any;
|
|
2456
|
+
}): any;
|
|
2454
2457
|
};
|
|
2455
2458
|
};
|
|
2456
2459
|
__test: {
|
|
@@ -2589,6 +2592,13 @@ export function createApiClient(options: {
|
|
|
2589
2592
|
query?: {};
|
|
2590
2593
|
headers: any;
|
|
2591
2594
|
}) => any;
|
|
2595
|
+
overwrite: ({ token, orderId, payments, jwtToken, headers }: {
|
|
2596
|
+
token: any;
|
|
2597
|
+
orderId: any;
|
|
2598
|
+
payments: any;
|
|
2599
|
+
jwtToken: any;
|
|
2600
|
+
headers: any;
|
|
2601
|
+
}) => any;
|
|
2592
2602
|
};
|
|
2593
2603
|
voucher: {
|
|
2594
2604
|
get: ({ token, voucher, headers }: {
|
|
@@ -3,12 +3,7 @@ declare function usersFactory({ client, internalAuthTokenProvider }: {
|
|
|
3
3
|
client: any;
|
|
4
4
|
internalAuthTokenProvider: any;
|
|
5
5
|
}): {
|
|
6
|
-
get: ({ token, jwtToken, id, headers }?: {
|
|
7
|
-
token: any;
|
|
8
|
-
jwtToken: any;
|
|
9
|
-
id: any;
|
|
10
|
-
headers: any;
|
|
11
|
-
}) => any;
|
|
6
|
+
get: ({ token, jwtToken, id, headers }?: {}) => any;
|
|
12
7
|
all: ({ token, jwtToken, query, headers }: {
|
|
13
8
|
token: any;
|
|
14
9
|
jwtToken: any;
|
|
@@ -45,5 +40,13 @@ declare function usersFactory({ client, internalAuthTokenProvider }: {
|
|
|
45
40
|
sequence: any;
|
|
46
41
|
headers: any;
|
|
47
42
|
}): any;
|
|
43
|
+
transfer({ jwtToken, token, userId, sequenceId, newUserId, headers }: {
|
|
44
|
+
jwtToken: any;
|
|
45
|
+
token: any;
|
|
46
|
+
userId: any;
|
|
47
|
+
sequenceId: any;
|
|
48
|
+
newUserId: any;
|
|
49
|
+
headers: any;
|
|
50
|
+
}): any;
|
|
48
51
|
};
|
|
49
52
|
};
|
|
@@ -15,4 +15,11 @@ declare function orderFactory({ client, internalAuthTokenProvider }: {
|
|
|
15
15
|
query?: {};
|
|
16
16
|
headers: any;
|
|
17
17
|
}) => any;
|
|
18
|
+
overwrite: ({ token, orderId, payments, jwtToken, headers }: {
|
|
19
|
+
token: any;
|
|
20
|
+
orderId: any;
|
|
21
|
+
payments: any;
|
|
22
|
+
jwtToken: any;
|
|
23
|
+
headers: any;
|
|
24
|
+
}) => any;
|
|
18
25
|
};
|
|
@@ -2363,12 +2363,7 @@ declare const _exports: {
|
|
|
2363
2363
|
}) => any;
|
|
2364
2364
|
};
|
|
2365
2365
|
users: {
|
|
2366
|
-
get: ({ token, jwtToken, id, headers }?: {
|
|
2367
|
-
token: any;
|
|
2368
|
-
jwtToken: any;
|
|
2369
|
-
id: any;
|
|
2370
|
-
headers: any;
|
|
2371
|
-
}) => any;
|
|
2366
|
+
get: ({ token, jwtToken, id, headers }?: {}) => any;
|
|
2372
2367
|
all: ({ token, jwtToken, query, headers }: {
|
|
2373
2368
|
token: any;
|
|
2374
2369
|
jwtToken: any;
|
|
@@ -2405,6 +2400,14 @@ declare const _exports: {
|
|
|
2405
2400
|
sequence: any;
|
|
2406
2401
|
headers: any;
|
|
2407
2402
|
}): any;
|
|
2403
|
+
transfer({ jwtToken, token, userId, sequenceId, newUserId, headers }: {
|
|
2404
|
+
jwtToken: any;
|
|
2405
|
+
token: any;
|
|
2406
|
+
userId: any;
|
|
2407
|
+
sequenceId: any;
|
|
2408
|
+
newUserId: any;
|
|
2409
|
+
headers: any;
|
|
2410
|
+
}): any;
|
|
2408
2411
|
};
|
|
2409
2412
|
};
|
|
2410
2413
|
__test: {
|
|
@@ -2543,6 +2546,13 @@ declare const _exports: {
|
|
|
2543
2546
|
query?: {};
|
|
2544
2547
|
headers: any;
|
|
2545
2548
|
}) => any;
|
|
2549
|
+
overwrite: ({ token, orderId, payments, jwtToken, headers }: {
|
|
2550
|
+
token: any;
|
|
2551
|
+
orderId: any;
|
|
2552
|
+
payments: any;
|
|
2553
|
+
jwtToken: any;
|
|
2554
|
+
headers: any;
|
|
2555
|
+
}) => any;
|
|
2546
2556
|
};
|
|
2547
2557
|
voucher: {
|
|
2548
2558
|
get: ({ token, voucher, headers }: {
|