@spritz-finance/service-client 0.10.0 → 0.11.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.
@@ -104,12 +104,20 @@ async function createCheckbookDebitCard(input) {
104
104
  * flag). Throws on a non-2xx response.
105
105
  */
106
106
  async function createTokenizedDebitCard(input) {
107
- return serviceClient_1.baseClient
108
- .post(`${LIABILITIES_ENDPOINT}/debit-card/create`, input)
109
- .then((res) => ({
110
- externalId: res.data.checkbookCardId,
111
- cardLast4: res.data.cardLast4,
112
- }));
107
+ var _a, _b;
108
+ // Served by the Hono ServiceApi (30s timeout), which wraps the result in the
109
+ // standard `{ status, data }` envelope. Unwrap it here so callers keep the
110
+ // simple `{ externalId, cardLast4 }` contract; surface the provider error
111
+ // message on failure instead of an opaque error.
112
+ const res = await serviceClient_1.baseClient.post(`${LIABILITIES_V2_ENDPOINT}/checkbook/debit-card/create`, input);
113
+ const body = res.data;
114
+ if (body.status === "failure") {
115
+ throw new Error((_b = (_a = body.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : "Tokenized debit card creation failed");
116
+ }
117
+ return {
118
+ externalId: body.data.checkbookCardId,
119
+ cardLast4: body.data.cardLast4,
120
+ };
113
121
  }
114
122
  async function createCheckbookDigitalAccount(input) {
115
123
  return serviceClient_1.baseClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",