@spritz-finance/service-client 0.14.0 → 0.15.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 { ExternalBillInput, PayableAccount, PayableAccountInstitution, SimpleCardTransaction, UpsertVirtualCardInput } from "./types";
|
|
2
|
+
import { BankAccountPayoutRail, 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;
|
|
@@ -16,6 +16,8 @@ export declare function getAccount(accountId: string): Promise<(Omit<import("../
|
|
|
16
16
|
payable: boolean;
|
|
17
17
|
testPaymentAvailable: boolean;
|
|
18
18
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
19
|
+
} & {
|
|
20
|
+
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
19
21
|
}) | (Omit<import("../lib/graphClient/generated").VirtualCard, "type" | "institution"> & {
|
|
20
22
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
21
23
|
externalId?: string | null;
|
|
@@ -59,6 +61,8 @@ export declare function getAccountByExternalId(externalId: string): Promise<(Omi
|
|
|
59
61
|
payable: boolean;
|
|
60
62
|
testPaymentAvailable: boolean;
|
|
61
63
|
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
64
|
+
} & {
|
|
65
|
+
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
62
66
|
}) | (Omit<import("../lib/graphClient/generated").VirtualCard, "type" | "institution"> & {
|
|
63
67
|
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
64
68
|
externalId?: string | null;
|
|
@@ -102,3 +106,19 @@ export declare function getAccountById(accountId: string): Promise<import("../ty
|
|
|
102
106
|
export declare function createUSVirtualCardNoKyc(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<PayableAccount>>;
|
|
103
107
|
export declare function upsertVirtualCard(input: UpsertVirtualCardInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<PayableAccount>>;
|
|
104
108
|
export declare function getRecentCardSpendTransactions(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<SimpleCardTransaction[]>>;
|
|
109
|
+
/**
|
|
110
|
+
* Permanently disable a payout rail for a bank account. Used when the payment
|
|
111
|
+
* network rejects the specific account (e.g. RTP "Creditor account Is Invalid")
|
|
112
|
+
* so the account stops advertising that rail. Idempotent per rail.
|
|
113
|
+
*/
|
|
114
|
+
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
|
+
__t: import("../lib/graphClient/generated").PayableAccountType;
|
|
116
|
+
externalId?: string | null;
|
|
117
|
+
institutionId?: string | null;
|
|
118
|
+
nickname?: string | null;
|
|
119
|
+
payable: boolean;
|
|
120
|
+
testPaymentAvailable: boolean;
|
|
121
|
+
provider: import("../lib/graphClient/generated").AccountProvider;
|
|
122
|
+
} & {
|
|
123
|
+
disabledPayoutRails?: import("./types").DisabledPayoutRail[] | null;
|
|
124
|
+
}>>;
|
|
@@ -44,9 +44,13 @@ exports.getAccountById = getAccountById;
|
|
|
44
44
|
exports.createUSVirtualCardNoKyc = createUSVirtualCardNoKyc;
|
|
45
45
|
exports.upsertVirtualCard = upsertVirtualCard;
|
|
46
46
|
exports.getRecentCardSpendTransactions = getRecentCardSpendTransactions;
|
|
47
|
+
exports.disablePayoutRail = disablePayoutRail;
|
|
47
48
|
exports.PayableAccountsClient = __importStar(require("./payableAccountsServiceClient"));
|
|
48
49
|
const serviceClient_1 = require("../serviceClient");
|
|
49
50
|
const PAYABLE_ACCOUNTS_ENDPOINT = "/payable-accounts";
|
|
51
|
+
// The Hono ServiceApi (`/api/{proxy+}`) is mapped on the shared gateway domain
|
|
52
|
+
// under the `payable-accounts-v2` key (serverless.yaml HTTPAPIMapping).
|
|
53
|
+
const PAYABLE_ACCOUNTS_ROUTER_ENDPOINT = "/payable-accounts-v2/api";
|
|
50
54
|
async function getAccount(accountId) {
|
|
51
55
|
return serviceClient_1.baseClient
|
|
52
56
|
.get(`${PAYABLE_ACCOUNTS_ENDPOINT}/payable-account/id/${accountId}`)
|
|
@@ -97,3 +101,13 @@ async function getRecentCardSpendTransactions(userId) {
|
|
|
97
101
|
.get(`${PAYABLE_ACCOUNTS_ENDPOINT}/virtual-card/recent-transactions/user/${userId}`)
|
|
98
102
|
.then((res) => res.data);
|
|
99
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Permanently disable a payout rail for a bank account. Used when the payment
|
|
106
|
+
* network rejects the specific account (e.g. RTP "Creditor account Is Invalid")
|
|
107
|
+
* so the account stops advertising that rail. Idempotent per rail.
|
|
108
|
+
*/
|
|
109
|
+
async function disablePayoutRail(accountId, rail, reason) {
|
|
110
|
+
return serviceClient_1.baseClient
|
|
111
|
+
.post(`${PAYABLE_ACCOUNTS_ROUTER_ENDPOINT}/bank-accounts/${accountId}/payout-rails/disable`, { rail, reason })
|
|
112
|
+
.then((res) => res.data);
|
|
113
|
+
}
|
|
@@ -71,7 +71,18 @@ type PayableAccountModelExtension = {
|
|
|
71
71
|
provider: AccountProvider;
|
|
72
72
|
};
|
|
73
73
|
type BillModel = Omit<Bill, "type" | "institution"> & PayableAccountModelExtension;
|
|
74
|
-
type
|
|
74
|
+
export type BankAccountPayoutRail = "ach_standard" | "ach_same_day" | "wire" | "rtp" | "eft" | "sepa" | "faster_payments";
|
|
75
|
+
export type DisabledPayoutRail = {
|
|
76
|
+
rail: BankAccountPayoutRail;
|
|
77
|
+
disabledAt: string;
|
|
78
|
+
reason: string;
|
|
79
|
+
};
|
|
80
|
+
type BankAcountModel = Omit<BankAccount, "type" | "institution"> & PayableAccountModelExtension & {
|
|
81
|
+
/** Rails the payment network rejected for this specific account (e.g. RTP
|
|
82
|
+
* "Creditor account Is Invalid"). Sticky: serialized `bankAccountFeatures`
|
|
83
|
+
* are already effective capabilities (detected rails minus these). */
|
|
84
|
+
disabledPayoutRails?: DisabledPayoutRail[] | null;
|
|
85
|
+
};
|
|
75
86
|
type VirtualCardModel = Omit<VirtualCard, "type" | "institution"> & PayableAccountModelExtension;
|
|
76
87
|
type DebitCardModel = Omit<DebitCard, "type" | "institution"> & PayableAccountModelExtension & {
|
|
77
88
|
providerRegistrations?: ProviderRegistration[];
|