@haven_ai/sdk 0.1.5 → 0.1.6

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.
package/dist/index.cjs CHANGED
@@ -1178,7 +1178,7 @@ var HavenClient = class {
1178
1178
  ...initialInit,
1179
1179
  headers: retryHeaders
1180
1180
  });
1181
- if (retryResponse.status === 402) {
1181
+ if (!retryResponse.ok) {
1182
1182
  await this.recordMerchantRetryRejected({
1183
1183
  rail: "x402",
1184
1184
  paymentId: receipt.paymentId,
@@ -1191,8 +1191,8 @@ var HavenClient = class {
1191
1191
  }
1192
1192
  });
1193
1193
  throw new HavenApiError(
1194
- "x402 retry was rejected after Haven funded the delegate wallet; reconciliation may be required.",
1195
- 402,
1194
+ "x402 retry failed after Haven funded the delegate wallet; reconciliation may be required.",
1195
+ retryResponse.status,
1196
1196
  {
1197
1197
  marker: "x402_retry_rejected_after_funding",
1198
1198
  payment_id: receipt.paymentId,
@@ -1331,7 +1331,7 @@ var HavenClient = class {
1331
1331
  ...initialInit,
1332
1332
  headers: retryHeaders
1333
1333
  });
1334
- if (retryResponse.status === 402) {
1334
+ if (!retryResponse.ok) {
1335
1335
  await this.recordMerchantRetryRejected({
1336
1336
  rail: receipt.rail,
1337
1337
  paymentId: receipt.paymentId,
@@ -1343,8 +1343,8 @@ var HavenClient = class {
1343
1343
  }
1344
1344
  });
1345
1345
  throw new HavenApiError(
1346
- "Machine payment retry was rejected after Haven sent the payment.",
1347
- 402,
1346
+ "Machine payment retry failed after Haven sent the payment.",
1347
+ retryResponse.status,
1348
1348
  {
1349
1349
  marker: "machine_payment_retry_rejected_after_payment",
1350
1350
  payment_id: receipt.paymentId,
@@ -2227,7 +2227,7 @@ var HavenClient = class {
2227
2227
  };
2228
2228
  }
2229
2229
  mapPaymentReceipt(raw) {
2230
- return {
2230
+ const receipt = {
2231
2231
  id: raw.id,
2232
2232
  paymentId: raw.payment_id,
2233
2233
  rail: raw.rail,
@@ -2254,6 +2254,13 @@ var HavenClient = class {
2254
2254
  createdAt: raw.created_at,
2255
2255
  updatedAt: raw.updated_at
2256
2256
  };
2257
+ if ("payment_intent_id" in raw) {
2258
+ receipt.paymentIntentId = raw.payment_intent_id ?? null;
2259
+ }
2260
+ if ("approval_request_id" in raw) {
2261
+ receipt.approvalRequestId = raw.approval_request_id ?? null;
2262
+ }
2263
+ return receipt;
2257
2264
  }
2258
2265
  };
2259
2266
  function sleep(ms) {