@spritz-finance/service-client 0.11.0 → 0.13.0
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/payableAccounts/payableAccountsServiceClient.d.ts +4 -0
- package/lib/payableAccounts/types.d.ts +23 -1
- package/lib/payableAccounts/types.js +7 -1
- package/lib/platform/platformServiceClient.d.ts +8 -1
- package/lib/platform/platformServiceClient.js +13 -0
- package/lib/platform/types.d.ts +16 -0
- package/package.json +1 -1
|
@@ -32,6 +32,8 @@ export declare function getAccount(accountId: string): Promise<(Omit<import("../
|
|
|
32
32
|
payable: boolean;
|
|
33
33
|
testPaymentAvailable: boolean;
|
|
34
34
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
35
|
+
} & {
|
|
36
|
+
providerRegistrations?: import("./types").ProviderRegistration[];
|
|
35
37
|
}) | (Omit<import("../lib/graphClient/generated").OneTimePayment, "type" | "institution"> & {
|
|
36
38
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
37
39
|
externalId?: string | null;
|
|
@@ -73,6 +75,8 @@ export declare function getAccountByExternalId(externalId: string): Promise<(Omi
|
|
|
73
75
|
payable: boolean;
|
|
74
76
|
testPaymentAvailable: boolean;
|
|
75
77
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
78
|
+
} & {
|
|
79
|
+
providerRegistrations?: import("./types").ProviderRegistration[];
|
|
76
80
|
}) | (Omit<import("../lib/graphClient/generated").OneTimePayment, "type" | "institution"> & {
|
|
77
81
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
78
82
|
externalId?: string | null;
|
|
@@ -41,6 +41,26 @@ export type CheckbookAccountInput = {
|
|
|
41
41
|
ownedByUser?: boolean;
|
|
42
42
|
type: BankAccountSubType;
|
|
43
43
|
};
|
|
44
|
+
export declare enum ProviderRegistrationStatus {
|
|
45
|
+
Pending = "Pending",
|
|
46
|
+
Active = "Active",
|
|
47
|
+
Failed = "Failed"
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A card's registration with a single provider (Checkbook, Modern Treasury, …).
|
|
51
|
+
* Embedded in the debit-card payload by payable-accounts `getAccountById` so
|
|
52
|
+
* consumers can resolve a specific provider's externalId/readiness without a
|
|
53
|
+
* second fetch. Dates are serialized as ISO strings over the wire.
|
|
54
|
+
*/
|
|
55
|
+
export type ProviderRegistration = {
|
|
56
|
+
provider: AccountProvider;
|
|
57
|
+
externalId?: string | null;
|
|
58
|
+
status: ProviderRegistrationStatus;
|
|
59
|
+
error?: string | null;
|
|
60
|
+
attemptCount: number;
|
|
61
|
+
activatedAt?: string | null;
|
|
62
|
+
lastFailedAt?: string | null;
|
|
63
|
+
};
|
|
44
64
|
type PayableAccountModelExtension = {
|
|
45
65
|
__t: PayableAccountType;
|
|
46
66
|
externalId?: string | null;
|
|
@@ -53,7 +73,9 @@ type PayableAccountModelExtension = {
|
|
|
53
73
|
type BillModel = Omit<Bill, "type" | "institution"> & PayableAccountModelExtension;
|
|
54
74
|
type BankAcountModel = Omit<BankAccount, "type" | "institution"> & PayableAccountModelExtension;
|
|
55
75
|
type VirtualCardModel = Omit<VirtualCard, "type" | "institution"> & PayableAccountModelExtension;
|
|
56
|
-
type DebitCardModel = Omit<DebitCard, "type" | "institution"> & PayableAccountModelExtension
|
|
76
|
+
type DebitCardModel = Omit<DebitCard, "type" | "institution"> & PayableAccountModelExtension & {
|
|
77
|
+
providerRegistrations?: ProviderRegistration[];
|
|
78
|
+
};
|
|
57
79
|
type DigitalAccountModel = Omit<DigitalAccount, "type" | "institution"> & PayableAccountModelExtension;
|
|
58
80
|
type OneTimePaymentModel = Omit<OneTimePayment, "type" | "institution"> & PayableAccountModelExtension;
|
|
59
81
|
export type PayableAccount = BankAcountModel | VirtualCardModel | BillModel | DebitCardModel | OneTimePaymentModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VirtualCardStatus = exports.VirtualCardType = exports.BankAccountSubType = exports.PayableAccountOriginator = exports.AccountSyncStatus = void 0;
|
|
3
|
+
exports.VirtualCardStatus = exports.VirtualCardType = exports.ProviderRegistrationStatus = exports.BankAccountSubType = exports.PayableAccountOriginator = exports.AccountSyncStatus = void 0;
|
|
4
4
|
var generated_1 = require("../lib/graphClient/generated");
|
|
5
5
|
Object.defineProperty(exports, "AccountSyncStatus", { enumerable: true, get: function () { return generated_1.AccountSyncStatus; } });
|
|
6
6
|
Object.defineProperty(exports, "PayableAccountOriginator", { enumerable: true, get: function () { return generated_1.PayableAccountOriginator; } });
|
|
@@ -10,6 +10,12 @@ var BankAccountSubType;
|
|
|
10
10
|
BankAccountSubType["Checking"] = "CHECKING";
|
|
11
11
|
BankAccountSubType["Savings"] = "SAVINGS";
|
|
12
12
|
})(BankAccountSubType || (exports.BankAccountSubType = BankAccountSubType = {}));
|
|
13
|
+
var ProviderRegistrationStatus;
|
|
14
|
+
(function (ProviderRegistrationStatus) {
|
|
15
|
+
ProviderRegistrationStatus["Pending"] = "Pending";
|
|
16
|
+
ProviderRegistrationStatus["Active"] = "Active";
|
|
17
|
+
ProviderRegistrationStatus["Failed"] = "Failed";
|
|
18
|
+
})(ProviderRegistrationStatus || (exports.ProviderRegistrationStatus = ProviderRegistrationStatus = {}));
|
|
13
19
|
var VirtualCardType;
|
|
14
20
|
(function (VirtualCardType) {
|
|
15
21
|
VirtualCardType["USVirtualDebitCard"] = "USVirtualDebitCard";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as PlatformClient from "./platformServiceClient";
|
|
2
|
-
import { IssuePayoutData, IssuePayoutRequest, MTBalancesData, PlaidTreasuryBalancesData, RelayCheckbookCardData, RelayCheckbookCardRequest, SendPaymentData, SendPaymentRequest, TabapayBalancesResponse, TabapayFundingRequirementResponse, ValidateBillData, ValidateBillRequest } from "./types";
|
|
2
|
+
import { CreateTokenizationData, CreateTokenizationRequest, IssuePayoutData, IssuePayoutRequest, MTBalancesData, PlaidTreasuryBalancesData, RelayCheckbookCardData, RelayCheckbookCardRequest, SendPaymentData, SendPaymentRequest, TabapayBalancesResponse, TabapayFundingRequirementResponse, ValidateBillData, ValidateBillRequest } from "./types";
|
|
3
3
|
export declare function validateBill(request: ValidateBillRequest): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ValidateBillData>>;
|
|
4
4
|
export declare function tabapayBalances(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TabapayBalancesResponse>>;
|
|
5
5
|
export declare function tabapayFundingRequirement(currency?: string): Promise<TabapayFundingRequirementResponse>;
|
|
@@ -18,3 +18,10 @@ export declare function plaidTreasuryBalances(): Promise<import("../types").ApiF
|
|
|
18
18
|
* raw PAN is decrypted in-flight by the relay and never returned.
|
|
19
19
|
*/
|
|
20
20
|
export declare function relayCheckbookCard(request: RelayCheckbookCardRequest): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RelayCheckbookCardData>>;
|
|
21
|
+
/**
|
|
22
|
+
* Create an Evervault tokenization in platform (core_tokenizations) from
|
|
23
|
+
* already-encrypted `ev:` tokens, returning the tokenization id. Only tokens
|
|
24
|
+
* cross the boundary — the caller is responsible for the Evervault encryption,
|
|
25
|
+
* so no raw PAN reaches platform.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createTokenization(request: CreateTokenizationRequest): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<CreateTokenizationData>>;
|
|
@@ -45,6 +45,7 @@ exports.sendPayment = sendPayment;
|
|
|
45
45
|
exports.modernTreasuryBalances = modernTreasuryBalances;
|
|
46
46
|
exports.plaidTreasuryBalances = plaidTreasuryBalances;
|
|
47
47
|
exports.relayCheckbookCard = relayCheckbookCard;
|
|
48
|
+
exports.createTokenization = createTokenization;
|
|
48
49
|
exports.PlatformClient = __importStar(require("./platformServiceClient"));
|
|
49
50
|
const axios_1 = __importDefault(require("axios"));
|
|
50
51
|
// @ts-expect-error no type declarations for axios-token-interceptor
|
|
@@ -117,3 +118,15 @@ async function relayCheckbookCard(request) {
|
|
|
117
118
|
.post(EVERVAULT_RELAY_ENDPOINT, request)
|
|
118
119
|
.then((res) => res.data);
|
|
119
120
|
}
|
|
121
|
+
const TOKENIZATIONS_ENDPOINT = "/v1/evervault/tokenizations";
|
|
122
|
+
/**
|
|
123
|
+
* Create an Evervault tokenization in platform (core_tokenizations) from
|
|
124
|
+
* already-encrypted `ev:` tokens, returning the tokenization id. Only tokens
|
|
125
|
+
* cross the boundary — the caller is responsible for the Evervault encryption,
|
|
126
|
+
* so no raw PAN reaches platform.
|
|
127
|
+
*/
|
|
128
|
+
async function createTokenization(request) {
|
|
129
|
+
return platformClient
|
|
130
|
+
.post(TOKENIZATIONS_ENDPOINT, request)
|
|
131
|
+
.then((res) => res.data);
|
|
132
|
+
}
|
package/lib/platform/types.d.ts
CHANGED
|
@@ -119,3 +119,19 @@ export interface RelayCheckbookCardData {
|
|
|
119
119
|
checkbook_card_id: string;
|
|
120
120
|
card_last4: string;
|
|
121
121
|
}
|
|
122
|
+
export interface CreateTokenizationRequest {
|
|
123
|
+
user_id: string;
|
|
124
|
+
type: string;
|
|
125
|
+
/**
|
|
126
|
+
* Token values keyed by field (e.g. `number`, `expiry_month`, `expiry_year`).
|
|
127
|
+
* `number` must be an Evervault (`ev:...`) token so platform's relay can
|
|
128
|
+
* decrypt it in-flight; expiry parts are plaintext. No raw PAN crosses.
|
|
129
|
+
*/
|
|
130
|
+
tokens: Record<string, string>;
|
|
131
|
+
}
|
|
132
|
+
export interface CreateTokenizationData {
|
|
133
|
+
id: string;
|
|
134
|
+
user_id: string;
|
|
135
|
+
type: string;
|
|
136
|
+
created_at: string;
|
|
137
|
+
}
|