@spritz-finance/service-client 0.24.0 → 0.26.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.
@@ -15,7 +15,8 @@ export declare function validateTransfer({ userId, transferId, amount, toAddress
15
15
  toAddress: string;
16
16
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
17
17
  export declare function createBridgeTransfer(userId: string, input: {
18
- amount: number;
18
+ sourceAmount: number;
19
+ referenceId: string;
19
20
  token: string;
20
21
  network: BridgeNetwork;
21
22
  fromAddress: string;
@@ -71,7 +71,7 @@ async function validateTransfer({ userId, transferId, amount, toAddress, }) {
71
71
  }
72
72
  async function createBridgeTransfer(userId, input) {
73
73
  return serviceClient_1.baseClient
74
- .post(`${ONRAMP_ENDPOINT}/user/${userId}/transfer`, input)
74
+ .post(`${ONRAMP_ROUTER_ENDPOINT}/off-ramps/users/${userId}/transfers`, input)
75
75
  .then((res) => res.data);
76
76
  }
77
77
  async function getExternalPayments(paymentIds) {
@@ -1,5 +1,5 @@
1
1
  export * as PayableAccountsClient from "./payableAccountsServiceClient";
2
- import { BankAccountPayoutRail, BankAccountUnpayableCode, DebitCardDetails, ExternalBillInput, PayableAccount, PayableAccountInstitution, SimpleCardTransaction, UpsertVirtualCardInput } from "./types";
2
+ import { BankAccountPayoutRail, BankAccountUnpayableCode, DebitCardDetails, DebitCardUnpayableCode, 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;
@@ -39,6 +39,9 @@ export declare function getAccount(accountId: string): Promise<(Omit<import("../
39
39
  provider: import("../lib/graphClient/generated").AccountProvider;
40
40
  } & {
41
41
  providerRegistrations?: import("./types").ProviderRegistration[];
42
+ unpayableCode?: DebitCardUnpayableCode | null;
43
+ unpayableReason?: string | null;
44
+ unpayableAt?: string | null;
42
45
  }) | (Omit<import("../lib/graphClient/generated").OneTimePayment, "type" | "institution"> & {
43
46
  __t: import("../lib/graphClient/generated").PayableAccountType;
44
47
  externalId?: string | null;
@@ -87,6 +90,9 @@ export declare function getAccountByExternalId(externalId: string): Promise<(Omi
87
90
  provider: import("../lib/graphClient/generated").AccountProvider;
88
91
  } & {
89
92
  providerRegistrations?: import("./types").ProviderRegistration[];
93
+ unpayableCode?: DebitCardUnpayableCode | null;
94
+ unpayableReason?: string | null;
95
+ unpayableAt?: string | null;
90
96
  }) | (Omit<import("../lib/graphClient/generated").OneTimePayment, "type" | "institution"> & {
91
97
  __t: import("../lib/graphClient/generated").PayableAccountType;
92
98
  externalId?: string | null;
@@ -160,3 +166,10 @@ export declare function markUnpayable(accountId: string, code: BankAccountUnpaya
160
166
  unpayableReason?: string | null;
161
167
  unpayableAt?: string | null;
162
168
  }>>;
169
+ /**
170
+ * Permanently mark a debit card unpayable — the network refused a payout for a
171
+ * reason no retry can fix ("The card has expired."). `payable: false` is what
172
+ * liabilities gates creation, reissue and redirect on; the user must add a
173
+ * replacement card. Idempotent.
174
+ */
175
+ export declare function markDebitCardUnpayable(cardId: string, code: DebitCardUnpayableCode, reason: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<DebitCardDetails>>;
@@ -47,6 +47,7 @@ exports.getRecentCardSpendTransactions = getRecentCardSpendTransactions;
47
47
  exports.getDebitCardById = getDebitCardById;
48
48
  exports.disablePayoutRail = disablePayoutRail;
49
49
  exports.markUnpayable = markUnpayable;
50
+ exports.markDebitCardUnpayable = markDebitCardUnpayable;
50
51
  exports.PayableAccountsClient = __importStar(require("./payableAccountsServiceClient"));
51
52
  const serviceClient_1 = require("../serviceClient");
52
53
  const PAYABLE_ACCOUNTS_ENDPOINT = "/payable-accounts";
@@ -137,3 +138,14 @@ async function markUnpayable(accountId, code, reason) {
137
138
  .post(`${PAYABLE_ACCOUNTS_ROUTER_ENDPOINT}/bank-accounts/${accountId}/unpayable`, { code, reason })
138
139
  .then((res) => res.data);
139
140
  }
141
+ /**
142
+ * Permanently mark a debit card unpayable — the network refused a payout for a
143
+ * reason no retry can fix ("The card has expired."). `payable: false` is what
144
+ * liabilities gates creation, reissue and redirect on; the user must add a
145
+ * replacement card. Idempotent.
146
+ */
147
+ async function markDebitCardUnpayable(cardId, code, reason) {
148
+ return serviceClient_1.baseClient
149
+ .post(`${PAYABLE_ACCOUNTS_ROUTER_ENDPOINT}/debit-cards/${cardId}/unpayable`, { code, reason })
150
+ .then((res) => res.data);
151
+ }
@@ -98,8 +98,19 @@ type BankAcountModel = Omit<BankAccount, "type" | "institution"> & PayableAccoun
98
98
  unpayableAt?: string | null;
99
99
  };
100
100
  type VirtualCardModel = Omit<VirtualCard, "type" | "institution"> & PayableAccountModelExtension;
101
+ /**
102
+ * Why a debit card is `payable: false` through no fault of the user's input.
103
+ * Mirrors `BankAccountUnpayableCode`; verbatim evidence stays in
104
+ * `unpayableReason`.
105
+ */
106
+ export type DebitCardUnpayableCode = "card_expired";
101
107
  type DebitCardModel = Omit<DebitCard, "type" | "institution"> & PayableAccountModelExtension & {
102
108
  providerRegistrations?: ProviderRegistration[];
109
+ /** Set alongside `payable: false` when the card lapsed or the network
110
+ * refused it; listed so clients can show the user why. */
111
+ unpayableCode?: DebitCardUnpayableCode | null;
112
+ unpayableReason?: string | null;
113
+ unpayableAt?: string | null;
103
114
  };
104
115
  type DigitalAccountModel = Omit<DigitalAccount, "type" | "institution"> & PayableAccountModelExtension;
105
116
  type OneTimePaymentModel = Omit<OneTimePayment, "type" | "institution"> & PayableAccountModelExtension;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",