@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 +14 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1061 -0
- package/dist/index.d.ts +1061 -0
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1176,7 +1176,7 @@ var HavenClient = class {
|
|
|
1176
1176
|
...initialInit,
|
|
1177
1177
|
headers: retryHeaders
|
|
1178
1178
|
});
|
|
1179
|
-
if (retryResponse.
|
|
1179
|
+
if (!retryResponse.ok) {
|
|
1180
1180
|
await this.recordMerchantRetryRejected({
|
|
1181
1181
|
rail: "x402",
|
|
1182
1182
|
paymentId: receipt.paymentId,
|
|
@@ -1189,8 +1189,8 @@ var HavenClient = class {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
});
|
|
1191
1191
|
throw new HavenApiError(
|
|
1192
|
-
"x402 retry
|
|
1193
|
-
|
|
1192
|
+
"x402 retry failed after Haven funded the delegate wallet; reconciliation may be required.",
|
|
1193
|
+
retryResponse.status,
|
|
1194
1194
|
{
|
|
1195
1195
|
marker: "x402_retry_rejected_after_funding",
|
|
1196
1196
|
payment_id: receipt.paymentId,
|
|
@@ -1329,7 +1329,7 @@ var HavenClient = class {
|
|
|
1329
1329
|
...initialInit,
|
|
1330
1330
|
headers: retryHeaders
|
|
1331
1331
|
});
|
|
1332
|
-
if (retryResponse.
|
|
1332
|
+
if (!retryResponse.ok) {
|
|
1333
1333
|
await this.recordMerchantRetryRejected({
|
|
1334
1334
|
rail: receipt.rail,
|
|
1335
1335
|
paymentId: receipt.paymentId,
|
|
@@ -1341,8 +1341,8 @@ var HavenClient = class {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
});
|
|
1343
1343
|
throw new HavenApiError(
|
|
1344
|
-
"Machine payment retry
|
|
1345
|
-
|
|
1344
|
+
"Machine payment retry failed after Haven sent the payment.",
|
|
1345
|
+
retryResponse.status,
|
|
1346
1346
|
{
|
|
1347
1347
|
marker: "machine_payment_retry_rejected_after_payment",
|
|
1348
1348
|
payment_id: receipt.paymentId,
|
|
@@ -2225,7 +2225,7 @@ var HavenClient = class {
|
|
|
2225
2225
|
};
|
|
2226
2226
|
}
|
|
2227
2227
|
mapPaymentReceipt(raw) {
|
|
2228
|
-
|
|
2228
|
+
const receipt = {
|
|
2229
2229
|
id: raw.id,
|
|
2230
2230
|
paymentId: raw.payment_id,
|
|
2231
2231
|
rail: raw.rail,
|
|
@@ -2252,6 +2252,13 @@ var HavenClient = class {
|
|
|
2252
2252
|
createdAt: raw.created_at,
|
|
2253
2253
|
updatedAt: raw.updated_at
|
|
2254
2254
|
};
|
|
2255
|
+
if ("payment_intent_id" in raw) {
|
|
2256
|
+
receipt.paymentIntentId = raw.payment_intent_id ?? null;
|
|
2257
|
+
}
|
|
2258
|
+
if ("approval_request_id" in raw) {
|
|
2259
|
+
receipt.approvalRequestId = raw.approval_request_id ?? null;
|
|
2260
|
+
}
|
|
2261
|
+
return receipt;
|
|
2255
2262
|
}
|
|
2256
2263
|
};
|
|
2257
2264
|
function sleep(ms) {
|