@spritz-finance/service-client 0.15.0 → 0.16.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as PayableAccountsClient from "./payableAccountsServiceClient";
|
|
2
|
-
import { BankAccountPayoutRail, ExternalBillInput, PayableAccount, PayableAccountInstitution, SimpleCardTransaction, UpsertVirtualCardInput } from "./types";
|
|
2
|
+
import { BankAccountPayoutRail, BankAccountUnpayableCode, ExternalBillInput, PayableAccount, PayableAccountInstitution, SimpleCardTransaction, UpsertVirtualCardInput } from "./types";
|
|
3
3
|
export declare function getAccount(accountId: string): Promise<(Omit<import("../lib/graphClient/generated").Bill, "type" | "institution"> & {
|
|
4
4
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
5
5
|
externalId?: string | null;
|
|
@@ -18,6 +18,9 @@ export declare function getAccount(accountId: string): Promise<(Omit<import("../
|
|
|
18
18
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
19
19
|
} & {
|
|
20
20
|
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
21
|
+
unpayableCode?: BankAccountUnpayableCode | null;
|
|
22
|
+
unpayableReason?: string | null;
|
|
23
|
+
unpayableAt?: string | null;
|
|
21
24
|
}) | (Omit<import("../lib/graphClient/generated").VirtualCard, "type" | "institution"> & {
|
|
22
25
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
23
26
|
externalId?: string | null;
|
|
@@ -63,6 +66,9 @@ export declare function getAccountByExternalId(externalId: string): Promise<(Omi
|
|
|
63
66
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
64
67
|
} & {
|
|
65
68
|
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
69
|
+
unpayableCode?: BankAccountUnpayableCode | null;
|
|
70
|
+
unpayableReason?: string | null;
|
|
71
|
+
unpayableAt?: string | null;
|
|
66
72
|
}) | (Omit<import("../lib/graphClient/generated").VirtualCard, "type" | "institution"> & {
|
|
67
73
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
68
74
|
externalId?: string | null;
|
|
@@ -107,9 +113,12 @@ export declare function createUSVirtualCardNoKyc(userId: string): Promise<import
|
|
|
107
113
|
export declare function upsertVirtualCard(input: UpsertVirtualCardInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<PayableAccount>>;
|
|
108
114
|
export declare function getRecentCardSpendTransactions(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<SimpleCardTransaction[]>>;
|
|
109
115
|
/**
|
|
110
|
-
* Permanently disable a payout rail for a bank account. Used when the
|
|
111
|
-
*
|
|
112
|
-
*
|
|
116
|
+
* Permanently disable a payout rail for a bank account. Used when the account is
|
|
117
|
+
* fine but cannot use one rail (e.g. "Transaction type not supported or
|
|
118
|
+
* authorized on the receiving account"). Idempotent per rail.
|
|
119
|
+
*
|
|
120
|
+
* For a bank rejecting the ACCOUNT itself, use `markUnpayable` instead — leaving
|
|
121
|
+
* the other rails enabled lets a reissue downgrade onto a doomed rail.
|
|
113
122
|
*/
|
|
114
123
|
export declare function disablePayoutRail(accountId: string, rail: BankAccountPayoutRail, reason: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Omit<import("../lib/graphClient/generated").BankAccount, "type" | "institution"> & {
|
|
115
124
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
@@ -121,4 +130,26 @@ export declare function disablePayoutRail(accountId: string, rail: BankAccountPa
|
|
|
121
130
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
122
131
|
} & {
|
|
123
132
|
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
133
|
+
unpayableCode?: BankAccountUnpayableCode | null;
|
|
134
|
+
unpayableReason?: string | null;
|
|
135
|
+
unpayableAt?: string | null;
|
|
136
|
+
}>>;
|
|
137
|
+
/**
|
|
138
|
+
* Permanently mark a bank account unpayable on every rail. Used when the
|
|
139
|
+
* receiving bank rejects the ACCOUNT — RTP "Creditor account Is Invalid" (AC03),
|
|
140
|
+
* ACH R02/R03/R04 — so no retry, reissue or downgrade can reach it. Idempotent.
|
|
141
|
+
*/
|
|
142
|
+
export declare function markUnpayable(accountId: string, code: BankAccountUnpayableCode, reason: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Omit<import("../lib/graphClient/generated").BankAccount, "type" | "institution"> & {
|
|
143
|
+
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
144
|
+
externalId?: string | null;
|
|
145
|
+
institutionId?: string | null;
|
|
146
|
+
nickname?: string | null;
|
|
147
|
+
payable: boolean;
|
|
148
|
+
testPaymentAvailable: boolean;
|
|
149
|
+
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
150
|
+
} & {
|
|
151
|
+
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
152
|
+
unpayableCode?: BankAccountUnpayableCode | null;
|
|
153
|
+
unpayableReason?: string | null;
|
|
154
|
+
unpayableAt?: string | null;
|
|
124
155
|
}>>;
|
|
@@ -45,6 +45,7 @@ exports.createUSVirtualCardNoKyc = createUSVirtualCardNoKyc;
|
|
|
45
45
|
exports.upsertVirtualCard = upsertVirtualCard;
|
|
46
46
|
exports.getRecentCardSpendTransactions = getRecentCardSpendTransactions;
|
|
47
47
|
exports.disablePayoutRail = disablePayoutRail;
|
|
48
|
+
exports.markUnpayable = markUnpayable;
|
|
48
49
|
exports.PayableAccountsClient = __importStar(require("./payableAccountsServiceClient"));
|
|
49
50
|
const serviceClient_1 = require("../serviceClient");
|
|
50
51
|
const PAYABLE_ACCOUNTS_ENDPOINT = "/payable-accounts";
|
|
@@ -102,12 +103,25 @@ async function getRecentCardSpendTransactions(userId) {
|
|
|
102
103
|
.then((res) => res.data);
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
|
-
* Permanently disable a payout rail for a bank account. Used when the
|
|
106
|
-
*
|
|
107
|
-
*
|
|
106
|
+
* Permanently disable a payout rail for a bank account. Used when the account is
|
|
107
|
+
* fine but cannot use one rail (e.g. "Transaction type not supported or
|
|
108
|
+
* authorized on the receiving account"). Idempotent per rail.
|
|
109
|
+
*
|
|
110
|
+
* For a bank rejecting the ACCOUNT itself, use `markUnpayable` instead — leaving
|
|
111
|
+
* the other rails enabled lets a reissue downgrade onto a doomed rail.
|
|
108
112
|
*/
|
|
109
113
|
async function disablePayoutRail(accountId, rail, reason) {
|
|
110
114
|
return serviceClient_1.baseClient
|
|
111
115
|
.post(`${PAYABLE_ACCOUNTS_ROUTER_ENDPOINT}/bank-accounts/${accountId}/payout-rails/disable`, { rail, reason })
|
|
112
116
|
.then((res) => res.data);
|
|
113
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Permanently mark a bank account unpayable on every rail. Used when the
|
|
120
|
+
* receiving bank rejects the ACCOUNT — RTP "Creditor account Is Invalid" (AC03),
|
|
121
|
+
* ACH R02/R03/R04 — so no retry, reissue or downgrade can reach it. Idempotent.
|
|
122
|
+
*/
|
|
123
|
+
async function markUnpayable(accountId, code, reason) {
|
|
124
|
+
return serviceClient_1.baseClient
|
|
125
|
+
.post(`${PAYABLE_ACCOUNTS_ROUTER_ENDPOINT}/bank-accounts/${accountId}/unpayable`, { code, reason })
|
|
126
|
+
.then((res) => res.data);
|
|
127
|
+
}
|
|
@@ -77,11 +77,25 @@ export type DisabledPayoutRail = {
|
|
|
77
77
|
disabledAt: string;
|
|
78
78
|
reason: string;
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Why the receiving bank rejected the account outright. Coarse by design — it
|
|
82
|
+
* drives user-facing copy ("add a different account"), not a mirror of every ISO
|
|
83
|
+
* 20022 / NACHA code. Verbatim provider text stays in `unpayableReason`.
|
|
84
|
+
*/
|
|
85
|
+
export type BankAccountUnpayableCode = "account_invalid" | "account_closed" | "account_blocked";
|
|
80
86
|
type BankAcountModel = Omit<BankAccount, "type" | "institution"> & PayableAccountModelExtension & {
|
|
81
|
-
/** Rails the payment network rejected for this specific account (e.g.
|
|
82
|
-
* "
|
|
83
|
-
* are already effective capabilities
|
|
87
|
+
/** Rails the payment network rejected for this specific account (e.g.
|
|
88
|
+
* "Transaction type not supported on the receiving account"). Sticky:
|
|
89
|
+
* serialized `bankAccountFeatures` are already effective capabilities
|
|
90
|
+
* (detected rails minus these). */
|
|
84
91
|
disabledPayoutRails?: DisabledPayoutRail[] | null;
|
|
92
|
+
/** Why the receiving bank rejected the account outright (RTP AC03, ACH
|
|
93
|
+
* R02/R03/R04). Set together with `payable: false`, and the account stays
|
|
94
|
+
* listed so clients can show the user why it can't be paid rather than
|
|
95
|
+
* having it silently disappear. */
|
|
96
|
+
unpayableCode?: BankAccountUnpayableCode | null;
|
|
97
|
+
unpayableReason?: string | null;
|
|
98
|
+
unpayableAt?: string | null;
|
|
85
99
|
};
|
|
86
100
|
type VirtualCardModel = Omit<VirtualCard, "type" | "institution"> & PayableAccountModelExtension;
|
|
87
101
|
type DebitCardModel = Omit<DebitCard, "type" | "institution"> & PayableAccountModelExtension & {
|