@spritz-finance/service-client 0.32.1 → 0.33.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/platform/types.d.ts
CHANGED
|
@@ -152,10 +152,43 @@ export interface MTAccount {
|
|
|
152
152
|
* owed out. Decimal dollars. Disjoint from `liability`; the two sum to the
|
|
153
153
|
* full MT payable.
|
|
154
154
|
*/
|
|
155
|
-
terminalLiability: string;
|
|
155
|
+
terminalLiability: string | null;
|
|
156
|
+
/**
|
|
157
|
+
* Outbound credits that are NOT liabilities payouts (treasury transfers such
|
|
158
|
+
* as MT → Checkbook / MT → Mercury) and have not yet been sent. Disjoint from
|
|
159
|
+
* `liability` and `terminalLiability`. MT still counts these in the available
|
|
160
|
+
* balance, so a consumer sizing MT top-ups must subtract this too. Decimal
|
|
161
|
+
* dollars.
|
|
162
|
+
*/
|
|
163
|
+
inFlightTransferLiability: string;
|
|
164
|
+
/**
|
|
165
|
+
* Subset of `liability`: next-day (standard) ACH credits still queued for
|
|
166
|
+
* their banking-day batch; not disbursable until the next banking day.
|
|
167
|
+
* Decimal dollars.
|
|
168
|
+
*/
|
|
169
|
+
nextDayAchLiability: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* An MT account that only collects ACH debits (FOMO's account, ledger 1061)
|
|
173
|
+
* and is swept into the Spritz USD account. Payouts never leave it, so it has
|
|
174
|
+
* none of `MTAccount`'s payout-liability fields.
|
|
175
|
+
*/
|
|
176
|
+
export interface MTCollectionAccount {
|
|
177
|
+
id: string;
|
|
178
|
+
name: string;
|
|
179
|
+
role: "fomo_ach_debit";
|
|
180
|
+
currency: string;
|
|
181
|
+
balances: MTAccountBalance[];
|
|
156
182
|
}
|
|
157
183
|
export interface MTBalancesData {
|
|
184
|
+
/** Spritz's own payout accounts. Consumers picking the first USD entry get Spritz's account. */
|
|
158
185
|
accounts: MTAccount[];
|
|
186
|
+
/**
|
|
187
|
+
* Kept out of `accounts` so existing consumers keep reading Spritz's own
|
|
188
|
+
* account. Platform omits a collection account whose balance read failed, so
|
|
189
|
+
* a missing entry means "unavailable", not zero.
|
|
190
|
+
*/
|
|
191
|
+
collectionAccounts: MTCollectionAccount[];
|
|
159
192
|
}
|
|
160
193
|
export interface PlaidTreasuryAccountBalance {
|
|
161
194
|
/** Platform plaid_accounts record id. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * as RainClient from "./rainServiceClient";
|
|
2
2
|
import { VirtualCardStatus } from "../payableAccounts/types";
|
|
3
3
|
import { ApplicationStatus, CardDetailsResponse, CardOrderStatus, CardType, CreateRainApplicationInput, OrderPhysicalCardInput, OrderPhysicalCardResponse, RainCard, RainContract, RainUser, ShippingDetails, WithdrawalSignature } from "./types";
|
|
4
|
+
export declare const CREATE_CARD_APPLICATION_TIMEOUT_MS = 28000;
|
|
4
5
|
export declare function createCardApplication(userId: string, input: CreateRainApplicationInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RainUser>>;
|
|
5
6
|
export declare function getUserDepositAddress({ userId, network, }: {
|
|
6
7
|
userId: string;
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.RainClient = void 0;
|
|
36
|
+
exports.CREATE_CARD_APPLICATION_TIMEOUT_MS = exports.RainClient = void 0;
|
|
37
37
|
exports.createCardApplication = createCardApplication;
|
|
38
38
|
exports.getUserDepositAddress = getUserDepositAddress;
|
|
39
39
|
exports.validateContractAddress = validateContractAddress;
|
|
@@ -51,9 +51,21 @@ exports.RainClient = __importStar(require("./rainServiceClient"));
|
|
|
51
51
|
const restClient_1 = require("../restClient");
|
|
52
52
|
const baseClient = (0, restClient_1.getRestClient)(process.env.RAIN_SERVICE_API_IAM_URL, "/rain-v2/api");
|
|
53
53
|
const RAIN_ENDPOINT = "/rain-v2";
|
|
54
|
+
// Rain's CreateRainApplication submits the application and uploads the ID
|
|
55
|
+
// documents, which takes 10-18s in production. The 10s DEFAULT_TIMEOUT_MS
|
|
56
|
+
// aborted the caller while Rain went on to create the application, so the
|
|
57
|
+
// user saw an error for an application that succeeded. Stay under the 30s
|
|
58
|
+
// Lambda timeout on both sides.
|
|
59
|
+
exports.CREATE_CARD_APPLICATION_TIMEOUT_MS = 28000;
|
|
54
60
|
async function createCardApplication(userId, input) {
|
|
55
61
|
return baseClient
|
|
56
|
-
.post(`${RAIN_ENDPOINT}/application?userId=${userId}`, input
|
|
62
|
+
.post(`${RAIN_ENDPOINT}/application?userId=${userId}`, input, {
|
|
63
|
+
timeout: exports.CREATE_CARD_APPLICATION_TIMEOUT_MS,
|
|
64
|
+
// Opt out of the shared 502 retry: a 502 can arrive after Rain already
|
|
65
|
+
// created the application, a repeat create fails, and a second 28s
|
|
66
|
+
// attempt would outlast the caller's 30s Lambda.
|
|
67
|
+
headers: { "x-retry-attempt": "true" },
|
|
68
|
+
})
|
|
57
69
|
.then((res) => res.data);
|
|
58
70
|
}
|
|
59
71
|
async function getUserDepositAddress({ userId, network, }) {
|