btrz-api-client 7.16.0 → 7.18.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/inventory/external-wallets.js +28 -13
- package/lib/endpoints/notifications/notify-tickets.js +17 -0
- package/package.json +1 -1
- package/src/endpoints/inventory/external-wallets.js +12 -6
- package/src/endpoints/notifications/notify-tickets.js +11 -0
- package/test/endpoints/inventory/change-requests.test.js +1 -1
- package/test/endpoints/inventory/external-wallets.test.js +14 -0
- package/test/endpoints/notifications/notify-tickets.test.js +21 -1
- package/types/client.d.ts +21 -3
- package/types/endpoints/inventory/external-wallets.d.ts +12 -3
- package/types/endpoints/notifications/notify-tickets.d.ts +9 -0
- package/types/initializedClient.d.ts +21 -3
|
@@ -8,31 +8,46 @@ function externalWalletsFactory(_ref) {
|
|
|
8
8
|
internalAuthTokenProvider = _ref.internalAuthTokenProvider;
|
|
9
9
|
|
|
10
10
|
var saldoMax = {
|
|
11
|
-
|
|
11
|
+
all: function all(_ref2) {
|
|
12
12
|
var token = _ref2.token,
|
|
13
13
|
jwtToken = _ref2.jwtToken,
|
|
14
|
-
|
|
14
|
+
_ref2$query = _ref2.query,
|
|
15
|
+
query = _ref2$query === undefined ? {} : _ref2$query,
|
|
16
|
+
headers = _ref2.headers;
|
|
17
|
+
|
|
18
|
+
return client.get("/external-wallets/saldo-max", {
|
|
19
|
+
params: query,
|
|
20
|
+
headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, jwtToken: jwtToken, headers: headers })
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
create: function create(_ref3) {
|
|
24
|
+
var token = _ref3.token,
|
|
25
|
+
jwtToken = _ref3.jwtToken,
|
|
26
|
+
externalWallet = _ref3.externalWallet,
|
|
27
|
+
headers = _ref3.headers;
|
|
15
28
|
|
|
16
29
|
return client({
|
|
17
30
|
url: "/external-wallets/saldo-max",
|
|
18
31
|
method: "post",
|
|
19
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
32
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
20
33
|
data: { externalWallet: externalWallet }
|
|
21
34
|
});
|
|
22
35
|
},
|
|
23
|
-
get: function get(
|
|
24
|
-
var token =
|
|
25
|
-
jwtToken =
|
|
26
|
-
walletId =
|
|
36
|
+
get: function get(_ref4) {
|
|
37
|
+
var token = _ref4.token,
|
|
38
|
+
jwtToken = _ref4.jwtToken,
|
|
39
|
+
walletId = _ref4.walletId,
|
|
40
|
+
headers = _ref4.headers;
|
|
27
41
|
|
|
28
42
|
return client.get("/external-wallets/saldo-max/" + walletId, {
|
|
29
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider })
|
|
43
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
|
|
30
44
|
});
|
|
31
45
|
},
|
|
32
|
-
update: function update(
|
|
33
|
-
var token =
|
|
34
|
-
jwtToken =
|
|
35
|
-
externalWallet =
|
|
46
|
+
update: function update(_ref5) {
|
|
47
|
+
var token = _ref5.token,
|
|
48
|
+
jwtToken = _ref5.jwtToken,
|
|
49
|
+
externalWallet = _ref5.externalWallet,
|
|
50
|
+
headers = _ref5.headers;
|
|
36
51
|
|
|
37
52
|
var externalWalletFieldsToUpdate = {
|
|
38
53
|
nip: externalWallet.nip,
|
|
@@ -43,7 +58,7 @@ function externalWalletsFactory(_ref) {
|
|
|
43
58
|
return client({
|
|
44
59
|
url: "/external-wallets/saldo-max/" + externalWallet._id,
|
|
45
60
|
method: "put",
|
|
46
|
-
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider }),
|
|
61
|
+
headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
|
|
47
62
|
data: {
|
|
48
63
|
externalWallet: externalWalletFieldsToUpdate
|
|
49
64
|
}
|
|
@@ -29,6 +29,23 @@ 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
|
+
}
|
|
32
49
|
}
|
|
33
50
|
};
|
|
34
51
|
}
|
package/package.json
CHANGED
|
@@ -4,20 +4,26 @@ const {
|
|
|
4
4
|
|
|
5
5
|
function externalWalletsFactory({client, internalAuthTokenProvider}) {
|
|
6
6
|
const saldoMax = {
|
|
7
|
-
|
|
7
|
+
all: ({token, jwtToken, query = {}, headers}) => {
|
|
8
|
+
return client.get("/external-wallets/saldo-max", {
|
|
9
|
+
params: query,
|
|
10
|
+
headers: authorizationHeaders({token, internalAuthTokenProvider, jwtToken, headers})
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
create: ({token, jwtToken, externalWallet, headers}) => {
|
|
8
14
|
return client({
|
|
9
15
|
url: "/external-wallets/saldo-max",
|
|
10
16
|
method: "post",
|
|
11
|
-
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider}),
|
|
17
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
12
18
|
data: {externalWallet}
|
|
13
19
|
});
|
|
14
20
|
},
|
|
15
|
-
get: ({token, jwtToken, walletId}) => {
|
|
21
|
+
get: ({token, jwtToken, walletId, headers}) => {
|
|
16
22
|
return client.get(`/external-wallets/saldo-max/${walletId}`, {
|
|
17
|
-
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider})
|
|
23
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
|
|
18
24
|
});
|
|
19
25
|
},
|
|
20
|
-
update: ({token, jwtToken, externalWallet}) => {
|
|
26
|
+
update: ({token, jwtToken, externalWallet, headers}) => {
|
|
21
27
|
const externalWalletFieldsToUpdate = {
|
|
22
28
|
nip: externalWallet.nip,
|
|
23
29
|
walletNumber: externalWallet.walletNumber,
|
|
@@ -27,7 +33,7 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
|
|
|
27
33
|
return client({
|
|
28
34
|
url: `/external-wallets/saldo-max/${externalWallet._id}`,
|
|
29
35
|
method: "put",
|
|
30
|
-
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider}),
|
|
36
|
+
headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
|
|
31
37
|
data: {
|
|
32
38
|
externalWallet: externalWalletFieldsToUpdate
|
|
33
39
|
}
|
|
@@ -19,6 +19,17 @@ 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
|
+
}
|
|
22
33
|
}
|
|
23
34
|
};
|
|
24
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {axiosMock, expectRequest} = require("./../../test-helpers");
|
|
2
2
|
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
3
|
|
|
4
|
-
describe
|
|
4
|
+
describe("inventory/change-requests", function() {
|
|
5
5
|
const token = "I owe you a token";
|
|
6
6
|
const jwtToken = "I owe you a JWT token";
|
|
7
7
|
|
|
@@ -15,6 +15,20 @@ describe("inventory/external-wallets", () => {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
describe("/saldo-max", () => {
|
|
18
|
+
it("should retrieve a list of Saldo Max wallets", () => {
|
|
19
|
+
const query = {walletNumber: "CTCW6L"};
|
|
20
|
+
|
|
21
|
+
axiosMock.onGet("/external-wallets/saldo-max", {params: query}).reply(expectRequest({
|
|
22
|
+
statusCode: 200, token, jwtToken
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
return api.inventory.externalWallets.saldoMax.all({
|
|
26
|
+
jwtToken,
|
|
27
|
+
token,
|
|
28
|
+
query
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
18
32
|
it("should create a new Saldo Max wallet", async () => {
|
|
19
33
|
const externalWallet = {
|
|
20
34
|
firstName: "John",
|
|
@@ -9,7 +9,7 @@ describe("notifications/notify-tickets", () => {
|
|
|
9
9
|
axiosMock.reset();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
it("should post send an email", () => {
|
|
12
|
+
it("should post send an email with ticket", () => {
|
|
13
13
|
const query = {
|
|
14
14
|
lang: "en"
|
|
15
15
|
};
|
|
@@ -29,4 +29,24 @@ 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
|
+
});
|
|
32
52
|
});
|
package/types/client.d.ts
CHANGED
|
@@ -616,20 +616,29 @@ export function createApiClient(options: {
|
|
|
616
616
|
};
|
|
617
617
|
externalWallets: {
|
|
618
618
|
saldoMax: {
|
|
619
|
-
|
|
619
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
620
|
+
token: any;
|
|
621
|
+
jwtToken: any;
|
|
622
|
+
query?: {};
|
|
623
|
+
headers: any;
|
|
624
|
+
}) => any;
|
|
625
|
+
create: ({ token, jwtToken, externalWallet, headers }: {
|
|
620
626
|
token: any;
|
|
621
627
|
jwtToken: any;
|
|
622
628
|
externalWallet: any;
|
|
629
|
+
headers: any;
|
|
623
630
|
}) => any;
|
|
624
|
-
get: ({ token, jwtToken, walletId }: {
|
|
631
|
+
get: ({ token, jwtToken, walletId, headers }: {
|
|
625
632
|
token: any;
|
|
626
633
|
jwtToken: any;
|
|
627
634
|
walletId: any;
|
|
635
|
+
headers: any;
|
|
628
636
|
}) => any;
|
|
629
|
-
update: ({ token, jwtToken, externalWallet }: {
|
|
637
|
+
update: ({ token, jwtToken, externalWallet, headers }: {
|
|
630
638
|
token: any;
|
|
631
639
|
jwtToken: any;
|
|
632
640
|
externalWallet: any;
|
|
641
|
+
headers: any;
|
|
633
642
|
}) => any;
|
|
634
643
|
};
|
|
635
644
|
};
|
|
@@ -4228,6 +4237,15 @@ export function createApiClient(options: {
|
|
|
4228
4237
|
headers: any;
|
|
4229
4238
|
}): any;
|
|
4230
4239
|
};
|
|
4240
|
+
vouchers: {
|
|
4241
|
+
create({ token, jwtToken, query, data, headers }: {
|
|
4242
|
+
token: any;
|
|
4243
|
+
jwtToken: any;
|
|
4244
|
+
query: any;
|
|
4245
|
+
data: any;
|
|
4246
|
+
headers: any;
|
|
4247
|
+
}): any;
|
|
4248
|
+
};
|
|
4231
4249
|
};
|
|
4232
4250
|
ordersRulesValidations: {
|
|
4233
4251
|
create: ({ token, jwtToken, query, orderRulesValidation, headers }: {
|
|
@@ -4,20 +4,29 @@ declare function externalWalletsFactory({ client, internalAuthTokenProvider }: {
|
|
|
4
4
|
internalAuthTokenProvider: any;
|
|
5
5
|
}): {
|
|
6
6
|
saldoMax: {
|
|
7
|
-
|
|
7
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
8
|
+
token: any;
|
|
9
|
+
jwtToken: any;
|
|
10
|
+
query?: {};
|
|
11
|
+
headers: any;
|
|
12
|
+
}) => any;
|
|
13
|
+
create: ({ token, jwtToken, externalWallet, headers }: {
|
|
8
14
|
token: any;
|
|
9
15
|
jwtToken: any;
|
|
10
16
|
externalWallet: any;
|
|
17
|
+
headers: any;
|
|
11
18
|
}) => any;
|
|
12
|
-
get: ({ token, jwtToken, walletId }: {
|
|
19
|
+
get: ({ token, jwtToken, walletId, headers }: {
|
|
13
20
|
token: any;
|
|
14
21
|
jwtToken: any;
|
|
15
22
|
walletId: any;
|
|
23
|
+
headers: any;
|
|
16
24
|
}) => any;
|
|
17
|
-
update: ({ token, jwtToken, externalWallet }: {
|
|
25
|
+
update: ({ token, jwtToken, externalWallet, headers }: {
|
|
18
26
|
token: any;
|
|
19
27
|
jwtToken: any;
|
|
20
28
|
externalWallet: any;
|
|
29
|
+
headers: any;
|
|
21
30
|
}) => any;
|
|
22
31
|
};
|
|
23
32
|
};
|
|
@@ -14,4 +14,13 @@ 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
|
+
};
|
|
17
26
|
};
|
|
@@ -570,20 +570,29 @@ declare const _exports: {
|
|
|
570
570
|
};
|
|
571
571
|
externalWallets: {
|
|
572
572
|
saldoMax: {
|
|
573
|
-
|
|
573
|
+
all: ({ token, jwtToken, query, headers }: {
|
|
574
|
+
token: any;
|
|
575
|
+
jwtToken: any;
|
|
576
|
+
query?: {};
|
|
577
|
+
headers: any;
|
|
578
|
+
}) => any;
|
|
579
|
+
create: ({ token, jwtToken, externalWallet, headers }: {
|
|
574
580
|
token: any;
|
|
575
581
|
jwtToken: any;
|
|
576
582
|
externalWallet: any;
|
|
583
|
+
headers: any;
|
|
577
584
|
}) => any;
|
|
578
|
-
get: ({ token, jwtToken, walletId }: {
|
|
585
|
+
get: ({ token, jwtToken, walletId, headers }: {
|
|
579
586
|
token: any;
|
|
580
587
|
jwtToken: any;
|
|
581
588
|
walletId: any;
|
|
589
|
+
headers: any;
|
|
582
590
|
}) => any;
|
|
583
|
-
update: ({ token, jwtToken, externalWallet }: {
|
|
591
|
+
update: ({ token, jwtToken, externalWallet, headers }: {
|
|
584
592
|
token: any;
|
|
585
593
|
jwtToken: any;
|
|
586
594
|
externalWallet: any;
|
|
595
|
+
headers: any;
|
|
587
596
|
}) => any;
|
|
588
597
|
};
|
|
589
598
|
};
|
|
@@ -4182,6 +4191,15 @@ declare const _exports: {
|
|
|
4182
4191
|
headers: any;
|
|
4183
4192
|
}): any;
|
|
4184
4193
|
};
|
|
4194
|
+
vouchers: {
|
|
4195
|
+
create({ token, jwtToken, query, data, headers }: {
|
|
4196
|
+
token: any;
|
|
4197
|
+
jwtToken: any;
|
|
4198
|
+
query: any;
|
|
4199
|
+
data: any;
|
|
4200
|
+
headers: any;
|
|
4201
|
+
}): any;
|
|
4202
|
+
};
|
|
4185
4203
|
};
|
|
4186
4204
|
ordersRulesValidations: {
|
|
4187
4205
|
create: ({ token, jwtToken, query, orderRulesValidation, headers }: {
|