@spritz-finance/service-client 0.34.1 → 0.34.2
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.
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export * as PlatformClient from "./platformServiceClient";
|
|
2
|
-
import {
|
|
2
|
+
import { ApiResponse } from "../types";
|
|
3
|
+
import { CreateTokenizationData, CreateTokenizationRequest, IssueCardPayoutData, IssueCardPayoutRequest, IssuePayoutByReferenceData, IssuePayoutByReferenceRequest, IssuePayoutData, IssuePayoutRequest, IntegratorUsageKey, IntegratorUsageOperation, IntegratorUsageSummary, MTBalancesData, PersonByUserData, PlaidTreasuryBalancesData, RelayCheckbookCardData, RelayCheckbookCardRequest, ReleaseIntegratorUsageRequest, ReserveIntegratorUsageRequest, SendPaymentData, SendPaymentRequest, TabapayBalancesResponse, TabapayFundingRequirementResponse, ValidateBillData, ValidateBillRequest } from "./types";
|
|
3
4
|
export declare function validateBill(request: ValidateBillRequest): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ValidateBillData>>;
|
|
4
5
|
export declare function tabapayBalances(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TabapayBalancesResponse>>;
|
|
5
6
|
export declare function tabapayFundingRequirement(currency?: string): Promise<TabapayFundingRequirementResponse>;
|
|
6
7
|
export declare function issuePayout(request: IssuePayoutRequest): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IssuePayoutData>>;
|
|
8
|
+
/**
|
|
9
|
+
* Platform answers a reference-shape refusal (payment not payable, amount
|
|
10
|
+
* unverified, destination unsafe) with 422 `{ error, code }`. It is returned as
|
|
11
|
+
* an `ApiFailure` so callers can fail the payment; any other non-2xx still
|
|
12
|
+
* rejects, because it means platform was unavailable and the payout must stay
|
|
13
|
+
* retryable.
|
|
14
|
+
*/
|
|
15
|
+
export declare function issuePayoutByReference(request: IssuePayoutByReferenceRequest): Promise<ApiResponse<IssuePayoutByReferenceData>>;
|
|
7
16
|
/**
|
|
8
17
|
* Push-to-debit payout via Modern Treasury. Platform lazily materializes the
|
|
9
18
|
* MT external account + Card from the Evervault tokenization on first payout,
|
|
@@ -41,6 +41,7 @@ exports.validateBill = validateBill;
|
|
|
41
41
|
exports.tabapayBalances = tabapayBalances;
|
|
42
42
|
exports.tabapayFundingRequirement = tabapayFundingRequirement;
|
|
43
43
|
exports.issuePayout = issuePayout;
|
|
44
|
+
exports.issuePayoutByReference = issuePayoutByReference;
|
|
44
45
|
exports.issueCardPayout = issueCardPayout;
|
|
45
46
|
exports.sendPayment = sendPayment;
|
|
46
47
|
exports.modernTreasuryBalances = modernTreasuryBalances;
|
|
@@ -98,6 +99,29 @@ async function issuePayout(request) {
|
|
|
98
99
|
.post(`${MT_ENDPOINT}/issue-payout`, request)
|
|
99
100
|
.then((res) => res.data);
|
|
100
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Platform answers a reference-shape refusal (payment not payable, amount
|
|
104
|
+
* unverified, destination unsafe) with 422 `{ error, code }`. It is returned as
|
|
105
|
+
* an `ApiFailure` so callers can fail the payment; any other non-2xx still
|
|
106
|
+
* rejects, because it means platform was unavailable and the payout must stay
|
|
107
|
+
* retryable.
|
|
108
|
+
*/
|
|
109
|
+
async function issuePayoutByReference(request) {
|
|
110
|
+
var _a;
|
|
111
|
+
const res = await platformClient.post(`${MT_ENDPOINT}/issue-payout`, request, {
|
|
112
|
+
validateStatus: (status) => (status >= 200 && status < 300) || status === 422,
|
|
113
|
+
});
|
|
114
|
+
if (res.status !== 422)
|
|
115
|
+
return res.data;
|
|
116
|
+
const refusal = res.data;
|
|
117
|
+
return {
|
|
118
|
+
status: "failure",
|
|
119
|
+
error: {
|
|
120
|
+
message: (_a = refusal.error) !== null && _a !== void 0 ? _a : "Payout refused",
|
|
121
|
+
...(refusal.code ? { code: refusal.code } : {}),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
101
125
|
/**
|
|
102
126
|
* Push-to-debit payout via Modern Treasury. Platform lazily materializes the
|
|
103
127
|
* MT external account + Card from the Evervault tokenization on first payout,
|
package/lib/platform/types.d.ts
CHANGED
|
@@ -62,6 +62,19 @@ export interface IssuePayoutRequest {
|
|
|
62
62
|
statementDescriptor?: string;
|
|
63
63
|
metadata?: Record<string, string>;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Reference-shape payout: platform resolves the destination, amount, rail and
|
|
67
|
+
* recipient from the liabilities Payment and payable-accounts itself, so the
|
|
68
|
+
* caller cannot redirect or resize it.
|
|
69
|
+
*/
|
|
70
|
+
export interface IssuePayoutByReferenceRequest {
|
|
71
|
+
paymentId: string;
|
|
72
|
+
userId: string;
|
|
73
|
+
}
|
|
74
|
+
/** `payment_order_id` is absent while platform holds the payout in its funding queue. */
|
|
75
|
+
export type IssuePayoutByReferenceData = Omit<IssuePayoutData, "payment_order_id"> & {
|
|
76
|
+
payment_order_id?: string;
|
|
77
|
+
};
|
|
65
78
|
export interface IssuePayoutData {
|
|
66
79
|
payment_order_id: string;
|
|
67
80
|
status: string;
|