@agent-score/commerce 2.7.3 → 2.7.5
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/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/identity/express.js +1 -1
- package/dist/identity/express.mjs +1 -1
- package/dist/identity/fastify.js +1 -1
- package/dist/identity/fastify.mjs +1 -1
- package/dist/identity/hono.js +1 -1
- package/dist/identity/hono.mjs +1 -1
- package/dist/identity/nextjs.js +1 -1
- package/dist/identity/nextjs.mjs +1 -1
- package/dist/identity/web.js +1 -1
- package/dist/identity/web.mjs +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +23 -1
- package/dist/payment/index.d.ts +23 -1
- package/dist/payment/index.js +16 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +15 -2
- package/dist/payment/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/payment/index.mjs
CHANGED
|
@@ -440,6 +440,17 @@ function classifyOrchestrationError(err) {
|
|
|
440
440
|
}
|
|
441
441
|
return null;
|
|
442
442
|
}
|
|
443
|
+
function stripUnsignedX402PayloadFields(payload) {
|
|
444
|
+
if (typeof payload !== "object" || payload === null) return payload;
|
|
445
|
+
const p = payload;
|
|
446
|
+
if (!("extensions" in p) && !("resource" in p)) return payload;
|
|
447
|
+
const rest = {};
|
|
448
|
+
for (const [k, v] of Object.entries(p)) {
|
|
449
|
+
if (k === "extensions" || k === "resource") continue;
|
|
450
|
+
rest[k] = v;
|
|
451
|
+
}
|
|
452
|
+
return rest;
|
|
453
|
+
}
|
|
443
454
|
async function processX402Settle({
|
|
444
455
|
x402Server,
|
|
445
456
|
payload,
|
|
@@ -460,6 +471,7 @@ async function processX402Settle({
|
|
|
460
471
|
if (!matchedRequirement) {
|
|
461
472
|
return { success: false, phase: "no_requirements", reason: "x402Server.buildPaymentRequirements returned empty" };
|
|
462
473
|
}
|
|
474
|
+
const facilitatorPayload = stripUnsignedX402PayloadFields(payload);
|
|
463
475
|
const resolvedTransportContext = transportContext ?? (() => {
|
|
464
476
|
const path = new URL(resourceMeta.url).pathname;
|
|
465
477
|
return { method: "POST", adapter: { getPath: () => path }, routePattern: path };
|
|
@@ -474,7 +486,7 @@ async function processX402Settle({
|
|
|
474
486
|
let verifyResult;
|
|
475
487
|
try {
|
|
476
488
|
verifyResult = await server.verifyPayment(
|
|
477
|
-
|
|
489
|
+
facilitatorPayload,
|
|
478
490
|
matchedRequirement,
|
|
479
491
|
enrichedExt,
|
|
480
492
|
resolvedTransportContext
|
|
@@ -489,7 +501,7 @@ async function processX402Settle({
|
|
|
489
501
|
}
|
|
490
502
|
try {
|
|
491
503
|
const settleResult = await server.settlePayment(
|
|
492
|
-
|
|
504
|
+
facilitatorPayload,
|
|
493
505
|
matchedRequirement,
|
|
494
506
|
enrichedExt,
|
|
495
507
|
resolvedTransportContext
|
|
@@ -1462,6 +1474,7 @@ export {
|
|
|
1462
1474
|
resolveRecipient,
|
|
1463
1475
|
runWithMppxFailureCapture,
|
|
1464
1476
|
settlementOverrideHeader,
|
|
1477
|
+
stripUnsignedX402PayloadFields,
|
|
1465
1478
|
usdToAtomic,
|
|
1466
1479
|
validateX402NetworkConfig,
|
|
1467
1480
|
verifyX402Request,
|