wallaby-cash 1.2.0 → 1.3.2
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/README.md +42 -39
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/auth/index.d.ts +4 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/merchants/index.d.ts +59 -0
- package/dist/routes/merchants.d.ts +50 -0
- package/dist/tests/data/index.d.ts +1 -0
- package/dist/tests/data/merchants.d.ts +8 -0
- package/dist/types/common.d.ts +2 -4
- package/dist/types/merchants.d.ts +4 -0
- package/package.json +2 -2
- package/src/lib/auth/index.ts +4 -4
- package/src/lib/index.ts +1 -0
- package/src/lib/merchants/index.ts +166 -0
- package/src/routes/merchants.ts +39 -0
- package/src/tests/data/index.ts +1 -0
- package/src/tests/data/merchants.ts +8 -0
- package/src/tests/merchants.spec.ts +72 -0
- package/src/tests/system.spec.ts +0 -2
- package/src/types/common.ts +2 -4
- package/src/types/merchants.ts +5 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Merchants } from '../lib';
|
|
2
|
+
import { config, merchantAsset } from './data';
|
|
3
|
+
|
|
4
|
+
describe.skip('Merchants', () => {
|
|
5
|
+
let merchants: Merchants;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
merchants = new Merchants(config);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should create a merchant', () => {
|
|
12
|
+
const merchantData = {
|
|
13
|
+
name: 'Test Merchant',
|
|
14
|
+
email: 'test@example.com',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const createdMerchant = merchants.create(merchantData);
|
|
18
|
+
|
|
19
|
+
expect(createdMerchant).toEqual(expect.objectContaining(merchantData));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should update a merchant', () => {
|
|
23
|
+
const merchantId = '123';
|
|
24
|
+
const updatedMerchantData = {
|
|
25
|
+
name: 'Updated Merchant',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const updatedMerchant = merchants.update({ merchantId, name: updatedMerchantData.name });
|
|
29
|
+
|
|
30
|
+
expect(updatedMerchant).toEqual(expect.objectContaining(updatedMerchantData));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should get merchant data', () => {
|
|
34
|
+
const merchantId = '123';
|
|
35
|
+
|
|
36
|
+
const merchantData = merchants.getMerchantData({ merchantId });
|
|
37
|
+
|
|
38
|
+
expect(merchantData).toEqual(expect.objectContaining({ merchantId }));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should list all merchants', () => {
|
|
42
|
+
const merchantList = merchants.list();
|
|
43
|
+
|
|
44
|
+
expect(merchantList).toBeInstanceOf(Array);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should get merchant assets', () => {
|
|
48
|
+
const merchantId = '123';
|
|
49
|
+
|
|
50
|
+
const assets = merchants.getAssets({ merchantId });
|
|
51
|
+
|
|
52
|
+
expect(assets).toBeInstanceOf(Array);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should add an asset to a merchant', () => {
|
|
56
|
+
const merchantId = '123';
|
|
57
|
+
const configId = '456';
|
|
58
|
+
|
|
59
|
+
const addedAsset = merchants.addAsset({ merchantId, configId });
|
|
60
|
+
|
|
61
|
+
expect(addedAsset).toEqual(expect.objectContaining(merchantAsset));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should delete an asset from a merchant', () => {
|
|
65
|
+
const merchantId = '123';
|
|
66
|
+
const configId = '456';
|
|
67
|
+
|
|
68
|
+
const deletedAsset = merchants.deleteAsset({ merchantId, configId });
|
|
69
|
+
|
|
70
|
+
expect(deletedAsset).toEqual(expect.objectContaining({ configId }));
|
|
71
|
+
});
|
|
72
|
+
});
|
package/src/tests/system.spec.ts
CHANGED
|
@@ -25,7 +25,6 @@ describe('System Functions', () => {
|
|
|
25
25
|
mockAxiosSpy.mockImplementation(() => Promise.resolve({ data: mockUserData }));
|
|
26
26
|
const response = await wallaby.system.getUserData(testUser.id);
|
|
27
27
|
expect(response?.externalUserId).toBe(testUser.id);
|
|
28
|
-
expect(response?.firstName).toBe(testUser.firstName);
|
|
29
28
|
});
|
|
30
29
|
xit('Returns `User not found` error with wrong ID', async () => {
|
|
31
30
|
mockAxiosSpy.mockImplementation(() => Promise.reject({ message: 'User not found' }));
|
|
@@ -37,7 +36,6 @@ describe('System Functions', () => {
|
|
|
37
36
|
mockAxiosSpy.mockImplementation(() => Promise.resolve({ data: mockUserData }));
|
|
38
37
|
const response = await wallaby.system.getUserData(testUser.id);
|
|
39
38
|
expect(response?.externalUserId).toBe(testUser.id);
|
|
40
|
-
expect(response?.firstName).toBe(testUser.firstName);
|
|
41
39
|
});
|
|
42
40
|
xit('Returns `User not found` error with wrong ID', async () => {
|
|
43
41
|
mockAxiosSpy.mockImplementation(() => Promise.reject({ message: 'User not found' }));
|
package/src/types/common.ts
CHANGED
|
@@ -22,8 +22,6 @@ export declare type WallabyConfig = {
|
|
|
22
22
|
|
|
23
23
|
export declare type User = {
|
|
24
24
|
id: string;
|
|
25
|
-
firstName?: string;
|
|
26
|
-
lastName?: string;
|
|
27
25
|
externalUserId: string;
|
|
28
26
|
clientAuthPubKey: string;
|
|
29
27
|
wallabyAuthPubKey: string;
|
|
@@ -166,10 +164,10 @@ export enum BlockchainSlip44 {
|
|
|
166
164
|
}
|
|
167
165
|
|
|
168
166
|
export enum BlockchainName {
|
|
169
|
-
Bitcoin = 'BITCOIN',
|
|
170
|
-
Ethereum = 'ETHEREUM',
|
|
171
167
|
Algorand = 'ALGORAND',
|
|
172
168
|
Avalanche = 'AVALANCHE',
|
|
169
|
+
Bitcoin = 'BITCOIN',
|
|
170
|
+
Ethereum = 'ETHEREUM',
|
|
173
171
|
Polygon = 'POLYGON',
|
|
174
172
|
}
|
|
175
173
|
|
package/src/types/merchants.ts
CHANGED