@spritz-finance/service-client 0.2.0 → 0.2.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/lib/config.d.ts +1 -0
- package/lib/config.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/transactionsServiceClient.d.ts +1 -1
- package/lib/transactionsServiceClient.js +2 -1
- package/lib/transactionsServiceClient.test.js +1 -1
- package/lib/usersServiceClient.d.ts +11 -0
- package/lib/usersServiceClient.js +20 -0
- package/package.json +2 -2
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -10,6 +10,7 @@ const envConfigs = {
|
|
|
10
10
|
graphEndpoint: 'https://api-dev.spritz.finance/graphql',
|
|
11
11
|
verificationServiceEndpoint: 'https://api-dev.spritz.finance/verification',
|
|
12
12
|
transactionsServiceEndpoint: 'https://api-dev.spritz.finance/transactions',
|
|
13
|
+
usersServiceEndpoint: 'https://api-dev.spritz.finance/users',
|
|
13
14
|
},
|
|
14
15
|
test: {
|
|
15
16
|
env: 'staging',
|
|
@@ -17,18 +18,21 @@ const envConfigs = {
|
|
|
17
18
|
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
18
19
|
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
19
20
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
21
|
+
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
20
22
|
},
|
|
21
23
|
staging: {
|
|
22
24
|
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
23
25
|
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
24
26
|
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
25
27
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
28
|
+
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
26
29
|
},
|
|
27
30
|
production: {
|
|
28
31
|
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
29
32
|
graphEndpoint: 'https://api.spritz.finance/graphql',
|
|
30
33
|
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
31
34
|
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
35
|
+
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
32
36
|
},
|
|
33
37
|
};
|
|
34
38
|
exports.config = (0, config_1.setupEnvConfig)(envConfigs);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -15,3 +15,4 @@ __exportStar(require("./credentials"), exports);
|
|
|
15
15
|
__exportStar(require("./serviceClient"), exports);
|
|
16
16
|
__exportStar(require("./verificationServiceClient"), exports);
|
|
17
17
|
__exportStar(require("./transactionsServiceClient"), exports);
|
|
18
|
+
__exportStar(require("./usersServiceClient"), exports);
|
|
@@ -10,6 +10,6 @@ interface UtxoInvoice {
|
|
|
10
10
|
export declare class TransactionsServiceClient {
|
|
11
11
|
client: AxiosInstance;
|
|
12
12
|
constructor();
|
|
13
|
-
createPaymentInvoice(network: string, amount: number): Promise<UtxoInvoice>;
|
|
13
|
+
createPaymentInvoice(network: string, amount: number, paymentReference: string): Promise<UtxoInvoice>;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -9,11 +9,12 @@ class TransactionsServiceClient {
|
|
|
9
9
|
baseURL: config_1.config.transactionsServiceEndpoint,
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
async createPaymentInvoice(network, amount) {
|
|
12
|
+
async createPaymentInvoice(network, amount, paymentReference) {
|
|
13
13
|
return this.client
|
|
14
14
|
.post(`/invoices`, {
|
|
15
15
|
network,
|
|
16
16
|
amount,
|
|
17
|
+
paymentReference,
|
|
17
18
|
})
|
|
18
19
|
.then((res) => res.data);
|
|
19
20
|
}
|
|
@@ -4,7 +4,7 @@ const transactionsServiceClient_1 = require("./transactionsServiceClient");
|
|
|
4
4
|
describe('TransactionsServiceClient', () => {
|
|
5
5
|
const client = new transactionsServiceClient_1.TransactionsServiceClient();
|
|
6
6
|
it('should work', async () => {
|
|
7
|
-
const data = await client.createPaymentInvoice('bitcoin-testnet', 100);
|
|
7
|
+
const data = await client.createPaymentInvoice('bitcoin-testnet', 100, '64283904a7ab475a6a2bc4b5');
|
|
8
8
|
console.log(data);
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsersServiceClient = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const serviceClient_1 = require("./serviceClient");
|
|
6
|
+
class UsersServiceClient {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
9
|
+
baseURL: config_1.config.usersServiceEndpoint,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async findOrInitialize(email) {
|
|
13
|
+
return this.client
|
|
14
|
+
.post(`/find-or-initialize`, {
|
|
15
|
+
email,
|
|
16
|
+
})
|
|
17
|
+
.then((res) => res.data);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.UsersServiceClient = UsersServiceClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spritz-finance/service-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Service client",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"coverageDirectory": "../coverage",
|
|
48
48
|
"testEnvironment": "node"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "db273605ccf80b57c595b1b6bcfa503d2d9db91c"
|
|
51
51
|
}
|