@spritz-finance/service-client 0.2.4 → 0.2.6
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/payableAccountsServiceClient.d.ts +47 -0
- package/lib/payableAccountsServiceClient.js +44 -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
|
@@ -12,6 +12,7 @@ const envConfigs = {
|
|
|
12
12
|
transactionsServiceEndpoint: 'https://api-dev.spritz.finance/transactions',
|
|
13
13
|
usersServiceEndpoint: 'https://api-dev.spritz.finance/users',
|
|
14
14
|
liabilitiesServiceEndpoint: 'https://api-dev.spritz.finance/liabilities',
|
|
15
|
+
payableAccountsServiceEndpoint: 'https://api-dev.spritz.finance/payable-accounts',
|
|
15
16
|
},
|
|
16
17
|
test: {
|
|
17
18
|
env: 'staging',
|
|
@@ -21,6 +22,7 @@ const envConfigs = {
|
|
|
21
22
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
22
23
|
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
23
24
|
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
25
|
+
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
24
26
|
},
|
|
25
27
|
staging: {
|
|
26
28
|
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
@@ -29,6 +31,7 @@ const envConfigs = {
|
|
|
29
31
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
30
32
|
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
31
33
|
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
34
|
+
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
32
35
|
},
|
|
33
36
|
production: {
|
|
34
37
|
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
@@ -37,6 +40,7 @@ const envConfigs = {
|
|
|
37
40
|
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
38
41
|
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
39
42
|
liabilitiesServiceEndpoint: 'https://api.spritz.finance/liabilities',
|
|
43
|
+
payableAccountsServiceEndpoint: 'https://api.spritz.finance/payable-accounts',
|
|
40
44
|
},
|
|
41
45
|
};
|
|
42
46
|
exports.config = (0, config_1.setupEnvConfig)(envConfigs);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -17,3 +17,4 @@ __exportStar(require("./verificationServiceClient"), exports);
|
|
|
17
17
|
__exportStar(require("./transactionsServiceClient"), exports);
|
|
18
18
|
__exportStar(require("./usersServiceClient"), exports);
|
|
19
19
|
__exportStar(require("./liabilitiesServiceClient"), exports);
|
|
20
|
+
__exportStar(require("./payableAccountsServiceClient"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
declare enum BankAccountSubType {
|
|
3
|
+
Business = "BUSINESS",
|
|
4
|
+
Checking = "CHECKING",
|
|
5
|
+
Savings = "SAVINGS"
|
|
6
|
+
}
|
|
7
|
+
export declare type CheckbookAccountInput = {
|
|
8
|
+
userId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
holder: string;
|
|
12
|
+
accountNumber: string;
|
|
13
|
+
routingNumber: string;
|
|
14
|
+
ownedByUser?: boolean;
|
|
15
|
+
type: BankAccountSubType;
|
|
16
|
+
};
|
|
17
|
+
interface PayableAccountBankAccount {
|
|
18
|
+
_id: string;
|
|
19
|
+
__t: string;
|
|
20
|
+
id: string;
|
|
21
|
+
institutionId: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
country: string;
|
|
24
|
+
currency: string;
|
|
25
|
+
name: string;
|
|
26
|
+
nickname: string;
|
|
27
|
+
originator: string;
|
|
28
|
+
accountNumber: string;
|
|
29
|
+
bankAccountType: string;
|
|
30
|
+
bankAccountSubType: string;
|
|
31
|
+
holder: string;
|
|
32
|
+
email: string;
|
|
33
|
+
ownedByUser: boolean;
|
|
34
|
+
bankAccountDetails: {
|
|
35
|
+
routingNumber: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare class PayableAccountsServiceClient {
|
|
39
|
+
client: AxiosInstance;
|
|
40
|
+
constructor();
|
|
41
|
+
getAccount(accountId: string): Promise<PayableAccountBankAccount>;
|
|
42
|
+
deleteAccount(accountId: string): Promise<boolean>;
|
|
43
|
+
renameAccount(accountId: string, name: String): Promise<PayableAccountBankAccount>;
|
|
44
|
+
getAccounts(accountIds: string[]): Promise<PayableAccountBankAccount[]>;
|
|
45
|
+
createFromCheckbook(input: CheckbookAccountInput): Promise<PayableAccountBankAccount>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayableAccountsServiceClient = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const serviceClient_1 = require("./serviceClient");
|
|
6
|
+
var BankAccountSubType;
|
|
7
|
+
(function (BankAccountSubType) {
|
|
8
|
+
BankAccountSubType["Business"] = "BUSINESS";
|
|
9
|
+
BankAccountSubType["Checking"] = "CHECKING";
|
|
10
|
+
BankAccountSubType["Savings"] = "SAVINGS";
|
|
11
|
+
})(BankAccountSubType || (BankAccountSubType = {}));
|
|
12
|
+
class PayableAccountsServiceClient {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
15
|
+
baseURL: config_1.config.payableAccountsServiceEndpoint,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async getAccount(accountId) {
|
|
19
|
+
return this.client
|
|
20
|
+
.get(`/payable-account/${accountId}`)
|
|
21
|
+
.then((res) => res.data);
|
|
22
|
+
}
|
|
23
|
+
async deleteAccount(accountId) {
|
|
24
|
+
return this.client
|
|
25
|
+
.delete(`/payable-account/${accountId}`)
|
|
26
|
+
.then((res) => res.data);
|
|
27
|
+
}
|
|
28
|
+
async renameAccount(accountId, name) {
|
|
29
|
+
return this.client
|
|
30
|
+
.put(`/payable-account/${accountId}`, { name })
|
|
31
|
+
.then((res) => res.data);
|
|
32
|
+
}
|
|
33
|
+
async getAccounts(accountIds) {
|
|
34
|
+
return this.client
|
|
35
|
+
.get(`/payable-accounts?accountIds=${accountIds.join(',')}`)
|
|
36
|
+
.then((res) => res.data);
|
|
37
|
+
}
|
|
38
|
+
async createFromCheckbook(input) {
|
|
39
|
+
return this.client
|
|
40
|
+
.post(`/create-from-checkbook`, input)
|
|
41
|
+
.then((res) => res.data);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.PayableAccountsServiceClient = PayableAccountsServiceClient;
|
|
@@ -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.6",
|
|
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": "448608507c448e5e15a3ba6dc267856d35889776"
|
|
51
51
|
}
|