@spritz-finance/service-client 0.2.3 → 0.2.5
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/liabilitiesServiceClient.d.ts +43 -0
- package/lib/liabilitiesServiceClient.js +38 -0
- package/lib/usersServiceClient.d.ts +1 -0
- package/lib/usersServiceClient.js +5 -0
- package/package.json +2 -2
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -11,6 +11,7 @@ const envConfigs = {
|
|
|
11
11
|
verificationServiceEndpoint: 'https://api-dev.spritz.finance/verification',
|
|
12
12
|
transactionsServiceEndpoint: 'https://api-dev.spritz.finance/transactions',
|
|
13
13
|
usersServiceEndpoint: 'https://api-dev.spritz.finance/users',
|
|
14
|
+
liabilitiesServiceEndpoint: 'https://api-dev.spritz.finance/liabilities',
|
|
14
15
|
},
|
|
15
16
|
test: {
|
|
16
17
|
env: 'staging',
|
|
@@ -19,6 +20,7 @@ const envConfigs = {
|
|
|
19
20
|
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
20
21
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
21
22
|
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
23
|
+
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
22
24
|
},
|
|
23
25
|
staging: {
|
|
24
26
|
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
@@ -26,6 +28,7 @@ const envConfigs = {
|
|
|
26
28
|
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
27
29
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
28
30
|
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
31
|
+
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
29
32
|
},
|
|
30
33
|
production: {
|
|
31
34
|
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
@@ -33,6 +36,7 @@ const envConfigs = {
|
|
|
33
36
|
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
34
37
|
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
35
38
|
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
39
|
+
liabilitiesServiceEndpoint: 'https://api.spritz.finance/liabilities',
|
|
36
40
|
},
|
|
37
41
|
};
|
|
38
42
|
exports.config = (0, config_1.setupEnvConfig)(envConfigs);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -16,3 +16,4 @@ __exportStar(require("./serviceClient"), exports);
|
|
|
16
16
|
__exportStar(require("./verificationServiceClient"), exports);
|
|
17
17
|
__exportStar(require("./transactionsServiceClient"), exports);
|
|
18
18
|
__exportStar(require("./usersServiceClient"), exports);
|
|
19
|
+
__exportStar(require("./liabilitiesServiceClient"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
export declare enum RewardProvider {
|
|
3
|
+
INTERNAL = "INTERNAL",
|
|
4
|
+
REFERRAL_ROCK = "REFERRAL_ROCK",
|
|
5
|
+
GROWSURF = "GROWSURF"
|
|
6
|
+
}
|
|
7
|
+
export declare enum RewardTransactionType {
|
|
8
|
+
CREDIT = "CREDIT",
|
|
9
|
+
DEBIT = "DEBIT"
|
|
10
|
+
}
|
|
11
|
+
export declare enum RewardCreditSource {
|
|
12
|
+
REFERRER_REWARD = "REFERRER_REWARD",
|
|
13
|
+
REFERRAL_REWARD = "REFERRAL_REWARD",
|
|
14
|
+
CONTEST = "CONTEST",
|
|
15
|
+
REFUND = "REFUND",
|
|
16
|
+
OTHER = "OTHER",
|
|
17
|
+
REVENUE_SHARE = "REVENUE_SHARE"
|
|
18
|
+
}
|
|
19
|
+
export interface RelatedCredit {
|
|
20
|
+
creditId: string;
|
|
21
|
+
amountSpent: number;
|
|
22
|
+
order: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RewardTransaction {
|
|
25
|
+
_id: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
remainingSpend: number;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
id: string;
|
|
30
|
+
nonce: number;
|
|
31
|
+
type: RewardTransactionType;
|
|
32
|
+
source?: RewardCreditSource;
|
|
33
|
+
provider?: RewardProvider;
|
|
34
|
+
relatedCredits?: RelatedCredit[];
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
userId: string;
|
|
37
|
+
context?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class LiabilitiesServiceClient {
|
|
40
|
+
client: AxiosInstance;
|
|
41
|
+
constructor();
|
|
42
|
+
getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LiabilitiesServiceClient = exports.RewardCreditSource = exports.RewardTransactionType = exports.RewardProvider = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const serviceClient_1 = require("./serviceClient");
|
|
6
|
+
var RewardProvider;
|
|
7
|
+
(function (RewardProvider) {
|
|
8
|
+
RewardProvider["INTERNAL"] = "INTERNAL";
|
|
9
|
+
RewardProvider["REFERRAL_ROCK"] = "REFERRAL_ROCK";
|
|
10
|
+
RewardProvider["GROWSURF"] = "GROWSURF";
|
|
11
|
+
})(RewardProvider = exports.RewardProvider || (exports.RewardProvider = {}));
|
|
12
|
+
var RewardTransactionType;
|
|
13
|
+
(function (RewardTransactionType) {
|
|
14
|
+
RewardTransactionType["CREDIT"] = "CREDIT";
|
|
15
|
+
RewardTransactionType["DEBIT"] = "DEBIT";
|
|
16
|
+
})(RewardTransactionType = exports.RewardTransactionType || (exports.RewardTransactionType = {}));
|
|
17
|
+
var RewardCreditSource;
|
|
18
|
+
(function (RewardCreditSource) {
|
|
19
|
+
RewardCreditSource["REFERRER_REWARD"] = "REFERRER_REWARD";
|
|
20
|
+
RewardCreditSource["REFERRAL_REWARD"] = "REFERRAL_REWARD";
|
|
21
|
+
RewardCreditSource["CONTEST"] = "CONTEST";
|
|
22
|
+
RewardCreditSource["REFUND"] = "REFUND";
|
|
23
|
+
RewardCreditSource["OTHER"] = "OTHER";
|
|
24
|
+
RewardCreditSource["REVENUE_SHARE"] = "REVENUE_SHARE";
|
|
25
|
+
})(RewardCreditSource = exports.RewardCreditSource || (exports.RewardCreditSource = {}));
|
|
26
|
+
class LiabilitiesServiceClient {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
29
|
+
baseURL: config_1.config.liabilitiesServiceEndpoint,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async getRewardTransaction(transactionId) {
|
|
33
|
+
return this.client
|
|
34
|
+
.get(`/reward-transactions/${transactionId}`)
|
|
35
|
+
.then((res) => res.data);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.LiabilitiesServiceClient = LiabilitiesServiceClient;
|
|
@@ -9,6 +9,11 @@ class UsersServiceClient {
|
|
|
9
9
|
baseURL: config_1.config.usersServiceEndpoint,
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
+
async getUserById(id) {
|
|
13
|
+
return this.client
|
|
14
|
+
.get(`/${id}`)
|
|
15
|
+
.then((res) => res.data);
|
|
16
|
+
}
|
|
12
17
|
async findOrInitialize(email) {
|
|
13
18
|
return this.client
|
|
14
19
|
.post(`/find-or-initialize`, {
|
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.5",
|
|
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": "330e67b72ff6f025b0ead7cab9680783dc27bc5a"
|
|
51
51
|
}
|