@spritz-finance/service-client 0.3.5 → 0.3.7
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/exchangeRates/exchangeRatesServiceClient.d.ts +3 -0
- package/lib/exchangeRates/exchangeRatesServiceClient.js +40 -0
- package/lib/exchangeRates/types.d.ts +6 -0
- package/lib/exchangeRates/types.js +2 -0
- package/lib/growth/growthServiceClient.d.ts +2 -0
- package/lib/growth/growthServiceClient.js +35 -0
- package/lib/index.d.ts +21 -12
- package/lib/index.js +33 -12
- package/lib/liabilities/liabilitiesServiceClient.d.ts +14 -0
- package/lib/liabilities/liabilitiesServiceClient.js +92 -0
- package/lib/{liabilitiesServiceClient.d.ts → liabilities/types.d.ts} +3 -84
- package/lib/liabilities/types.js +23 -0
- package/lib/lib/graphClient/generated.d.ts +138 -58
- package/lib/lib/graphClient/generated.js +3 -0
- package/lib/onramp/onrampServiceClient.d.ts +5 -0
- package/lib/onramp/onrampServiceClient.js +41 -0
- package/lib/{onrampServiceClient.d.ts → onramp/types.d.ts} +1 -8
- package/lib/onramp/types.js +2 -0
- package/lib/payableAccounts/payableAccountsServiceClient.d.ts +80 -0
- package/lib/payableAccounts/payableAccountsServiceClient.js +65 -0
- package/lib/{payableAccountsServiceClient.d.ts → payableAccounts/types.d.ts} +2 -13
- package/lib/payableAccounts/types.js +12 -0
- package/lib/payments/paymentsClient.d.ts +13 -0
- package/lib/payments/paymentsClient.js +92 -0
- package/lib/payments/types.d.ts +54 -0
- package/lib/payments/types.js +12 -0
- package/lib/serviceClient.d.ts +1 -0
- package/lib/serviceClient.js +5 -1
- package/lib/transactions/transactionsServiceClient.d.ts +7 -0
- package/lib/transactions/transactionsServiceClient.js +67 -0
- package/lib/{transactionsServiceClient.d.ts → transactions/types.d.ts} +3 -14
- package/lib/transactions/types.js +17 -0
- package/lib/{unblockServiceClient.d.ts → unblock/types.d.ts} +1 -15
- package/lib/unblock/types.js +14 -0
- package/lib/unblock/unblockServiceClient.d.ts +11 -0
- package/lib/unblock/unblockServiceClient.js +65 -0
- package/lib/users/types.d.ts +23 -0
- package/lib/users/types.js +2 -0
- package/lib/users/usersServiceClient.d.ts +8 -0
- package/lib/users/usersServiceClient.js +69 -0
- package/lib/{verificationServiceClient.d.ts → verification/types.d.ts} +0 -11
- package/lib/verification/types.js +2 -0
- package/lib/verification/verificationServiceClient.d.ts +5 -0
- package/lib/verification/verificationServiceClient.js +41 -0
- package/lib/web3/types.d.ts +13 -0
- package/lib/web3/types.js +2 -0
- package/lib/web3/web3ServiceClient.d.ts +3 -0
- package/lib/web3/web3ServiceClient.js +35 -0
- package/package.json +1 -1
- package/lib/exchangeRatesServiceClient.d.ts +0 -12
- package/lib/exchangeRatesServiceClient.js +0 -23
- package/lib/growthServiceClient.d.ts +0 -6
- package/lib/growthServiceClient.js +0 -18
- package/lib/liabilitiesServiceClient.js +0 -153
- package/lib/onrampServiceClient.js +0 -23
- package/lib/payableAccountsServiceClient.js +0 -52
- package/lib/transactionsServiceClient.js +0 -60
- package/lib/unblockServiceClient.js +0 -54
- package/lib/usersServiceClient.d.ts +0 -34
- package/lib/usersServiceClient.js +0 -45
- package/lib/verificationServiceClient.js +0 -19
- package/lib/verificationServiceClient.test.d.ts +0 -1
- package/lib/verificationServiceClient.test.js +0 -10
- package/lib/web3ServiceClient.d.ts +0 -20
- package/lib/web3ServiceClient.js +0 -18
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -6,6 +6,7 @@ const config_1 = require("@spritz-finance/config");
|
|
|
6
6
|
const envConfigs = {
|
|
7
7
|
base: {
|
|
8
8
|
env: (_b = (_a = process.env.STAGE) !== null && _a !== void 0 ? _a : process.env.NODE_ENV) !== null && _b !== void 0 ? _b : 'dev',
|
|
9
|
+
baseEndpoint: 'https://api-dev.spritz.finance',
|
|
9
10
|
authEndpoint: 'https://auth-dev.spritz.finance/oauth2/token',
|
|
10
11
|
graphEndpoint: 'https://api-dev.spritz.finance/graphql',
|
|
11
12
|
verificationServiceEndpoint: 'https://api-dev.spritz.finance/verification',
|
|
@@ -22,6 +23,7 @@ const envConfigs = {
|
|
|
22
23
|
test: {
|
|
23
24
|
env: 'staging',
|
|
24
25
|
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
26
|
+
baseEndpoint: 'https://api-staging.spritz.finance',
|
|
25
27
|
graphEndpoint: 'https://api-staging.spritz.finance/router/graph',
|
|
26
28
|
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
27
29
|
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
@@ -34,6 +36,7 @@ const envConfigs = {
|
|
|
34
36
|
onrampServiceEndpoint: 'https://api-staging.spritz.finance/bridge',
|
|
35
37
|
},
|
|
36
38
|
staging: {
|
|
39
|
+
baseEndpoint: 'https://api-staging.spritz.finance',
|
|
37
40
|
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
38
41
|
graphEndpoint: 'https://api-staging.spritz.finance/router/graph',
|
|
39
42
|
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
@@ -48,6 +51,7 @@ const envConfigs = {
|
|
|
48
51
|
onrampServiceEndpoint: 'https://api-staging.spritz.finance/bridge',
|
|
49
52
|
},
|
|
50
53
|
production: {
|
|
54
|
+
baseEndpoint: 'https://api.spritz.finance',
|
|
51
55
|
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
52
56
|
graphEndpoint: 'https://api.spritz.finance/router/graph',
|
|
53
57
|
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getLatestRate = exports.ExchangeRatesClient = void 0;
|
|
27
|
+
exports.ExchangeRatesClient = __importStar(require("./exchangeRatesServiceClient"));
|
|
28
|
+
const serviceClient_1 = require("../serviceClient");
|
|
29
|
+
const EXCHANGE_RATE_ENDPOINT = '/exchange-rates';
|
|
30
|
+
async function getLatestRate(target, base = 'USD') {
|
|
31
|
+
return serviceClient_1.baseClient
|
|
32
|
+
.get(`${EXCHANGE_RATE_ENDPOINT}/latest`, {
|
|
33
|
+
params: {
|
|
34
|
+
target,
|
|
35
|
+
base,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
.then((res) => res.data);
|
|
39
|
+
}
|
|
40
|
+
exports.getLatestRate = getLatestRate;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getUserReferrer = exports.GrowthClient = void 0;
|
|
27
|
+
exports.GrowthClient = __importStar(require("./growthServiceClient"));
|
|
28
|
+
const serviceClient_1 = require("../serviceClient");
|
|
29
|
+
const GROWTH_ENDPOINT = '/growth';
|
|
30
|
+
async function getUserReferrer(userId) {
|
|
31
|
+
return serviceClient_1.baseClient
|
|
32
|
+
.get(`${GROWTH_ENDPOINT}/referrals/referrer/${userId}`)
|
|
33
|
+
.then((res) => res.data);
|
|
34
|
+
}
|
|
35
|
+
exports.getUserReferrer = getUserReferrer;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
export * from './graphClient';
|
|
2
|
-
export
|
|
3
|
-
export * from './
|
|
4
|
-
export
|
|
5
|
-
export * from './
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
10
|
-
export * from './
|
|
11
|
-
export
|
|
12
|
-
export * from './
|
|
13
|
-
export
|
|
2
|
+
export { VerificationClient } from './verification/verificationServiceClient';
|
|
3
|
+
export * from './verification/types';
|
|
4
|
+
export { UsersClient } from './users/usersServiceClient';
|
|
5
|
+
export * from './users/types';
|
|
6
|
+
export { GrowthClient } from './growth/growthServiceClient';
|
|
7
|
+
export { PayableAccountsClient } from './payableAccounts/payableAccountsServiceClient';
|
|
8
|
+
export * from './payableAccounts/types';
|
|
9
|
+
export { PaymentsClient } from './payments/paymentsClient';
|
|
10
|
+
export * from './payments/types';
|
|
11
|
+
export { ExchangeRatesClient } from './exchangeRates/exchangeRatesServiceClient';
|
|
12
|
+
export * from './exchangeRates/types';
|
|
13
|
+
export { Web3Client } from './web3/web3ServiceClient';
|
|
14
|
+
export * from './web3/types';
|
|
15
|
+
export { TransactionsClient } from './transactions/transactionsServiceClient';
|
|
16
|
+
export * from './transactions/types';
|
|
17
|
+
export { OnrampClient } from './onramp/onrampServiceClient';
|
|
18
|
+
export * from './onramp/types';
|
|
19
|
+
export { UnblockClient } from './unblock/unblockServiceClient';
|
|
20
|
+
export * from './unblock/types';
|
|
21
|
+
export { LiabilitiesClient } from './liabilities/liabilitiesServiceClient';
|
|
22
|
+
export * from './liabilities/types';
|
package/lib/index.js
CHANGED
|
@@ -14,16 +14,37 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.LiabilitiesClient = exports.UnblockClient = exports.OnrampClient = exports.TransactionsClient = exports.Web3Client = exports.ExchangeRatesClient = exports.PaymentsClient = exports.PayableAccountsClient = exports.GrowthClient = exports.UsersClient = exports.VerificationClient = void 0;
|
|
17
18
|
__exportStar(require("./graphClient"), exports);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
__exportStar(require("./
|
|
29
|
-
|
|
19
|
+
var verificationServiceClient_1 = require("./verification/verificationServiceClient");
|
|
20
|
+
Object.defineProperty(exports, "VerificationClient", { enumerable: true, get: function () { return verificationServiceClient_1.VerificationClient; } });
|
|
21
|
+
__exportStar(require("./verification/types"), exports);
|
|
22
|
+
var usersServiceClient_1 = require("./users/usersServiceClient");
|
|
23
|
+
Object.defineProperty(exports, "UsersClient", { enumerable: true, get: function () { return usersServiceClient_1.UsersClient; } });
|
|
24
|
+
__exportStar(require("./users/types"), exports);
|
|
25
|
+
var growthServiceClient_1 = require("./growth/growthServiceClient");
|
|
26
|
+
Object.defineProperty(exports, "GrowthClient", { enumerable: true, get: function () { return growthServiceClient_1.GrowthClient; } });
|
|
27
|
+
var payableAccountsServiceClient_1 = require("./payableAccounts/payableAccountsServiceClient");
|
|
28
|
+
Object.defineProperty(exports, "PayableAccountsClient", { enumerable: true, get: function () { return payableAccountsServiceClient_1.PayableAccountsClient; } });
|
|
29
|
+
__exportStar(require("./payableAccounts/types"), exports);
|
|
30
|
+
var paymentsClient_1 = require("./payments/paymentsClient");
|
|
31
|
+
Object.defineProperty(exports, "PaymentsClient", { enumerable: true, get: function () { return paymentsClient_1.PaymentsClient; } });
|
|
32
|
+
__exportStar(require("./payments/types"), exports);
|
|
33
|
+
var exchangeRatesServiceClient_1 = require("./exchangeRates/exchangeRatesServiceClient");
|
|
34
|
+
Object.defineProperty(exports, "ExchangeRatesClient", { enumerable: true, get: function () { return exchangeRatesServiceClient_1.ExchangeRatesClient; } });
|
|
35
|
+
__exportStar(require("./exchangeRates/types"), exports);
|
|
36
|
+
var web3ServiceClient_1 = require("./web3/web3ServiceClient");
|
|
37
|
+
Object.defineProperty(exports, "Web3Client", { enumerable: true, get: function () { return web3ServiceClient_1.Web3Client; } });
|
|
38
|
+
__exportStar(require("./web3/types"), exports);
|
|
39
|
+
var transactionsServiceClient_1 = require("./transactions/transactionsServiceClient");
|
|
40
|
+
Object.defineProperty(exports, "TransactionsClient", { enumerable: true, get: function () { return transactionsServiceClient_1.TransactionsClient; } });
|
|
41
|
+
__exportStar(require("./transactions/types"), exports);
|
|
42
|
+
var onrampServiceClient_1 = require("./onramp/onrampServiceClient");
|
|
43
|
+
Object.defineProperty(exports, "OnrampClient", { enumerable: true, get: function () { return onrampServiceClient_1.OnrampClient; } });
|
|
44
|
+
__exportStar(require("./onramp/types"), exports);
|
|
45
|
+
var unblockServiceClient_1 = require("./unblock/unblockServiceClient");
|
|
46
|
+
Object.defineProperty(exports, "UnblockClient", { enumerable: true, get: function () { return unblockServiceClient_1.UnblockClient; } });
|
|
47
|
+
__exportStar(require("./unblock/types"), exports);
|
|
48
|
+
var liabilitiesServiceClient_1 = require("./liabilities/liabilitiesServiceClient");
|
|
49
|
+
Object.defineProperty(exports, "LiabilitiesClient", { enumerable: true, get: function () { return liabilitiesServiceClient_1.LiabilitiesClient; } });
|
|
50
|
+
__exportStar(require("./liabilities/types"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * as LiabilitiesClient from './liabilitiesServiceClient';
|
|
2
|
+
import { CheckbookUser } from '../lib/graphClient/generated';
|
|
3
|
+
import { ExternalBillInput } from '../payableAccounts/types';
|
|
4
|
+
import { CardTransaction, CheckbookCardResponse, CheckbookDebitCardResponse, CreateCheckbookUserParams, CreateDebitCardInput, CreateEntityParams, MethodFiEntity, RewardTransaction } from './types';
|
|
5
|
+
export declare function getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
|
|
6
|
+
export declare function createMethodFiEntity(args: CreateEntityParams): Promise<MethodFiEntity>;
|
|
7
|
+
export declare function getMethodFiEntity(userId: string): Promise<MethodFiEntity>;
|
|
8
|
+
export declare function createCheckbookUser(args: CreateCheckbookUserParams): Promise<CheckbookUser>;
|
|
9
|
+
export declare function getCheckbookUser(userId: string): Promise<CheckbookUser>;
|
|
10
|
+
export declare function createCheckbookVirtualCard(userId: string): Promise<CheckbookCardResponse>;
|
|
11
|
+
export declare function createCheckbookDebitCard(input: CreateDebitCardInput): Promise<CheckbookDebitCardResponse>;
|
|
12
|
+
export declare function createUSBillFromAccountNumber(userId: string, accountNumber: string, merchantId: string): Promise<ExternalBillInput>;
|
|
13
|
+
export declare function getVirtualCardBalance(cardExternalId: string, userId: string): Promise<number>;
|
|
14
|
+
export declare function getVirtualCardTransactions(cardExternalId: string, userId: string): Promise<CardTransaction[]>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getVirtualCardTransactions = exports.getVirtualCardBalance = exports.createUSBillFromAccountNumber = exports.createCheckbookDebitCard = exports.createCheckbookVirtualCard = exports.getCheckbookUser = exports.createCheckbookUser = exports.getMethodFiEntity = exports.createMethodFiEntity = exports.getRewardTransaction = exports.LiabilitiesClient = void 0;
|
|
27
|
+
exports.LiabilitiesClient = __importStar(require("./liabilitiesServiceClient"));
|
|
28
|
+
const serviceClient_1 = require("../serviceClient");
|
|
29
|
+
const LIABILITIES_ENDPOINT = '/liabilities';
|
|
30
|
+
async function getRewardTransaction(transactionId) {
|
|
31
|
+
return serviceClient_1.baseClient
|
|
32
|
+
.get(`${LIABILITIES_ENDPOINT}/reward-transactions/${transactionId}`)
|
|
33
|
+
.then((res) => res.data);
|
|
34
|
+
}
|
|
35
|
+
exports.getRewardTransaction = getRewardTransaction;
|
|
36
|
+
async function createMethodFiEntity(args) {
|
|
37
|
+
return serviceClient_1.baseClient
|
|
38
|
+
.post(`${LIABILITIES_ENDPOINT}/methodFi/entity2`, args)
|
|
39
|
+
.then((res) => res.data);
|
|
40
|
+
}
|
|
41
|
+
exports.createMethodFiEntity = createMethodFiEntity;
|
|
42
|
+
async function getMethodFiEntity(userId) {
|
|
43
|
+
return serviceClient_1.baseClient
|
|
44
|
+
.get(`${LIABILITIES_ENDPOINT}/methodFi/entity/user/${userId}`)
|
|
45
|
+
.then((res) => res.data);
|
|
46
|
+
}
|
|
47
|
+
exports.getMethodFiEntity = getMethodFiEntity;
|
|
48
|
+
async function createCheckbookUser(args) {
|
|
49
|
+
return serviceClient_1.baseClient
|
|
50
|
+
.post(`${LIABILITIES_ENDPOINT}/checkbook/user`, args)
|
|
51
|
+
.then((res) => res.data);
|
|
52
|
+
}
|
|
53
|
+
exports.createCheckbookUser = createCheckbookUser;
|
|
54
|
+
async function getCheckbookUser(userId) {
|
|
55
|
+
return serviceClient_1.baseClient
|
|
56
|
+
.get(`${LIABILITIES_ENDPOINT}/checkbook/user/${userId}`)
|
|
57
|
+
.then((res) => res.data);
|
|
58
|
+
}
|
|
59
|
+
exports.getCheckbookUser = getCheckbookUser;
|
|
60
|
+
async function createCheckbookVirtualCard(userId) {
|
|
61
|
+
return serviceClient_1.baseClient
|
|
62
|
+
.post(`${LIABILITIES_ENDPOINT}/virtual-card/create/${userId}`)
|
|
63
|
+
.then((res) => res.data);
|
|
64
|
+
}
|
|
65
|
+
exports.createCheckbookVirtualCard = createCheckbookVirtualCard;
|
|
66
|
+
async function createCheckbookDebitCard(input) {
|
|
67
|
+
return serviceClient_1.baseClient
|
|
68
|
+
.post(`${LIABILITIES_ENDPOINT}/debit-card/create`, input)
|
|
69
|
+
.then((res) => res.data);
|
|
70
|
+
}
|
|
71
|
+
exports.createCheckbookDebitCard = createCheckbookDebitCard;
|
|
72
|
+
async function createUSBillFromAccountNumber(userId, accountNumber, merchantId) {
|
|
73
|
+
return serviceClient_1.baseClient
|
|
74
|
+
.post(`${LIABILITIES_ENDPOINT}/methodFi/bill/user/${userId}`, {
|
|
75
|
+
accountNumber,
|
|
76
|
+
merchantId,
|
|
77
|
+
})
|
|
78
|
+
.then((res) => res.data);
|
|
79
|
+
}
|
|
80
|
+
exports.createUSBillFromAccountNumber = createUSBillFromAccountNumber;
|
|
81
|
+
async function getVirtualCardBalance(cardExternalId, userId) {
|
|
82
|
+
return serviceClient_1.baseClient
|
|
83
|
+
.get(`${LIABILITIES_ENDPOINT}/virtual-card/card/${cardExternalId}/balance?userId=${userId}`)
|
|
84
|
+
.then((res) => res.data);
|
|
85
|
+
}
|
|
86
|
+
exports.getVirtualCardBalance = getVirtualCardBalance;
|
|
87
|
+
async function getVirtualCardTransactions(cardExternalId, userId) {
|
|
88
|
+
return serviceClient_1.baseClient
|
|
89
|
+
.get(`${LIABILITIES_ENDPOINT}/virtual-card/card/${cardExternalId}/transactions?userId=${userId}`)
|
|
90
|
+
.then((res) => res.data);
|
|
91
|
+
}
|
|
92
|
+
exports.getVirtualCardTransactions = getVirtualCardTransactions;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { AccountProvider, CheckbookUser, CreateDirectPaymentInput, DirectPayment, PaymentStatus } from './lib/graphClient/generated';
|
|
3
|
-
import { ExternalBillInput } from './payableAccountsServiceClient';
|
|
4
1
|
export declare enum RewardProvider {
|
|
5
2
|
INTERNAL = "INTERNAL",
|
|
6
3
|
REFERRAL_ROCK = "REFERRAL_ROCK",
|
|
@@ -18,22 +15,6 @@ export declare enum RewardCreditSource {
|
|
|
18
15
|
OTHER = "OTHER",
|
|
19
16
|
REVENUE_SHARE = "REVENUE_SHARE"
|
|
20
17
|
}
|
|
21
|
-
export type Payment = {
|
|
22
|
-
_id: string;
|
|
23
|
-
accountId: string;
|
|
24
|
-
amount: number;
|
|
25
|
-
createdAt: string;
|
|
26
|
-
directPaymentId: string;
|
|
27
|
-
feeAmount: number;
|
|
28
|
-
id: string;
|
|
29
|
-
paymentProvider: string;
|
|
30
|
-
rewardsAmount: number;
|
|
31
|
-
status: string;
|
|
32
|
-
subscriptionId: string | null;
|
|
33
|
-
type: string;
|
|
34
|
-
updatedAt: string;
|
|
35
|
-
userId: string;
|
|
36
|
-
};
|
|
37
18
|
export type CheckbookCardResponse = {
|
|
38
19
|
userId: string;
|
|
39
20
|
externalId: string;
|
|
@@ -132,10 +113,10 @@ interface IEntity {
|
|
|
132
113
|
created_at: string;
|
|
133
114
|
updated_at: string;
|
|
134
115
|
}
|
|
135
|
-
interface MethodFiEntity extends IEntity {
|
|
116
|
+
export interface MethodFiEntity extends IEntity {
|
|
136
117
|
userId: string;
|
|
137
118
|
}
|
|
138
|
-
interface IEntityCreateOpts {
|
|
119
|
+
export interface IEntityCreateOpts {
|
|
139
120
|
type: TEntityTypes;
|
|
140
121
|
address?: IEntityAddress | null;
|
|
141
122
|
metadata?: any;
|
|
@@ -158,7 +139,7 @@ export interface ICorporationCreateOpts extends IEntityCreateOpts {
|
|
|
158
139
|
type: 'c_corporation' | 's_corporation' | 'llc' | 'partnership' | 'sole_proprietorship';
|
|
159
140
|
corporation: Partial<IEntityCorporation>;
|
|
160
141
|
}
|
|
161
|
-
type CardTransaction = {
|
|
142
|
+
export type CardTransaction = {
|
|
162
143
|
amount: number;
|
|
163
144
|
timestamp: Date;
|
|
164
145
|
description: string;
|
|
@@ -182,43 +163,6 @@ export type CreateCheckbookUserParams = {
|
|
|
182
163
|
countryCode?: string;
|
|
183
164
|
};
|
|
184
165
|
};
|
|
185
|
-
export declare enum PaymentSource {
|
|
186
|
-
Web = "Web",
|
|
187
|
-
Mobile = "Mobile",
|
|
188
|
-
Integrator = "Integrator",
|
|
189
|
-
PaymentAddress = "PaymentAddress",
|
|
190
|
-
Subscription = "Subscription",
|
|
191
|
-
External = "Subscription"
|
|
192
|
-
}
|
|
193
|
-
type GetUsersTransactionVolumeBody = {
|
|
194
|
-
userIds: string[];
|
|
195
|
-
monthsBack?: number;
|
|
196
|
-
paymentDateThreshold?: string;
|
|
197
|
-
};
|
|
198
|
-
type GetUserRewardFeeAmountBody = {
|
|
199
|
-
userId: string;
|
|
200
|
-
monthsBack?: number;
|
|
201
|
-
excludeDaysSinceUserCreated?: number;
|
|
202
|
-
paymentDateThreshold?: string;
|
|
203
|
-
};
|
|
204
|
-
export interface CreateDirectPaymentArgs extends CreateDirectPaymentInput {
|
|
205
|
-
userId: string;
|
|
206
|
-
noFees?: boolean;
|
|
207
|
-
source?: PaymentSource;
|
|
208
|
-
}
|
|
209
|
-
export type ExternalPaymentInput = {
|
|
210
|
-
externalPaymentId: string;
|
|
211
|
-
userId: string;
|
|
212
|
-
paymentAmountUSD: number;
|
|
213
|
-
feeAmountUSD: number;
|
|
214
|
-
accountId: string;
|
|
215
|
-
paymentProvider: AccountProvider;
|
|
216
|
-
paymentCurrency: string;
|
|
217
|
-
targetCurrency: string;
|
|
218
|
-
targetCurrencyRate: number;
|
|
219
|
-
targetCurrencyFee: number;
|
|
220
|
-
targetCurrencyAmount: number;
|
|
221
|
-
};
|
|
222
166
|
export type CreateDebitCardInput = {
|
|
223
167
|
userId: string;
|
|
224
168
|
cardNumber: string;
|
|
@@ -231,29 +175,4 @@ export type CheckbookDebitCardResponse = {
|
|
|
231
175
|
cardNumber: string;
|
|
232
176
|
expirationDate: string;
|
|
233
177
|
};
|
|
234
|
-
export declare class LiabilitiesServiceClient {
|
|
235
|
-
client: AxiosInstance;
|
|
236
|
-
constructor();
|
|
237
|
-
getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
|
|
238
|
-
createMethodFiEntity(args: CreateEntityParams): Promise<MethodFiEntity>;
|
|
239
|
-
getMethodFiEntity(userId: string): Promise<MethodFiEntity>;
|
|
240
|
-
createCheckbookUser(args: CreateCheckbookUserParams): Promise<CheckbookUser>;
|
|
241
|
-
getCheckbookUser(userId: string): Promise<CheckbookUser>;
|
|
242
|
-
createCheckbookVirtualCard(userId: string): Promise<CheckbookCardResponse>;
|
|
243
|
-
createCheckbookDebitCard(input: CreateDebitCardInput): Promise<CheckbookDebitCardResponse>;
|
|
244
|
-
createUSBillFromAccountNumber(userId: string, accountNumber: string, merchantId: string): Promise<ExternalBillInput>;
|
|
245
|
-
getVirtualCardBalance(cardExternalId: string, userId: string): Promise<number>;
|
|
246
|
-
getVirtualCardTransactions(cardExternalId: string, userId: string): Promise<CardTransaction[]>;
|
|
247
|
-
canUserMakeTestPayment(userId: string): Promise<boolean>;
|
|
248
|
-
createDirectPayment(args: CreateDirectPaymentArgs): Promise<DirectPayment>;
|
|
249
|
-
validateDirectPayment(args: CreateDirectPaymentArgs): Promise<DirectPayment>;
|
|
250
|
-
getValidPaymentsForAccount(accountId: string): Promise<Payment[]>;
|
|
251
|
-
getValidPaymentsForUser(userId: string): Promise<Payment[]>;
|
|
252
|
-
getRewardTransactionVolume(args: GetUsersTransactionVolumeBody): Promise<number>;
|
|
253
|
-
getRewardFeeAmount(args: GetUserRewardFeeAmountBody): Promise<number>;
|
|
254
|
-
initializeExternalPayment(args: ExternalPaymentInput): Promise<Payment>;
|
|
255
|
-
scheduleExternalPayment(args: ExternalPaymentInput): Promise<Payment>;
|
|
256
|
-
updateExternalPaymentStatus(paymentId: string, status: PaymentStatus): Promise<Payment>;
|
|
257
|
-
getDirectPaymentToken(directPaymentId: string): Promise<string | null>;
|
|
258
|
-
}
|
|
259
178
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RewardCreditSource = exports.RewardTransactionType = exports.RewardProvider = void 0;
|
|
4
|
+
var RewardProvider;
|
|
5
|
+
(function (RewardProvider) {
|
|
6
|
+
RewardProvider["INTERNAL"] = "INTERNAL";
|
|
7
|
+
RewardProvider["REFERRAL_ROCK"] = "REFERRAL_ROCK";
|
|
8
|
+
RewardProvider["GROWSURF"] = "GROWSURF";
|
|
9
|
+
})(RewardProvider || (exports.RewardProvider = RewardProvider = {}));
|
|
10
|
+
var RewardTransactionType;
|
|
11
|
+
(function (RewardTransactionType) {
|
|
12
|
+
RewardTransactionType["CREDIT"] = "CREDIT";
|
|
13
|
+
RewardTransactionType["DEBIT"] = "DEBIT";
|
|
14
|
+
})(RewardTransactionType || (exports.RewardTransactionType = RewardTransactionType = {}));
|
|
15
|
+
var RewardCreditSource;
|
|
16
|
+
(function (RewardCreditSource) {
|
|
17
|
+
RewardCreditSource["REFERRER_REWARD"] = "REFERRER_REWARD";
|
|
18
|
+
RewardCreditSource["REFERRAL_REWARD"] = "REFERRAL_REWARD";
|
|
19
|
+
RewardCreditSource["CONTEST"] = "CONTEST";
|
|
20
|
+
RewardCreditSource["REFUND"] = "REFUND";
|
|
21
|
+
RewardCreditSource["OTHER"] = "OTHER";
|
|
22
|
+
RewardCreditSource["REVENUE_SHARE"] = "REVENUE_SHARE";
|
|
23
|
+
})(RewardCreditSource || (exports.RewardCreditSource = RewardCreditSource = {}));
|