@agent-score/commerce 2.7.4 → 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 +12 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -16
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +22 -22
- package/dist/payment/index.d.ts +22 -22
- package/dist/payment/index.js +13 -17
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +12 -16
- package/dist/payment/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/payment/index.mjs
CHANGED
|
@@ -440,20 +440,16 @@ function classifyOrchestrationError(err) {
|
|
|
440
440
|
}
|
|
441
441
|
return null;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function stripUnsignedX402PayloadFields(payload) {
|
|
444
444
|
if (typeof payload !== "object" || payload === null) return payload;
|
|
445
445
|
const p = payload;
|
|
446
|
-
|
|
447
|
-
const
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
scheme,
|
|
454
|
-
network,
|
|
455
|
-
payload: inner
|
|
456
|
-
};
|
|
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;
|
|
457
453
|
}
|
|
458
454
|
async function processX402Settle({
|
|
459
455
|
x402Server,
|
|
@@ -475,7 +471,7 @@ async function processX402Settle({
|
|
|
475
471
|
if (!matchedRequirement) {
|
|
476
472
|
return { success: false, phase: "no_requirements", reason: "x402Server.buildPaymentRequirements returned empty" };
|
|
477
473
|
}
|
|
478
|
-
const
|
|
474
|
+
const facilitatorPayload = stripUnsignedX402PayloadFields(payload);
|
|
479
475
|
const resolvedTransportContext = transportContext ?? (() => {
|
|
480
476
|
const path = new URL(resourceMeta.url).pathname;
|
|
481
477
|
return { method: "POST", adapter: { getPath: () => path }, routePattern: path };
|
|
@@ -490,7 +486,7 @@ async function processX402Settle({
|
|
|
490
486
|
let verifyResult;
|
|
491
487
|
try {
|
|
492
488
|
verifyResult = await server.verifyPayment(
|
|
493
|
-
|
|
489
|
+
facilitatorPayload,
|
|
494
490
|
matchedRequirement,
|
|
495
491
|
enrichedExt,
|
|
496
492
|
resolvedTransportContext
|
|
@@ -505,7 +501,7 @@ async function processX402Settle({
|
|
|
505
501
|
}
|
|
506
502
|
try {
|
|
507
503
|
const settleResult = await server.settlePayment(
|
|
508
|
-
|
|
504
|
+
facilitatorPayload,
|
|
509
505
|
matchedRequirement,
|
|
510
506
|
enrichedExt,
|
|
511
507
|
resolvedTransportContext
|
|
@@ -1478,7 +1474,7 @@ export {
|
|
|
1478
1474
|
resolveRecipient,
|
|
1479
1475
|
runWithMppxFailureCapture,
|
|
1480
1476
|
settlementOverrideHeader,
|
|
1481
|
-
|
|
1477
|
+
stripUnsignedX402PayloadFields,
|
|
1482
1478
|
usdToAtomic,
|
|
1483
1479
|
validateX402NetworkConfig,
|
|
1484
1480
|
verifyX402Request,
|